dashboard.html 16.2 KB
Newer Older
1
<%! from django.utils.translation import ugettext as _ %>
2
<%! from django.template import RequestContext %>
3
<%! import third_party_auth %>
4
<%! from third_party_auth import pipeline %>
5
<%! from microsite_configuration import microsite %>
6

7 8
<%!
  from django.core.urlresolvers import reverse
9
%>
10 11 12 13 14 15

<%
  cert_name_short = settings.CERT_NAME_SHORT
  cert_name_long = settings.CERT_NAME_LONG
%>

Matthew Mongeau committed
16 17 18 19
<%inherit file="main.html" />

<%namespace name='static' file='static_content.html'/>

20
<%block name="pagetitle">${_("Dashboard")}</%block>
21
<%block name="bodyclass">view-dashboard is-authenticated</%block>
22
<%block name="nav_skip">#my-courses</%block>
23

Will Daly committed
24 25 26 27 28 29 30 31
<%block name="header_extras">
% for template_name in ["donation"]:
<script type="text/template" id="${template_name}-tpl">
  <%static:include path="dashboard/${template_name}.underscore" />
</script>
% endfor
</%block>

32
<%block name="js_extra">
Will Daly committed
33
  <%static:js group='dashboard'/>
34
  <script type="text/javascript">
35 36 37 38 39 40 41 42 43
    $(document).ready(function() {
      edx.dashboard.legacy.init({
        dashboard: "${reverse('dashboard')}",
        signInUser: "${reverse('signin_user')}",
        passwordReset: "${reverse('password_reset')}",
        changeEmail: "${reverse('change_email')}",
        changeEmailSettings: "${reverse('change_email_settings')}",
        changeName: "${reverse('change_name')}",
        verifyToggleBannerFailedOff: "${reverse('verify_student_toggle_failed_banner_off')}",
44
      });
45
    });
46 47 48
  </script>
</%block>

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
<div class="dashboard-notifications" tabindex="-1">
    % if reverifications["must_reverify"] or reverifications["denied"]:
        ## Section Element must be outside of the re-verify template. The template is re-used for courseware, and has separate styling.
        <section class="dashboard-banner">
            <%include file='dashboard/_dashboard_prompt_midcourse_reverify.html' />
        </section>
    % endif

    %if message:
        <section class="dashboard-banner">
            ${message}
        </section>
    %endif

    % if duplicate_provider:
        <section class="dashboard-banner third-party-auth">
            <%include file='dashboard/_dashboard_third_party_error.html' />
        </section>
    % endif

    %if enrollment_message:
        <section class="dashboard-banner">
            ${enrollment_message}
        </section>
    %endif
</div>

<section class="container dashboard" id="dashboard-main">
77

78
  <section class="profile-sidebar">
79
    <header class="profile">
80
      <h1 class="user-name">${ user.username }</h1>
81
    </header>
82 83
    <section class="user-info">
      <ul>
84
        <li class="info--username">
85
          <span class="title">${_("Full Name")} (<a href="#apply_name_change" rel="leanModal" class="edit-name">${_("edit")}</a>)</span> <span class="data">${ user.profile.name | h }</span>
86
        </li>
87
        <li class="info--email">
88
          <span class="title">${_("Email")}
89
            % if external_auth_map is None or 'shib' not in external_auth_map.external_domain:
90
            (<a href="#change_email" rel="leanModal" class="edit-email">${_("edit")}</a>)
91 92
            % endif
          </span> <span class="data">${ user.email | h }</span>
93
        </li>
94

95
        %if len(language_options) > 1:
96
        <%include file='dashboard/_dashboard_info_language.html' />
97
        %endif
98

99
        % if third_party_auth.is_enabled():
100 101 102
        <li class="controls--account">
          <span class="title">
            ## Translators: this section lists all the third-party authentication providers (for example, Google and LinkedIn) the user can link with or unlink from their edX account.
103
            ${_("Connected Accounts")}
104 105 106 107 108 109
          </span>

          <span class="data">
            <span class="third-party-auth">

            % for state in provider_user_states:
