Bugzilla – Attachment 136523 Details for
Bug 22659
Add 'save and continue' functionality to news and HTML customizations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22659: Add save and continue button to additional-contents.tt
Bug-22659-Add-save-and-continue-button-to-addition.patch (text/plain), 5.37 KB, created by
Lucas Gass (lukeg)
on 2022-06-24 15:28:33 UTC
(
hide
)
Description:
Bug 22659: Add save and continue button to additional-contents.tt
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2022-06-24 15:28:33 UTC
Size:
5.37 KB
patch
obsolete
>From bdf463127288ad5c341d00a01b7caba07ad2a73e Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Thu, 3 Feb 2022 22:31:19 +0000 >Subject: [PATCH] Bug 22659: Add save and continue button to > additional-contents.tt > >To test: >1. Apply patch and restart everything >2. Go to Tools > News and create some new additional content. >3. Notice a Save and continue button >4. Try saving and contining. >5. Make sure if you are using the CodeMirror editor that you are still in the CodeMirror editor >6. Try 2 - 5 again but with the wysiwyg editor, make sure when you save and continue you remain in the wysiwyg editor. >7. If you are saving and contining from News make sure you remain in News, when you are saving and contining from HTML customizations make sure you remain there. >8. Turn on the NewsLog system preference >9. With the NewsLog on make sure your content is being logged correctly when you sabe and continue. > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../prog/en/modules/tools/additional-contents.tt | 15 +++++++++++++++ > tools/additional-contents.pl | 16 +++++++++++++++- > 2 files changed, 30 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index 3a762a9505..f996ec72ad 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -171,6 +171,12 @@ > <div id="toolbar" class="btn-toolbar"> > <div class="btn-group"> > <button class="btn btn-default" id="submit_form"><i class="fa fa-save"></i> Save</button> >+ <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"> >+ <span class="caret"></span> >+ </button> >+ <ul class="dropdown-menu"> >+ <li><a id="saveandcontinue" href="#">Save and continue editing</a></li> >+ </ul> > </div> > [% IF category == 'news' %] > <a class="btn btn-default cancel" href="/cgi-bin/koha/tools/additional-contents.pl"><i class="fa fa-remove"></i> Cancel</a> >@@ -184,6 +190,8 @@ > <input type="hidden" name="category" value="[% category | html %]" /> > <input type="hidden" name="code" value="[% additional_content.code | html %]" /> > <input type="hidden" name="idnew" value="[% additional_content.idnew | html %]" /> >+ <input type="hidden" id="redirect" name="redirect" value="" /> >+ <input type="hidden" id="editmode" name="editmode" value="[% editmode | html %]" /> > <fieldset class="rows"> > <ol> > <li> >@@ -453,6 +461,13 @@ > [% INCLUDE 'calendar.inc' %] > [% Asset.js("js/tools-menu.js") | $raw %] > [% Asset.js("lib/hc-sticky.js") | $raw %] >+ <script> >+ $("#saveandcontinue").on("click",function(e){ >+ e.preventDefault(); >+ $("#redirect").val("just_save"); >+ $("#submit_form").click(); >+ }); >+ </script> > [% IF additional_contents.count %] > [% INCLUDE 'datatables.inc' %] > <script> >diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl >index c179cac7ef..f7fbb03f23 100755 >--- a/tools/additional-contents.pl >+++ b/tools/additional-contents.pl >@@ -40,12 +40,17 @@ my $op = $cgi->param('op') || 'list'; > my $id = $cgi->param('id'); > my $category = $cgi->param('category') || 'news'; > my $wysiwyg; >+my $redirect = $cgi->param('redirect'); >+my $editmode; >+ > if( $cgi->param('editmode') ){ > $wysiwyg = $cgi->param('editmode') eq "wysiwyg" ? 1 : 0; > } else { > $wysiwyg = C4::Context->preference("AdditionalContentsEditor") eq "tinymce" ? 1 : 0; > } > >+$editmode = $wysiwyg eq 1 ? "wysiwyg" : "text"; >+ > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "tools/additional-contents.tt", >@@ -136,6 +141,7 @@ elsif ( $op eq 'add_validate' ) { > ); > $updated = $additional_content->_result->get_dirty_columns; > $additional_content->store; >+ $id = $additional_content->idnew; > }; > if ($@) { > $success = 0; >@@ -170,6 +176,7 @@ elsif ( $op eq 'add_validate' ) { > ? 'News_' . $additional_content->idnew > : $location . '_' . $additional_content->idnew; > $additional_content->code($code)->store; >+ $id = $additional_content->idnew; > } > }; > if ($@) { >@@ -183,7 +190,13 @@ elsif ( $op eq 'add_validate' ) { > } > > } >- $op = 'list'; >+ >+ if( $redirect eq "just_save" ){ >+ print $cgi->redirect("/cgi-bin/koha/tools/additional-contents.pl?op=add_form&id=$id&editmode=$editmode&redirect=done"); >+ exit; >+ } else { >+ $op = 'list'; >+ } > } > elsif ( $op eq 'delete_confirmed' ) { > my @ids = $cgi->multi_param('ids'); >@@ -252,6 +265,7 @@ $template->param( > op => $op, > category => $category, > wysiwyg => $wysiwyg, >+ editmode => $editmode, > languages => \@languages, > ); > >-- >2.30.2
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 22659
:
126593
|
126929
|
127133
|
130155
|
130238
|
132365
|
134802
|
134803
|
134804
|
134805
|
135471
|
135472
|
135473
| 136523 |
136524