Skip to content

Commit

Permalink
Merge pull request #1125 from edx/adam/remove-instr-dash-buttons
Browse files Browse the repository at this point in the history
disable buttons for legacy and beta instr dash
  • Loading branch information
adampalay committed Oct 7, 2013
2 parents a617988 + e375846 commit faf796b
Show file tree
Hide file tree
Showing 10 changed files with 254 additions and 55 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.

LMS: Disable data download buttons on the instructor dashboard for large courses

LMS: Refactor and clean student dashboard templates.

Expand Down
10 changes: 10 additions & 0 deletions lms/djangoapps/instructor/views/instructor_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.core.urlresolvers import reverse
from django.utils.html import escape
from django.http import Http404
from django.conf import settings

from courseware.access import has_access
from courseware.courses import get_course_by_id
Expand Down Expand Up @@ -45,10 +46,19 @@ def instructor_dashboard_2(request, course_id):
_section_analytics(course_id),
]

enrollment_count = sections[0]['enrollment_count']

disable_buttons = False
max_enrollment_for_buttons = settings.MITX_FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS")
if max_enrollment_for_buttons is not None:
disable_buttons = enrollment_count > max_enrollment_for_buttons


context = {
'course': course,
'old_dashboard_url': reverse('instructor_dashboard', kwargs={'course_id': course_id}),
'sections': sections,
'disable_buttons': disable_buttons,
}

return render_to_response('instructor/instructor_dashboard_2/instructor_dashboard_2.html', context)
Expand Down
71 changes: 41 additions & 30 deletions lms/djangoapps/instructor/views/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,15 @@ def instructor_dashboard(request, course_id):
else:
idash_mode = request.session.get('idash_mode', 'Grades')

enrollment_number = CourseEnrollment.objects.filter(course_id=course_id, is_active=1).count()

# assemble some course statistics for output to instructor
def get_course_stats_table():
datatable = {'header': ['Statistic', 'Value'],
'title': _u('Course Statistics At A Glance'),
}
data = [['# Enrolled', CourseEnrollment.objects.filter(course_id=course_id, is_active=1).count()]]
datatable = {
'header': ['Statistic', 'Value'],
'title': _u('Course Statistics At A Glance'),
}
data = [['# Enrolled', enrollment_number]]
data += [['Date', timezone.now().isoformat()]]
data += compute_course_stats(course).items()
if request.user.is_staff:
Expand Down Expand Up @@ -832,35 +835,43 @@ def get_analytics_result(analytics_name):
if not datatable:
course_stats = get_course_stats_table()

# disable buttons for large courses
disable_buttons = False
max_enrollment_for_buttons = settings.MITX_FEATURES.get("MAX_ENROLLMENT_INSTR_BUTTONS")
if max_enrollment_for_buttons is not None:
disable_buttons = enrollment_number > max_enrollment_for_buttons

#----------------------------------------
# context for rendering

context = {'course': course,
'staff_access': True,
'admin_access': request.user.is_staff,
'instructor_access': instructor_access,
'forum_admin_access': forum_admin_access,
'datatable': datatable,
'course_stats': course_stats,
'msg': msg,
'modeflag': {idash_mode: 'selectedmode'},
'studio_url': studio_url,

'to_option': email_to_option, # email
'subject': email_subject, # email
'editor': email_editor, # email
'email_msg': email_msg, # email
'show_email_tab': show_email_tab, # email

'problems': problems, # psychometrics
'plots': plots, # psychometrics
'course_errors': modulestore().get_item_errors(course.location),
'instructor_tasks': instructor_tasks,
'offline_grade_log': offline_grades_available(course_id),
'cohorts_ajax_url': reverse('cohorts', kwargs={'course_id': course_id}),

'analytics_results': analytics_results,
}
context = {
'course': course,
'staff_access': True,
'admin_access': request.user.is_staff,
'instructor_access': instructor_access,
'forum_admin_access': forum_admin_access,
'datatable': datatable,
'course_stats': course_stats,
'msg': msg,
'modeflag': {idash_mode: 'selectedmode'},
'studio_url': studio_url,

'to_option': email_to_option, # email
'subject': email_subject, # email
'editor': email_editor, # email
'email_msg': email_msg, # email
'show_email_tab': show_email_tab, # email

'problems': problems, # psychometrics
'plots': plots, # psychometrics
'course_errors': modulestore().get_item_errors(course.location),
'instructor_tasks': instructor_tasks,
'offline_grade_log': offline_grades_available(course_id),
'cohorts_ajax_url': reverse('cohorts', kwargs={'course_id': course_id}),

'analytics_results': analytics_results,
'disable_buttons': disable_buttons
}

