unit.html 8.21 KB
Newer Older
1 2
<%inherit file="base.html" />
<%! from django.core.urlresolvers import reverse %>
3
<%namespace name="units" file="widgets/units.html" />
4
<%block name="title">Individual Unit</%block>
5 6
<%block name="bodyclass">is-signedin course unit</%block>

7 8
<%block name="jsextra">
  <script type='text/javascript'>
9
  $(document).ready(function() {
10 11 12
    new CMS.Views.UnitEdit({
      el: $('.main-wrapper'),
      model: new CMS.Models.Module({
13 14
        id: '${unit_location}',
        state: '${unit_state}'
15 16
      })
    });
17 18 19 20 21 22 23 24

    $(document).ready(function() {
      $('body').addClass('js');

      // tabs
      $('.tab-group').tabs();
    });

25 26 27 28 29
    $('.new-component-template').each(function(){
        $emptyEditor = $(this).find('.empty');
        $(this).prepend($emptyEditor);
      });
    });
30

31
  </script>
32

33
</%block>
34
<%block name="content">
35
  <div class="main-wrapper edit-state-${unit_state}" data-id="${unit_location}">
36
    <div class="inner-wrapper">
37
      <div class="alert editing-draft-alert">
38 39 40 41 42 43 44
        <p class="alert-message"><strong>You are editing a draft.</strong>
        % if published_date:
        This unit was originally published on ${published_date}.
        % endif
        </p>
        <a href="${published_preview_link}" target="_blank" class="alert-action secondary">Preview the published version</a>
      </div>
45 46
      <div class="main-column">
        <article class="unit-body window">
47
          <p class="unit-name-input"><label>Display Name:</label><input type="text" value="${unit.display_name_with_default | h}" class="unit-display-name-input" /></p>
48
          <ol class="components">
49 50
            % for id in components:
            <li class="component" data-id="${id}"/>
51
            % endfor
52
            <li class="new-component-item adding">
53
              <div class="new-component">
54
                <h5>Add New Component</h5>
55 56 57 58 59 60 61 62 63 64 65
                <ul class="new-component-type">
                  % for type in sorted(component_templates.keys()):
                  <li>
                    <a href="#" data-type="${type}">
                      <span class="large-template-icon large-${type}-icon"></span>
                      <span class="name">${type}</span>
                    </a>
                  </li>
                  % endfor
                </ul>
              </div>
66 67
                % for type, templates in sorted(component_templates.items()):
                <div class="new-component-templates new-component-${type}">
68 69 70 71 72 73 74 75 76 77 78
                    % if type == "problem":
                    <div class="tab-group tabs">
                            <ul class="problem-type-tabs nav-tabs">
                              <li class="current">
                                <a class="link-tab" href="#tab1">Common Problem Types</a>
                              </li>
                              <li>
                                <a class="link-tab" href="#tab2">Advanced</a>
                              </li>
                            </ul>
                    % endif
79 80 81
                        <div class="tab current" id="tab1">
                          <ul class="new-component-template">
                              % for name, location, has_markdown, is_empty in templates:
82 83 84 85 86 87 88
                                % if has_markdown or type != "problem":
                                    % if is_empty:
                                      <li class="editor-md empty">
                                        <a href="#" data-location="${location}">
                                          <span class="name"> ${name}</span>
                                        </a>
                                      </li>
89

90 91 92 93 94 95 96
                                    % else:
                                      <li class="editor-md">
                                        <a href="#" data-location="${location}">
                                          <span class="name"> ${name}</span>
                                        </a>
                                      </li>
                                    % endif
97
                                % endif
98

99 100 101
                              %endfor
                          </ul>
                        </div>
102 103 104
                    % if type == "problem":
                            <div class="tab" id="tab2">
                              <ul class="new-component-template">
105
                                  % for name, location, has_markdown, is_empty in templates:
106
                                    % if not has_markdown:
107 108 109 110 111 112
                                        % if is_empty:
                                          <li class="editor-manual empty">
                                            <a href="#" data-location="${location}">
                                              <span class="name">${name}</span>
                                            </a>
                                          </li>
113

114 115 116 117 118
                                        % else:
                                          <li class="editor-manual">
                                            <a href="#" data-location="${location}">
                                              <span class="name"> ${name}</span>
                                            </a>
119

120 121 122 123
                                          </li>
                                        % endif
                                    % endif
                                  % endfor
124 125
                              </ul>
                            </div>
126
                    </div>
127
                    % endif
128 129 130
                    <a href="#" class="cancel-button">Cancel</a>
                </div>
                % endfor
131 132 133 134
            </li>
          </ol>
        </article>
      </div>
135

136
      <div class="sidebar">
137
        <div class="unit-settings window">
138
          <h4 class="header">Unit Settings</h4>
139
          <div class="window-contents">
140 141
            <div class="row visibility">
              <label class="inline-label">Visibility:</label>
142
              <select class='visibility-select'>
143 144
                <option value="public">Public</option>
                <option value="private">Private</option>
145
              </select>
146
            </div>
147
            <div class="row published-alert">
148 149
              <p class="edit-draft-message">This unit has been published. To make changes, you must <a href="#" class="create-draft">edit a draft</a>.</p>
              <p class="publish-draft-message">This is a draft of the published unit. To update the live version, you must <a href="#" class="publish-draft">replace it with this draft</a>.</p>
150
            </div>
151
            <div class="row status">
152
              <p>This unit is scheduled to be released to <strong>students</strong>
153 154
              % if release_date is not None:
                  on <strong>${release_date}</strong>
155
              % endif
156
              with the subsection <a href="${reverse('edit_subsection', kwargs={'location': subsection.location})}">"${subsection.display_name_with_default}"</a></p>
157
            </div>
158
            <div class="row unit-actions">
159
              <a href="#" class="delete-draft delete-button">Delete Draft</a>
160
              <a href="${draft_preview_link}" target="_blank" class="preview-button">Preview</a>
161
              <a href="${published_preview_link}" target="_blank" class="view-button">View Live</a>
162 163
            </div>
          </div>
164
        </div>
165
        <div class="window unit-location">
166
          <h4 class="header">Unit Location</h4>
167
          <div class="window-contents">
168
            <div><input type="text" class="url" value="/courseware/${section.url_name}/${subsection.url_name}" disabled /></div>
169 170
            <ol>
              <li>
171
                <a href="#" class="section-item">${section.display_name_with_default}</a>
172
                <ol>
173 174 175
                  <li>
                    <a href="${reverse('edit_subsection', args=[subsection.location])}" class="section-item">
                      <span class="folder-icon"></span>
176
                      <span class="subsection-name"><span class="subsection-name-value">${subsection.display_name_with_default}</span></span>
177
                    </a>
178
                    ${units.enum_units(subsection, actions=False, selected=unit.location)}
179 180
                  </li>
                </ol>
181
              </li>
182
            </ol>
183
          </div>
184
        </div>
185 186 187
      </div>
    </div>
  </div>
188

189
</%block>