superdesk/superdesk-client-core

View on GitHub
scripts/apps/users/views/user-privileges.html

Summary

Maintainability
Test Coverage
<form name="userPrivileges">
    <div class="action-bar" ng-class="{
        show: userPrivileges.$dirty
        }">
        <div class="button-group button-group--end button-group--comfort">
            <button
                class="btn"
                ng-click="cancel()"
                ng-disabled="!userPrivileges.$dirty" translate>Cancel</button>
            <button class="btn btn--primary" ng-disabled="!userPrivileges.$dirty" ng-click="save()" translate>Save</button>
        </div>
    </div>
    <div class="privileges-settings form-flat inner-content">
        <table class="table table--fixed-header">
            <thead>
                <tr>
                    <th class="name"></th>
                    <th class="td user-field" translate>User</th>
                    <th class="td role-field" translate>Role</th>
                    <th class="blank-field"></th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="p in privileges track by p.name">
                    <td class="name">
                        <div>
                            <span>{{ :: p.label | translate }}</span>
                            <span
                                ng-if="p.description"
                                sd-tooltip="{{ :: p.description | translate  }}"
                                flow="right"
                            >
                                <span class="icon-info-sign"></span>
                            </span>
                        </div>
                    </td>
                    <td>
                        <input type="checkbox" ng-true-value="1" ng-false-value="0"
                               ng-model="user.privileges[p.name]"
                               ng-if="!role.privileges[p.name]" />
                        <input type="checkbox" ng-true-value="1" ng-false-value="0"
                               ng-model="role.privileges[p.name]"
                               ng-disabled="true"
                               ng-if="role.privileges[p.name]" />
                    </td>
                    <td><span ng-if="role.privileges[p.name]" class="label">{{:: role.name | translate }}</span></td>
                    <td class="blank-field"></td>
                </tr>
            </tbody>
        </table>
    </div>
</form>