preston/bittorious

View on GitHub
app/views/welcome/settings.html.slim

Summary

Maintainability
Test Coverage
.row

    .col-md-12 ng-show="selectedFeed.can_update"
        = render 'feeds/form'
        hr

    .col-md-6
        .h2 Authorized Users
        table.table.table-condensed.table-striped#authorized-users
            thead
                tr
                    th
                        a ng-click="reverse = !reverse; predicate = 'user.name'; " Name
                    th
                        a ng-click="reverse = !reverse; predicate = 'role'; " Role
                    th ng-show="selectedFeed.can_update" Actions
            tbody
                tr ng-repeat="p in selectedFeed.permissions | orderBy:predicate:reverse"
                    td ng-bind="p.user.name"
                    td ng-bind="p.role"
                    td ng-show="selectedFeed.can_update"
                        button.btn.btn-default ng-click="deletePermission(p)" = text_with_icon('Revoke', 'trash')

    .col-md-6
        br
        .well
            h4 Authorize a user...
            form role="form"
                .form-group
                    input.form-control id="userFilterFormInput" placeholder="John Smith" ng-model="userSearch.text"
            table.table.table-condensed.table-striped#unauthorized-users ng-show="userSearch.text.length > 0"
                thead
                    tr
                        th
                            a ng-click="reverse = !reverse; predicate = 'name'; " Name
                        th Grant
                tbody
                    tr ng-repeat="u in users | filter:userFilterMatch | orderBy:predicate:reverse" ng-show="selectedFeed" ng-if="!u.admin"
                        td ng-bind="u.name"
                        td
                            .btn-group
                                button.btn.btn-default ng-click="createPermission(u,'#{Permission::SUBSCRIBER_ROLE}')" = text_with_icon('Subscriber', 'download')
                                button.btn.btn-default ng-click="createPermission(u,'#{Permission::PUBLISHER_ROLE}')" = text_with_icon('Publisher', 'upload')


            h4 Administrators
            p The global portal administrators below always have access, so they won't show up in your search results. 
            ul
                li ng-repeat="u in users" ng-if="u.admin" ng-bind="u.name"