Bug 7980: [SIGNED-OFF] Group search results tag input with other actions

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.

signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Owen Leonard 2012-04-18 11:32:48 -04:00 committed by Paul Poulain
parent cfae2c6a61
commit ddfb28876c
4 changed files with 75 additions and 32 deletions

View File

@ -722,6 +722,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;
@ -1407,6 +1431,10 @@ padding-left : .4em;
font-size : 100%;
}
.results_summary.actions {
margin-top : .5em;
}
.m880 {
display:block;
text-align:right;
@ -1420,10 +1448,6 @@ padding-left : .4em;
color: #707070;
}
#login4tags {
margin-top : .3em;
}
.results_summary .label {
color: #202020;
}

View File

@ -223,6 +223,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";
@ -503,6 +521,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">
@ -528,35 +563,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 ) %]
@ -570,6 +578,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 %]

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B