110
            <div class="auth-provider">
111

112 113
              <div class="status">
                % if state.has_account:
114
                <i class="icon fa fa-link"></i> <span class="copy">${_("Linked")}</span>
115
                % else:
116
                <i class="icon fa fa-unlink"></i><span class="copy">${_("Not Linked")}</span>
117 118
                % endif
              </div>
119 120 121 122 123 124 125 126 127 128

              <span class="provider">${state.provider.NAME}</span>
              <span class="control">

              % if state.has_account:
                <form
                  action="${pipeline.get_disconnect_url(state.provider.NAME)}"
                  method="post"
                  name="${state.get_unlink_form_name()}">
                  <input type="hidden" name="csrfmiddlewaretoken" value="${csrf_token}">
129 130 131 132 133 134

                  <a href="#" onclick="document.${state.get_unlink_form_name()}.submit()">
                    ## Translators: clicking on this removes the link between a user's edX account and their account with an external authentication provider (like Google or LinkedIn).
                    ${_("Unlink")}
                  </a>
                % else:
135
                  <a href="${pipeline.get_login_url(state.provider.NAME, pipeline.AUTH_ENTRY_DASHBOARD, redirect_url='/')}">
136 137 138
                    ## Translators: clicking on this creates a link between a user's edX account and their account with an external authentication provider (like Google or LinkedIn).
                    ${_("Link")}
                  </a>
139
              % endif
140 141
              </form>

142 143 144 145 146 147 148
              </span>
            </div>
            % endfor
          </span>
        </li>
        % endif

149 150 151 152 153 154 155 156 157
        % if len(order_history_list):
        <li class="order-history">
          <span class="title">${_("Order History")}</span>
          % for order_history_item in order_history_list:
            <span><a href="${order_history_item['receipt_url']}" target="_blank" class="edit-name">${order_history_item['order_date']}</a></span>
          % endfor
        </li>
        % endif

158
        % if external_auth_map is None or 'shib' not in external_auth_map.external_domain:
159
        <li class="controls--account">
160
          <span class="title"><a href="#password_reset_complete" rel="leanModal" id="pwd_reset_button">${_("Reset Password")}</a></span>
161 162
          <form id="password_reset_form" method="post" data-remote="true" action="${reverse('password_reset')}">
            <input id="id_email" type="hidden" name="email" maxlength="75" value="${user.email}" />
163
            <!-- <input type="submit" id="pwd_reset_button" value="${_("Reset Password")}" /> -->
164
          </form>
165
        </li>
166 167
        % endif

168
        <%include file='dashboard/_dashboard_status_verification.html' />
169

170 171
        <%include file='dashboard/_dashboard_reverification_sidebar.html' />

172 173
      </ul>
    </section>
174

175
  </section>
Matthew Mongeau committed
176

177
  <section class="my-courses" id="my-courses">
178
    <header>
179
      <h2>${_("Current Courses")}</h2>
180
    </header>
Matthew Mongeau committed
181

Julia Hansbrough committed
182
    % if len(course_enrollment_pairs) > 0:
183
      <ul class="listing-courses">
Julia Hansbrough committed
184
        % for course, enrollment in course_enrollment_pairs:
185 186
            <% show_courseware_link = (course.id in show_courseware_links_for) %>
            <% cert_status = cert_statuses.get(course.id) %>
187
            <% show_email_settings = (course.id in show_email_settings_for) %>
188
            <% course_mode_info = all_course_modes.get(course.id) %>
189
            <% show_refund_option = (course.id in show_refund_option_for) %>
190
            <% is_paid_course = (course.id in enrolled_courses_either_paid) %>
191
            <% is_course_blocked = (course.id in block_courses) %>
192
            <% course_verification_status = verification_status_by_course.get(course.id, {}) %>
193 194
            <% course_requirements = courses_requirements_not_met.get(course.id) %>
            <%include file='dashboard/_dashboard_course_listing.html' args="course=course, enrollment=enrollment, show_courseware_link=show_courseware_link, cert_status=cert_status, show_email_settings=show_email_settings, course_mode_info=course_mode_info, show_refund_option = show_refund_option, is_paid_course = is_paid_course, is_course_blocked = is_course_blocked, verification_status=course_verification_status, course_requirements=course_requirements" />
