submit assignment RCE flag

closes CNVS-27647

Start RCE service integration with granular
feature flags for high risk areas

TEST PLAN:
 1) regression test submitting an assignment with a text entry
    type
 2) with RCE service in the mix and the RICH_CONTENT_HIGH_RISK_ENABLED
    flag on (the high risk flag), test submitting the assignment
 3)  note there will be no sidebar here.  We expect there to be no
    regressions using the remote editor.

Change-Id: I606a6c4004eea9656b6f4eaf3d883024801f177b
Reviewed-on: https://gerrit.instructure.com/73887
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
This commit is contained in:
Ethan Vizitei 2016-03-07 11:38:13 -07:00 committed by Ethan Vizitei
parent 4e2eef2285
commit 39b4757a55
2 changed files with 14 additions and 4 deletions

View File

@ -55,6 +55,7 @@ class AssignmentsController < ApplicationController
end
def show
js_env(Services::RichContent.env_for(@domain_root_account, risk_level: :highrisk))
@assignment ||= @context.assignments.find(params[:id])
if @assignment.deleted?
respond_to do |format|

View File

@ -24,6 +24,7 @@ define([
'jst/assignments/homework_submission_tool',
'compiled/external_tools/HomeworkSubmissionLtiContainer',
'compiled/views/editor/KeyboardShortcuts' /* TinyMCE Keyboard Shortcuts for a11y */,
'jsx/shared/rce/RichContentEditor',
'compiled/jquery.rails_flash_notifications',
'jquery.ajaxJSON' /* ajaxJSON */,
'jquery.inst_tree' /* instTree */,
@ -36,10 +37,14 @@ define([
'tinymce.editor_box' /* editorBox */,
'vendor/jquery.scrollTo' /* /\.scrollTo/ */,
'jqueryui/tabs' /* /\.tabs/ */
], function(I18n, $, _, GoogleDocsTreeView, homework_submission_tool, HomeworkSubmissionLtiContainer, RCEKeyboardShortcuts) {
], function(I18n, $, _, GoogleDocsTreeView, homework_submission_tool,
HomeworkSubmissionLtiContainer, RCEKeyboardShortcuts, RichContentEditor) {
window.submissionAttachmentIndex = -1;
var richContentEditor = new RichContentEditor({riskLevel: "highrisk"});
richContentEditor.preloadRemoteModule();
$(document).ready(function() {
var submitting = false,
submissionForm = $('.submit_assignment_form');
@ -206,7 +211,7 @@ define([
$(".switch_text_entry_submission_views").click(function(event) {
event.preventDefault();
$("#submit_online_text_entry_form textarea:first").editorBox('toggle');
richContentEditor.callOnRCE($("#submit_online_text_entry_form textarea:first"), 'toggle')
// todo: replace .andSelf with .addBack when JQuery is upgraded.
$(this).siblings(".switch_text_entry_submission_views").andSelf().toggle();
});
@ -228,7 +233,9 @@ define([
activate: function(event, ui) {
if (ui.newTab.find('a').hasClass('submit_online_text_entry_option')) {
$el = $("#submit_online_text_entry_form textarea:first");
if (!$el.editorBox('exists?')) { $el.editorBox(); }
if (!richContentEditor.callOnRCE($el, 'exists?')) {
richContentEditor.loadNewEditor($el);
}
}
if (ui.newTab.attr("aria-controls") === "submit_google_doc_form") {
@ -238,7 +245,9 @@ define([
create: function(event, ui) {
if (ui.tab.find('a').hasClass('submit_online_text_entry_option')) {
$el = $("#submit_online_text_entry_form textarea:first");
if (!$el.editorBox('exists?')) { $el.editorBox(); }
if (!richContentEditor.callOnRCE($el, 'exists?')) {
richContentEditor.loadNewEditor($el);
}
}
//list Google Docs if Google Docs tab is active