Koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc
Owen Leonard 9917b39d9d
Bug 36557: Convert Cart and Lists controls to buttons and rework logic
This patch tries to address errors in the way features are displayed in
result lists so that controls for holds, tags, lists, etc. are shown or
hidden according to system preferences.

The patch converts the Cart/Lists dropdown to separate buttons, making
the display logic simpler and making the interface more consistent with
updates to the staff interface search results.

To test, apply the patch and rebuild the OPAC CSS.

- In the OPAC, test these pages:
  - Catalog search results
  - List contents
- Test with various combinations of these system preferences:
  - opacbookbag
  - DisplayMultiPlaceHold
  - virtualshelves
  - OPACHoldRequests
  - TagsEnabled
  - TagsInputOnList
  - UseRecalls
  - ArticleRequests

With each different combination of settings the right controls should
appear in the toolbar at the top (if present), and with each search
result.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-07-01 18:55:43 +02:00

67 lines
5.4 KiB
HTML

<div class="actions-menu noprint">
[% IF ( HoldsEnabled ) %]
[% UNLESS ( items.norequests ) %]
[% IF ( shelf AND op == 'view' ) # Lists view has more granular checking of hold availability %]
[% IF ( items.allow_onshelf_holds ) %]
<span class="actions"><a class="btn btn-link btn-sm" aria-label="Place a hold on [% items.title | html %]" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% items.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></span>
[% ELSE %]
[% IF ( items.itemsissued ) %]
<span class="actions"><a class="btn btn-link btn-sm" aria-label="Place a hold on [% items.title | html %]" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% items.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></span>
[% END %]
[% END %]
[% ELSE %]
<span class="actions"><a class="btn btn-link btn-sm" aria-label="Place a hold on [% items.title | html %]" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% items.biblionumber | html %]"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a></span>
[% END %]
[% END # / UNLESS items.norequests %]
[% END # / OPACHoldRequests %]
[% IF ( RecallsEnabled ) %]
<span class="actions"><a class="btn btn-link btn-sm recall" href="/cgi-bin/koha/opac-recall.pl?biblionumber=[% items.biblionumber | html %]"><i class="fa-solid fa-book-bookmark" aria-hidden="true"></i> Place recall</a></span>
[% END %]
[% IF ( LoginEnabled ) %]
[% IF items.artreqpossible %]
<span class="actions"><a href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% items.biblionumber | uri %]" class="btn btn-link btn-sm"><i class="fa-solid fa-file-lines" aria-hidden="true"></i> Request article</a></span>
[% END %]
[% END %]
[% IF ( TagsInputEnabled ) %]
[% IF ( loggedinusername ) %]
<span class="actions"><a id="tag_add[% items.biblionumber | html %]" href="#" class="tag_add btn btn-link btn-sm"><i class="fa fa-tag" aria-hidden="true"></i> Add tag</a></span>
<div id="tagform[% items.biblionumber | html %]" class="tag_results_input form-inline" style="display:none;">
<label for="newtag[% items.biblionumber | html %]">New tag(s), separated by a comma:</label>
<input type="text" name="newtag[% items.biblionumber | html %]" id="newtag[% items.biblionumber | html %]" class="form-control form-control-sm newtag" maxlength="100" />
<input name="tagbutton" class="btn btn-sm btn-primary tagbutton" title="[% items.biblionumber | html %]" type="submit" value="Add" />
<a class="cancel_tag_add" id="cancel[% items.biblionumber | html %]" href="#">(done)</a>
</div>
<span id="newtag[% items.biblionumber | html %]_status" class="tagstatus" style="display:none;">
Tag status here.
</span>
[% ELSE %]
<span class="actions">
<span class="login4tags">
<a class="btn btn-link btn-sm loginModal-trigger" href="/cgi-bin/koha/opac-user.pl"><i class="fa fa-tag" aria-hidden="true"></i> Log in to add tags</a>
</span>
</span>
[% END # IF loggedinusername %]
[% END # if TagsInputEnabled %]
[% IF ( ListsEnabled ) %]
[% IF ( shelf AND op == 'view' ) %]
<span class="actions"><a href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% items.biblionumber | uri %]" class="addtoshelf btn btn-link btn-sm"><i class="fa fa-list" aria-hidden="true"></i> Save to another list</a></span>
[% IF can_remove_biblios %]
<span class="actions"><a class="btn btn-link btn-sm removeitems" data-biblionumber="[% items.biblionumber | html %]" href="#"><i class="fa fa-remove" aria-hidden="true"></i> Remove from this list</a></span>
[% END %]
[% ELSE %]
<span class="actions"><a class="addtoshelf btn btn-link btn-sm" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% items.biblionumber | html %]"><i class="fa fa-list" aria-hidden="true"></i> Save to lists</a></span>
[% END # /IF ( shelf AND op == 'view' ) %]
[% END # /IF Koha.Preference( 'opacuserlogin' ) %]
[% IF ( CartEnabled ) %]
[% IF ( items.incart ) %]
<span class="actions cart-actions"><a data-biblionumber="[% items.biblionumber | html %]" class="btn btn-link btn-sm addtocart cart[% items.biblionumber | html %]" href="#"><i class="fa fa-shopping-cart" aria-hidden="true"></i> In your cart</a> <a data-biblionumber="[% items.biblionumber | html %]" class="btn btn-link btn-sm remove cartRemove cartR[% items.biblionumber | html %]" href="#">(remove)</a></span>
[% ELSE %]
<span class="actions cart-actions"><a aria-label="Add [% items.title | html %] to the cart" data-biblionumber="[% items.biblionumber | html %]" class="btn btn-link btn-sm addtocart cart cart[% items.biblionumber | html %]" href="#"><i class="fa fa-shopping-cart" aria-hidden="true"></i> Add to cart</a> <a style="display:none;" data-biblionumber="[% items.biblionumber | html %]" class="btn btn-link btn-sm remove cartRemove cartR[% items.biblionumber | html %]" href="#">(remove)</a></span>
[% END %]
[% END # / IF opacbookbag %]
</div>