Bug 10418 - Correct template markup problems on course reserves add item page
authorOwen Leonard <oleonard@myacpl.org>
Wed, 5 Jun 2013 13:56:23 +0000 (09:56 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 14 Jun 2013 18:21:45 +0000 (11:21 -0700)
This patch corrects several problems with the course reserves add item
pages:

- Non-standard grid markup.
- Extra </div>.
- Incorrect styling of errors and messages.
- Redundant JS for adding focus to a field (use "focus" class).
- Invalid use of <label> with no corresponding input (use <span
  class="label"> instead).
- Incorrect capitalization.

To test, apply the patch and examing both steps of the process of adding
an item to an existing course: The initial "scan barcode" form, and the
form for editing details of a scanned item.

Some cases to check:

- Scan an invalid barcode.
- Scan a barcode which has already been added to a course.
- Scan a barcode wihch has already been added to the course you're
  working with.

Forms should look correct and work correctly.

This patch contains whitespace changes, so please ignore whitespace when
examining changes.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
The add item screen continues to work as before.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl. Works as advertised.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt

index 05bfe6d..439987b 100644 (file)
@@ -2,17 +2,6 @@
 <title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
-
-<script type="text/javascript">
-//<![CDATA[
-
-$(document).ready(function() {
-  $('#barcode').focus();
-});
-
-//]]>
-</script>
-
 <body>
 
 [% INCLUDE 'header.inc' %]
@@ -20,42 +9,32 @@ $(document).ready(function() {
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Add reserves for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]">[% course.course_name %]</a></i></div>
 
-<div id="doc2" class="yui-t7">
+<div id="doc" class="yui-t7">
     <div id="bd">
-        <div id="yui-main">
-            <div class="yui-b">
-                <div class="yui-g">
-                    <div class="yui-u first">
-                        [% IF ERROR_BARCODE_NOT_FOUND %]
-                            <div class="error">No item found for barcode [% ERROR_BARCODE_NOT_FOUND %]</div>
-                        [% END %]
-
-                        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
-                            <input type="hidden" name="course_id" value="[% course.course_id %]" />
-                            <input type="hidden" name="action" value="lookup" />
-
-                            <fieldset class="rows">
-                                <legend>Add items: scan barcode</legend>
-                                <ol>
-                                    <li>
-                                        <label class="required" for="barcode">Item barcode:</label>
-                                        <input id="barcode" name="barcode" type="text" />
-                                    </li>
-                                </ol>
-                            </fieldset>
-
-                            <fieldset class="action">
-                                <input type="submit" value="Submit" class="submit" />
-
-                                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]" class="cancel">Cancel</a>
-                            </fieldset>
-                        </form>
-                    </div>
-                </div>
-            </div>
-        </div>
+        [% IF ERROR_BARCODE_NOT_FOUND %]
+            <div class="dialog alert">No item found with barcode [% ERROR_BARCODE_NOT_FOUND %]</div>
+        [% END %]
+
+        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
+            <input type="hidden" name="course_id" value="[% course.course_id %]" />
+            <input type="hidden" name="action" value="lookup" />
+
+            <fieldset class="rows">
+                <legend>Add items: scan barcode</legend>
+                <ol>
+                    <li>
+                        <label class="required" for="barcode">Item barcode:</label>
+                        <input id="barcode" name="barcode" class="focus" type="text" />
+                    </li>
+                </ol>
+            </fieldset>
+
+            <fieldset class="action">
+                <input type="submit" value="Submit" class="submit" />
+
+                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]" class="cancel">Cancel</a>
+            </fieldset>
+        </form>
     </div>
-</div>
-
 
 [% INCLUDE 'intranet-bottom.inc' %]
index 2326e3f..96bf783 100644 (file)
@@ -1,15 +1,6 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
 [% INCLUDE 'doc-head-close.inc' %]
-
-<script type="text/javascript">
-//<![CDATA[
-$(document).ready(function() {
-  $('#submit').focus();
-});
-//]]>
-</script>
-
 </head>
 
 <body>