195
      % endfor
196 197

      </ul>
198 199
    % else:
      <section class="empty-dashboard-message">
200
        % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
201
          <p>${_("Looks like you haven't enrolled in any courses yet.")}</p>
202
          <a href="${marketing_link('COURSES')}">
203
            ${_("Find courses now!")}
204 205
          </a>
        % else:
206
          <p>${_("Looks like you haven't enrolled in any courses yet.")}</p>
207
        %endif
208 209
      </section>
    % endif
Matthew Mongeau committed
210

211 212
    % if staff_access and len(errored_courses) > 0:
      <div id="course-errors">
213
        <h2>${_("Course-loading errors")}</h2>
214 215 216 217 218 219 220 221 222 223 224 225

      % for course_dir, errors in errored_courses.items():
         <h3>${course_dir | h}</h3>
             <ul>
           % for (msg, err) in errors:
               <li>${msg}
                 <ul><li><pre>${err}</pre></li></ul>
               </li>
           % endfor
             </ul>
      % endfor
    % endif
Matthew Mongeau committed
226 227
  </section>
</section>
228

229
<section id="email-settings-modal" class="modal" aria-hidden="true">
230
  <div class="inner-wrapper" role="dialog" aria-labelledby="email-settings-title">
231
    <button class="close-modal">
232
      <i class="icon fa fa-remove"></i>
233 234
      <span class="sr">
        ## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
235
        ${_("Close")}
236 237
      </span>
    </button>
238

239
    <header>
240
      <h2 id="email-settings-title">
241
        ${_("Email Settings for {course_number}").format(course_number='<span id="email_settings_course_number"></span>')}
242 243
        <span class="sr">,
          ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
244
          ${_("window open")}
245 246
        </span>
      </h2>
247 248 249 250 251
      <hr/>
    </header>

    <form id="email_settings_form" method="post">
      <input name="course_id" id="email_settings_course_id" type="hidden" />
252
      <label>${_("Receive course emails")} <input type="checkbox" id="receive_emails" name="receive_emails" /></label>
253
      <div class="submit">
254
        <input type="submit" id="submit" value="${_("Save Settings")}" />
255 256 257 258 259
      </div>
    </form>
  </div>
</section>

260

261

262
<section id="password_reset_complete" class="modal" aria-hidden="true">
263
  <div class="inner-wrapper" role="dialog" aria-labelledby="password-reset-email">
264
    <button class="close-modal">
265
      <i class="icon fa fa-remove"></i>
266 267
      <span class="sr">
        ## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
268
        ${_("Close")}
269 270
      </span>
    </button>
271

272
    <header>
273
      <h2 id="password-reset-email">
274
        ${_("Password Reset Email Sent")}
275 276
        <span class="sr">,
          ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
277
          ${_("window open")}
278 279
        </span>
      </h2>
280 281
      <hr/>
    </header>
282
    <div>
283 284
      <form> <!-- Here for styling reasons -->
        <section>
285
          <p>${_("An email has been sent to {email}. Follow the link in the email to change your password.").format(email=user.email)}</p>
286 287
        </section>
      </form>
288 289 290
    </div>
  </div>
</section>
291

292
<section id="change_email" class="modal" aria-hidden="true">
293
  <div class="inner-wrapper" role="dialog" aria-labelledby="change_email_title">
294
    <button class="close-modal">
295
      <i class="icon fa fa-remove"></i>
296 297
      <span class="sr">
        ## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
298
        ${_("Close")}
299 300
      </span>
    </button>
301

302
    <header>
303 304 305 306
      <h2>
        <span id="change_email_title">${_("Change Email")}</span>
        <span class="sr">,
          ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
307
          ${_("window open")}
308 309
        </span>
      </h2>
310 311 312 313
      <hr/>
    </header>
    <div id="change_email_body">
      <form id="change_email_form">
314 315
        <div id="change_email_error" class="modal-form-error"> </div>
          <div class="input-group">
