express_admin 1.7.28 → 1.7.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/express_admin/components/_filter.sass +17 -0
- data/app/assets/stylesheets/express_admin/screen.sass +1 -0
- data/app/components/express_admin/collection_filter.rb +31 -0
- data/lib/express_admin/standard_actions.rb +26 -6
- data/lib/express_admin/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8cec8a16d8b19753bb84b13648532cf14f696f
|
4
|
+
data.tar.gz: 47d9fe386d1018d71caa8548da23340b16f92c18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe38c39fc5686864203803f68ae1611a89c324bac1c96411d1cb1961fc06511463b176b54bd64396fda049ae43f8078fcda8f872d02ed247322b48ae4bdc1321
|
7
|
+
data.tar.gz: 4d38dd9c209e8f3149ad44d9cd4110fdc22c5615518b9c3bf0bac949181d368559cdc9331ee69923bd10397c46d66316aeadca0039a348a40fd0875b05e01413
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.filter-tag
|
2
|
+
a
|
3
|
+
color: white
|
4
|
+
font-size: 1.2em
|
5
|
+
text-transform: none
|
6
|
+
|
7
|
+
.filter-criteria
|
8
|
+
float: right
|
9
|
+
display: block
|
10
|
+
margin-left: 1em
|
11
|
+
margin-right: 1em
|
12
|
+
margin-top: 1em
|
13
|
+
|
14
|
+
.content-title
|
15
|
+
display: inline
|
16
|
+
float: left
|
17
|
+
padding-left: 8px
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module ExpressAdmin
|
2
|
+
module Components
|
3
|
+
module Controls
|
4
|
+
class CollectionFilter < ExpressTemplates::Components::Configurable
|
5
|
+
include ExpressTemplates::Components::Capabilities::Resourceful
|
6
|
+
|
7
|
+
tag :span
|
8
|
+
|
9
|
+
before_build {
|
10
|
+
add_class 'filter-criteria'
|
11
|
+
}
|
12
|
+
|
13
|
+
contains -> {
|
14
|
+
if _filter_column
|
15
|
+
text_node "Filter: "
|
16
|
+
span(class: 'label filter-tag') {
|
17
|
+
icon_link(:'android-cancel', text: helpers.params[:filter][_filter_column],
|
18
|
+
href: log_entries_path(filter: {}),
|
19
|
+
right: true)
|
20
|
+
}
|
21
|
+
end
|
22
|
+
}
|
23
|
+
|
24
|
+
private
|
25
|
+
def _filter_column
|
26
|
+
helpers.params[:filter].try(:keys).try(:first)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -237,14 +237,33 @@ module ExpressAdmin
|
|
237
237
|
else
|
238
238
|
resource_class
|
239
239
|
end
|
240
|
-
|
241
|
-
scope =
|
242
|
-
|
243
|
-
self.instance_variable_set(collection_ivar, scope)
|
240
|
+
filtered_scope = filter(scope) # TODO: Removed the conditionally invoked .all
|
241
|
+
# scope = params[:asc] || params[:desc] ? sort_table(scope) : scope
|
242
|
+
self.instance_variable_set(collection_ivar, filtered_scope)
|
244
243
|
end
|
245
244
|
|
246
|
-
def
|
247
|
-
|
245
|
+
def filter(scope)
|
246
|
+
if _filter_field
|
247
|
+
scope.kind_of?(Array) ? _array_filter(scope) : _sql_filter(scope)
|
248
|
+
else
|
249
|
+
scope
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
def _filter_field
|
254
|
+
params[:filter] ? params[:filter].keys.first : nil
|
255
|
+
end
|
256
|
+
|
257
|
+
def _filter_value
|
258
|
+
params[:filter][_filter_field]
|
259
|
+
end
|
260
|
+
|
261
|
+
def _array_filter(list)
|
262
|
+
list.select {|item| item.send(_filter_field).eql?(_filter_value)}
|
263
|
+
end
|
264
|
+
|
265
|
+
def _sql_filter(scope)
|
266
|
+
scope.where(_filter_field.to_sym => _filter_value)
|
248
267
|
end
|
249
268
|
|
250
269
|
def sort_table(scope)
|
@@ -257,6 +276,7 @@ module ExpressAdmin
|
|
257
276
|
end
|
258
277
|
end
|
259
278
|
|
279
|
+
# TODO: Refactor.
|
260
280
|
def search?(scope)
|
261
281
|
params[:search_string].present? ? search(scope) : scope
|
262
282
|
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: express_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Talcott Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: express_templates
|
@@ -399,6 +399,7 @@ files:
|
|
399
399
|
- app/assets/stylesheets/express_admin/components/_command_button.sass
|
400
400
|
- app/assets/stylesheets/express_admin/components/_definition.sass
|
401
401
|
- app/assets/stylesheets/express_admin/components/_empty_state.sass
|
402
|
+
- app/assets/stylesheets/express_admin/components/_filter.sass
|
402
403
|
- app/assets/stylesheets/express_admin/components/_h_box.sass
|
403
404
|
- app/assets/stylesheets/express_admin/components/_image.sass
|
404
405
|
- app/assets/stylesheets/express_admin/components/_label.sass
|
@@ -438,6 +439,7 @@ files:
|
|
438
439
|
- app/assets/stylesheets/express_admin/shared/_widgets.sass
|
439
440
|
- app/assets/stylesheets/ionicons/ionicons.scss
|
440
441
|
- app/components/express_admin/code_editor.rb
|
442
|
+
- app/components/express_admin/collection_filter.rb
|
441
443
|
- app/components/express_admin/command_button.rb
|
442
444
|
- app/components/express_admin/command_button_list.rb
|
443
445
|
- app/components/express_admin/country_select.rb
|
@@ -647,7 +649,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
647
649
|
version: '0'
|
648
650
|
requirements: []
|
649
651
|
rubyforge_project:
|
650
|
-
rubygems_version: 2.
|
652
|
+
rubygems_version: 2.4.7
|
651
653
|
signing_key:
|
652
654
|
specification_version: 4
|
653
655
|
summary: ExpressAdmin provides an admin menu framework based on Foundation.
|