Bugzilla – Attachment 50456 Details for
Bug 16301
Remove the use of "onclick" from SMS cellular providers template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16301 - Remove the use of "onclick" from SMS cellular providers template
Bug-16301---Remove-the-use-of-onclick-from-SMS-cel.patch (text/plain), 5.15 KB, created by
Owen Leonard
on 2016-04-20 12:46:38 UTC
(
hide
)
Description:
Bug 16301 - Remove the use of "onclick" from SMS cellular providers template
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-04-20 12:46:38 UTC
Size:
5.15 KB
patch
obsolete
>From f7b5c8e89571d899905c3d012dfbdd1c15a0e854 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 20 Apr 2016 08:31:16 -0400 >Subject: [PATCH] Bug 16301 - Remove the use of "onclick" from SMS cellular > providers template >Content-Type: text/plain; charset="utf-8" > >This patch refactors some of the JavaScript in the SMS cellular >providers template so that event attributes are removed from the markup. > >This patch also updates the markup for the "Edit" and "Delete" buttons >to make them consistent with similar buttons in Koha. > >To test you must have the SMSSendDriver system preference set to >"Email." > >- Go to Administration -> SMS cellular providers. >- If necessary, create a new SMS cellular provider. >- Edit at least one patron to use an SMS cellular provider under "Patron > messaging preferences." >- In the table of SMS cellular providers: > - Click the "Edit" button. The correct edit form should be displayed. > - Click the "Delete" button next to a provider which is not used by > any patrons. You should see an error message, "Are you sure you want > to delete [provider name]." Test both cancel and confirm. > - Click the "Delete" button next to a provider which is in use by one > or more patrons. YOu should see an error message, "Are you sure you > want to delete [provider name]? X patron(s) are using it!" Test both > cancel and confirm. >--- > koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js | 15 +++++++++++++++ > .../prog/en/modules/admin/sms_providers.tt | 19 +++++-------------- > 2 files changed, 20 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js b/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js >index 23a9c12..bccedeb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js >@@ -5,6 +5,21 @@ $(document).ready(function() { > $("#new_provider").on("click",function(){ > add_provider(); > }); >+ $(".edit").on("click",function(e){ >+ e.preventDefault(); >+ var providerid = $(this).data("providerid"); >+ edit_provider( providerid ); >+ }); >+ $(".delete").on("click",function(e){ >+ e.preventDefault(); >+ var providerid = $(this).data("providerid"); >+ var patrons_using = $(this).data("patrons_using"); >+ if( patrons_using !== "" ){ >+ delete_provider( providerid, patrons_using ); >+ } else { >+ delete_provider( providerid ); >+ } >+ }); > }); > > function clear_form(){ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt >index d164a0d..6646c2b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/sms_providers.tt >@@ -38,7 +38,6 @@ > <th>Domain</th> > <th title="Patrons using this provider">Patrons</th> > <th> </th> >- <th> </th> > </tr> > </thead> > >@@ -48,21 +47,13 @@ > <td id="name_[% p.id %]">[% p.name %]</td> > <td id="domain_[% p.id %]">[% p.domain %]</td> > <td id="patrons_using_[% p.id %]">[% p.patrons_using %]</td> >- <td> >- <a class="btn edit" href="#" id="edit_[% p.id %]" onclick="edit_provider( [% p.id %] );"> >+ <td class="actions"> >+ <a class="btn btn-mini edit" href="#" id="edit_[% p.id %]" data-providerid="[% p.id %]"> > <i class="fa fa-pencil"></i> Edit > </a> >- </td> >- <td> >- [% IF p.patrons_using %] >- <a class="btn btn-danger" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %], [% p.patrons_using %] );"> >- <span style="color:white"><i class="fa fa-trash"></i> Delete</span> >- </a> >- [% ELSE %] >- <a class="btn delete" href="#" id="delete_[% p.id %]" onclick="delete_provider( [% p.id %] );"> >- <i class="fa fa-trash"></i> Delete >- </a> >- [% END %] >+ <a class="btn btn-mini delete" href="#" data-providerid="[% p.id %]" data-patrons_using="[% p.patrons_using %]" id="delete_[% p.id %]"> >+ <i class="fa fa-trash"></i> Delete >+ </a> > </td> > </tr> > [% END %] >-- >2.1.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 16301
:
50456
|
50467
|
50626