Merge pull request #2857 from edx/adam/new-data-download

Update data download dash for parity (LMS-1203)
This commit is contained in:
Sarina Canelake
2014-03-13 10:58:50 -04:00
6 changed files with 94 additions and 38 deletions

View File

@@ -18,6 +18,7 @@ class DataDownload
@$section.data 'wrapper', @
# gather elements
@$list_studs_btn = @$section.find("input[name='list-profiles']'")
@$list_studs_csv_btn = @$section.find("input[name='list-profiles-csv']'")
@$list_anon_btn = @$section.find("input[name='list-anon-ids']'")
@$grade_config_btn = @$section.find("input[name='dump-gradeconf']'")
@$calculate_grades_csv_btn = @$section.find("input[name='calculate-grades-csv']'")
@@ -43,43 +44,44 @@ class DataDownload
# this handler binds to both the download
# and the csv button
@$list_studs_csv_btn.click (e) =>
url = @$list_studs_btn.data 'endpoint'
# handle csv special case
# redirect the document to the csv file.
url += '/csv'
location.href = url
@$list_studs_btn.click (e) =>
url = @$list_studs_btn.data 'endpoint'
# handle csv special case
if $(e.target).data 'csv'
# redirect the document to the csv file.
url += '/csv'
location.href = url
else
# Dynamically generate slickgrid table for displaying student profile information
@clear_display()
@$download_display_table.text gettext('Loading...')
# Dynamically generate slickgrid table for displaying student profile information
@clear_display()
@$download_display_table.text gettext('Loading...')
# fetch user list
$.ajax
dataType: 'json'
url: url
error: std_ajax_err =>
@clear_display()
@$download_request_response_error.text gettext("Error getting student list.")
success: (data) =>
@clear_display()
# fetch user list
$.ajax
dataType: 'json'
url: url
error: std_ajax_err =>
@clear_display()
@$download_request_response_error.text gettext("Error getting student list.")
success: (data) =>
@clear_display()
# display on a SlickGrid
options =
enableCellNavigation: true
enableColumnReorder: false
forceFitColumns: true
rowHeight: 35
# display on a SlickGrid
options =
enableCellNavigation: true
enableColumnReorder: false
forceFitColumns: true
rowHeight: 35
columns = ({id: feature, field: feature, name: feature} for feature in data.queried_features)
grid_data = data.students
columns = ({id: feature, field: feature, name: feature} for feature in data.queried_features)
grid_data = data.students
$table_placeholder = $ '<div/>', class: 'slickgrid'
@$download_display_table.append $table_placeholder
grid = new Slick.Grid($table_placeholder, grid_data, columns, options)
# grid.autosizeColumns()
$table_placeholder = $ '<div/>', class: 'slickgrid'
@$download_display_table.append $table_placeholder
grid = new Slick.Grid($table_placeholder, grid_data, columns, options)
# grid.autosizeColumns()
@$grade_config_btn.click (e) =>
url = @$grade_config_btn.data 'endpoint'