blacklight_facet_extras 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -0,0 +1,33 @@
1
+ <%- # local params:
2
+ # label
3
+ # display_label
4
+ # options =>
5
+ # :remove => url for a remove constraint link
6
+ # :classes => array of classes to add to container span
7
+ options ||= {}
8
+ options[:escape_label] = true unless options.has_key?(:escape_label)
9
+ options[:escape_value] = true unless options.has_key?(:escape_value)
10
+ -%>
11
+
12
+ <span class="appliedFilter constraint <%= options[:classes].join(" ") if options[:classes] %>">
13
+ <%- unless label.blank? -%>
14
+ <span class="filterName"><%= options[:escape_label] ? h(label) : raw(label) %></span>
15
+ <%- end -%>
16
+ <%- unless display_label.blank? -%>
17
+ <span class="filterValue"><%= options[:escape_value] ? h(display_label) : raw(display_label) %></span>
18
+ <%- end -%>
19
+ <%- unless options[:remove].blank? -%>
20
+ <% accessible_remove_label =
21
+ if label.blank?
22
+ "Remove constraint #{options[:escape_value] ? h(display_label) : display_label}"
23
+ else
24
+ "Remove constraint #{options[:escape_value] ? h(label) : label}: #{options[:escape_value] ? h(display_label) : display_label}"
25
+ end
26
+ %>
27
+ <%= link_to(accessible_remove_label,
28
+ options[:remove],
29
+ :class=>'btnRemove imgReplace',
30
+ :alt=>'remove'
31
+ ) %>
32
+ <%- end -%>
33
+ </span>
@@ -5,6 +5,7 @@ module BlacklightFacetExtras::Filter::ControllerExtension
5
5
  def self.included(some_class)
6
6
  some_class.send :include,BlacklightFacetExtras::ControllerExtension
7
7
  some_class.helper_method :facet_filter_config
8
+ some_class.helper_method :blacklight_filter_config
8
9
  some_class.helper BlacklightFacetExtras::Filter::ViewHelperExtension
9
10
  end
10
11
  def facet_filter_config(solr_field)
@@ -15,4 +15,15 @@ module BlacklightFacetExtras::Filter::ViewHelperExtension
15
15
 
16
16
  facet_field
17
17
  end
18
+
19
+ def render_constraint_element(label, value, options = {})
20
+ options[:classes] ||= []
21
+ config = blacklight_filter_config.keys.select { |y| options[:classes].include? "filter-#{y.parameterize}" }.first
22
+ return super(label, value, options) unless config
23
+
24
+ display_label = blacklight_filter_config[config].call(value)
25
+ display_label = value if label === true
26
+ return ''.html_safe if label.blank?
27
+ render(:partial => "catalog/filter_constraints_element", :locals => {:label => label, :display_label => display_label, :value => value, :options => options})
28
+ end
18
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_facet_extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-29 00:00:00.000000000 -04:00
13
- default_executable:
12
+ date: 2011-10-14 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
- requirement: &2168700020 !ruby/object:Gem::Requirement
16
+ requirement: &2152062460 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '3.0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2168700020
24
+ version_requirements: *2152062460
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: blacklight
28
- requirement: &2168699600 !ruby/object:Gem::Requirement
27
+ requirement: &2152061960 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,7 +32,7 @@ dependencies:
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: *2168699600
35
+ version_requirements: *2152061960
37
36
  description:
38
37
  email:
39
38
  - chris_beer@wgbh.org
@@ -49,6 +48,7 @@ files:
49
48
  - app/views/catalog/_facet_partials/_pivot.html.erb
50
49
  - app/views/catalog/_facet_partials/_query.html.erb
51
50
  - app/views/catalog/_facet_partials/_range.html.erb
51
+ - app/views/catalog/_filter_constraints_element.html.erb
52
52
  - app/views/catalog/_hierarchical_constraints_element.html.erb
53
53
  - assets/javascripts/blacklight_facet_extras.js
54
54
  - assets/stylesheets/blacklight_facet_extras.css
@@ -78,7 +78,6 @@ files:
78
78
  - lib/blacklight_facet_extras/tag/view_helper_extension.rb
79
79
  - lib/blacklight_facet_extras/version.rb
80
80
  - lib/blacklight_facet_extras/view_helper_extension.rb
81
- has_rdoc: true
82
81
  homepage: http://projectblacklight.org/
83
82
  licenses: []
84
83
  post_install_message:
@@ -99,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
98
  version: '0'
100
99
  requirements: []
101
100
  rubyforge_project: blacklight
102
- rubygems_version: 1.6.2
101
+ rubygems_version: 1.8.10
103
102
  signing_key:
104
103
  specification_version: 3
105
104
  summary: Blacklight facet extras plugin