standard_view 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/application/_filter.html.erb +20 -0
- data/app/views/standard_view/_index.html.erb +7 -17
- data/config/locales/en.yml +2 -0
- data/lib/standard_view/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62f8b997437730cd005a5e84de2037af5d588cf589f6ef412fedfd1ac3eb4714
|
4
|
+
data.tar.gz: 730047005e6d791328033a9dc2e938e97cc9c071c407d72465d43201cd5689fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e68d3e09d2aef86136217f922758a993b9d98743bf3b9901824a9b620331bd386b226ddbef020688ddb99b8cb977a7939808e351ab0e8ac86b3d8eebdff5b0
|
7
|
+
data.tar.gz: 8052a5f7456591ffe524025c086786c7405502da3d800082542eaaad8511887ec806676c08801c11d225145a6744b9741047219f5fe494cd8cfd859bbfac0fe2
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% has_default = facet.default_filter? %>
|
2
|
+
<% without_filter = params[:filter].blank? %>
|
3
|
+
<% is_all = has_default ? params[:all].present? : without_filter %>
|
4
|
+
<ul class="nav nav-pills justify-content-end">
|
5
|
+
<li class="nav-item">
|
6
|
+
<span class="nav-link"><%= icon_for(:filter) %></span>
|
7
|
+
</li>
|
8
|
+
<li class="nav-item">
|
9
|
+
<% all_params = {}.tap { |h| h[:all] = true if has_default } %>
|
10
|
+
<%= link_to t("common.all"), params.permit(:page).merge(all_params), class: "nav-link #{"active" if is_all}" %>
|
11
|
+
</li>
|
12
|
+
<% list.filter_values.each do |value, label| %>
|
13
|
+
<% is_default = value == facet.default_filter.to_s %>
|
14
|
+
<% is_active = is_default ? (without_filter && !is_all) : params[:filter] == value %>
|
15
|
+
<% filter_params = {}.tap { |h| h[:filter] = value unless is_default } %>
|
16
|
+
<li class="nav-item">
|
17
|
+
<%= link_to label, params.permit(:page).merge(filter_params), class: "nav-link #{"active" if is_active}" %>
|
18
|
+
</li>
|
19
|
+
<% end %>
|
20
|
+
</ul>
|
@@ -9,7 +9,8 @@
|
|
9
9
|
<% if local_assigns[:facet].nil? %>
|
10
10
|
<% facet_name = is_nested ? action_name : controller_name %>
|
11
11
|
<% facet_class = local_assigns[:facet_class].presence || "#{facet_name.singularize.camelize}Facet".constantize %>
|
12
|
-
<%
|
12
|
+
<% filter_arguments = { filter_by: params[:filter], all: params[:all].present? } %>
|
13
|
+
<% facet = facet_class.new(current_page: current_page, source: facet_source, **filter_arguments) %>
|
13
14
|
<% end %>
|
14
15
|
|
15
16
|
<% if local_assigns[:list].nil? %>
|
@@ -52,26 +53,15 @@
|
|
52
53
|
|
53
54
|
<% unless content_for?(:page_content) %>
|
54
55
|
<% content_for(:page_content) do %>
|
55
|
-
|
56
|
-
|
56
|
+
<% if content_for?(:subnav_content) || list.filter_field? %>
|
57
|
+
<%= content_for(:subnav_content) if content_for?(:subnav_content) %>
|
58
|
+
<%= render "filter", list: list, facet: facet if list.filter_field? %>
|
57
59
|
|
58
|
-
|
59
|
-
|
60
|
-
<%# end %>
|
61
|
-
<!-- <hr>-->
|
62
|
-
<%# end %>
|
60
|
+
<hr>
|
61
|
+
<% end %>
|
63
62
|
|
64
63
|
<div class="row">
|
65
64
|
<div class="col-12">
|
66
|
-
<%# filtered_collection = collection %>
|
67
|
-
<%# if uses_filter %>
|
68
|
-
<%# if params[:filter].present? %>
|
69
|
-
<%# filtered_collection = filtered_collection.public_send(params[:filter].to_sym) %>
|
70
|
-
<%# elsif has_filter_default && !params[:all].present? %>
|
71
|
-
<%# filtered_collection = filtered_collection.public_send(filter_default) %>
|
72
|
-
<%# end %>
|
73
|
-
<%# end %>
|
74
|
-
|
75
65
|
<%= render "standard_view/paginated_collection", list: list, is_filtered: facet.filtered? %>
|
76
66
|
</div>
|
77
67
|
</div>
|
data/config/locales/en.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standard_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Garside
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-05-
|
12
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.3.
|
34
|
+
version: 0.3.9
|
35
35
|
- - "<"
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '1.0'
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.3.
|
44
|
+
version: 0.3.9
|
45
45
|
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- app/helpers/standard_view/navigation_helper.rb
|
277
277
|
- app/views/application/_attribute_card_value.html.erb
|
278
278
|
- app/views/application/_attributes_card.html.erb
|
279
|
+
- app/views/application/_filter.html.erb
|
279
280
|
- app/views/application/_flash_messages.html.erb
|
280
281
|
- app/views/application/_icon.html.erb
|
281
282
|
- app/views/application/_javascripts.html.erb
|