group-configuration-details.underscore 4.38 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
                <span class="ui-toggle-expansion icon fa fa-caret-<% if(showGroups){ print('down'); } else { print('right'); } %>"></span>
cahrens committed
6
                <%- name %>
7 8 9
            </a>
        </h3>
    </header>
10

11
    <ol class="collection-info group-configuration-info group-configuration-info-<% if(showGroups){ print('block'); } else { print('inline'); } %>">
12 13
      <% if (!_.isUndefined(id)) { %>
        <li class="group-configuration-id"
cahrens committed
14 15
            ><span class="group-configuration-label"><%- gettext('ID') %>: </span
            ><span class="group-configuration-value"><%- id %></span
16 17 18
        ></li>
      <% } %>
      <% if (showGroups) { %>
19
        <li class="collection-description group-configuration-description">
cahrens committed
20
            <%- description %>
21 22 23
        </li>
      <% } else { %>
        <li class="group-configuration-groups-count">
cahrens committed
24
            <%- groupsCountMessage %>
25
        </li>
26
        <li class="group-configuration-usage-count">
cahrens committed
27
            <%- usageCountMessage %>
28
        </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
          <li class="item group group-<%= groupIndex %>">
cahrens committed
37 38
            <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"><span class="icon fa fa-pencil" aria-hidden="true"></span> <%- gettext("Edit") %></button>
46
        </li>
47 48
        <% if (_.isEmpty(usage)) { %>
            <li class="action action-delete wrapper-delete-button">
49
                <button class="delete action-icon" title="<%- gettext('Delete') %>"><span class="icon fa fa-trash-o" aria-hidden="true"></span></button>
50 51
            </li>
        <% } else { %>
cahrens committed
52
            <li class="action action-delete wrapper-delete-button" data-tooltip="<%- gettext('Cannot delete when in use by an experiment') %>">
ssemenova committed
53
                <button class="delete action-icon is-disabled" disabled="disabled" title="<%- gettext('Delete') %>"><span class="icon fa fa-trash-o" aria-hidden="true"></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)) { %>
cahrens committed
61
      <h4 class="intro group-configuration-usage-text"><%- gettext('This Group Configuration is used in:') %></h4>
62
      <ol class="usage group-configuration-usage">
63
        <% _.each(usage, function(unit) { %>
64
          <li class="usage-unit group-configuration-usage-unit">
cahrens committed
65
            <p><a href=<%- unit.url %> ><%- unit.label %></a></p>
66 67 68
            <% if (unit.validation) { %>
              <p>
                <% if (unit.validation.type === 'warning') { %>
69
                  <span class="icon fa fa-warning" aria-hidden="true"></span>
70
                <% } else if (unit.validation.type === 'error') { %>
71
                  <span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
72
                <% } %>
73
                <span class="usage-validation-message group-configuration-validation-message">
cahrens committed
74
                  <%- unit.validation.text %>
75 76 77
                </span>
              </p>
            <% } %>
78 79 80 81 82
          </li>
        <% }) %>
      </ol>
    <% } else { %>
      <p class="group-configuration-usage-text">
83 84 85 86 87 88 89 90 91
          <%= HtmlUtils.interpolateHtml(
              gettext('This Group Configuration is not in use. Start by adding a content experiment to any Unit via the {linkStart}Course Outline{linkEnd}.'),
              {
                  linkStart: HtmlUtils.interpolateHtml(
                      HtmlUtils.HTML('<a href="{courseOutlineUrl}" title="{courseOutlineTitle}">'),
                      { courseOutlineUrl: courseOutlineUrl, courseOutlineTitle: gettext('Course Outline')}),
                  linkEnd: HtmlUtils.HTML('</a>')
              })
          %>
92 93 94 95
      </p>
    <% } %>
  </div>
<% } %>