[open-ils-commits] [GIT] Evergreen ILS branch rel_2_2 updated. 30b6b8c483962ae24e47eb61450dc59534a3b896
Evergreen Git
git at git.evergreen-ils.org
Tue Oct 16 21:20:44 EDT 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_2 has been updated
via 30b6b8c483962ae24e47eb61450dc59534a3b896 (commit)
from dabeec45dc60f64e697ef661963f2245d519fc4f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 30b6b8c483962ae24e47eb61450dc59534a3b896
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date: Thu Oct 11 16:00:36 2012 -0400
TPAC: Make facet display work as in JSPAC
Namely, this means:
- You see five facets per category by default, not ten.
- You can click a link to see all the facets in a category
(before this it was impossible to display more than ten).
- When viewing all the facets in a category, you can click a link
to reduce the list back to five.
- This number five I'm talking about is configurable in config.tt2.
- Alphabetical sorting of facets grouped by the same numbers of
results is restored.
This addresses LP #1065109.
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Signed-off-by: Kathy Lussier <klussier at masslnc.org>
Conflicts:
Open-ILS/src/templates/opac/css/style.css.tt2
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
index b11d0bf..c2b24bb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
@@ -287,7 +287,7 @@ sub get_records_and_facets {
# collect the facet data
my $search = OpenSRF::AppSession->create('open-ils.search');
my $facet_req = $search->request(
- 'open-ils.search.facet_cache.retrieve', $facet_key, 10
+ 'open-ils.search.facet_cache.retrieve', $facet_key
) if $facet_key;
# gather up the unapi recs
@@ -306,7 +306,13 @@ sub get_records_and_facets {
for my $ent (keys %$entries) {
push(@entries, {value => $ent, count => $$entries{$ent}});
};
- @entries = sort { $b->{count} <=> $a->{count} } @entries;
+
+ # Sort facet entries by 1) count descending, 2) text ascending
+ @entries = sort {
+ $b->{count} <=> $a->{count} ||
+ $a->{value} cmp $b->{value}
+ } @entries;
+
$facets->{$cmf_id} = {
cmf => $self->ctx->{get_cmf}->($cmf_id),
data => \@entries
diff --git a/Open-ILS/src/templates/opac/parts/config.tt2 b/Open-ILS/src/templates/opac/parts/config.tt2
index 9d802e3..4d41eac 100644
--- a/Open-ILS/src/templates/opac/parts/config.tt2
+++ b/Open-ILS/src/templates/opac/parts/config.tt2
@@ -68,5 +68,6 @@ facet.display = [
{facet_class => 'series', facet_order => ['seriestitle']},
{facet_class => 'subject', facet_order => ['name', 'geographic']}
];
+facet.default_display_count = 5;
%]
diff --git a/Open-ILS/src/templates/opac/parts/result/facets.tt2 b/Open-ILS/src/templates/opac/parts/result/facets.tt2
index dd27dd9..fed133a 100644
--- a/Open-ILS/src/templates/opac/parts/result/facets.tt2
+++ b/Open-ILS/src/templates/opac/parts/result/facets.tt2
@@ -1,12 +1,15 @@
<div class="facet_box_wrapper">
[%
-close_facets = CGI.param('close_facet') || [];
+long_facets = CGI.param('long_facet') || [];
selected_facets = CGI.param('facet') || [];
# sorted list of search facets
sorted_facets = [];
+# we'll clobber the facet. "namespace" later
+DEFAULT_DISPLAY_COUNT = facet.default_display_count;
+
IF facet.display;
# facet display configuration present. Traverse the
@@ -37,46 +40,38 @@ ELSE;
labels.push(facet.cmf.label);
END;
- FOR facet_label IN labels.sort;
- FOR facet IN ctx.search_facets.values;
- IF facet.cmf.label == facet_label;
- sorted_facets.push(facet);
- END;
- END;
- END;
+ # We used to do a sort here, but now that's handled in EGCatLoader.
+ sorted_facets = ctx.search_facets.values;
END;
+display_count_by_cmf = {};
+
FOR facet IN sorted_facets;
fclass = facet.cmf.field_class;
fname = facet.cmf.name;
- close_key = fclass _ fname %]
+ fid = facet.cmf.id;
+ long_key = fclass _ fname %]
<div class="facet_box_temp">
<div class="header">
- <span class="button">
-
- [% IF close_facets.grep(close_key).0;
- new_close = [];
- FOR fct IN close_facets;
- IF fct != close_key;
- new_close.push(fct);
+ [% IF long_facets.grep(long_key).0;
+ new_long = [];
+ FOR fct IN long_facets;
+ IF fct != long_key;
+ new_long.push(fct);
END;
END;
- expand_url = mkurl('', {close_facet => new_close});
- IF new_close.size == 0;
- expand_url = mkurl('', {}, ['close_facet']);
+ expand_url = mkurl('', {long_facet => new_long});
+ IF new_long.size == 0;
+ expand_url = mkurl('', {}, ['long_facet']);
END;
%]
- <a href="[% expand_url %]"><img
- src="[% ctx.media_prefix %]/images/adv_search_plus_btn.png" alt="[% l('Expand') %]" /></a>
- [% ELSE %]
- <a href="[% mkurl('', {close_facet => close_facets.merge([close_key])}) %]"><img
- src="[% ctx.media_prefix %]/images/adv_search_minus_btn.png" alt="[% l('Collapse') %]" /></a>
+ <a class="button" href="[% expand_url %]">[% l("Fewer") %]</a>
+ [% ELSIF facet.data.size > DEFAULT_DISPLAY_COUNT %]
+ <a class="button" href="[% mkurl('', {long_facet => long_facets.merge([long_key])}) %]">[% l("More") %]</a>
[% END %]
- </span>
<div class="title">[% facet.cmf.label %]</div>
</div>
- [% IF !close_facets.grep(close_key).0 %]
<div class="box_wrapper">
<div class="box">
[% FOR facet_data IN facet.data;
@@ -91,6 +86,16 @@ FOR facet IN sorted_facets;
new_facets.push(selected);
END;
END;
+
+ display_count_by_cmf.$fid = display_count_by_cmf.$fid || 0;
+
+ NEXT UNLESS long_facets.grep(long_key).0 OR
+ display_count_by_cmf.$fid < DEFAULT_DISPLAY_COUNT;
+
+ # fix syntax highlighting: >
+
+ display_count_by_cmf.$fid = display_count_by_cmf.$fid + 1;
+
IF this_selected;
# This facet is already selected by the user.
# Link removes the facet from the set of selected facets.
@@ -122,7 +127,6 @@ FOR facet IN sorted_facets;
[% END %]
</div>
</div> <!-- box_wrapper -->
- [% END %]
</div> <!-- facet_box_temp -->
[% END %]
</div> <!-- facet_box_wrapper -->
diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css
index 6704721..2115114 100644
--- a/Open-ILS/web/css/skin/default/opac/style.css
+++ b/Open-ILS/web/css/skin/default/opac/style.css
@@ -1049,9 +1049,12 @@ div.facet_sidebar {
overflow:hidden;
}
-.facet_box_temp .header .button {
- float:right;
- padding-right:6px;
+
+.facet_box_temp .header a.button {
+ float:right;
+ padding-top:6px;
+ padding-right:6px;
+ color:#fffffF;
}
.facet_box_wrapper .box_wrapper {
-----------------------------------------------------------------------
Summary of changes:
.../perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm | 10 +++-
Open-ILS/src/templates/opac/parts/config.tt2 | 1 +
.../src/templates/opac/parts/result/facets.tt2 | 58 +++++++++++---------
Open-ILS/web/css/skin/default/opac/style.css | 9 ++-
4 files changed, 46 insertions(+), 32 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list