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.
Created attachment 9840 [details] [review] Bug 8163 - 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.
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.
Created attachment 11086 [details] [review] 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.
The patch doesn't apply on master because it relies on your previous patch. Can you resubmit a clean patch?
(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.
Created attachment 11107 [details] [review] 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.
Created attachment 11109 [details] [review] [SIGNED-OFF] Bug 8163 [REVISED] Click to populate XSLT preferences with "default" or empty values Works well. It's really easy to add similar links for other preferences. Great patch!
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.
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 !
Created attachment 13181 [details] [review] 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.
Sorry, commmit message should also note that the problem Paul describes in comment 9 is fixed.
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?
(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.
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>
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.
The last patch fixes the Paul's remark. Marked as Passed QA.
Contains string changes. Will hold for 3.12.
This patch has been pushed to master.
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
Pushed to 3.8.x will be in 3.8.8
Patches do not apply to 3.6.x, please reopen and submit a patch for 3.6.x if necessary. Thanks!