Ghost/ghost/admin/app/validators/product-benefit-item.js
Rishabh Garg 46b311b561 Wired benefits section to API (#2023)
refs https://github.com/TryGhost/Team/issues/792

- updates product benefit to use `name` instead of `label` attribute for benefit text
- updates model/serializer/validator to correctly handle benefit attributes
- added `+` button for adding new labels as the enter behavior is closing the popup(needs fix)
2021-06-28 15:19:54 +05:30

19 lines
444 B
JavaScript

import BaseValidator from './base';
import {isBlank} from '@ember/utils';
export default BaseValidator.create({
properties: ['name'],
name(model) {
let name = model.get('name');
let hasValidated = model.get('hasValidated');
if (isBlank(name)) {
model.get('errors').add('name', 'You must specify a name');
this.invalidate();
}
hasValidated.addObject('name');
}
});