Show cohorts on the new instructor dashboard

TNL-161

Remove placeholder text
This commit is contained in:
Andy Armstrong
2014-09-04 09:39:34 -04:00
committed by cahrens
parent 6d5cd5d0b8
commit 9e366fe202
12 changed files with 230 additions and 6 deletions

View File

@@ -0,0 +1,6 @@
<header class="cohort-management-group-header">
<h3 class="group-header-title">
<span class="title-value"><%- cohort.get('name') %></span>
<span class="group-count"><%- cohort.get('user_count') %></span>
</h3>
</header>

View File

@@ -0,0 +1,35 @@
<h2 class="section-title">
<span class="value"><%- gettext('Cohort Management') %></span>
<span class="description"></span>
</h2>
<!-- nav -->
<% if (cohorts.length > 0) { %>
<div class="cohort-management-nav">
<form action="" method="post" name="" id="cohort-management-nav-form" class="cohort-management-nav-form">
<div class="cohort-management-nav-form-select field field-select">
<label for="cohort-select" class="label sr">${_("Select a cohort to manage")}</label>
<select class="input cohort-select" name="cohort-select" id="cohort-select">
<option value=""><%- gettext('Select a cohort') %></option>
<% _.each(cohorts, function(cohort) { %>
<%
var label = interpolate(
gettext('%(cohort_name)s (%(user_count)s)'),
{ cohort_name: cohort.get('name'), user_count: cohort.get('user_count') },
true
);
%>
<option value="<%- cohort.get('id') %>"><%- label %></option>
<% }); %>
</select>
</div>
<button class="form-submit button action-primary action-view sr"><%- gettext('View cohort group') %></button>
</form>
</div>
<!-- individual group -->
<div class="cohort-management-group"></div>
<% } %>

View File

@@ -33,12 +33,12 @@
}
</script>
<script type="text/javascript" src="${static.url('js/vendor/underscore-min.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/backbone-min.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/mustache.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/flot/jquery.flot.axislabels.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jquery-jvectormap-1.1.1/jquery-jvectormap-1.1.1.min.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jquery-jvectormap-1.1.1/jquery-jvectormap-world-mill-en.js')}"></script>
<script type="text/javascript" src="${static.url('js/course_groups/cohorts.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jquery.event.drag-2.2.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/jquery.event.drop-2.2.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/slick.core.js')}"></script>
@@ -50,6 +50,21 @@
<script type="text/javascript" src="${static.url('js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js')}"></script>
<%static:js group='module-descriptor-js'/>
<%static:js group='instructor_dash'/>
## Backbone classes declared explicitly until RequireJS is supported
<script type="text/javascript" src="${static.url('js/models/cohort.js')}"></script>
<script type="text/javascript" src="${static.url('js/collections/cohort.js')}"></script>
<script type="text/javascript" src="${static.url('js/views/cohort_editor.js')}"></script>
<script type="text/javascript" src="${static.url('js/views/cohorts.js')}"></script>
</%block>
## Include Underscore templates
<%block name="header_extras">
% for template_name in ["cohorts", "cohort-editor"]:
<script type="text/template" id="${template_name}-tpl">
<%static:include path="instructor/instructor_dashboard_2/${template_name}.underscore" />
</script>
% endfor
</%block>
## NOTE that instructor is set as the active page so that the instructor button lights up, even though this is the instructor_2 page.

View File

@@ -26,7 +26,6 @@
</div>
</script>
<div class="vert-left">
<div class="batch-enrollment">
<h2> ${_("Batch Enrollment")} </h2>
<p>
@@ -112,9 +111,8 @@
<div class="request-response-error"></div>
</div>
%endif
</div>
<div class="vert-right member-lists-management">
<div class="member-lists-management">
## Translators: an "Administration List" is a list, such as Course Staff, that users can be added to.
<h2> ${_("Administration List Management")} </h2>
@@ -216,3 +214,29 @@
%endif
</div>
%if course.is_cohorted:
<hr class="divider" />
<div class="cohort-management membership-section" data-ajax_url="${section_data['cohorts_ajax_url']}">
</div>
% endif
<%block name="headextra">
<script>
$(document).ready(function() {
var cohortManagementElement = $('.cohort-management');
if (cohortManagementElement.length > 0) {
var cohorts = new CohortCollection();
cohorts.url = cohortManagementElement.data('ajax_url');
var cohortsView = new CohortsView({
el: cohortManagementElement,
model: cohorts
});
cohortsView.render();
cohorts.fetch().done(function() {
cohortsView.render();
});
}
});
</script>
</%block>