Bugzilla – Attachment 50871 Details for
Bug 16372
Replace the use of "onclick" for deletion confirmation in some templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16372 - Replace the use of "onclick" for deletion confirmation in some templates
0001-Bug-16372-Replace-the-use-of-onclick-for-deletion-co.patch (text/plain), 10.10 KB, created by
Arslan Farooq
on 2016-04-28 03:50:39 UTC
(
hide
)
Description:
Bug 16372 - Replace the use of "onclick" for deletion confirmation in some templates
Filename:
MIME Type:
Creator:
Arslan Farooq
Created:
2016-04-28 03:50:39 UTC
Size:
10.10 KB
patch
obsolete
>From 7511ae9e0f472f79ef1e2a22776966e72935ceef Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 26 Apr 2016 13:00:42 -0400 >Subject: [PATCH] [SIGNED-OFF] Bug 16372 - Replace the use of "onclick" for > deletion confirmation in some templates > >This patch removes the use of event attributes from several templates >where the attributes were used to handle deletion operations. I've >grouped these changes in one patch because each template had only small >changes to be made. > >Unrelated change: Reformatted the "no news items" message which is >displayed if there are no news items. > >To test, apply the patch and test deletion operations on the following >pages. Clicking "delete" should prompty you to confirm. Test both the >confirm and cancel actions. > >- On the staff client home page, test deletion of a news item. >- On the patron lists page, test deletion of a patron list. >- In the patron card creator, choose Manage -> Images. Test the "Delete" > button for a single image. >- On the news page, test deletion of a single news item. >- On the news page, test deletion of multiple items. > >Signed-off-by: Arslan Farooq <arslanone@gmail.com> >--- > .../intranet-tmpl/prog/en/modules/intranet-main.tt | 7 ++++++- > .../intranet-tmpl/prog/en/modules/patron_lists/lists.tt | 11 ++++++----- > .../prog/en/modules/patroncards/image-manage.tt | 6 ++++-- > .../intranet-tmpl/prog/en/modules/tools/koha-news.tt | 15 +++++++++------ > 4 files changed, 25 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index f7e8b36..49cdc55 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -7,6 +7,11 @@ > <script type="text/javascript"> > //<![CDATA[ > var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This cannot be undone."); >+ $(document).ready(function(){ >+ $(".news_delete").on("click", function(){ >+ return confirmDelete(MSG_CONFIRM_DELETE); >+ }); >+ }); > //]]> > </script> > </head> >@@ -183,7 +188,7 @@ var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This > <p class="newsfooter"> Posted on [% koha_new.newdate %][% IF( ( newsdisp == 'staff' || newsdisp == 'both' ) && koha_new.borrowernumber ) %] by <span class="newsauthor_title">[% koha_new.author_title %] </span>[% koha_new.author_firstname %] [% koha_new.author_surname %]<br />[% END %] > [% IF ( CAN_user_tools ) %] > <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% koha_new.idnew %]">Edit</a> >- | <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% koha_new.idnew %]" onclick="return confirm(MSG_CONFIRM_DELETE);">Delete</a> >+ | <a class="news_delete" href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% koha_new.idnew %]">Delete</a> > | <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form">New</a> > [% END %] > </p> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >index f9b3406..8764bbe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >@@ -15,11 +15,12 @@ > ], > "sPaginationType": "four_button" > } )); >+ $(".delete_patron").on("click", function(){ >+ $(".dropdown").removeClass("open"); >+ var list = $(this).data("list-name"); >+ return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) ); >+ }); > }); >- >- function ConfirmDelete( list ) { >- return confirm( _("Are you sure you want to delete the list %s?").format(list) ); >- } > //]]> > </script> > >@@ -67,7 +68,7 @@ > <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="listactions[% l.patron_list_id %]"> > <li><a href="/cgi-bin/koha/patron_lists/list.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-user"></i> Add patrons</a></li> > <li><a href="/cgi-bin/koha/patron_lists/add-modify.pl?patron_list_id=[% l.patron_list_id %]"><i class="fa fa-pencil"></i> Edit list</a></li> >- <li><a href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id %]" onclick='return ConfirmDelete("[% l.name %]")'><i class="fa fa-trash"></i> Delete list</a></li> >+ <li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id %]" data-list-name="[% l.name %]"><i class="fa fa-trash"></i> Delete list</a></li> > [% IF ( l.patron_list_patrons_rs.count ) %] > <li class="divider"></li> > <li><a href="#" onclick='GB_showCenter(_("Print patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id %]", 400, 800);return false;'><i class="fa fa-print"></i> Print patron cards</a></li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt >index b2ede43..84b58eb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt >@@ -3,7 +3,6 @@ > [% INCLUDE 'doc-head-close.inc' %] > <script type="text/javascript"> > //<![CDATA[ >- var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this image?"); > function DeleteConfirm() { > var results = selected_images("delete"); > if (results.images != -1) { >@@ -40,6 +39,9 @@ > $("#delete").click(function(){ > return DeleteConfirm(); > }); >+ $(".delete_image").on("click", function(){ >+ return confirmDelete( _("Are you sure you want to delete this image?") ); >+ }); > }); > //]]> > </script> >@@ -133,7 +135,7 @@ > [% FOREACH text_field IN TABL.text_fields %] > [% IF ( text_field.select_field ) %] > <td> >- <a class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_DELETE);" href="/cgi-bin/koha/patroncards/image-manage.pl?op=delete&image_id=[% text_field.field_value %]"><icon class="fa fa-trash"></icon> Delete</a> >+ <a class="delete_image btn btn-mini" href="/cgi-bin/koha/patroncards/image-manage.pl?op=delete&image_id=[% text_field.field_value %]"><icon class="fa fa-trash"></icon> Delete</a> > </td> > <td align="center"><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td> > [% ELSIF ( text_field.field_value ) %] >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 bee9945..7606440 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 >@@ -16,15 +16,18 @@ > ], > "sPaginationType": "full_numbers" > })); >+ $(".delete_news").on("click", function(){ >+ return confirmDelete( _("Are you sure you want to delete this news item? This cannot be undone.") ); >+ }); >+ $("#del_form").on("submit",function(){ >+ return confirmDelete( _("Are you sure you want to delete the selected news?") ); >+ }); > }); > //]]> > </script> > [% END %] > <script type="text/javascript" src="[% interface %]/lib/tiny_mce/tiny_mce.js"></script> > <script type="text/javascript">//<![CDATA[ >-var MSG_CONFIRM_DELETE_NEWS = _("Are you sure you want to delete the selected news?"); >-var MSG_CONFIRM_DELETE_SINGLE = _("Are you sure you want to delete this news item? This cannot be undone."); >- > tinyMCE.init({ > mode : "textareas", > theme : "advanced", >@@ -204,7 +207,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > </form> > </div> > [% IF ( opac_news_count ) %] >- <form name="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl" onsubmit='return confirm(MSG_CONFIRM_DELETE_NEWS)'> >+ <form id="del_form" method="post" action="/cgi-bin/koha/tools/koha-news.pl"> > <table id="newst"> > <thead> <tr> > <th> </th> >@@ -252,7 +255,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > </td> > <td class="actions"> > <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&id=[% opac_new.idnew %]" class="btn btn-mini"><i class="fa fa-pencil"></i> Edit</a> >- <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% opac_new.idnew %]" onclick="return confirm(MSG_CONFIRM_DELETE_SINGLE);" class="btn btn-mini"><i class="fa fa-trash"></i> Delete</a> >+ <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&ids=[% opac_new.idnew %]" class="delete_news btn btn-mini"><i class="fa fa-trash"></i> Delete</a> > </td> > </tr> > [% END %]</tbody> >@@ -261,7 +264,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > <fieldset class="action"><input type="submit" class="button" value="Delete selected" /></fieldset> > </form> > [% ELSE %] >- <p>No news loaded</p> >+ <div class="dialog message">There are no news items.</div> > [% END %] > [% END %] > </div> >-- >1.7.10.4 >
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 16372
:
50832
|
50871
|
50887