Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding raw template to decorator #809

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

Traksewt
Copy link

@Traksewt Traksewt commented Dec 2, 2016

Description

Currently setting the template for a custom decorator requires using the template cache, and you cannot pass in a raw template string. There is some code inside the decorator provider to support it, but it is not exposed, as it does not work.

When manually setting the decorator to have type equals to template, the builder cannot find the raw template. This is because it is looking for the 'template' field on the wrong variable, checking the form instead of the 'field'.

To test out using a raw template, you can try

schemaFormDecoratorsProvider.decorator('bootstrapDecorator')['myCustomDecorator'].type = 'template';

Fixes Related issues

  • This doesn't expose raw templates to the decorator helper methods, however, it does get rid of the bugs so it can be exposed in the future.

Checklist

  • I have read and understand the CONTRIBUTIONS.md file
  • I have searched for and linked related issues
  • I have created test cases to ensure quick resolution of the PR is easier
  • I am NOT targeting main branch
  • I did NOT include the dist folder in my PR

@json-schema-form/angular-schema-form-lead

@Anthropic
Copy link
Member

@Traksewt thanks for your PR sorry for the delayed response, I was in the middle of the separated core changes and then holidays, would you be able to update to the latest version and reapply your changes to the renamed files? Would love to accept your efforts :)

src/services/builder.js -> src/services/sf-builder.provider.js
test/services/decorators-test.js -> src/services/schema-form-decorators.provider.spec.js

@Traksewt
Copy link
Author

@Anthropic ok no problem. rebased.

Copy link
Member

@Anthropic Anthropic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from form to field breaks three tests, can you add the field.type test below the form.type test, I would expect that to work for both cases.

@Anthropic
Copy link
Member

Anthropic commented Jan 24, 2017

Didn't realise I could change it myself within your commit, how cool :)

Oh but then your test fails... hmmm...

@Anthropic
Copy link
Member

@Traksewt any ideas?

@scottux
Copy link
Contributor

scottux commented Aug 18, 2018

The tests are failing because the decorator is trying to load the template remotely as a url, but the template is a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants