[Koha-patches] [PATCH] Bug 9137 - Focus when editing/adding new itemtypes/authorised values

Owen Leonard oleonard at myacpl.org
Mon Nov 26 16:55:27 CET 2012


This patch adds the "focus" class to the relevant inputs so
that the global staff client JS will move the focus to those fields.
Logic in the authorised_values template puts the focus on the
correct field whether you're adding a new category, a new value,
or performing an edit.

To test, try the following operations:
 - add an itemtype
 - edit an itemtype
 - add an authorised value category
 - add an authorised value value
 - edit an authorised value value

In all cases the focus should automatically be in the first
form field.
---
 .../prog/en/modules/admin/authorised_values.tt     |    6 +++++-
 .../prog/en/modules/admin/itemtypes.tt             |    8 ++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
index 4acaac3..8657ec8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt
@@ -60,7 +60,7 @@
         <fieldset class="rows"><ol>
         <li>
 			 [% IF ( action_add_category ) %]<label for="category">Category</label>
-		<input type="text" name="category"  id="category" size="10" maxlength="10" />
+            <input type="text" name="category"  id="category" size="10" maxlength="10" class="focus" />
 			 [% ELSE %]<span class="label">Category</span>
 		<input type="hidden" name="category" value="[% category %]" />	 [% category %]
 			 [% END %]
@@ -68,7 +68,11 @@
         <li>
             <label for="authorised_value">Authorized value</label>
      [% IF ( action_modify ) %]<input type="hidden" id="id" name="id" value="[% id %]" />[% END %]
+            [% IF ( action_add_category ) %]
             <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" />
+            [% ELSE %]
+            <input type="text" id="authorised_value" name="authorised_value" value="[% authorised_value %]" maxlength="80" class="focus" />
+            [% END %]
         </li>
         <li>
             <label for="lib">Description</label>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
index cb3f9ba..30a3a85 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
@@ -168,11 +168,15 @@ Item types administration
      </li>
   [% ELSE %]
       <li>
-          <label for="itemtype">Item type</label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" />
+          <label for="itemtype">Item type</label> <input type="text" id="itemtype" name="itemtype" size="10" maxlength="10" onblur="toUC(this)" class="focus" />
       </li>
   [% END %]
       <li>
-          <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" />      </li>
+      [% IF ( itemtype ) %]
+          <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" class="focus" /></li>
+      [% ELSE %]
+          <label for="description">Description</label><input type="text" id="description" name="description" size="48" value="[% description |html %]" /></li>
+      [% END %]
      [% IF ( noItemTypeImages ) %]
 	 <li><span class="label">Image: </span>Item type images are disabled. To enable them, turn off the <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=noItemTypeImages">noItemTypeImages system preference</a></li></ol>
 	 [% ELSE %]</ol>
-- 
1.7.9.5


More information about the Koha-patches mailing list