effective_datatables 1.0.0 → 1.0.1
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: 86c4a4ce9bbbe51c5b6a37624ab041e0150130a7
|
4
|
+
data.tar.gz: 5601231c343b39b14aeb87b5e5e04c7086f26c4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4a50e770e239cbef09f544414d4f18a78471140e456309536672e61e40e192de1c2e5ad25d7e98ae9d4fc8e1964c4c3e3a8649e639fb8cb4442b14eb87bd65e
|
7
|
+
data.tar.gz: 8edc669655778534cddfc4e74e31811740759574d0f0597b2e2b033211084014a397340e14a9b48177f499c02009538658d4c883ccb7682ac65f5b9ff30857ea
|
data/README.md
CHANGED
@@ -184,11 +184,25 @@ or (complex example):
|
|
184
184
|
|
185
185
|
```ruby
|
186
186
|
def collection
|
187
|
-
|
188
|
-
.joins(
|
189
|
-
.
|
190
|
-
.
|
191
|
-
.
|
187
|
+
collection = Effective::Order.unscoped.purchased
|
188
|
+
.joins(:user)
|
189
|
+
.joins(:order_items)
|
190
|
+
.group('users.email')
|
191
|
+
.group('orders.id')
|
192
|
+
.select('users.email AS email')
|
193
|
+
.select('orders.*')
|
194
|
+
.select("#{query_total} AS total")
|
195
|
+
.select("string_agg(order_items.title, '!!OI!!') AS order_items")
|
196
|
+
|
197
|
+
if attributes[:user_id].present?
|
198
|
+
collection.where(:user_id => attributes[:user_id])
|
199
|
+
else
|
200
|
+
collection
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def query_total
|
205
|
+
"SUM((order_items.price * order_items.quantity) + (CASE order_items.tax_exempt WHEN true THEN 0 ELSE ((order_items.price * order_items.quantity) * order_items.tax_rate) END))"
|
192
206
|
end
|
193
207
|
```
|
194
208
|
|
@@ -6,7 +6,7 @@ module Effective
|
|
6
6
|
@datatable = Effective::Datatable.find(params[:id], params[:attributes])
|
7
7
|
@datatable.view = view_context if @datatable.present?
|
8
8
|
|
9
|
-
EffectiveDatatables.authorized?(self, :index, @datatable.collection_class)
|
9
|
+
EffectiveDatatables.authorized?(self, :index, @datatable.try(:collection_class) || Effective::Datatable)
|
10
10
|
|
11
11
|
respond_to do |format|
|
12
12
|
format.html
|
@@ -164,13 +164,13 @@ module Effective
|
|
164
164
|
col = collection
|
165
165
|
|
166
166
|
if active_record_collection?
|
167
|
-
self.total_records = (
|
167
|
+
self.total_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col.to_sql}) AS datatables_count").first['count'] rescue 1)
|
168
168
|
|
169
169
|
col = table_tool.order(col)
|
170
170
|
col = table_tool.search(col)
|
171
171
|
|
172
172
|
if table_tool.search_terms.present? && array_tool.search_terms.blank?
|
173
|
-
self.display_records = (
|
173
|
+
self.display_records = (collection_class.connection.execute("SELECT COUNT(*) FROM (#{col.to_sql}) AS datatables_count").first['count'] rescue 1)
|
174
174
|
end
|
175
175
|
else
|
176
176
|
self.total_records = col.size
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_datatables
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
174
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.2.0
|
176
176
|
signing_key:
|
177
177
|
specification_version: 4
|
178
178
|
summary: Uniquely powerful server-side searching, sorting and filtering of any ActiveRecord
|