Bugzilla – Attachment 97975 Details for
Bug 23915
Replace OPAC list sort menu with Bootstrap menu button
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23915: Replace OPAC list sort menu with Bootstrap menu button
Bug-23915-Replace-OPAC-list-sort-menu-with-Bootstr.patch (text/plain), 4.33 KB, created by
Owen Leonard
on 2020-01-27 12:50:58 UTC
(
hide
)
Description:
Bug 23915: Replace OPAC list sort menu with Bootstrap menu button
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-01-27 12:50:58 UTC
Size:
4.33 KB
patch
obsolete
>From 2e81ef239346e38e7938b1fc2e6c11df7b8aa851 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 28 Oct 2019 17:57:20 +0000 >Subject: [PATCH] Bug 23915: Replace OPAC list sort menu with Bootstrap menu > button > >This patch adds JavaScript to the list contents page which converts the >resort form's <select> menu into a Bootstrap dropdown menu. This allows >for a more compact and consistent display. > >To test, apply the patch and regenerate the OPAC CSS >(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). > >View a list in the OPAC. The toolbar of list controls ("New list," >"Download list," etc.) should have a similary-styled "Sort" button. Each >sorting option should work correctly. >--- > koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss | 34 ++++++++++++++++++---- > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 25 ++++++++++++++-- > 2 files changed, 52 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >index da7a04922b6..eabc76a272f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >+++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >@@ -24,11 +24,8 @@ $footer-height: 45px; > } > > .js { >- .dateformat { >- display: none; >- } >- >- #sortsubmit { >+ .dateformat, >+ #sorting-form { > display: none; > } > } >@@ -609,6 +606,29 @@ th { > color: #333; > } > >+/* Add style for Bootstrap dropdown-header class */ >+.dropdown-header { >+ border-top: 1px solid #eee; >+ color: #000; >+ display: block; >+ font-size: 90%; >+ font-weight: 700; >+ line-height: 1.42857143; >+ padding: 3px 20px; >+ padding-left: 10px; >+ white-space: nowrap; >+} >+ >+.btn-group.open { >+ .btn-link { >+ &.dropdown-toggle { >+ background-image: none; >+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); >+ } >+ } >+} >+ >+ > .breadcrumb { > background-color: #F0F3F3; > font-size: 85%; >@@ -1361,6 +1381,10 @@ div { > border-left: 0; > } > } >+ >+ &.dropdown-header { >+ display: block; >+ } > } > > ul { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index ec0ffcd4838..7e96b06c38d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -977,8 +977,6 @@ $(function() { > KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]'); > [% END %] > >- $('#sort-submit').hide(); >- > [% IF print %] > window.print(); > window.onafterprint = function () { >@@ -995,12 +993,35 @@ $(function() { > stickyClass: "floating" > }); > >+ sortMenu( $("#sorting-form") ); >+ > $("#sortfield").on("change", function(){ > $('#sorting-form').submit(); > }); > > }); // document.ready > >+function sortMenu( sorting_form ){ >+ var shelfnumber = sorting_form.find("input[name='shelfnumber']").val(); >+ var sort_link = "/cgi-bin/koha/opac-shelves.pl?op=view&shelfnumber=" + shelfnumber + "&sortfield="; >+ var menu = "<div class=\"btn-group\"><button type=\"button\" class=\"btn btn-link dropdown-toggle\" data-toggle=\"dropdown\" id=\"sortmenu\" aria-haspopup=\"true\" aria-expanded=\"false\"><i class=\"fa fa-sort\"></i> " + _("Sort") + "</span></button><ul class=\"dropdown-menu dropdown-menu-right\" aria-labelledby=\"sortmenu\">"; >+ $("#sortfield").children().each(function(){ >+ if( $(this)[0].tagName.toUpperCase() == "OPTION" ){ >+ menu += "<li><a href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a></li>"; >+ } else if( $(this)[0].tagName.toUpperCase() == "OPTGROUP" ){ >+ menu += "<li class=\"dropdown-header\">" + $(this).attr("label") + "</li>"; >+ $(this).children().each(function(){ >+ if( $(this)[0].tagName.toUpperCase() == "OPTION" ){ >+ menu += "<li><a href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a></li>"; >+ } >+ }); >+ } >+ }); >+ menu += "</ul></div>"; >+ $(".list-actions").append( menu ); >+ sorting_form.remove(); >+} >+ > function AdjustRemark() { > var category; > if( $("#category").length > 0 ) { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23915
:
94816
|
94817
|
97975
|
98039
|
98045
|
98092