group-configuration-details.underscore 3.75 KB
Newer Older
1 2 3 4
<div class="collection-details wrapper-group-configuration">
    <header class="collection-header group-configuration-header">
        <h3 class="title group-configuration-title">
            <a href="#" class="toggle group-toggle <% if(showGroups){ print('hide'); } else { print('show'); } %>-groups">
5
                <i class="ui-toggle-expansion icon fa fa-caret-<% if(showGroups){ print('down'); } else { print('right'); } %>"></i>
6 7 8 9
                <%= name %>
            </a>
        </h3>
    </header>
10

11
    <ol class="collection-info group-configuration-info group-configuration-info-<% if(showGroups){ print('block'); } else { print('inline'); } %>">
12 13 14 15 16 17 18
      <% if (!_.isUndefined(id)) { %>
        <li class="group-configuration-id"
            ><span class="group-configuration-label"><%= gettext('ID') %>: </span
            ><span class="group-configuration-value"><%= id %></span
        ></li>
      <% } %>
      <% if (showGroups) { %>
19
        <li class="collection-description group-configuration-description">
20 21 22 23 24 25
            <%= description %>
        </li>
      <% } else { %>
        <li class="group-configuration-groups-count">
            <%= groupsCountMessage %>
        </li>
26 27 28
        <li class="group-configuration-usage-count">
            <%= usageCountMessage %>
        </li>
29 30 31 32 33
      <% } %>
    </ol>

    <% if(showGroups) { %>
      <% allocation = Math.floor(100 / groups.length) %>
34
      <ol class="collection-items groups groups-<%= index %>">
35
        <% groups.each(function(group, groupIndex) { %>
36 37 38
          <li class="item group group-<%= groupIndex %>">
            <span class="name group-name"><%= group.get('name') %></span>
            <span class="meta group-allocation"><%= allocation %>%</span>
39 40 41
          </li>
        <% }) %>
      </ol>
42
    <% } %>
43 44
    <ul class="actions group-configuration-actions">
        <li class="action action-edit">
45
            <button class="edit"><i class="icon fa fa-pencil"></i> <%= gettext("Edit") %></button>
46
        </li>
47 48
        <% if (_.isEmpty(usage)) { %>
            <li class="action action-delete wrapper-delete-button">
49
                <button class="delete action-icon"><i class="icon fa fa-trash-o"></i><span><%= gettext("Delete") %></span></button>
50 51 52
            </li>
        <% } else { %>
            <li class="action action-delete wrapper-delete-button" data-tooltip="<%= gettext('Cannot delete when in use by an experiment') %>">
53
                <button class="delete action-icon is-disabled" aria-disabled="true"><i class="icon fa fa-trash-o"></i><span><%= gettext("Delete") %></span></button>
54 55
            </li>
        <% } %>
56
    </ul>
57
</div>
58
<% if(showGroups) { %>
59
  <div class="collection-references wrapper-group-configuration-usages">
60
    <% if (!_.isEmpty(usage)) { %>
61 62
      <h4 class="intro group-configuration-usage-text"><%= gettext('This Group Configuration is used in:') %></h4>
      <ol class="usage group-configuration-usage">
63
        <% _.each(usage, function(unit) { %>
64
          <li class="usage-unit group-configuration-usage-unit">
65 66 67 68
            <p><a href=<%= unit.url %> ><%= unit.label %></a></p>
            <% if (unit.validation) { %>
              <p>
                <% if (unit.validation.type === 'warning') { %>
69
                  <i class="icon fa fa-warning"></i>
70
                <% } else if (unit.validation.type === 'error') { %>
71
                  <i class="icon fa fa-exclamation-circle"></i>
72
                <% } %>
73
                <span class="usage-validation-message group-configuration-validation-message">
74
                  <%= unit.validation.text %>
75 76 77
                </span>
              </p>
            <% } %>
78 79 80 81 82 83 84 85 86 87
          </li>
        <% }) %>
      </ol>
    <% } else { %>
      <p class="group-configuration-usage-text">
        <%= outlineAnchorMessage %>
      </p>
    <% } %>
  </div>
<% } %>