Re: [Koha-devel] [Koha] 3.8.4 staff main page
"Redirecting" this to the devel (not user) list At 06:51 PM 9/14/2012 +0800, MT wrote:
The first staff page in 3.8.4 after logging in has a tabbed search box at the top that "defaults" to patron check [out]s - our staff has asked me to change this to the fourth/last tab "catalogue" as they cannot find a "preference" anywhere. And this is why a git installation for testing and development would be very helpful. You could develop a patch for changing the default ordering of the tab in the header_search div, which could be of use to the community. The recommended way is to USE JQUERY (javascript). This upgrades with ease if done properly. Do not modify the perl/template files! This sets you up for an upgrade headache.
I am unaware of an *easy* way to write anything in js to accomplish my staff's request. However, here's the fix (Mark, if you think this could be of use to the community as you suggest above, please disseminate it as an enhancement, bug, whatever ...) which was remarkably easy, once I found the relevant code. FYI, Firebug does not appear to be of much use tracking down things like these. To change the search default of "Check out, Check in, Search patrons, Search the catalog" in the tabs at: <http://koha-admin3/cgi-bin/koha/mainpage.pl> edit /usr/share/koha/intranet/htdocs/intranet-tmpl/prog/en/includes/home-search.inc and reorder lines 32-35 to put "your preference" at top: [% IF ( CAN_user_catalogue ) %]<li><a href="/cgi-bin/koha/catalogue/search.pl#catalog_search">Search the catalog</a></li>[% END %] [% IF ( CAN_user_circulate ) %]<li><a href="/cgi-bin/koha/circ/circulation.pl#circ_search">Check out</a></li>[% END %] [% IF ( CAN_user_circulate ) %]<li><a href="/cgi-bin/koha/circ/returns.pl#checkin_search">Check in</a></li>[% END %] [% IF ( CAN_user_borrowers ) %]<li><a href="/cgi-bin/koha/members/members-home.pl#patron_search">Search patrons</a></li>[% END %] The focus will always be on the first tab. Best regards, Paul
Greetings,
However, here's the fix (Mark, if you think this could be of use to the community as you suggest above, please disseminate it as an enhancement, bug, whatever ...)
I already knew that, and I already told you that is the wrong way to do it. As such, it should not be disseminated. The reason it is the wrong way is not every library will be using the staff client to search first and foremost. Others may check out and check in. Another good way which requires a git development environment and programming effort, if you were going to modify the template file, is to probably create a system preference for this under Search and then modify the template to output based on the system preference which would get set in some code. GPML, Mark Tompsett
Op 15-09-12 18:51, Paul schreef:
I am unaware of an *easy* way to write anything in js to accomplish my staff's request. However, here's the fix (Mark, if you think this could be of use to the community as you suggest above, please disseminate it as an enhancement, bug, whatever ...) which was remarkably easy, once I found the relevant code. FYI, Firebug does not appear to be of much use tracking down things like these.
Mark is right, your fix is a bad idea. Here is how to do it properly. 1) using firebug, determine the ID of the tabs bit, it turns out to be header_search. 2) look up what this jquery ui-tabs thing is, which will take you to: http://jqueryui.com/demos/tabs/ 3) poke around and see that the 'selected' option looks like the kind of thing that we might want. 3.5) play around with this in the firebug console to make sure we have everything right. 4) write the following JS into the intranetuserjs box: $(function() { $('#header_search').tabs({selected:2}); }); 5) go have a beer because that was pretty quick :) 5.5) apologise to firebug because it was pretty useful after all, then consider that perhaps you had too many beers, and talking to bits of software is rarely constructive. Put your phone away so you don't drunk-dial someone. -- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
Hi, On Mon, Sep 17, 2012 at 6:14 AM, Robin Sheat <robin@catalyst.net.nz> wrote:
5.5) apologise to firebug because it was pretty useful after all, then consider that perhaps you had too many beers, and talking to bits of software is rarely constructive. Put your phone away so you don't drunk-dial someone.
5.6) Later, we we find out our debug tools have actually been sentient for years, tell Firebug that yes, you really were sincere when you apologized and that talking to one's software is a perfectly normal thing to do. Regards, Galen -- Galen Charlton Director of Implementation Equinox Software, Inc. / The Open Source Experts email: gmc@esilibrary.com direct: +1 770-709-5581 cell: +1 404-984-4366 skype: gmcharlt web: http://www.esilibrary.com/ Supporting Koha and Evergreen: http://koha-community.org & http://evergreen-ils.org
Op 17-09-12 15:46, Galen Charlton schreef:
5.6) Later, we we find out our debug tools have actually been sentient for years, tell Firebug that yes, you really were sincere when you apologized and that talking to one's software is a perfectly normal thing to do.
Don't anthropomorphise software. It hates that. -- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
At 12:14 PM 9/17/2012 +0200, Robin Sheat wrote:
Op 15-09-12 18:51, Paul schreef:
I am unaware of an *easy* way to write anything in js to accomplish my staff's request. However, here's the fix (Mark, if you think this could be of use to the community as you suggest above, please disseminate it as an enhancement, bug, whatever ...) which was remarkably easy, once I found the relevant code. FYI, Firebug does not appear to be of much use tracking down things like these.
Mark is right, your fix is a bad idea. Here is how to do it properly.
Robin - tnx for taking the time to reply. What value of "bad"? A simple, fully functional, easy, reversible, move (not rewrite) of a single line of code, is bad?
1) using firebug, determine the ID of the tabs bit, it turns out to be header_search.
By grepping header_search was how I eventually got to home_search.inc in the first place to modify the order of lines 32-35.
2) look up what this jquery ui-tabs thing is, which will take you to: http://jqueryui.com/demos/tabs/ 3) poke around and see that the 'selected' option looks like the kind of thing that we might want. 3.5) play around with this in the firebug console to make sure we have everything right. 4) write the following JS into the intranetuserjs box: $(function() { $('#header_search').tabs({selected:2}); });
This does not appear to function - the focus remains fixed on the first tab - despite trying a copy/paste of your suggestion, and various combinations of: $('#header_search').tabs({selected:#catalog_search}); $('#header_search').tabs('select', '#catalog_search'); with and without single quotes and|or hash marks. I also tried, from the <http://jqueryui.com/demos/tabs/> you suggested (and which I had already visited): var $tabs = $('#header_search').tabs({ add: function(event, ui) { $tabs.tabs('select', '#catalog_search'); } }); Still no joy, except by re-ordering lines 32-35 in home_search.inc
5) go have a beer because that was pretty quick :)
Probably not -- and I'm pretty close to being teetotal; last time I had a glass of anything alcoholic was champagne at my wedding in 1963.
5.5) apologise to firebug because it was pretty useful after all,
Thank you Firebug, with my apologies for taking your name in vain ...
then consider that perhaps you had too many beers, and talking to bits of software is rarely constructive. Put your phone away so you don't drunk-dial someone.
Now that's a bit melodramatic, don't you think? Paul
On Mon, Sep 17, 2012 at 12:22 PM, Paul <paul.a@aandc.org> wrote:
At 12:14 PM 9/17/2012 +0200, Robin Sheat wrote:
Op 15-09-12 18:51, Paul schreef:
I am unaware of an *easy* way to write anything in js to accomplish my staff's request. However, here's the fix (Mark, if you think this could be of use to the community as you suggest above, please disseminate it as an enhancement, bug, whatever ...) which was remarkably easy, once I found the relevant code. FYI, Firebug does not appear to be of much use tracking down things like these.
Mark is right, your fix is a bad idea. Here is how to do it properly.
Robin - tnx for taking the time to reply.
What value of "bad"? A simple, fully functional, easy, reversible, move (not rewrite) of a single line of code, is bad?
Ahh... herein lies the song of the siren... "Just one little change won't hurt, now will it?" And before you know it, you've heavily modified your templates one little change at a time and you have a special form of punishment to undergo at upgrade time. Been there, done that. Yes... I know... "It won't happen to me that way...." :-) The pathway of Koha lies strewn with the bodies of those who swore they'd only make one template change, so at least tie yourself to the mast of the ship as you sail through those waters. Kind Regards, Chris
4) write the following JS into the intranetuserjs box: $(function() { $('#header_search').tabs({selected:2}); });
This does not appear to function - the focus remains fixed on the first tab - despite trying a copy/paste of your suggestion
Unfortunately it looks like that code only works in master, which uses an upgraded version of jQueryUI. -- Owen -- Web Developer Athens County Public Libraries http://www.myacpl.org
Op 17-09-12 18:22, Paul schreef:
What value of "bad"? A simple, fully functional, easy, reversible, move (not rewrite) of a single line of code, is bad?
To add to what Chris N said, every change is something you have to be aware of and track whenever you do an upgrade.
This does not appear to function - the focus remains fixed on the first tab - despite trying a copy/paste of your suggestion, and various combinations of:
Darn, I didn't consider older versions of jquery-ui.
$('#header_search').tabs({selected:#catalog_search}); $('#header_search').tabs('select', '#catalog_search');
with and without single quotes and|or hash marks.
For what it's worth, # indicates that it's an id (as in <div id='header_search'>) and single or double quotes don't matter so long as you're consistent within a string.
5) go have a beer because that was pretty quick :)
Probably not -- and I'm pretty close to being teetotal; last time I had a glass of anything alcoholic was champagne at my wedding in 1963.
alcoholvrij beer is a thing around here, I discovered :)
then consider that perhaps you had too many beers, and talking to bits of software is rarely constructive. Put your phone away so you don't drunk-dial someone.
Now that's a bit melodramatic, don't you think?
It's just a precaution, you never know ;) -- Robin Sheat Catalyst IT Ltd. ✆ +64 4 803 2204 GPG: 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
participants (6)
-
Chris Nighswonger -
Galen Charlton -
Mark Tompsett -
Owen Leonard -
Paul -
Robin Sheat