Bug 16058: Delete individual news item from koha-news.pl
authorAleisha <aleishaamohia@hotmail.com>
Tue, 29 Mar 2016 02:29:26 +0000 (02:29 +0000)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Thu, 31 Mar 2016 20:08:17 +0000 (20:08 +0000)
This patch adds a confirm message for deleting a news item from the home page in the staff client. It also gives the ability to delete an individual news item from koha-news.pl with a confirm message. The buttons on koha-news.pl are now styled as font awesome buttons.

To test:
1) Go to main intranet page. Click 'Delete' for a news item.
2) Confirm that Cancel stops the Delete, and OK deletes the item and takes you to tools/koha-news.pl
3) Confirm that the buttons (Edit and Delete) on koha-news.pl are now styled as font awesome buttons and the buttons don't wrap on a narrow browser.
4) Confirm that the column heading for the buttons is now "Actions".
5) Confirm that clicking Delete triggers a confirm message. Confirm that Cancel stops the Delete, and OK deletes the item and it no longer shows in the News table or anywhere else.

Sponsored-by: Catalyst IT
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended-patch: just split the td on several lines for readability.

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt

index 64c05f9..f7e8b36 100644 (file)
@@ -4,7 +4,11 @@
 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/mainpage.css" />
 [% INCLUDE 'doc-head-close.inc' %]
 <style type="text/css"> </style>
-
+<script type="text/javascript">
+//<![CDATA[
+var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this news item? This cannot be undone.");
+//]]>
+</script>
 </head>
 <body id="main_intranet-main" class="main">
 [% INCLUDE 'header.inc' %]
                     <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&amp;id=[% koha_new.idnew %]">Edit</a>
-                             | <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew %]">Delete</a>
+                             | <a href="/cgi-bin/koha/tools/koha-news.pl?op=del&amp;ids=[% koha_new.idnew %]" onclick="return confirm(MSG_CONFIRM_DELETE);">Delete</a>
                              | <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form">New</a>
                         [% END %]
                     </p>
index ca4588a..bee9945 100644 (file)
@@ -23,6 +23,7 @@
 <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",
@@ -215,7 +216,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
                         <th>Title</th>
                         <th>Author</th>
                         <th>News</th>
-                        <th>&nbsp;</th>
+                        <th>Actions</th>
                     </tr></thead>
                     <tbody>[% FOREACH opac_new IN opac_news %]
                          [% IF ( opac_new.expired ) %]
@@ -249,7 +250,10 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div>
                            <td>
                                 [% opac_new.new %]
                             </td>
-                            <td><a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;id=[% opac_new.idnew %]">Edit</a></td>
+                            <td class="actions">
+                                <a href="/cgi-bin/koha/tools/koha-news.pl?op=add_form&amp;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&amp;ids=[% opac_new.idnew %]" onclick="return confirm(MSG_CONFIRM_DELETE_SINGLE);" class="btn btn-mini"><i class="fa fa-trash"></i> Delete</a>
+                            </td>
                         </tr>
                     [% END %]</tbody>
                 </table>