From 0b28fd23f8269b3f8aba807360ea70f4af7fa4a4 Mon Sep 17 00:00:00 2001 From: asadiqbal Date: Tue, 6 Oct 2015 14:52:38 +0500 Subject: [PATCH] SOL-1225 --- cms/static/js/certificates/models/signatory.js | 12 ------------ .../spec/views/certificate_details_spec.js | 2 +- .../spec/views/certificate_editor_spec.js | 6 +++--- cms/templates/js/signatory-editor.underscore | 8 ++++---- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/cms/static/js/certificates/models/signatory.js b/cms/static/js/certificates/models/signatory.js index 6644d01b51..d16bdaaa4e 100644 --- a/cms/static/js/certificates/models/signatory.js +++ b/cms/static/js/certificates/models/signatory.js @@ -33,11 +33,6 @@ function(_, str, Backbone, BackboneRelational, gettext) { validate: function(attrs) { var errors = null; - if(_.has(attrs, 'name') && attrs.name.length > 40) { - errors = _.extend({ - 'name': gettext('Signatory name should not be more than 40 characters long.') - }, errors); - } if(_.has(attrs, 'title')){ var title = attrs.title; var lines = title.split(/\r\n|\r|\n/); @@ -46,13 +41,6 @@ function(_, str, Backbone, BackboneRelational, gettext) { 'title': gettext('Signatory title should span over maximum of 2 lines.') }, errors); } - else if ((lines.length > 1 && (lines[0].length > 53 && lines[1].length > 53)) || - (lines.length === 1 && title.length > 106)) { - errors = _.extend({ - 'title': gettext('Signatory title should have maximum of 40 characters per line.') - }, errors); - } - } if (errors !== null){ return errors; diff --git a/cms/static/js/certificates/spec/views/certificate_details_spec.js b/cms/static/js/certificates/spec/views/certificate_details_spec.js index 3314348bcd..a03748f9f4 100644 --- a/cms/static/js/certificates/spec/views/certificate_details_spec.js +++ b/cms/static/js/certificates/spec/views/certificate_details_spec.js @@ -252,7 +252,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails }); setValuesToInputs(this.view, { - inputSignatoryTitle: 'This is a certificate signatory title that has waaaaaaay more than 106 characters, in order to cause an exception.' + inputSignatoryTitle: 'Signatory Title \non three \nlines' }); setValuesToInputs(this.view, { diff --git a/cms/static/js/certificates/spec/views/certificate_editor_spec.js b/cms/static/js/certificates/spec/views/certificate_editor_spec.js index 9ea6dbd241..1d2cd14790 100644 --- a/cms/static/js/certificates/spec/views/certificate_editor_spec.js +++ b/cms/static/js/certificates/spec/views/certificate_editor_spec.js @@ -228,10 +228,10 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce } ); - it('signatories should not save when fields have too many characters per line', function() { + it('signatories should save when fields have too many characters per line', function() { this.view.$(SELECTORS.addSignatoryButton).click(); setValuesToInputs(this.view, { - inputCertificateName: 'New Certificate Name' + inputCertificateName: 'New Certificate Name that has too many characters without any limit' }); setValuesToInputs(this.view, { @@ -243,7 +243,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce }); this.view.$(SELECTORS.saveCertificateButton).click(); - expect(this.view.$('.certificate-edit-error')).toHaveClass('is-shown'); + expect(this.view.$('.certificate-edit-error')).not.toHaveClass('is-shown'); }); it('signatories should not save when title span on more than 2 lines', function() { diff --git a/cms/templates/js/signatory-editor.underscore b/cms/templates/js/signatory-editor.underscore index 65789a9eb5..cea8ea7c8c 100644 --- a/cms/templates/js/signatory-editor.underscore +++ b/cms/templates/js/signatory-editor.underscore @@ -11,16 +11,16 @@ <%= gettext("Certificate Signatory Configuration") %>
- " value="<%= name %>" aria-describedby="signatory-name-<%= signatory_number %>-tip" maxlength="40" /> - <%= gettext("The name of this signatory as it should appear on certificates. Maximum 40 characters.") %> + " value="<%= name %>" aria-describedby="signatory-name-<%= signatory_number %>-tip" /> + <%= gettext("The name of this signatory as it should appear on certificates.") %> <% if(error && error.name) { %> <%= error.name %> <% } %>
- - <%= gettext("The title of this signatory as it should appear on certificates. Maximum of 106 characters.") %> + + <%= gettext("Titles more than 100 characters may prevent students from printing their certificate on a single page.") %> <% if(error && error.title) { %> <%= error.title %> <% } %>