smarter_listing 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a4b098e6859a2cc16de163f6295db108c24b812
|
4
|
+
data.tar.gz: cc45839c66358ba89e81e3f71f63e4ac2f5e7de4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1f2c8967b4d98c2ba1123633f17628eef0165b2d5d5c0148168d8d53f22000d6b834fe3ed968724dbe4d64e516ae3ca26d749f9cf718ad296b074890b837150
|
7
|
+
data.tar.gz: ca8e4850691842b0c13bd99bb3f6435ad60c8797215ef6a455d2fc92cec61d89614d2d1b410ff98801d4e6f58c7fdb85cb5380e1fe94c41d4084b00af4fcac38
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<%=link_to action[:custom_url], {
|
1
|
+
<%= link_to *[action[:custom_url], {title: action[:custom_title], remote: true, method: :patch, class: action[:name]}, action[:html_options]].compact do %>
|
2
2
|
<i class="<%= action[:custom_icon] %>"></i>
|
3
3
|
<% end %>
|
@@ -1 +1,2 @@
|
|
1
|
-
<%= smart_listing_item collection_sym, :create, resource, resource.valid? ? "#{resource_view_path}/#{table_name.to_s.singularize}" : "#{resource_view_path}/form.html" %>
|
1
|
+
<%= smart_listing_item collection_sym, :create, resource, resource.valid? ? "#{resource_view_path}/#{table_name.to_s.singularize}" : "#{resource_view_path}/form.html" %>
|
2
|
+
<%== render 'smarter_listing/form_logic' unless resource.valid? %>
|
@@ -1 +1,2 @@
|
|
1
|
-
<%= smart_listing_item collection_sym, :update, resource, resource.valid? ? "#{resource_view_path}/#{model.name.demodulize.underscore}" : "#{resource_view_path}/form.html" %>
|
1
|
+
<%= smart_listing_item collection_sym, :update, resource, resource.valid? ? "#{resource_view_path}/#{model.name.demodulize.underscore}" : "#{resource_view_path}/form.html" %>
|
2
|
+
<%== render 'smarter_listing/form_logic' unless resource.valid? %>
|
@@ -53,12 +53,25 @@ module SmarterListing::ControllerExtension
|
|
53
53
|
render 'smarter_listing/destroy'
|
54
54
|
end
|
55
55
|
|
56
|
+
def restore
|
57
|
+
resource.current_user = current_user if resource.respond_to?(:current_user=)
|
58
|
+
resource.restore!
|
59
|
+
index
|
60
|
+
end
|
61
|
+
|
56
62
|
def filter_parameter
|
57
63
|
self.class.instance_variable_get :@filter_parameter
|
58
64
|
end
|
59
65
|
|
60
66
|
def filtered(model)
|
61
|
-
results = model.
|
67
|
+
results = if params[:show_deleted] == "1" && model.instance_methods.include?(:deleted?)
|
68
|
+
if model.column_names.include?("deleted_at")
|
69
|
+
model.only_deleted
|
70
|
+
else
|
71
|
+
results.map(&:deleted?)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
results ||= model.all
|
62
75
|
unless params[filter_parameter].blank?
|
63
76
|
if model.respond_to?(:search)
|
64
77
|
results = results.search { fulltext "#{params[filter_parameter]}" }.results
|
@@ -66,13 +79,6 @@ module SmarterListing::ControllerExtension
|
|
66
79
|
results = results.where("name LIKE ?", "%#{params[filter_parameter]}%")
|
67
80
|
end
|
68
81
|
end
|
69
|
-
if params[:show_deleted] == "1" && model.instance_methods.include?(:deleted?)
|
70
|
-
if model.column_names.include?("deleted_at")
|
71
|
-
results = results.where.not(deleted_at: nil)
|
72
|
-
else
|
73
|
-
results = results.where.not(status: model.statuses[:deleted])
|
74
|
-
end
|
75
|
-
end
|
76
82
|
results
|
77
83
|
end
|
78
84
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smarter_listing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Sprauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|