316 317 318 319 320 321
            <label>${_("Please enter your new email address:")}
              <input id="new_email_field" type="email" value="" />
            </label>
            <label>${_("Please confirm your password:")}
              <input id="new_email_password" value="" type="password" />
            </label>
322
          </div>
323
          <section>
324
            <p>${_("We will send a confirmation to both {email} and your new email address as part of the process.").format(email=user.email)}</p>
325
          </section>
326
          <div class="submit">
327
            <input type="submit" id="submit_email_change" value="${_("Change Email")}"/>
328 329 330 331 332 333
          </div>
      </form>
    </div>
  </div>
</section>

334 335
<%include file='modal/_modal-settings-language.html' />

336
<section id="apply_name_change" class="modal" aria-hidden="true">
337
  <div class="inner-wrapper" role="dialog" aria-labelledby="change-name-title">
338
    <button class="close-modal">
339
      <i class="icon fa fa-remove"></i>
340 341
      <span class="sr">
        ## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
342
        ${_("Close")}
343 344
      </span>
    </button>
345

346
    <header>
347 348 349 350
      <h2 id="change-name-title">
        ${_("Change your name")}
        <span class="sr">,
          ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
351
          ${_("window open")}
352 353
        </span>
      </h2>
354 355 356 357 358
      <hr/>
    </header>
    <div id="change_name_body">
      <form id="change_name_form">
        <div id="change_name_error" class="modal-form-error"> </div>
359
        ## Translators: note that {platform} {cert_name_short} will look something like: "edX certificate". Please do not change the order of these placeholders.
360
        <p>${_("To uphold the credibility of your {platform} {cert_name_short}, all name changes will be recorded.").format(platform=settings.PLATFORM_NAME, cert_name_short=cert_name_short)}</p>
361 362
        <br/>
          <div class="input-group">
363
            ## Translators: note that {platform} {cert_name_short} will look something like: "edX certificate". Please do not change the order of these placeholders.
364 365 366 367 368 369
            <label>${_("Enter your desired full name, as it will appear on your {platform} {cert_name_short}:").format(platform=settings.PLATFORM_NAME, cert_name_short=cert_name_short)}
              <input id="new_name_field" value="" type="text" />
            </label>
            <label>${_("Reason for name change:")}
              <textarea id="name_rationale_field" value=""></textarea>
            </label>
370 371
          </div>
          <div class="submit">
372
            <input type="submit" id="submit" value="${_("Change My Name")}">
373
          </div>
374 375 376 377
      </form>
    </div>
  </div>
</section>
378 379

<section id="unenroll-modal" class="modal unenroll-modal" aria-hidden="true">
David Baumgold committed
380
  <div class="inner-wrapper" role="dialog" aria-labelledby="unenrollment-modal-title">
381
    <button class="close-modal">
382
      <i class="icon fa fa-remove"></i>
383 384
      <span class="sr">
        ## Translators: this is a control to allow users to exit out of this modal interface (a menu or piece of UI that takes the full focus of the screen)
385
        ${_("Close")}
386 387 388
      </span>
    </button>

389
    <header>
390
      <h2 id="unenrollment-modal-title">
391 392 393
        <span id='track-info'></span>
        <span id='unenroll_course_number'></span>?
        <span id='refund-info'></span>
394 395
        <span class="sr">,
          ## Translators: this text gives status on if the modal interface (a menu or piece of UI that takes the full focus of the screen) is open or not
396
          ${_("window open")}
397 398
        </span>
      </h2>
399 400 401 402 403 404 405
      <hr/>
    </header>
    <div id="unenroll_error" class="modal-form-error"></div>
    <form id="unenroll_form" method="post" data-remote="true" action="${reverse('change_enrollment')}">
      <input name="course_id" id="unenroll_course_id" type="hidden" />
      <input name="enrollment_action" type="hidden" value="unenroll" />
      <div class="submit">
406
        <input name="submit" type="submit" value="${_("Unenroll")}" />
407 408 409
      </div>
    </form>
  </div>
410
</section>