templus_models 2.0.14 → 2.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa21c229faa68ac0391b4c89acadf0052db3abbb
4
- data.tar.gz: 1088f6449ad2850d571b9a32a5dd8fd53776e1a4
3
+ metadata.gz: c4c3261e33c32d29539818bc4f9df911b5ea8105
4
+ data.tar.gz: 0eed8196e4d499761c82238ed5843f99c6c84b4d
5
5
  SHA512:
6
- metadata.gz: f11e309a014478406d44236ac2fc3b31ebbf2a20c04ee37b90054f7e562bdda6dbe2c716c71134a295b52ad8a9501780fd11e87197a95a81af330d1a6ee7927e
7
- data.tar.gz: 760c77819cf75d0caf4b40143dd2649844674e2ff9e11d7ac070e5a75f4692a65e5ddece225dd56d9e0bd5a5c63393d6425fcd7be7b2574e147c7962dfe5277f
6
+ metadata.gz: 5d6d65de90ec66af6bbc6bd221757061cf28a3ed562f5decdf9dcb915282e0ae5e829c20eb7b9be1148fd4454c8f12d45977dc717418ea22502367d68c913c60
7
+ data.tar.gz: df420b44e56be37579c29a69cfcdfd8546234de5d03a40e79deb7a76d198f6b92be744f6adc27c1971c8f0f2b5194c07860b33b9746f42f87f5fc3fbe8f9d68a
@@ -8,6 +8,7 @@ class CrudController < ApplicationController
8
8
  else
9
9
  @q = @model.search(params[:q])
10
10
  end
11
+
11
12
  if @q.sorts.empty?
12
13
  if @crud_helper.order_field.to_s.include?("desc") || @crud_helper.order_field.to_s.include?("asc")
13
14
  @q.sorts = @crud_helper.order_field.to_s
@@ -15,10 +16,11 @@ class CrudController < ApplicationController
15
16
  @q.sorts = "#{@crud_helper.order_field} asc"
16
17
  end
17
18
  end
19
+
18
20
  if respond_to?(:current_usuario)
19
- @records = @q.result.accessible_by(current_ability, :read).page(params[:page]).per(@crud_helper.per_page)
21
+ @records = @q.result.accessible_by(current_ability, :read).uniq.page(params[:page]).per(@crud_helper.per_page)
20
22
  else
21
- @records = @q.result.page(params[:page]).per(@crud_helper.per_page)
23
+ @records = @q.result.uniq.page(params[:page]).per(@crud_helper.per_page)
22
24
  end
23
25
  @titulo = @model.name.pluralize
24
26
  render partial: 'records' if request.respond_to?(:wiselinks_partial?) && request.wiselinks_partial?
@@ -123,11 +125,13 @@ class CrudController < ApplicationController
123
125
  @q = @model.search(params[:q])
124
126
  end
125
127
  @q.sorts = 'updated_at desc' if @q.sorts.empty?
128
+
126
129
  if respond_to?(:current_usuario)
127
- results = @q.result.accessible_by(current_ability).page(params[:page])
130
+ results = @q.result.accessible_by(current_ability).uniq.page(params[:page])
128
131
  else
129
- results = @q.result.page(params[:page])
132
+ results = @q.result.uniq.page(params[:page])
130
133
  end
134
+
131
135
  instance_variable_set("@#{params[:var]}", results)
132
136
  if request.respond_to?(:wiselinks_partial?) && request.wiselinks_partial?
133
137
  render :partial => params[:partial]
@@ -144,9 +148,9 @@ class CrudController < ApplicationController
144
148
  @q = @model.search(parametros)
145
149
  @q.sorts = 'updated_at desc' if @q.sorts.empty?
146
150
  if respond_to?(:current_usuario)
147
- results = @q.result.accessible_by(current_ability).page(params[:page])
151
+ results = @q.result.accessible_by(current_ability).uniq.page(params[:page])
148
152
  else
149
- results = @q.result.page(params[:page])
153
+ results = @q.result.uniq.page(params[:page])
150
154
  end
151
155
  if valid_instance_method?(params[:label])
152
156
  method_label = params[:label]
@@ -163,6 +167,7 @@ class CrudController < ApplicationController
163
167
  else
164
168
  @q = @model.search(params[:q])
165
169
  end
170
+
166
171
  if @q.sorts.empty?
167
172
  if @crud_helper.order_field.to_s.include?("desc") || @crud_helper.order_field.to_s.include?("asc")
168
173
  @q.sorts = @crud_helper.order_field.to_s
@@ -170,10 +175,11 @@ class CrudController < ApplicationController
170
175
  @q.sorts = "#{@crud_helper.order_field} asc"
171
176
  end
172
177
  end
178
+
173
179
  if respond_to?(:current_usuario)
174
- @records = @q.result.accessible_by(current_ability)
180
+ @records = @q.result.uniq.accessible_by(current_ability)
175
181
  else
176
- @records = @q.result
182
+ @records = @q.result.uniq
177
183
  end
178
184
  report_name = "#{@crud_helper.title}_#{DateTime.now.strftime('%Y%m%d')}"
179
185
  respond_to do |format|
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "2.0.14"
2
+ VERSION = "2.0.15"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: templus_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.14
4
+ version: 2.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Sol
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-28 00:00:00.000000000 Z
13
+ date: 2018-01-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -981,7 +981,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
981
981
  version: '0'
982
982
  requirements: []
983
983
  rubyforge_project:
984
- rubygems_version: 2.6.8
984
+ rubygems_version: 2.6.13
985
985
  signing_key:
986
986
  specification_version: 4
987
987
  summary: Easy CRUD generator for Rails Projects