Bugzilla – Attachment 109950 Details for
Bug 26431
Use split button to offer choice of WYSIWYG or code editor for news
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26431: Use split button to offer choice of WYSIWYG or code editor for news
Bug-26431-Use-split-button-to-offer-choice-of-WYSI.patch (text/plain), 5.79 KB, created by
Lucas Gass (lukeg)
on 2020-09-11 14:58:03 UTC
(
hide
)
Description:
Bug 26431: Use split button to offer choice of WYSIWYG or code editor for news
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2020-09-11 14:58:03 UTC
Size:
5.79 KB
patch
obsolete
>From 05b772b3504fd081c78f4bd5f139392fe1d960dd Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 30 Jul 2020 12:38:22 +0000 >Subject: [PATCH] Bug 26431: Use split button to offer choice of WYSIWYG or > code editor for news > >This patch modifies the news interface so that the user is offered a >choice of editing news items using the default editor as defined by the >NewsToolEditor system preference or the non-default one. > >To test, apply the patch and go to Tools -> News. > >- In the list of news items you should see an "Edit" split button in > each row. >- Clicking the "Edit" part of the button should open the edit view with > the correct editor as defined by the NewsToolEditor preference. >- Clicking the menu arrow on the button should offer the other editing > method: > - If NewsToolEditor is set to "WYSIWYG," the menu should offer "text > editor." > - If NewsToolEditor is set to "text editor," the menu should offer > "WYSIWYG editor." >- Test the button with the NewsToolEditor preference set to both options > and confirm that the button and menu work correctly. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > .../prog/en/modules/tools/koha-news.tt | 28 ++++++++++++++++++---- > tools/koha-news.pl | 11 ++++++++- > 2 files changed, 34 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index c37983b0d2..c210a5b707 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -9,7 +9,7 @@ > [% INCLUDE 'doc-head-close.inc' %] > [% IF ( opac_news_count ) %] > [% END %] >-[% IF Koha.Preference('NewsToolEditor') == 'codemirror' %] >+[% UNLESS ( wysiwyg ) %] > [% Asset.css("lib/codemirror/codemirror.css") | $raw %] > [% Asset.css("lib/codemirror/lint.min.css") | $raw %] > <style> >@@ -159,8 +159,28 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% opac_new.content | $raw %] > </td> > <td class="actions"> >- <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.idnew | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a> >- <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% opac_new.idnew | uri %]" class="delete_news btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a> >+ [% IF ( wysiwyg ) %] >+ [% SET editmode = "wysiwyg" %] >+ [% ELSE %] >+ [% SET editmode = "text" %] >+ [% END %] >+ <div class="btn-group dropup"> >+ <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.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> >+ </button> >+ <ul class="dropdown-menu pull-right"> >+ <li> >+ [% IF ( wysiwyg ) %] >+ <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.idnew | uri %]&editmode=text"><i class="fa fa-pencil"></i> Edit with text editor</a> >+ [% ELSE %] >+ <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.idnew | uri %]&editmode=wysiwyg"><i class="fa fa-pencil"></i> Edit with WYSIWYG editor</a> >+ [% END %] >+ </li> >+ </ul> >+ </div> >+ <div class="btn-group"> >+ <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% opac_new.idnew | uri %]" class="delete_news btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a> >+ </div> > </td> > </tr> > [% END %]</tbody> >@@ -305,7 +325,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > }); > </script> > [% END %] >- [% IF Koha.Preference('NewsToolEditor') == 'codemirror' %] >+ [% UNLESS ( wysiwyg ) %] > [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %] > [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %] > [% Asset.js( "lib/codemirror/lint.min.js" ) | $raw %] >diff --git a/tools/koha-news.pl b/tools/koha-news.pl >index a93528c602..821cd4bb15 100755 >--- a/tools/koha-news.pl >+++ b/tools/koha-news.pl >@@ -47,6 +47,12 @@ my $number = $cgi->param('number'); > my $lang = $cgi->param('lang'); > my $branchcode = $cgi->param('branch'); > my $error_message = $cgi->param('error_message'); >+my $wysiwyg; >+if( $cgi->param('editmode') ){ >+ $wysiwyg = $cgi->param('editmode') eq "wysiwyg" ? 1 : 0; >+} else { >+ $wysiwyg = C4::Context->preference("NewsToolEditor") eq "tinymce" ? 1 : 0; >+} > > # Foreign Key constraints work with NULL, not '' > # NULL = All branches. >@@ -158,5 +164,8 @@ else { > opac_news_count => $opac_news_count, > ); > } >-$template->param( lang => $lang ); >+$template->param( >+ lang => $lang, >+ wysiwyg => $wysiwyg, >+); > output_html_with_http_headers $cgi, $cookie, $template->output; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26431
:
109865
|
109950
|
109980
|
109981
|
109982