diff --git a/app/coffeescripts/ember/quizzes/config/app.coffee b/app/coffeescripts/ember/quizzes/config/app.coffee index 15b1e1188ee..8ae5ddc266e 100644 --- a/app/coffeescripts/ember/quizzes/config/app.coffee +++ b/app/coffeescripts/ember/quizzes/config/app.coffee @@ -12,7 +12,7 @@ define [ initialize: (container, application) -> env.setEnv(window.ENV) - Ember.$.ajaxPrefilter (options, originalOptions, xhr) -> + Ember.$.ajaxPrefilter 'json', (options, originalOptions, xhr) -> options.dataType = 'json' options.headers = 'Accept': 'application/vnd.api+json' diff --git a/app/coffeescripts/ember/quizzes/controllers/quiz_controller.coffee b/app/coffeescripts/ember/quizzes/controllers/quiz_controller.coffee index 89ea3e2673f..0c4a44b2b41 100644 --- a/app/coffeescripts/ember/quizzes/controllers/quiz_controller.coffee +++ b/app/coffeescripts/ember/quizzes/controllers/quiz_controller.coffee @@ -12,3 +12,11 @@ define [ unpublish: -> @set 'published', false @get('model').save() + + # Kind of a gross hack so we can get quiz arrows in... + addLegacyJS: (-> + return unless @get('quizSubmissionHTML.html') + Ember.$(document.body).append """ + + """ + ).observes('quizSubmissionHTML.html') diff --git a/app/coffeescripts/ember/quizzes/models/quiz.coffee b/app/coffeescripts/ember/quizzes/models/quiz.coffee index 137af9a845e..f7a214dc1c7 100644 --- a/app/coffeescripts/ember/quizzes/models/quiz.coffee +++ b/app/coffeescripts/ember/quizzes/models/quiz.coffee @@ -2,10 +2,11 @@ define [ 'ember' 'ember-data' 'i18n!quizzes' -], (Em, DS, I18n) -> + 'ic-ajax' +], (Em, DS, I18n, ajax) -> {alias, equal, any} = Em.computed - {belongsTo} = DS + {belongsTo, PromiseObject} = DS Em.onerror = (error) -> console.log 'ERR', error, error.stack @@ -71,3 +72,11 @@ define [ when 'graded_survey' then I18n.t 'graded_survey', 'Graded Survey' when 'practice_quiz' then I18n.t 'practice_quiz', 'Practice Quiz' ).property('quizType') + # temporary until we ship the show page with quiz submission info in ember + quizSubmissionHtmlURL: attr() + quizSubmissionHTML: (-> + promise = ajax(@get 'quizSubmissionHtmlURL').then (html) => + @set 'didLoadQuizSubmissionHTML', true + { html: html } + PromiseObject.create promise: promise + ).property('quizSubmissionHtmlURL') diff --git a/app/coffeescripts/ember/quizzes/templates/quiz/show.hbs b/app/coffeescripts/ember/quizzes/templates/quiz/show.hbs index ea7982f245f..f097a63ab6f 100644 --- a/app/coffeescripts/ember/quizzes/templates/quiz/show.hbs +++ b/app/coffeescripts/ember/quizzes/templates/quiz/show.hbs @@ -89,4 +89,17 @@ {{/each}} + +{{! this is only here for legacy styling to pull in + quiz submissions from the server! Confusing id-show above vs + id_show should be removed soon! }} +