[Koha-patches] [PATCH] Bug 7980 - Group search results tag input with other actions

Owen Leonard oleonard at myacpl.org
Wed Apr 18 21:17:53 CEST 2012


This patch hides the tag input form in OPAC search results when
TagsInputOnList is turned on. An "Add tag" is added to the
"Actions" line. Clicking the link un-hides the tag input form.
A "Cancel" link hides it again.

The patch also moves the display of ratings to the bottom of
the list so that existing tags are grouped with the other
title details which are prefixed with a label ("Type:",
"Availability", etc.).

To test, enable the TagsInputOnList system preference. Do a search
and try adding tags from the search results list.
---
 koha-tmpl/opac-tmpl/prog/en/css/opac.css           |   32 +++++++-
 .../opac-tmpl/prog/en/modules/opac-results.tt      |   75 ++++++++++++-------
 .../opac-tmpl/prog/images/tag-small-disabled.png   |  Bin 0 -> 317 bytes
 koha-tmpl/opac-tmpl/prog/images/tag-small.png      |  Bin 0 -> 347 bytes
 4 files changed, 75 insertions(+), 32 deletions(-)
 create mode 100644 koha-tmpl/opac-tmpl/prog/images/tag-small-disabled.png
 create mode 100644 koha-tmpl/opac-tmpl/prog/images/tag-small.png

diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index c10e08d..44b8a08 100644
--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css
+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
@@ -689,6 +689,30 @@ input.deleteshelf:active {
 
 #tagslist li { display : inline; }
 
+a.tag_results_add {
+	background-image: url(../../images/tag-small.png);
+	background-position : -1px center;
+	background-repeat : no-repeat;
+	padding-left : 13px;
+	text-decoration: none;
+}
+
+#login4tags {
+	background-image: url(../../images/tag-small-disabled.png);
+	background-position : -1px center;
+	background-repeat : no-repeat;
+	padding-left : 13px;
+	text-decoration: none;
+	margin-left: 1em;
+}
+
+.tag_results_input {
+    background-color: #EEE;
+    display: none;
+    margin-left: 1em;
+    padding: 0.3em;
+}
+
 #placehold input.submit:hover,
 #tagsel_span input.submit:hover {
 	color: #990033;
@@ -1372,6 +1396,10 @@ padding-left : .4em;
 	font-size : 100%;
 }
 
+.results_summary.actions {
+    margin-top : .5em;
+}
+
 .m880 {
     display:block; 
     text-align:right; 
@@ -1385,10 +1413,6 @@ padding-left : .4em;
 	color: #707070;
 }
 
-#login4tags {
-	margin-top : .3em;
-}
-
 .results_summary .label {
 	color: #202020;
 }
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
index 2c12d44..9d34040 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt
@@ -224,6 +224,24 @@ $(document).ready(function(){
                 tagAdded();
                 return false;
             });
