dashboard.html 10.6 KB
Newer Older
1
<%page expression_filter="h"/>
2 3
<%inherit file="main.html" />
<%namespace name='static' file='static_content.html'/>
4
<%!
5
from django.core.urlresolvers import reverse
6 7 8 9
from django.utils.translation import ugettext as _
from django.template import RequestContext
import third_party_auth
from third_party_auth import pipeline
10
from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string
11
from openedx.core.djangolib.markup import Text, HTML
12
%>
13 14 15 16 17 18

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

Matthew Mongeau committed
19

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

Will Daly committed
23 24 25 26 27 28
<%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
29 30 31 32 33 34

% for template_name in ["dashboard_search_item", "dashboard_search_results", "search_loading", "search_error"]:
<script type="text/template" id="${template_name}-tpl">
    <%static:include path="search/${template_name}.underscore" />
</script>
% endfor
Will Daly committed
35 36
</%block>

37
<%block name="js_extra">
38
  <script src="${static.url('js/commerce/credit.js')}"></script>
Will Daly committed
39
  <%static:js group='dashboard'/>
40
  <script type="text/javascript">
41 42
    $(document).ready(function() {
      edx.dashboard.legacy.init({
43 44 45
        dashboard: "${reverse('dashboard') | n, js_escaped_string}",
        signInUser: "${reverse('signin_user') | n, js_escaped_string}",
        changeEmailSettings: "${reverse('change_email_settings') | n, js_escaped_string}"
46
      });
47
    });
48
  </script>
49
  % if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'):
cahrens committed
50 51 52
    <%static:require_module module_name="js/search/dashboard/dashboard_search_factory" class_name="DashboardSearchFactory">
        DashboardSearchFactory();
    </%static:require_module>
53
  % endif
54 55 56 57
  % if redirect_message:
    <%static:require_module module_name="js/views/message_banner" class_name="MessageBannerView">
        var banner = new MessageBannerView({urgency: 'low', type: 'warning'});
        $('#content').prepend(banner.$el);
58
        banner.showMessage(${redirect_message | n, dump_js_escaped_json})
59 60
    </%static:require_module>
  % endif
61 62
</%block>

63 64 65
<div class="dashboard-notifications" tabindex="-1">
    %if message:
        <section class="dashboard-banner">
66
            ${message | n, unicode}
67 68 69 70 71
        </section>
    %endif

    %if enrollment_message:
        <section class="dashboard-banner">
72
            ${enrollment_message | n, unicode}
73 74 75 76
        </section>
    %endif
</div>

77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
<main id="main" aria-label="Content" tabindex="-1">
    <section class="container dashboard" id="dashboard-main">
      <section class="my-courses" id="my-courses">
        <header class="wrapper-header-courses">
          <h2 class="header-courses">${_("My Courses")}</h2>
        </header>


        % if len(course_enrollments) > 0:
          <ul class="listing-courses">
          <% share_settings = getattr(settings, 'SOCIAL_SHARING_SETTINGS', {}) %>
          % for dashboard_index, enrollment in enumerate(course_enrollments):
            <% show_courseware_link = (enrollment.course_id in show_courseware_links_for) %>
            <% cert_status = cert_statuses.get(enrollment.course_id) %>
            <% can_unenroll = (not cert_status) or cert_status.get('can_unenroll') %>
            <% credit_status = credit_statuses.get(enrollment.course_id) %>
            <% show_email_settings = (enrollment.course_id in show_email_settings_for) %>
            <% course_mode_info = all_course_modes.get(enrollment.course_id) %>
            <% show_refund_option = (enrollment.course_id in show_refund_option_for) %>
            <% is_paid_course = (enrollment.course_id in enrolled_courses_either_paid) %>
            <% is_course_blocked = (enrollment.course_id in block_courses) %>
            <% course_verification_status = verification_status_by_course.get(enrollment.course_id, {}) %>
            <% course_requirements = courses_requirements_not_met.get(enrollment.course_id) %>
            <% course_program_info = course_programs.get(unicode(enrollment.course_id)) %>
            <%include file = 'dashboard/_dashboard_course_listing.html' args="course_overview=enrollment.course_overview, enrollment=enrollment, show_courseware_link=show_courseware_link, cert_status=cert_status, can_unenroll=can_unenroll, credit_status=credit_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, dashboard_index=dashboard_index, share_settings=share_settings, user=user, course_program_info=course_program_info" />
          % endfor
103

