Commit 0df38c69 authored by Kevin Dibble's avatar Kevin Dibble Committed by Robert Lyon
Browse files

Bug 1044878: Editing duplicated content

Added a new feature that the user has to choose yes to
start editing copy. This will force users to interact with the
form before editing with the choice that they are editing
all copies of this content.

When selecting to use content from another note, the
form will update based on their choice. The editor will
remain open if yes has been selected. The editor will
be hidden and only the content will show if 'Yes' has
not be selected.

This is a UI element only - no decision is saved to the
DB as this is an editor based decision.

behatnotneeded

Change-Id: Idb8d6736796a2350359bd59395393f6c7d742f96
parent c17f02eb
......@@ -25,3 +25,4 @@ $string['textusedinothernotes'] = array(
1 => 'If you edit the text of this note, it will also be changed in %s blocks where it appears.'
);
$string['editcontent'] = 'Edit all copies of this note';
\ No newline at end of file
......@@ -218,6 +218,9 @@ function updateTextContent(a) {
jQuery('#instconf_licensereadonly_container').removeClass('d-none');
jQuery('#instconf_tagsreadonly_container').removeClass('d-none');
}
jQuery('#instconf_edit_container').removeClass('d-none');
jQuery('#instconf_otherblocksmsg_container').removeClass('d-none');
jQuery('#instconf_edit').trigger('change');
}
jQuery('#chooseartefactlink').on('click', function(e) {
e.preventDefault();
......@@ -230,6 +233,17 @@ jQuery('#chooseartefactlink').on('click', function(e) {
jQuery('#instconf_artefactid_container').toggleClass('d-none');
jQuery('#instconf_managenotes_container').toggleClass('d-none');
});
jQuery('#instconf #instconf_edit').on('change',function() {
if (jQuery(this).prop('checked')) {
jQuery('#instconf_textreadonly_container').addClass('d-none');
jQuery('#instconf_text_container').removeClass('d-none');
}
else {
jQuery('#instconf_textreadonly_container').removeClass('d-none');
jQuery('#instconf_text_container').addClass('d-none');
tinyMCE.get('instconf_text').setContent(jQuery('#instconf_textreadonly_display').html());
}
});
jQuery('#instconf a.copytextboxnote').each(function() {
jQuery(this).on('click', function(e) {
e.preventDefault();
......@@ -238,6 +252,7 @@ jQuery('#instconf a.copytextboxnote').each(function() {
jQuery(this).prop('checked', false);
}
});
jQuery('#instconf_edit_container').addClass('d-none');
jQuery('#instconf_makecopy').prop('checked', true);
jQuery('#instconf_textreadonly_container').addClass('d-none');
jQuery('#instconf_readonlymsg_container').addClass('d-none');
......@@ -374,9 +389,15 @@ EOF;
. ' <a class="copytextboxnote nojs-hidden-inline" href="">' . get_string('makeacopy', 'blocktype.internal/textbox') . '</a></p>',
'help' => true,
),
'edit' => array(
'type' => 'switchbox',
'class' => $otherblockcount > 0 ? '' : 'd-none',
'title' => get_string('editcontent', 'blocktype.internal/textbox'),
'defaultvalue' => 0,
),
'text' => array(
'type' => 'wysiwyg',
'class' => $readonly ? 'd-none' : '',
'class' => $readonly || $otherblockcount > 0 ? 'd-none' : '',
'title' => get_string('blockcontent', 'blocktype.internal/textbox'),
'width' => '100%',
'height' => $height . 'px',
......@@ -385,7 +406,7 @@ EOF;
),
'textreadonly' => array(
'type' => 'html',
'class' => $readonly ? '' : 'd-none',
'class' => $readonly || $otherblockcount > 0 ? '' : 'd-none',
'title' => get_string('blockcontent', 'blocktype.internal/textbox'),
'value' => '<div id="instconf_textreadonly_display" class="well text-midtone">' . $text . '</div>',
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment