Skip to content

Simplify sfMessage directive and uses #387

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

Closed
wants to merge 1 commit into from
Closed

Simplify sfMessage directive and uses #387

wants to merge 1 commit into from

Conversation

mike-marcacci
Copy link
Contributor

There's no need to overthink sfMessage; in all cases it uses the parent scope's form.description. This allows faster processing, and full data-binding so that an application can modify descriptions on-the-fly.

update(scope.ngModel.$valid);
}
template: '<div ng-if="!error && form.description" ng-bind-html="form.description"></div><div ng-if="error" ng-bind-html="error"></div>',
controller: ['$scope', function($scope) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why controller instead of link?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would actually be better written as link – I'll go ahead and do that. My first iteration actually used both (one to compile the element, the other the way it is). I'm going to change this back to link :) good catch!

@davidlgj
Copy link
Contributor

Hi @mike-marcacci, thanks for the PR!

One thing though, would you mind redo it without the files in dist/? It's a bit of a hassle to merge and it mucks up the history.

I've commented a bit above as well, am I right to presume its the two way binding with description that is the main problem here?

@mike-marcacci
Copy link
Contributor Author

Hey @davidlgj sorry for the slow reply! Been a crazy week. Yes, you're correct that the auto-binding is what I'm really after. I get what you're saying about custom add-ons wanting to use a field with a name other than description. However, I might contest that non-default behavior should be a little more difficult to implement than the default behavior (it's nice having description standardized), and thanks to the fact that the sfErrorMessage service does all the heavy lifting, it would be almost trivial to copy and modify the sfMessage directive's template and controller.

I'll go ahead and remove the dist/ files in case this solution ends up working out!

There's no need to overthink sfMessage; in all cases it uses the parent scope's . This allows faster processing, and full data-binding so that an application can modify descriptions on-the-fly.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.39%) to 79.4% when pulling 74295c5 on mike-marcacci:fix/auto-update-description into f08633e on Textalk:development.

@davidlgj
Copy link
Contributor

I've started some tentative work on an angular material decorator, I'm going to see where that goes, but it might be that we don't want descriptions at all there! Anyways, if I don't merge this as it is I'll at least try to fix up the binding.

Edit: I guess I'm saying give me some time :)

@davidlgj
Copy link
Contributor

Hi @mike-marcacci

Yes, so currently in the budding material decorator, https://github.com/Textalk/angular-schema-form-material we're using sf-message without description at all. Would it be OK to reject this PR if I implement a watch on the description so its always updated?

@mike-marcacci
Copy link
Contributor Author

Absolutely! Thank so much for the politeness :) I'm really excited to see how that material decorator, ahem, materializes

@davidlgj
Copy link
Contributor

Great! I'll try to get the watch done today. Checkout the development branch, it's starting to come together, inputs, textarea, selects and checkboxes sort of work. @Anthropic is doing some awesome work on it!

@Dervisevic
Copy link
Contributor

I'm really excited to see how that material decorator, ahem, materializes

Puntastic

davidlgj added a commit that referenced this pull request May 29, 2015
After discussion in #387
@davidlgj
Copy link
Contributor

@mike-marcacci

I've made a watch on description in development branch, e7ff94b

Seems to work(TM) :)

dev-arrow added a commit to dev-arrow/angular-schema-form that referenced this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants