Commit e87eac74 authored by Pramith Dayananda's avatar Pramith Dayananda Committed by Robert Lyon
Browse files

Bug 1694875: Annotation field validated via JS

Validation on portfolio collections
Validation on smartevidence grid
Behat tests added
A new feature file added

Change-Id: Ib5adf627f3391fb53805b0566a7c405313a3066b
parent 73736a63
......@@ -201,7 +201,10 @@ class PluginBlocktypeAnnotation extends MaharaCoreBlocktype {
'width' => '100%',
'height' => $height . 'px',
'defaultvalue' => $text,
'rules' => array('maxlength' => 65536),
'rules' => array(
'maxlength' => 65536,
'required' => true
),
),
'annotationreadonlymsg' => array(
'type' => 'html',
......@@ -455,7 +458,6 @@ class PluginBlocktypeAnnotation extends MaharaCoreBlocktype {
});
}
});
EOF;
}
}
......@@ -54,6 +54,7 @@ $string['groupadmins'] = 'Group Administrators';
$string['makepublicrequestsent'] = 'A message has been sent to %s to request that the feedback be made public.';
$string['makepublicrequestbyauthormessage'] = '%s has requested that you make their feedback public.';
$string['annotationempty'] = 'This field is required.';
$string['annotationfeedbackempty'] = 'Your feedback is empty. Please enter a message.';
$string['newannotationfeedbacknotificationsubject'] = 'New feedback on %s';
......
......@@ -163,16 +163,25 @@ jQuery(function($) {
values[item.name] = item.value;
}
});
values['tags'] = tags.join();
values['framework'] = params.framework;
values['view'] = params.view;
values['option'] = params.option;
values['action'] = 'update';
if (hastinymce) {
tinyMCE.execCommand('mceRemoveEditor', false, "instconf_text");
if (values["text"].length == 0) {
if ($("#instconf_text").parent().find('.errmsg').length == 0) {
$("#instconf_text").parent().append('<div class="errmsg"><span>' + get_string_ajax('annotationempty', 'artefact.annotation') + '</span></div>');
}
$('#instconf button.submitcancel.submit').prop("disabled", false);
}
else {
values['tags'] = tags.join();
values['framework'] = params.framework;
values['view'] = params.view;
values['option'] = params.option;
values['action'] = 'update';
if (hastinymce) {
tinyMCE.execCommand('mceRemoveEditor', false, "instconf_text");
}
editmatrix_update(values);
hide_dock();
}
editmatrix_update(values);
hide_dock();
});
// When we are saving the annotation feedback form - changing the evidence status
$('#annotationfeedback').on('submit', function(se) {
......
@javascript @core @core_portfolio
Feature: Annotation via smart evnidence map
In order to verify the empty annotations are disabled
As an admin
So I can annotate people's work
Background:
Given the following "pages" exist:
| title | description| ownertype | ownername |
| Page 01 | Admin's page 01 | user | admin |
| Page 02 | Admin's page 02 | user | admin |
| Page 03 | Admin's page 03 | user | admin |
| Page 04 | Admin's page 04 | user | admin |
And the following "collections" exist:
| title | description| ownertype | ownername | pages |
| Test collection | This is the collection 01 | user | admin | Page 01, Page 02, Page 03, Page 04 |
Scenario: Accessing annotation block
Given I log in as "admin" with password "Kupuhipa1"
# Navigating to admin block to turn it on
And I choose "Plugin administration" in "Extensions" from administration menu
And I press "activate_blocktype_annotation_submit"
And I should see "Hide" in the "form#activate_module_framework" "css_element"
And I choose "Settings" in "Institutions" from administration menu
And I press "Edit"
And I enable the switch "Allow SmartEvidence"
And I press "Submit"
# Make sure we have a matrix config form
And I choose "SmartEvidence" in "Extensions" from administration menu
And I follow "Add framework"
And I attach the file "example.matrix" to "Matrix file"
And I press "Upload matrix"
# Check that we have new framework
Then I should see "Title of your framework"
# Update 'Test collection' to have smart evidence
And I choose "Pages and collections" in "Portfolio" from main menu
And I click on "Test collection" panel menu
And I click on "Edit" in "Test collection" panel menu
And I select "Title of your framework" from "SmartEvidence framework"
And I press "Save"
And follow "Test collection"
# Click the matrix point and test empty annotation message
And I click on the matrix point "3,4"
And I press "Save"
And I should see "This field is required"
......@@ -27,8 +27,17 @@ Scenario: Accessing annotation block (Bug 1443730)
And I follow "Annotation"
And I press "Add"
And I press "Save"
# Checking empty annotation message
And I am on homepage
And follow "My page is amazing"
And I follow "Edit"
And I expand "General" node
And I follow "Annotation"
And I press "Add"
And I press "Save"
And I should see "This field is required"
# Checking that the block saved by using the one thing on the page that changed.
And I display the page
And I am on homepage
And follow "My page is amazing"
And I should see "Annotation"
And I should see "My page is amazing"
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