Bugzilla – Attachment 48761 Details for
Bug 15936
Revise layout and behavior of SMS cellular providers management
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15936 - Revise layout and behavior of SMS cellular providers management
Bug-15936---Revise-layout-and-behavior-of-SMS-cell.patch (text/plain), 13.95 KB, created by
Kyle M Hall (khall)
on 2016-03-07 18:38:05 UTC
(
hide
)
Description:
Bug 15936 - Revise layout and behavior of SMS cellular providers management
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-03-07 18:38:05 UTC
Size:
13.95 KB
patch
obsolete
>From 380257e2c5d6b04020695fb9d30569e72ad1b3db Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 19 Feb 2016 20:24:46 -0500 >Subject: [PATCH] Bug 15936 - Revise layout and behavior of SMS cellular > providers management > >This patch changes the behavior of the SMS cellular providers management >page so that sections of the page are shown or hidden based on what the >current task is. Other changes include: > >- Moving JavaScript to a separate file >- Adding a toolbar with a "New SMS provider" button. >- Adding the "generic" catalog search header form to the top of the > page. >- Adding "Required" classes to required fields so that the staff > client's built-in JS validation library can be used. > >To test, the SMSSendDriver system preference must be set to "Email." >Apply the patch and go to Administration -> SMS cellular providers. > >- Confirm that the add/edit form is hidden initially. A toolbar with a > "New SMS provider" button should appear with existing SMS cellular > providers in a table below. If there are no existing providers a > message dialog should say so. >- Confirm that the "New SMS provider" button works: > - The table should be hidden and an empty "add" form displayed. > - Confirm that an empty form cannot be submitted. > - Confirm that submitting valid data works. > - Confirm that clicking the "Cancel" button hides the form and > redisplays the table. >- Test the "edit" button for an existing provider: > - Confirm that the edit form is displayed and populated with the > correct data. > - Confirm that edits are saved correctly. >- When viewing the table of existing providers, confirm that clicking > the "Delete" button triggers a confirmation dialog. Test both > cancelling and confirming that dialog. >- Ponder whether all this is an improvement or not. > >Signed-off-by: Nicole C Engard <nengard@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../intranet-tmpl/prog/en/js/sms_providers.js | 58 +++++++ > .../prog/en/modules/admin/sms_providers.tt | 191 ++++++++++----------- > 2 files changed, 144 insertions(+), 105 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js b/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js >new file mode 100644 >index 0000000..23a9c12 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/sms_providers.js >@@ -0,0 +1,58 @@ >+$(document).ready(function() { >+ $('#submit_update').hide(); >+ $("#name").focus(); >+ $("#sms_add_form").hide(); >+ $("#new_provider").on("click",function(){ >+ add_provider(); >+ }); >+}); >+ >+function clear_form(){ >+ $("#id,#name,#domain").val(""); >+} >+ >+function add_provider(){ >+ clear_form(); >+ $(".dialog").hide(); >+ $("legend").text( LABEL_SMS_ADD_PROVIDER ); >+ $("#toolbar,#submit_update,#providerst").hide(); >+ $("#sms_add_form,#submit_save").show(); >+ $("#name").focus(); >+} >+ >+function edit_provider( id ) { >+ clear_form(); >+ $("legend").text( LABEL_SMS_EDIT_PROVIDER.format( $("#name_" + id).text() ) ); >+ $("#sms_add_form,#submit_update").show(); >+ >+ $("#id").val( id ); >+ $("#name").val( $("#name_" + id).text() ); >+ $("#domain").val( $("#domain_" + id).text() ); >+ >+ $("#toolbar,#submit_save,#providerst").hide(); >+ >+ $("#name").focus(); >+} >+ >+ >+function cancel_edit() { >+ clear_form(); >+ $(".dialog").show(); >+ $("#sms_add_form,#submit_update").hide(); >+ $("#toolbar,#submit_save,#providerst").show(); >+} >+ >+function delete_provider( id, users ) { >+ var c; >+ if ( users ) { >+ c = confirm( MSG_SMS_PATRONS_USING.format( $("#name_" + id).html(), users ) ); >+ } else { >+ c = confirm( MSG_SMS_DELETE_CONFIRM.format( $("#name_" + id).html() ) ); >+ } >+ >+ if ( c ) { >+ $("#op").val('delete'); >+ $("#id").val( id ); >+ $("#sms_form").submit(); >+ } >+} >\ No newline at end of file >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 8fbd415..d164a0d 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 >@@ -1,128 +1,109 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration › SMS cellular providers</title> > [% INCLUDE 'doc-head-close.inc' %] >-</head> >- > <script type="text/javascript"> >-$(document).ready(function() { >- $('#submit_update').hide(); >- $("#name").focus(); >-}); >- >-function edit_provider( id ) { >- cancel_edit(); >- >- $("#id").val( id ); >- $("#name").val( $("#name_" + id).text() ); >- $("#domain").val( $("#domain_" + id).text() ); >- >- $("#name_" + id).parent().children().addClass("highlighted-row"); >- >- $("#submit_save").hide(); >- $("#submit_update").show(); >- >- $("#name").focus(); >-} >- >-function cancel_edit() { >- $("#id").val(""); >- $("#name").val(""); >- $("#domain").val(""); >- >- $("tr").children().removeClass("highlighted-row"); >- >- $("#submit_update").hide(); >- $("#submit_save").show(); >- >-} >- >-function delete_provider( id, users ) { >- var c; >- if ( users ) { >- c = confirm( _("Are you sure you want to delete %s? %s patron(s) are using it!").format( $("#name_" + id).html(), users ) ); >- } else { >- c = confirm( _("Are you sure you want to delete %s?").format( $("#name_" + id).html() ) ); >- } >- >- if ( c ) { >- $("#op").val('delete'); >- $("#id").val( id ); >- $("#sms_form").submit(); >- } >-} >+ //<![CDATA[ >+ var MSG_SMS_PATRONS_USING = _("Are you sure you want to delete %s? %s patron(s) are using it!"); >+ var MSG_SMS_DELETE_CONFIRM = _("Are you sure you want to delete %s?"); >+ var LABEL_SMS_ADD_PROVIDER = _("Add an SMS cellular provider"); >+ var LABEL_SMS_EDIT_PROVIDER = _("Edit provider %s"); >+ //]]> > </script> >+<script type="text/javascript" src="[% themelang %]/js/sms_providers.js"></script> >+</head> >+ > <body id="admin_sms_providers" class="admin"> > [% INCLUDE 'header.inc' %] >+[% INCLUDE 'cat-search.inc' %] > > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › SMS cellular providers</div> > > <div id="doc3" class="yui-t2"> > <div id="bd"> > <div id="yui-main"> >- <div class="yui-b"> >+ <div class="yui-b"> >+ >+ <div id="toolbar" class="btn-toolbar"> >+ <a class="btn btn-small" id="new_provider" href="#"><i class="fa fa-plus"></i> New SMS provider</a> >+ </div> >+ > <h2>SMS cellular providers</h2> > >- <table> >- <thead> >- <tr> >- <th>Name</th> >- <th>Domain</th> >- <th title="Patrons using this provider">Patrons</th> >- <th> </th> >- <th> </th> >- </tr> >- </thead> >+ [% IF providers.size %] > >- <tbody> >- [% FOREACH p IN providers %] >+ <table id="providerst"> >+ <thead> > <tr> >- <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" href="#" id="edit_[% p.id %]" class="edit" onclick="edit_provider( [% 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" href="#" id="delete_[% p.id %]" class="delete" onclick="delete_provider( [% p.id %] );"> >- <i class="fa fa-trash"></i> Delete >- </a> >- [% END %] >- </td> >+ <th>Name</th> >+ <th>Domain</th> >+ <th title="Patrons using this provider">Patrons</th> >+ <th> </th> >+ <th> </th> > </tr> >- [% END %] >- </tbody> >- >- <tfoot> >- <form id="sms_form" action="sms_providers.pl" method="post"> >+ </thead> >+ >+ <tbody> >+ [% FOREACH p IN providers %] >+ <tr> >+ <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 %] );"> >+ <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 %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ >+ [% ELSE %] >+ >+ <div class="dialog message"> >+ There are no SMS cellular providers defined. >+ </div> >+ >+ [% END %] >+ >+ <div id="sms_add_form"> >+ <form id="sms_form" action="sms_providers.pl" method="post" class="validated"> >+ <fieldset class="rows"> >+ <legend>Add an SMS cellular provider</legend> > <input type="hidden" id="id" name="id" value="" /> > <input type="hidden" id="op" name="op" value="add_update" /> >- <tr> >- <td><input type="text" id="name" name="name" /></td> >- <td><input type="text" id="domain" name="domain" size="40"/></td> >- <td colspan="2"> >- <button class="btn" id="submit_save" type="submit"> >- <i class="fa fa-plus"></i> Add new >- </button> >- <button class="btn" id="submit_update" type="submit"> >- <i class="fa fa-plus-circle"></i> Update >- </button> >- </td> >- <td> >- <a class="btn" id="cancel" href="#" onclick="cancel_edit()"> >- <i class="fa fa-ban"></i> Cancel >- </a> >- </td> >- </tr> >- </form> >- </tfoot> >- </table> >+ <ol> >+ <li> >+ <label for="name" class="required">Name: </label> >+ <input type="text" id="name" name="name" required="required" /> >+ <span class="required">Required</span> >+ </li> >+ <li> >+ <label for="domain" class="required">Domain: </label> >+ <input type="text" id="domain" name="domain" required="required" size="40"/> >+ <span class="required">Required</span> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" id="submit_save" value="Submit" /> >+ <input type="submit" value="Submit" id="submit_update" /> >+ <a class="cancel" id="cancel" href="#" onclick="cancel_edit()">Cancel</a> >+ </fieldset> >+ </form> >+ </div> >+ > </div> > </div> > <div class="yui-b"> >-- >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 15936
:
48460
|
48554
|
48613
| 48761