maestrano/mno-enterprise-angular

View on GitHub
src/app/views/company/teams/organization-teams.html

Summary

Maintainability
Test Coverage
<div class="row dashboard-teams">
  <!-- Loader -->
  <mno-loader ng-show="isLoading"></mno-loader>

  <!-- No teams view -->
  <div ng-show="!isLoading && !hasTeams()">
    <div class="row">
      <div class="col-sm-12">
        <div class="well text-center">
          <p>{{ 'mno_enterprise.templates.dashboard.teams.index.no_teams_warning' | translate }}</p>

          <button type="button" class="btn btn-lg btn-warning top-buffer-1" ng-click="matrix.addTeam()">
            <i class="fa fa-plus"></i>
            {{ 'mno_enterprise.templates.dashboard.teams.index.add_team' | translate }}
          </button>
        </div>
      </div>
    </div>
  </div>

  <!-- Regular view -->
  <div ng-show="!isLoading && hasTeams()">
    <div class="row">
      <div class="col-sm-12">
        <span class="text-left text-muted">
          <small><em>
            {{ 'mno_enterprise.templates.dashboard.teams.index.admin_permission_warning' | translate }}
          </em></small>
        </span>
      </div>
    </div>

    <!-------------------------------------->
    <!--        Permissions matrix        -->
    <!-------------------------------------->
    <div class="permission-matrix-wrapper hidden-xs">
      <div class="row" ng-show="matrix.errors">
        <div class="alert alert-error">
          <button class="close" ng-click="matrix.errors=''">×</button>
          <ul>
            <li ng-repeat="error in matrix.errors">{{error}}</li>
          </ul>
        </div>
      </div>

      <div class="row">
        <!-- Matrix: left part (team & 'all' checkbox) -->
        <div class="col-xs-4 table-left">
          <table class="permission-matrix">
            <thead>
              <tr>
                <th class="th-first">
                  <button type="button" class="btn btn-warning" ng-click="matrix.addTeam()">
                    <i class="fa fa-plus"></i>
                    {{ 'mno_enterprise.templates.dashboard.teams.index.add_team_light' | translate }}
                  </button>
                </th>
                <th style="width:6%;">{{ 'mno_enterprise.templates.dashboard.teams.index.all' | translate }}</th>
              </tr>
            </thead>

            <tbody>
              <tr ng-repeat="team in teams">

                <td class="td-first team-name">
                  <div class="editable-instructions">
                    <span editable-text="team.name" onaftersave="matrix.updateTeamName(team)" buttons="no">{{ team.name }}</span>
                  </div>

                  <span class="team-remove">
                      <button class="btn btn-warning" ng-click="matrix.removeTeam(team)">
                        <i class="fa fa-remove hidden-xs"></i>
                      </button>
                  </span>
                </td>

                <td>
                  <input type="checkbox" ng-checked="matrix.hasAccess(team,'all')" ng-click="matrix.toggleAccess(team,'all')">
                </td>
              </tr>

              <tr class="btn-group-row" ng-show="matrix.isChanged()">
                <td class="text-center" colspan="2">
                  <div ng-show="matrix.isChanged() && !matrix.isLoading">
                    <button type="button" class="btn btn-default" ng-click="matrix.cancel()">Cancel</button>
                    <button type="button" class="btn btn-warning" ng-click="matrix.save()">Save</button>
                  </div>
                  <!-- Loader -->
                  <mno-loader ng-show="matrix.isLoading"></mno-loader>
                </td>
              </tr>
            </tbody>
          </table>
        </div>

        <!-- Matrix: right part (detailed permissions) -->
        <div class="col-xs-8 table-right">
          <div class="text-center" ng-show="!hasApps()">
            <p class="top-buffer-3">{{ 'mno_enterprise.templates.dashboard.teams.index.no_apps_warning' | translate }}</p>
            <a type="button" class="btn btn-warning" ui-sref="home.marketplace">
              <i class="fa fa-plus"></i>
              {{ 'mno_enterprise.templates.dashboard.teams.index.add_app' | translate }}
            </a>
          </div>

          <table class="permission-matrix" ng-show="hasApps()">
            <thead>
              <tr>
                <th ng-repeat="appInstance in appInstances">
                  <div class="th-content">
                    <img class="media-object" ng-src="{{appInstance.logo}}" ng-alt="{{appInstance.name}}">
                    {{ appInstance.name | truncate: 13}}
                  </div>
                </th>
                <th></th>
              </tr>
            </thead>

            <tbody>
              <tr ng-repeat="team in teams">
                <td ng-repeat="appInstance in appInstances">
                  <input type="checkbox" ng-checked="matrix.hasAccess(team,appInstance)" ng-click="matrix.toggleAccess(team,appInstance)">
                </td>
                <td></td>
              </tr>
            </tbody>
            <!-- End: Permissions matrix -->
          </table>
        </div>
        <!-- End: row -->
      </div>
      <div class="clearfix"></div>
      <!-- End: permission matrix wrapper -->
    </div>

    <!-------------------------------------->
    <!--     List of Teams (accordion)    -->
    <!-------------------------------------->
    <div dashboard-organization-team-list></div>
    <!-- End: regular view -->
  </div>

</div>