Bug 8163 - Click to populate XSLT preferences with "default" or empty values
Summary: Click to populate XSLT preferences with "default" or empty values
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: 3.8
Hardware: All All
: P5 - low trivial
Assignee: Owen Leonard
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-29 18:52 UTC by Owen Leonard
Modified: 2013-12-05 20:01 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 8163 - Click to populate XSLT preferences with "default" or empty values (5.93 KB, patch)
2012-05-29 19:12 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values (6.80 KB, patch)
2012-07-23 16:58 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values (6.05 KB, patch)
2012-07-24 12:52 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values (6.11 KB, patch)
2012-07-24 13:42 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values (6.24 KB, patch)
2012-11-01 18:46 UTC, Owen Leonard
Details | Diff | Splinter Review
[Signed off] Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values (6.25 KB, patch)
2012-11-08 19:23 UTC, Melia Meggs
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2012-05-29 18:52:38 UTC
Now that there are several options for populating the XSLT system preferences it would make things easier if the user could click to populate the field with "default" or to empty the field.
Comment 1 Owen Leonard 2012-05-29 19:12:02 UTC Comment hidden (obsolete)
Comment 2 Julian Maurice 2012-06-12 15:08:32 UTC
I wonder if we can make things more generic, like for example:

<a href="#" class="set_syspref" data-syspref="OPACXSLTResultsDisplay" data-value="default">Set to default</a>
<a href="#" class="set_syspref" data-syspref="OPACXSLTResultsDisplay" data-value="">Leave empty</a>

with JS:

$(".set_syspref").click(function() {
    var s = $(this).attr('data-syspref');
    var v = $(this).attr('data-value');
    $("#pref_"+s).val(v);
});

or something like this. What do you think? This way we can provide default button for all 'Free' and 'Integer' sysprefs that have a default value.
Comment 3 Owen Leonard 2012-07-23 16:58:52 UTC Comment hidden (obsolete)
Comment 4 Julian Maurice 2012-07-24 07:45:24 UTC
The patch doesn't apply on master because it relies on your previous patch. Can you resubmit a clean patch?
Comment 5 Owen Leonard 2012-07-24 12:52:01 UTC
(In reply to comment #4)
> The patch doesn't apply on master because it relies on your previous patch.
> Can you resubmit a clean patch?

Sorry, that was careless of me. Revision coming up.
Comment 6 Owen Leonard 2012-07-24 12:52:34 UTC Comment hidden (obsolete)
Comment 7 Julian Maurice 2012-07-24 13:42:31 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2012-07-24 13:59:34 UTC
QA Comments:

It is a nice feature but a few comments for the new JS function are needed.
Indeed, how a new developper can understand the utility of the css class set_syspref ? We can't find it using grep :-/

Marking as Passed QA but a followup is required.
Comment 9 Paul Poulain 2012-07-24 16:06:54 UTC
Hey, there's a tiny remaining problem with your patch:
* open OPAC tab (or search XSLT, or whatever to reach one of the syspref updated by this patch)
* click on "default", the "default" appears in the cell
* go to the bottom : damned, the syspref can't be saved because the button is still grey & not clickable !
Comment 10 Owen Leonard 2012-11-01 18:46:43 UTC Comment hidden (obsolete)
Comment 11 Owen Leonard 2012-11-01 18:49:06 UTC
Sorry, commmit message should also note that the problem Paul describes in comment 9 is fixed.
Comment 12 Melia Meggs 2012-11-08 19:12:23 UTC
I'm not sure about this revised patch.  After I applied it, I could see the blue links on "Leave empty" and "default," but when I click on them, nothing happens.  I tried changing an empty one to default and changing a default one to empty, but nothing changed.  Is it working for anyone else?
Comment 13 Owen Leonard 2012-11-08 19:16:41 UTC
(In reply to comment #12)
> I'm not sure about this revised patch.  After I applied it, I could see the
> blue links on "Leave empty" and "default," but when I click on them, nothing
> happens.

Try clearing your browser cache (or doing shift-reload). The patch modifies a linked javascript file which is probably being cached by the browser.
Comment 14 Melia Meggs 2012-11-08 19:23:47 UTC
Created attachment 13319 [details] [review]
[Signed off] Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values

This patch adds markup and JavaScript to the system preferences
interface so that the user can click "default" or "empty" to populate
an XSLT-related pref with those vaules.

To test, open system preferences for the OPAC or staff client. In
the description for an XSLT-related preference click the "default"
link to populate the field with "default." Click the "leave empty"
link to empty the field.

Revised according to Julian Maurice's suggestion for a more
generic, flexible way to implement it.

Signed-off-by: Melia Meggs <melia@test.bywatersolutions.com>
Comment 15 Melia Meggs 2012-11-08 19:24:42 UTC
Ok, that did it!

Clicking the "leave empty" and "default" links correctly fill in the cells, and I can save the sys prefs after I have modified them.

I am signing off now.
Comment 16 Jonathan Druart 2012-11-09 12:48:15 UTC
The last patch fixes the Paul's remark.
Marked as Passed QA.
Comment 17 Jared Camins-Esakov 2012-11-10 01:32:29 UTC
Contains string changes. Will hold for 3.12.
Comment 18 Jared Camins-Esakov 2012-11-23 17:36:20 UTC
This patch has been pushed to master.
Comment 19 Chris Cormack 2012-11-26 01:11:18 UTC
Pushing to 3.10.x will be in 3.10.1 more of a bug fix than an enhancement, the current way to populate the xslt prefs is very error prone
Comment 20 Chris Cormack 2012-11-26 07:37:44 UTC
Pushed to 3.8.x will be in 3.8.8
Comment 21 Liz Rea 2012-11-28 01:40:47 UTC
Patches do not apply to 3.6.x, please reopen and submit a patch for 3.6.x if necessary. 

Thanks!