hide buttons in rubric long description dialog when not editing

fixes CNVS-15284

test plan:
- create an assignment with a rubric
- as a teacher, edit the rubric on the assignment page and click on the
  "view long description" link
- the dialog should have 'update description' and 'cancel' buttons
- now stop editing the rubric and click the link
- the buttons should be hidden
- try reloading the page and viewing non-editing first, then editing
- try viewing the page as a student, and click the linke
- the buttons should be hidden

Change-Id: I35a340da41f5e2210b0fa81881029f277fd2e0d2
Reviewed-on: https://gerrit.instructure.com/50966
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Simon Williams 2015-03-24 15:28:29 -06:00
parent fa9d5972e3
commit 9b88791a15
2 changed files with 21 additions and 4 deletions

View File

@ -474,8 +474,8 @@ define([
if(editing && !isLearningOutcome) {
$rubric_long_description_dialog
.fillFormData(data)
.find('.editing').show()
.find(".displaying").hide();
.find('.editing').show().end()
.find(".displaying").hide().end();
} else {
if(!isLearningOutcome) {
// We want to prevent XSS in this dialog but users expect to have line
@ -501,8 +501,14 @@ define([
.data('current_criterion', $criterion)
.dialog({
title: I18n.t('titles.criterion_long_description', "Criterion Long Description"),
width: 400
}).fixDialogButtons().find("textarea:visible:first").focus().select();
width: 400,
buttons: []
});
if(editing && !isLearningOutcome) {
$rubric_long_description_dialog.fixDialogButtons();
$rubric_long_description_dialog.find("textarea:visible:first").focus().select();
}
})
.delegate(".find_rubric_link", 'click', function(event) {
event.preventDefault();

View File

@ -263,6 +263,17 @@ describe "assignment rubrics" do
expect(ee.first).to be_displayed
expect(ee.last).not_to be_displayed
end
it "shouldn't show 'update description' button in long description dialog" do
@assignment = @course.assignments.create(:name => 'assignment with rubric')
rubric_for_course
@rubric.associate_with(@assignment, @course, :purpose => 'grading')
get "/courses/#{@course.id}/assignments/#{@assignment.id}"
f(".criterion_description .long_description_link").click
expect(fj('.ui-dialog .save_button:visible')).to be_nil
end
end
context "assignment rubrics as an designer" do