SD-885 creation of a new user role with repeating role name

Then we shou

On Wed, Nov 12, 2014, 20:52 mugurrus <notifications@github.com> wrote:

> In app/scripts/superdesk-settings/module.js:
>
> > +        })
> > +        .directive('sdRoleUnique', ['api', '$q', function(api, $q) {
> > +            return {
> > +                require: 'ngModel',
> > +                scope: {},
> > +                link: function (scope, element, attrs, ctrl) {
> > +
> > +                    /**
> > +                     * Test if given value is unique for seleted field
> > +                     */
> > +                    function testUnique(modelValue, viewValue) {
> > +                        var value = modelValue || viewValue;
> > +                        if (value && attrs.uniqueField) {
> > +                            var criteria = {where: {}};
> > +                            criteria.where[attrs.uniqueField] = value;
> > +                            return api.roles.query(criteria)
>
> The request was to do this in real time like with the user creation.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/superdesk/superdesk-client/pull/544/files#r20240657>.
>