stop appending digits to long assignment names

fixes CNVS-1662

test plan:
  - turn draft state off
  - go to the asignments index
  - create an assignment group w/ a 254 char name
  - click the add assignment link on the right side
    with the newly created assignment group selected
    - the assignment created should not have a number at the end
    - it should save properly
  - click the add assignment link on the right side
    with a different group (without a long name)
    - the assignment created should have a number at the end
      (like usual)

Change-Id: I1cb7c1aa80eb698e1e5b84098448817e943e79fa
Reviewed-on: https://gerrit.instructure.com/35300
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Michael Nomitch 2014-05-21 16:34:49 -05:00 committed by Mike Nomitch
parent df32984b57
commit 35252ec992
1 changed files with 3 additions and 1 deletions

View File

@ -82,7 +82,9 @@ define([
var $group = $assignment.parents(".assignment_group");
var group_data = $group.getTemplateData({textValues: ['default_assignment_name', 'assignment_group_id']});
var title = group_data.default_assignment_name;
title += " " + $group.find(".group_assignment").length;
if(title.length <= 251){
title += " " + $group.find(".group_assignment").length;
}
var $form = $assignment.find("#add_assignment_form");
var buttonMsg = "Update";
var url = $assignment.find(".edit_assignment_link").attr('href');