@@ -19,115 +10,106 @@ $(document).ready(function() {
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Reserve <i><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]">[% item.title %]</a></i> for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]">[% course.course_name %]</a></i></div>
 
-<div id="doc2" class="yui-t7">
+<div id="doc" class="yui-t7">
     <div id="bd">
-        <div id="yui-main">
-            <div class="yui-b">
-                <div class="yui-g">
-                    <div class="yui-u first">
-                        [% IF course_reserve %]<div class="warn" id="already_on_reserve_this">This course already has this item on reserve.<div>[% END %]
-                        [% IF course_item    %]<div class="warn" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.size %]<div>[% END %]
-
-                        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
-                            <input type="hidden" name="course_id" value="[% course.course_id %]" />
-                            <input type="hidden" name="action" value="add" />
-
-                            <fieldset class="rows">
-                                <legend>Add <i>[% item.title %]</i> to <i>[% course.course_name %]</i></legend>
-                                <ol>
-                                    <li>
-                                        <label for="barcode">Barcode:</label>
-                                        <span id="barcode">[% item.barcode %]</span>
-                                        <input type="hidden" name="itemnumber" value="[% item.itemnumber %]" />
-                                    </li>
-
-                                    [% IF item_level_itypes %]
-                                    <li>
-                                        <label class="required" for="itype">Item Type:</label>
-                                        <select id="itype" name="itype">
-                                            <option value="">LEAVE UNCHANGED</option>
-
-                                            [% FOREACH it IN itypes %]
-                                                [% IF course_item.itype && ( ( course.enabled == 'yes' && it.itemtype == item.itype ) || ( course.enabled == 'no' && it.itemtype == course_item.itype ) ) %]
-                                                    <option value="[% it.itemtype %]" selected="selected">[% it.description %]</option>
-                                                [% ELSE %]
-                                                    <option value="[% it.itemtype %]">[% it.description %]</option>
-                                                [% END %]
-                                            [% END %]
-                                        </select>
-                                    </li>
-                                    [% END %]
-
-                                    <li>
-                                        <label class="required" for="ccode">Collection Code:</label>
-                                        <select id="ccode" name="ccode">
-                                            <option value="">LEAVE UNCHANGED</option>
-
-                                            [% FOREACH c IN ccodes %]
-                                                [% IF course_item.ccode && ( ( course.enabled == 'yes' && c.authorised_value == item.ccode ) || ( course.enabled == 'no' && c.authorised_value == course_item.ccode ) ) %]
-                                                    <option value="[% c.authorised_value %]" selected="selected">[% c.lib %]</option>
-                                                [% ELSE %]
-                                                    <option value="[% c.authorised_value %]">[% c.lib %]</option>
-                                                [% END %]
-                                            [% END %]
-                                        </select>
-                                    </li>
-
-                                    <li>
-                                        <label class="required" for="location">Shelving Location:</label>
-                                        <select id="location" name="location">
-                                            <option value="">LEAVE UNCHANGED</option>
-
-                                            [% FOREACH s IN locations %]
-                                                [% IF course_item.location && ( ( course.enabled == 'yes' && s.authorised_value == item.location ) || ( course.enabled == 'no' && s.authorised_value == course_item.location ) ) %]
-                                                    <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
-                                                [% ELSE %]
-                                                    <option value="[% s.authorised_value %]">[% s.lib %]</option>
-                                                [% END %]
-                                            [% END %]
-                                        </select>
-                                    </li>
-
-                                    <li>
-                                        <label class="required" for="holdingbranch">Holding Library:</label>
-                                        <select id="holdingbranch" name="holdingbranch">
-                                            <option value="">LEAVE UNCHANGED</option>
-
-                                            [% FOREACH b IN branches %]
-                                                [% IF course_item.holdingbranch && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %]
-                                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
-                                                [% ELSE %]
-                                                    <option value="[% b.value %]">[% b.branchname %]</option>
-                                                [% END %]
-                                            [% END %]
-                                        </select>
-                                    </li>
-
-                                    <li>
-                                        <label for="staff_note">Staff note:</label>
-                                        <textarea name="staff_note" id="staff_note">[% course_reserve.staff_note %]</textarea>
-                                    </li>
-
-                                    <li>
-                                        <label for="public_note">Public note:</label>
-                                        <textarea name="public_note" id="public_note">[% course_reserve.public_note %]</textarea>
-                                    </li>
-
-                                </ol>
-                            </fieldset>
-
-                            <fieldset class="action">
-                                <input type="submit" id="submit" value="Save" class="submit" />
-
-                                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]" class="cancel">Cancel</a>
-                            </fieldset>
-
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>
 