if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'):
context['beta_dashboard_url'] = reverse('instructor_dashboard_2', kwargs={'course_id': course_id})
Expand Down
4 changes: 4 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@

# Automatically approve student identity verification attempts
'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': False,

# Disable instructor dash buttons for downloading course data
# when enrollment exceeds this number
'MAX_ENROLLMENT_INSTR_BUTTONS': 200,
}

# Used for A/B testing
Expand Down
5 changes: 5 additions & 0 deletions lms/static/sass/base/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ $action-secondary-disabled-fg: $white;
$header-graphic-super-color: $m-blue-d1;
$header-graphic-sub-color: $m-gray-d2;

// State-based colors
$error-color: $error-red;
$warning-color: $m-pink;
$confirm-color: $m-green;

// ====================

// MISC: visual horizontal rules
Expand Down
44 changes: 41 additions & 3 deletions lms/static/sass/course/instructor/_instructor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
}
}

// ====================

// system feedback - messages
.msg {
border-radius: 1px;
Expand All @@ -51,15 +53,51 @@
}
}

// TYPE: warning
.msg-warning {
border-top: 2px solid $warning-color;
background: tint($warning-color,95%);

.copy {
color: $warning-color;
}
}

// TYPE: confirm
.msg-confirm {
border-top: 2px solid green;
background: tint(green,90%);
border-top: 2px solid $confirm-color;
background: tint($confirm-color,95%);

.copy {
color: $confirm-color;
}
}

// TYPE: confirm
.msg-error {
border-top: 2px solid $error-color;
background: tint($error-color,95%);

.copy {
color: green;
color: $error-color;
}
}

// ====================

// inline copy
.copy-confirm {
color: $confirm-color;
}

.copy-warning {
color: $warning-color;
}

.copy-error {
color: $error-color;
}

.list-advice {
list-style: none;
padding: 0;
Expand Down
71 changes: 71 additions & 0 deletions lms/static/sass/course/instructor/_instructor_2.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,77 @@
right: 15px;
font-size: 11pt;
}

// system feedback - messages
.msg {
border-radius: 1px;
padding: 10px 15px;
margin-bottom: 20px;

.copy {
font-weight: 600;
}
}

// TYPE: warning
.msg-warning {
border-top: 2px solid $warning-color;
background: tint($warning-color,95%);

.copy {
color: $warning-color;
}
}

// TYPE: confirm
.msg-confirm {
border-top: 2px solid $confirm-color;
background: tint($confirm-color,95%);

.copy {
color: $confirm-color;
}
}

// TYPE: confirm
.msg-error {
border-top: 2px solid $error-color;
background: tint($error-color,95%);

.copy {
color: $error-color;
}
}

// ====================

// inline copy
.copy-confirm {
color: $confirm-color;
}

.copy-warning {
color: $warning-color;
}

.copy-error {
color: $error-color;
}

.list-advice {
list-style: none;
padding: 0;
margin: 20px 0;

.item {
font-weight: 600;
margin-bottom: 10px;

&:last-child {
margin-bottom: 0;
}
}
}
}

section.instructor-dashboard-content-2 {
Expand Down
Loading

0 comments on commit faf796b

Please sign in to comment.