Bug 29515: Make title for HTML customizations optional

This adds code to make the title field for HTML customizations optional
while it stays mandatory for news entries.

1) Add a new HTML customization, verify you are forced to enter a title
2) Apply patch
3) Repeat and verify that you can now save without title
4) Add a new news entry
5) Verify that the title field remained mandatory there.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Katrin Fischer 2021-11-16 08:35:22 +00:00 committed by Fridolin Somers
parent 327be4a704
commit 2d19bfb052

View file

@ -199,8 +199,13 @@
</li>
[% UNLESS languages.size %]
<li>
<label for="title" class="required">Title: </label>
<input id="title" size="100" maxlength="250" type="text" name="title_default" value="[% additional_content.title | html %]" required="required" class="required" /> <span class="required">Required</span>
[% IF category == 'news' %]
<label for="title" class="required">Title: </label>
<input id="title" size="100" maxlength="250" type="text" name="title_default" value="[% additional_content.title | html %]" required="required" class="required" /> <span class="required">Required</span>
[% ELSE %]
<label for="title">Title: </label>
<input id="title" size="100" maxlength="250" type="text" name="title_default" value="[% additional_content.title | html %]" />
[% END %]
</li>
[% END %]
<li>
@ -554,6 +559,7 @@
<script>
$(document).ready(function() {
$("#tabs").tabs();
[% IF category == 'news' %]
$("#add_additional_content").validate({
submitHandler: function(form){
if ( ! $("#title_default").val().length > 0 ) {
@ -564,6 +570,7 @@
form.submit();
}
});
[% END %]
$("#submit_form").on("click",function(){
$("#add_additional_content").submit();