+        [% IF course_reserve %]<div class="dialog message" id="already_on_reserve_this">This course already has this item on reserve.</div>[% END %]
+        [% IF course_item %]<div class="dialog message" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.size %]</div>[% END %]
+
+        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
+            <input type="hidden" name="course_id" value="[% course.course_id %]" />
+            <input type="hidden" name="action" value="add" />
+
+            <fieldset class="rows">
+                <legend>Add <i>[% item.title %]</i> to <i>[% course.course_name %]</i></legend>
+                <ol>
+                    <li>
+                        <span class="label">Barcode:</span>
+                        <span id="barcode">[% item.barcode %]</span>
+                        <input type="hidden" name="itemnumber" value="[% item.itemnumber %]" />
+                    </li>
+
+                    [% IF item_level_itypes %]
+                    <li>
+                        <label class="required" for="itype">Item type:</label>
+                        <select id="itype" name="itype">
+                            <option value="">LEAVE UNCHANGED</option>
+
+                            [% FOREACH it IN itypes %]
+                                [% IF course_item.itype && ( ( course.enabled == 'yes' && it.itemtype == item.itype ) || ( course.enabled == 'no' && it.itemtype == course_item.itype ) ) %]
+                                    <option value="[% it.itemtype %]" selected="selected">[% it.description %]</option>
+                                [% ELSE %]
+                                    <option value="[% it.itemtype %]">[% it.description %]</option>
+                                [% END %]
+                            [% END %]
+                        </select>
+                    </li>
+                    [% END %]
+
+                    <li>
+                        <label class="required" for="ccode">Collection code:</label>
+                        <select id="ccode" name="ccode">
+                            <option value="">LEAVE UNCHANGED</option>
+
+                            [% FOREACH c IN ccodes %]
+                                [% IF course_item.ccode && ( ( course.enabled == 'yes' && c.authorised_value == item.ccode ) || ( course.enabled == 'no' && c.authorised_value == course_item.ccode ) ) %]
+                                    <option value="[% c.authorised_value %]" selected="selected">[% c.lib %]</option>
+                                [% ELSE %]
+                                    <option value="[% c.authorised_value %]">[% c.lib %]</option>
+                                [% END %]
+                            [% END %]
+                        </select>
+                    </li>
+
+                    <li>
+                        <label class="required" for="location">Shelving location:</label>
+                        <select id="location" name="location">
+                            <option value="">LEAVE UNCHANGED</option>
+
+                            [% FOREACH s IN locations %]
+                                [% IF course_item.location && ( ( course.enabled == 'yes' && s.authorised_value == item.location ) || ( course.enabled == 'no' && s.authorised_value == course_item.location ) ) %]
+                                    <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
+                                [% ELSE %]
+                                    <option value="[% s.authorised_value %]">[% s.lib %]</option>
+                                [% END %]
+                            [% END %]
+                        </select>
+                    </li>
+
+                    <li>
+                        <label class="required" for="holdingbranch">Holding library:</label>
+                        <select id="holdingbranch" name="holdingbranch">
+                            <option value="">LEAVE UNCHANGED</option>
+
+                            [% FOREACH b IN branches %]
+                                [% IF course_item.holdingbranch && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %]
+                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
+                                [% ELSE %]
+                                    <option value="[% b.value %]">[% b.branchname %]</option>
+                                [% END %]
+                            [% END %]
+                        </select>
+                    </li>
+
+                    <li>
+                        <label for="staff_note">Staff note:</label>
+                        <textarea name="staff_note" id="staff_note">[% course_reserve.staff_note %]</textarea>
+                    </li>
+
+                    <li>
+                        <label for="public_note">Public note:</label>
+                        <textarea name="public_note" id="public_note">[% course_reserve.public_note %]</textarea>
+                    </li>
+
+                </ol>
+            </fieldset>
+
+            <fieldset class="action">
+                <input type="submit" id="submit" value="Save" class="submit focus" />
+
+                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]" class="cancel">Cancel</a>
+            </fieldset>
+        </form>
+    </div>
 
 [% INCLUDE 'intranet-bottom.inc' %]