Bug 29265: Add option to pick editor when creating a new content entry

This patch changes the "New entry" button on the additional contents
page to be a split button which offers the alternative of the
non-default editor (as defined by AdditionalContentsEditor).

Also changed: I moved some of the template logic around to consolidate
handling of the editor variables.

To test, apply the patch and go to Tools -> HTML customizations.

 - At the top of the page there should be a split button. The dropdown
   option should offer the non-default editor.
 - If AdditionalContentsEditor is set to "text editor," clicking the
   "main" part of the button should take you to an entry page which uses
   the text editor.
   - The dropdown part of the button should say "New entry using
      WYSIWYG editor."
 - Switch the AdditionalContentsEditor preference and confirm that the
   button reflects the change.
 - Confirm that the individual "Edit" buttons for each existing content
   entry still works correctly according to the system preference.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2021-10-25 18:55:53 +00:00 committed by Jonathan Druart
parent d14c1f15a4
commit c7ba914861
1 changed files with 18 additions and 7 deletions

View File

@ -7,7 +7,10 @@
[% INCLUDE 'doc-head-open.inc' %]
<title>Additional contents &rsaquo; Tools &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
[% UNLESS ( wysiwyg ) %]
[% IF ( wysiwyg ) %]
[% SET editmode = "wysiwyg" %]
[% ELSE %]
[% SET editmode = "text" %]
[% Asset.css("lib/codemirror/codemirror.css") | $raw %]
[% Asset.css("lib/codemirror/lint.min.css") | $raw %]
<style>
@ -282,7 +285,20 @@
[% BLOCK list %]
<div id="toolbar" class="btn-toolbar">
<a class="btn btn-default" id="newentry" href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&category=[% category | html %]"><i class="fa fa-plus"></i> New entry</a>
<div class="btn-group">
<a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&editmode=[% editmode | uri %]" class="btn btn-default" id="newentry"> <i class="fa fa-plus"></i> New entry</a><button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<li>
[% IF ( wysiwyg ) %]
<a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&editmode=text">New entry using text editor</a>
[% ELSE %]
<a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&editmode=wysiwyg">New entry using WYSIWYG editor</a>
[% END %]
</li>
</ul>
</div>
</div>
<h2>Additional contents ([% IF category == 'news' %]News[% ELSE %]HTML customizations[% END %])</h2>
@ -358,11 +374,6 @@
</div>
</td>
<td class="actions">
[% IF ( wysiwyg ) %]
[% SET editmode = "wysiwyg" %]
[% ELSE %]
[% SET editmode = "text" %]
[% END %]
<div class="btn-group dropup">
<a href="/cgi-bin/koha/tools/additional-contents.pl?op=add_form&amp;id=[% c.idnew | uri %]&editmode=[% editmode | uri %]" class="btn btn-default btn-xs"> <i class="fa fa-pencil"></i> Edit</a><button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>