d8728aad57
issue #5841 - fix relative link checks in navlink url input component - fix navlink url input component sending absolute URLs instead of relative URLs to action handler - remove URL manipulation in navigation settings controller (url input handles URL manipulation, validator flags anything that's still incorrect) - capture cmd-s in url input to ensure changes are actioned before save - automatically add mailto: to e-mail addresses - add gh-validation-state-container component so .error/.success validation classes can be applied to any container element - add validation-state mixin that can be mixed in to any other component to give it access to validation status (used in gh-navitem component to keep alignment when inline error message elements are added) - validate and display inline errors on save - improve ember test coverage for navigation settings related controller and components
18 lines
672 B
JavaScript
18 lines
672 B
JavaScript
import Ember from 'ember';
|
|
import ValidationStateMixin from 'ghost/mixins/validation-state';
|
|
|
|
/**
|
|
* Handles the CSS necessary to show a specific property state. When passed a
|
|
* DS.Errors object and a property name, if the DS.Errors object has errors for
|
|
* the specified property, it will change the CSS to reflect the error state
|
|
* @param {DS.Errors} errors The DS.Errors object
|
|
* @param {string} property Name of the property
|
|
*/
|
|
export default Ember.Component.extend(ValidationStateMixin, {
|
|
classNameBindings: ['errorClass'],
|
|
|
|
errorClass: Ember.computed('hasError', function () {
|
|
return this.get('hasError') ? 'error' : 'success';
|
|
})
|
|
});
|