diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index ca89545ec0..c37fb1bc9f 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -142,5 +142,6 @@ def _section_analytics(course_id): 'section_key': 'analytics', 'section_display_name': 'Analytics', 'get_distribution_url': reverse('get_distribution', kwargs={'course_id': course_id}), + 'proxy_legacy_analytics_url': reverse('proxy_legacy_analytics', kwargs={'course_id': course_id}), } return section_data diff --git a/lms/static/coffee/src/instructor_dashboard/analytics.coffee b/lms/static/coffee/src/instructor_dashboard/analytics.coffee index d6e1ffdd3e..3229f51899 100644 --- a/lms/static/coffee/src/instructor_dashboard/analytics.coffee +++ b/lms/static/coffee/src/instructor_dashboard/analytics.coffee @@ -6,60 +6,32 @@ plantTimeout = -> window.InstructorDashboard.util.plantTimeout.apply this, arguments std_ajax_err = -> window.InstructorDashboard.util.std_ajax_err.apply this, arguments -# Analytics Section -class Analytics - constructor: (@$section) -> - @$section.data 'wrapper', @ - # gather elements - @$display = @$section.find '.distribution-display' - @$display_text = @$display.find '.distribution-display-text' - @$display_graph = @$display.find '.distribution-display-graph' - @$display_table = @$display.find '.distribution-display-table' - @$distribution_select = @$section.find 'select#distributions' - @$request_response_error = @$display.find '.request-response-error' - - @populate_selector => @$distribution_select.change => @on_selector_change() +class ProfileDistributionWidget + constructor: ({@$container, @feature, title, @endpoint}) -> + # render template + template_params = + title: title + feature: @feature + endpoint: @endpoint + template_html = $("#profile-distribution-widget-template").html() + @$container.html Mustache.render template_html, template_params reset_display: -> - @$display_text.empty() - @$display_graph.empty() - @$display_table.empty() - @$request_response_error.empty() + @$container.find('.display-errors').empty() + @$container.find('.display-text').empty() + @$container.find('.display-graph').empty() + @$container.find('.display-table').empty() - # fetch and list available distributions - # `cb` is a callback to be run after - populate_selector: (cb) -> - # ask for no particular distribution to get list of available distribuitions. - @get_profile_distributions undefined, - # on error, print to console and dom. - error: std_ajax_err => @$request_response_error.text "Error getting available distributions." - success: (data) => - # replace loading text in drop-down with "-- Select Distribution --" - @$distribution_select.find('option').eq(0).text "-- Select Distribution --" - - # add all fetched available features to drop-down - for feature in data.available_features - opt = $ '