104 105 106 107
          </ul>
        % else:
          <section class="empty-dashboard-message">
            <p>${_("You are not enrolled in any courses yet.")}</p>
108

109 110 111 112
            % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
              <a href="${marketing_link('COURSES')}">
                ${_("Explore courses")}
              </a>
113

114 115
            %endif
          </section>
116 117
        % endif

118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
        % if staff_access and len(errored_courses) > 0:
          <div id="course-errors">
            <h2>${_("Course-loading errors")}</h2>

          % for course_dir, errors in errored_courses.items():
             <h3>${course_dir}</h3>
                 <ul>
               % for (msg, err) in errors:
                   <li>${msg}
                     <ul><li><pre>${err}</pre></li></ul>
                   </li>
               % endfor
                 </ul>
          % endfor
          </div>
        % endif
      </section>
135

136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
      % if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'):
        <div id="dashboard-search-bar" class="search-bar dashboard-search-bar" role="search" aria-label="Dashboard">
          <form>
            <label for="dashboard-search-input">${_('Search Your Courses')}</label>
            <div class="search-field-wrapper">
              <input id="dashboard-search-input" type="text" class="search-field"/>
              <button type="submit" class="search-button" aria-label="${_('Search')}">
                <i class="icon fa fa-search" aria-hidden="true"></i>
              </button>
              <button type="button" class="cancel-button" aria-label="${_('Clear search')}">
                <i class="icon fa fa-remove" aria-hidden="true"></i>
              </button>
            </div>
          </form>
        </div>
      % endif

      % if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'):
        <section id="dashboard-search-results" class="search-results dashboard-search-results"></section>
      % endif

      <section class="profile-sidebar" id="profile-sidebar" role="region" aria-label="Account Status Info">
        <header class="profile">
          <h2 class="account-status-title sr">${_("Account Status Info")}: </h2>
        </header>
        <section class="user-info">
          <ul>

            % 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

            <%include file="${static.get_template_path('dashboard/_dashboard_status_verification.html')}" />

          </ul>
        </section>
      </section>
      % if xseries_credentials:
        <div class="wrapper-xseries-certificates">
          <p class="title">${_("XSeries Program Certificates")}</p>
          <p class="copy">${_("You have received a certificate for the following XSeries programs:")}</p>
          <ul>
          % for xseries_credential in xseries_credentials:
            <li>
              <a class="copy" href="${xseries_credential['credential_url']}">${xseries_credential['display_name']}</a>
            </li>
          % endfor
          </ul>
        </div>
      % endif
191
    </section>
192
</main>
193

194
<section id="email-settings-modal" class="modal" aria-hidden="true">
195
  <div class="inner-wrapper" role="dialog" aria-labelledby="email-settings-title">
196
    <button class="close-modal">
197
      <i class="icon fa fa-remove"></i>
198 199
      <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)
200
        ${_("Close")}
201 202
      </span>
    </button>
203

204
    <header>
205
      <h2 id="email-settings-title">
206
        ${Text(_("Email Settings for {course_number}")).format(course_number=HTML('<span id="email_settings_course_number"></span>'))}
207 208
        <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
209
          ${_("window open")}
210 211
        </span>
      </h2>
212 213 214 215 216
      <hr/>
    </header>

    <form id="email_settings_form" method="post">
      <input name="course_id" id="email_settings_course_id" type="hidden" />
217
      <label>${_("Receive course emails")} <input type="checkbox" id="receive_emails" name="receive_emails" /></label>
218
      <div class="submit">
219
        <input type="submit" id="submit" value="${_("Save Settings")}" />
220 221 222 223 224
      </div>
    </form>
  </div>
</section>

225
<section id="unenroll-modal" class="modal unenroll-modal" aria-hidden="true">
David Baumgold committed
226
  <div class="inner-wrapper" role="dialog" aria-labelledby="unenrollment-modal-title">
227
    <button class="close-modal">
228
      <i class="icon fa fa-remove"></i>
229 230
      <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)
231
        ${_("Close")}
232 233 234
      </span>
    </button>

235
    <header>
236
      <h2 id="unenrollment-modal-title">
237 238
        <span id='track-info'></span>
        <span id='refund-info'></span>
239 240
        <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
241
          ${_("window open")}
242 243
        </span>
      </h2>
244 245 246 247 248 249 250
      <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">
251
        <input name="submit" type="submit" value="${_("Unenroll")}" />
252 253 254
      </div>
    </form>
  </div>
255
</section>