Commit ada5fda9 by Matt Drayer

Merge pull request #10056 from edx/asadiqbal08/SOL-1255

asadiqbal08/SOL-1255: Remove all character limits in signatory fields
parents c17078b8 0b28fd23
...@@ -33,11 +33,6 @@ function(_, str, Backbone, BackboneRelational, gettext) { ...@@ -33,11 +33,6 @@ function(_, str, Backbone, BackboneRelational, gettext) {
validate: function(attrs) { validate: function(attrs) {
var errors = null; 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')){ if(_.has(attrs, 'title')){
var title = attrs.title; var title = attrs.title;
var lines = title.split(/\r\n|\r|\n/); var lines = title.split(/\r\n|\r|\n/);
...@@ -46,13 +41,6 @@ function(_, str, Backbone, BackboneRelational, gettext) { ...@@ -46,13 +41,6 @@ function(_, str, Backbone, BackboneRelational, gettext) {
'title': gettext('Signatory title should span over maximum of 2 lines.') 'title': gettext('Signatory title should span over maximum of 2 lines.')
}, errors); }, 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){ if (errors !== null){
return errors; return errors;
......
...@@ -252,7 +252,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails ...@@ -252,7 +252,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
}); });
setValuesToInputs(this.view, { 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, { setValuesToInputs(this.view, {
......
...@@ -228,10 +228,10 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce ...@@ -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(); this.view.$(SELECTORS.addSignatoryButton).click();
setValuesToInputs(this.view, { setValuesToInputs(this.view, {
inputCertificateName: 'New Certificate Name' inputCertificateName: 'New Certificate Name that has too many characters without any limit'
}); });
setValuesToInputs(this.view, { setValuesToInputs(this.view, {
...@@ -243,7 +243,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce ...@@ -243,7 +243,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
}); });
this.view.$(SELECTORS.saveCertificateButton).click(); 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() { it('signatories should not save when title span on more than 2 lines', function() {
......
...@@ -11,16 +11,16 @@ ...@@ -11,16 +11,16 @@
<legend class="sr"><%= gettext("Certificate Signatory Configuration") %></legend> <legend class="sr"><%= gettext("Certificate Signatory Configuration") %></legend>
<div class="input-wrap field text add-signatory-name <% if(error && error.name) { print('error'); } %>"> <div class="input-wrap field text add-signatory-name <% if(error && error.name) { print('error'); } %>">
<label for="signatory-name-<%= signatory_number %>"><%= gettext("Name ") %></label> <label for="signatory-name-<%= signatory_number %>"><%= gettext("Name ") %></label>
<input id="signatory-name-<%= signatory_number %>" class="collection-name-input input-text signatory-name-input" name="signatory-name" type="text" placeholder="<%= gettext("Name of the signatory") %>" value="<%= name %>" aria-describedby="signatory-name-<%= signatory_number %>-tip" maxlength="40" /> <input id="signatory-name-<%= signatory_number %>" class="collection-name-input input-text signatory-name-input" name="signatory-name" type="text" placeholder="<%= gettext("Name of the signatory") %>" value="<%= name %>" aria-describedby="signatory-name-<%= signatory_number %>-tip" />
<span id="signatory-name-<%= signatory_number %>-tip" class="tip tip-stacked"><%= gettext("The name of this signatory as it should appear on certificates. Maximum 40 characters.") %></span> <span id="signatory-name-<%= signatory_number %>-tip" class="tip tip-stacked"><%= gettext("The name of this signatory as it should appear on certificates.") %></span>
<% if(error && error.name) { %> <% if(error && error.name) { %>
<span class="message-error"><%= error.name %></span> <span class="message-error"><%= error.name %></span>
<% } %> <% } %>
</div> </div>
<div class="input-wrap field text add-signatory-title <% if(error && error.title) { print('error'); } %>"> <div class="input-wrap field text add-signatory-title <% if(error && error.title) { print('error'); } %>">
<label for="signatory-title-<%= signatory_number %>"><%= gettext("Title ") %></label> <label for="signatory-title-<%= signatory_number %>"><%= gettext("Title ") %></label>
<textarea id="signatory-title-<%= signatory_number %>" class="collection-name-input text input-text signatory-title-input" name="signatory-title" cols="40" rows="2" placeholder="<%= gettext("Title of the signatory") %>" aria-describedby="signatory-title-<%= signatory_number %>-tip" maxlength="106"><%= title %></textarea> <textarea id="signatory-title-<%= signatory_number %>" class="collection-name-input text input-text signatory-title-input" name="signatory-title" placeholder="<%= gettext("Title of the signatory") %>" aria-describedby="signatory-title-<%= signatory_number %>-tip" ><%= title %></textarea>
<span id="signatory-title-<%= signatory_number %>-tip" class="tip tip-stacked"><%= gettext("The title of this signatory as it should appear on certificates. Maximum of 106 characters.") %></span> <span id="signatory-title-<%= signatory_number %>-tip" class="tip tip-stacked"><%= gettext("Titles more than 100 characters may prevent students from printing their certificate on a single page.") %></span>
<% if(error && error.title) { %> <% if(error && error.title) { %>
<span class="message-error"><%= error.title %></span> <span class="message-error"><%= error.title %></span>
<% } %> <% } %>
......
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