+
+            $(".tag_results_add").click(function(){
+                var thisid = $(this).attr("id");
+                thisid = thisid.replace("tag_add","");
+                $(this).hide();
+                $("#tagform"+thisid).show();
+                $("#newtag"+thisid).focus();
+                return false;
+            })
+
+            $(".cancel_tag_add").click(function(){
+                var thisid = $(this).attr("id");
+                thisid = thisid.replace("cancel","");
+                $(this).parent().hide();
+                $("#tag_add"+thisid).show();
+                return false;
+            })
+
         [% ELSE %]
             $("#tagsel_tag").click(function(){
                 window.location = "/cgi-bin/koha/opac-user.pl";
@@ -504,6 +522,23 @@ $(document).ready(function(){
                     </span>
                 [% END %]
 
+                [% IF ( LibraryThingForLibrariesID ) %]<div class="ltfl_reviews"></div>[% END %]
+                [% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]
+                                [% IF ( TagsShowOnList ) %]
+                                [% IF ( SEARCH_RESULT.TagLoop.size ) %]
+                                        <div class="results_summary"><span class="label">Tags:</span>
+                                        <ul style="display: inline; list-style: none;">[% FOREACH TagLoo IN SEARCH_RESULT.TagLoop %]<li style="display: inline; list-style: none;"><a href="/cgi-bin/koha/opac-search.pl?tag=[% TagLoo.term |url %]&amp;q=[% TagLoo.term |url %]">[% TagLoo.term %]</a> <span class="weight">([% TagLoo.weight_total %])</span></li>
+                                            [% END %]
+                                        </ul>
+                                   [% END %]
+                                    [% IF ( SEARCH_RESULT.TagLoop.size ) %]
+                                    </div>[% END %]
+                                [% END %]
+                                [% END %][% END %]
+                [% IF ( SEARCH_RESULT.searchhighlightblob ) %]<span class="results_summary"><span class="label">Match:</span> [% SEARCH_RESULT.searchhighlightblob %]</span>[% END %]
+
+
+
 
                 [% IF ( OpacStarRatings == 'all' ) %]
                 <div class="results_summary">
@@ -529,35 +564,8 @@ $(document).ready(function(){
                 </div>
                 [% END %]
 
-
-                [% IF ( LibraryThingForLibrariesID ) %]<div class="ltfl_reviews"></div>[% END %]
-                [% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]
-                                [% IF ( TagsShowOnList ) %]
-                                [% IF ( SEARCH_RESULT.TagLoop.size ) %]
-                                        <div class="results_summary"><span class="label">Tags:</span>
-                                        <ul style="display: inline; list-style: none;">[% FOREACH TagLoo IN SEARCH_RESULT.TagLoop %]<li style="display: inline; list-style: none;"><a href="/cgi-bin/koha/opac-search.pl?tag=[% TagLoo.term |url %]&amp;q=[% TagLoo.term |url %]">[% TagLoo.term %]</a> <span class="weight">([% TagLoo.weight_total %])</span></li>
-                                            [% END %]
-                                        </ul>
-                                   [% END %]
-                                [% IF ( TagsInputOnList ) %]
-                                    [% IF ( loggedinusername ) %]
-                    <span class="label">New tag:</span>
-                                        <input name="newtag[% SEARCH_RESULT.biblionumber %]" id="newtag[% SEARCH_RESULT.biblionumber %]" maxlength="100" />
-                                        <input name="tagbutton" class="tagbutton" title="[% SEARCH_RESULT.biblionumber %]" type="submit" value="Add" />
-                                    <span id="newtag[% SEARCH_RESULT.biblionumber %]_status" class="tagstatus" style="display:none;">
-                                        Tag status here.
-                                    </span>
-                                       [% ELSIF ( loop.first ) %]<span class="tagstatus" id="login4tags">Log in to add tags.</span>
-                                    [% END %]
-                                [% END %]
-                                    [% IF ( SEARCH_RESULT.TagLoop.size ) %]
-                                    </div>[% END %]
-                                [% END %]
-                                [% END %][% END %]
-                [% IF ( SEARCH_RESULT.searchhighlightblob ) %]<span class="results_summary"><span class="label">Match:</span> [% SEARCH_RESULT.searchhighlightblob %]</span>[% END %]
-
 <span class="results_summary actions"><span class="label">Actions:</span>
-                                [% IF ( RequestOnOpac ) %]
+                [% IF ( RequestOnOpac ) %]
                     [% UNLESS ( SEARCH_RESULT.norequests ) %]
                         [% IF ( opacuserlogin ) %]
                             [% IF ( AllowOnShelfHolds ) %]
@@ -571,6 +579,17 @@ $(document).ready(function(){
                     [% END %]
                 [% END %]
 
+                [% IF ( TagsInputOnList ) %]
+                    [% IF ( loggedinusername ) %]
+                        <a class="tag_results_add" id="tag_add[% SEARCH_RESULT.biblionumber %]" href="#">Add tag</a>
+                        <span id="tagform[% SEARCH_RESULT.biblionumber %]" class="tag_results_input"><label for="newtag[% SEARCH_RESULT.biblionumber %]">New tag(s):</label><input name="newtag[% SEARCH_RESULT.biblionumber %]" id="newtag[% SEARCH_RESULT.biblionumber %]" maxlength="100" />
+                        <input name="tagbutton" class="tagbutton" title="[% SEARCH_RESULT.biblionumber %]" type="submit" value="Add" /> <a class="cancel_tag_add" id="cancel[% SEARCH_RESULT.biblionumber %]" href="#">Cancel</a>
+                        <span id="newtag[% SEARCH_RESULT.biblionumber %]_status" class="tagstatus" style="display:none;">
+                        Tag status here.
+                        </span></span>
+                    [% ELSIF ( loop.first ) %]<span id="login4tags">Log in to add tags.</span>
+                    [% END %]
+                [% END %]
 
                 [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( virtualshelves ) %]<a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]'); return false;">Save to Lists</a>
                 [% END %][% END %][% END %]
diff --git a/koha-tmpl/opac-tmpl/prog/images/tag-small-disabled.png b/koha-tmpl/opac-tmpl/prog/images/tag-small-disabled.png
new file mode 100644
index 0000000000000000000000000000000000000000..4976cb023a97e18b400777336cff68ca7c955f7a
GIT binary patch
literal 317
zcmeAS at N?(olHy`uVBq!ia0vp^+(695!3-or^+GlRDVB6cUq=Rp^(V|(yIunMk|nMY
zCBgY=CFO}lsSJ)O`AMk?p1FzXsX?iUDV2pMQ*D5XYyx~jTq`RpzkmP!=g*&S- at et?
z*EcseH#IeV{ra`Dv$Lh8rMkNM_wV0-|NgD2s`~fuUq?qrPft%xP0g=gzyAOKzi~$8
zTA(>1B|(0{KrT99 at b`Z%2$WCvba4!+xRoRzCYC19#?ZjPba77rp96y-2RB#IN6x03
z42&!yNe>@BPG;Q5$i$&?_So4YN4S;%nQNv5dw6i1VB}EfFsn;TbE`{iU}%y$c>df8
rMIHeMgUzfgEG<A~$JiJf7?>I61hc)l?8A8*XeEQEtDnm{r-UW|oH~M7

literal 0
HcmV?d00001

diff --git a/koha-tmpl/opac-tmpl/prog/images/tag-small.png b/koha-tmpl/opac-tmpl/prog/images/tag-small.png
new file mode 100644
index 0000000000000000000000000000000000000000..7e8b39e51d138604f299d044fdb0ce91b470cdf9
GIT binary patch
literal 347
zcmeAS at N?(olHy`uVBq!ia0vp^+(695!3-or^+GlRDVB6cUq=Rp^(V|(yIunMk|nMY
zCBgY=CFO}lsSJ)O`AMk?p1FzXsX?iUDV2pMQ*D5X0t0+PTowH5-hKP`;?rNfgh`Ly
z|1n6K`r`9n&8Qy3<f*D5E%LrK|NsBjjOu>>?VnO$gKliUUczLR;1>1p4)ySMo!I_I
zAO0F7PyPM(zfxf1*I)mDiocn*e*hXTT at vIM4CLYf4C*G_ra)zxo-U3d6}OTmOq%p)
zQWHZ1LlQ$G8;7()gT#^_Dk?iv59Bm3FmV-jb$4?&-C$s3nItx8$`lc{OF(AWsdJ}K
zoKRL}6>t#9{gdP4qZ9-bHEoKV;_ASq(6As!(=d!rvw@*$qa%aD0R~$s&hjJdZAXEY
OGI+ZBxvX<aXaWG?l8yxc

literal 0
HcmV?d00001

-- 
1.7.5.4



More information about the Koha-patches mailing list