templus_models 3.0.17 → 3.0.19
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba2c9b6e98d4eb10bda335f5153fb63a33acb7b0d273f6b5de29e426b2785421
|
4
|
+
data.tar.gz: b9e858f0d3cbaa70ca5cbacfbb83e6e44736fa6b0550c6ac3dfb8ee1688e4f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f48beda05e9d271ce7811f2a147beee85e7cab5cdd056cc861285daa78e58fa7f1d5b6b7cb3e3b2dece5713c6b5930a3448d02c5272b4a1eb233680c5ee32753
|
7
|
+
data.tar.gz: 1c6bd572c9a7d6efeaf8b5b0b2df96fdce9d20b85bddec3fe2cdba5efe30f735c74b9ecb047419d05701c6d9685ea48642fcd5f8f482cfb73fab0cea90f71ec6
|
@@ -5,9 +5,9 @@ class CrudController < ApplicationController
|
|
5
5
|
def index
|
6
6
|
authorize! :read, @model_permission if respond_to?(:current_usuario)
|
7
7
|
if params[:scope].present? && valid_method?(params[:scope])
|
8
|
-
@q = @model.send(params[:scope]).
|
8
|
+
@q = @model.send(params[:scope]).ransack(params[:q])
|
9
9
|
else
|
10
|
-
@q = @model.
|
10
|
+
@q = @model.ransack(params[:q])
|
11
11
|
end
|
12
12
|
if @q.sorts.empty?
|
13
13
|
if @crud_helper.order_field.to_s.include?("desc") || @crud_helper.order_field.to_s.include?("asc")
|
@@ -119,9 +119,9 @@ class CrudController < ApplicationController
|
|
119
119
|
authorize! :read, @model_permission if respond_to?(:current_usuario)
|
120
120
|
@resource = @model
|
121
121
|
if params[:scope].present? && valid_method?(params[:scope])
|
122
|
-
@q = @model.send(params[:scope]).
|
122
|
+
@q = @model.send(params[:scope]).ransack(params[:q])
|
123
123
|
else
|
124
|
-
@q = @model.
|
124
|
+
@q = @model.ransack(params[:q])
|
125
125
|
end
|
126
126
|
@q.sorts = 'updated_at desc' if @q.sorts.empty?
|
127
127
|
if respond_to?(:current_usuario)
|
@@ -142,7 +142,7 @@ class CrudController < ApplicationController
|
|
142
142
|
authorize! :read, @model if respond_to?(:current_usuario)
|
143
143
|
parametros = {}
|
144
144
|
parametros["#{params[:campo]}_#{params[:tipo]}"] = params[:term]
|
145
|
-
@q = @model.
|
145
|
+
@q = @model.ransack(parametros)
|
146
146
|
@q.sorts = 'updated_at desc' if @q.sorts.empty?
|
147
147
|
if respond_to?(:current_usuario)
|
148
148
|
results = @q.result.accessible_by(current_ability).page(params[:page])
|
@@ -160,9 +160,9 @@ class CrudController < ApplicationController
|
|
160
160
|
def listing
|
161
161
|
authorize! :read, @model_permission if respond_to?(:current_usuario)
|
162
162
|
if params[:scope].present? && valid_method?(params[:scope])
|
163
|
-
@q = @model.send(params[:scope]).
|
163
|
+
@q = @model.send(params[:scope]).ransack(params[:q])
|
164
164
|
else
|
165
|
-
@q = @model.
|
165
|
+
@q = @model.ransack(params[:q])
|
166
166
|
end
|
167
167
|
if @q.sorts.empty?
|
168
168
|
if @crud_helper.order_field.to_s.include?("desc") || @crud_helper.order_field.to_s.include?("asc")
|
@@ -223,7 +223,7 @@ class CrudController < ApplicationController
|
|
223
223
|
end
|
224
224
|
c_helper = Module.const_get(params[:model].camelize).reflect_on_association(params[:associacao]).class_name
|
225
225
|
@crud_helper = Module.const_get("#{c_helper}Crud") unless params[:render] == "modal" and params[:action] == "new"
|
226
|
-
@url = crud_associacao_models_path(model: params[:model], id: params[:id], associacao: params[:associacao], page: params[:page], q: params[:q])
|
226
|
+
@url = crud_associacao_models_path(model: params[:model], id: params[:id], associacao: params[:associacao], page: params[:page], q: params[:q].try(:to_unsafe_h))
|
227
227
|
@clean_url = crud_associacao_models_path(model: params[:model], id: params[:id], associacao: params[:associacao])
|
228
228
|
@model_permission = c_helper.constantize
|
229
229
|
@id = params[:associacao_id] if params[:associacao_id]
|
@@ -231,7 +231,7 @@ class CrudController < ApplicationController
|
|
231
231
|
@model = Module.const_get(params[:model].camelize)
|
232
232
|
@model_permission = @model
|
233
233
|
@crud_helper = Module.const_get("#{params[:model]}_crud".camelize) unless params[:render] == "modal" and params[:action] == "new"
|
234
|
-
@url = crud_models_path(model: params[:model], page: params[:page], q: params[:q])
|
234
|
+
@url = crud_models_path(model: params[:model], page: params[:page], q: params[:q].try(:to_unsafe_h))
|
235
235
|
@clean_url = crud_models_path(model: params[:model])
|
236
236
|
@id = params[:id] if params[:id]
|
237
237
|
end
|
@@ -13,15 +13,15 @@
|
|
13
13
|
<%unless params[:render] == 'modal'%>
|
14
14
|
<% if @record.new_record? %>
|
15
15
|
<% if @crud_associacao.present? %>
|
16
|
-
<% url = create_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], page: params[:page], q: params[:q]) %>
|
16
|
+
<% url = create_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], page: params[:page], q: params[:q].try(:to_unsafe_h)) %>
|
17
17
|
<% else %>
|
18
|
-
<% url = create_crud_path(model: @model.name.underscore, page: params[:page], q: params[:q]) %>
|
18
|
+
<% url = create_crud_path(model: @model.name.underscore, page: params[:page], q: params[:q].try(:to_unsafe_h)) %>
|
19
19
|
<% end %>
|
20
20
|
<% else %>
|
21
21
|
<% if @crud_associacao.present? %>
|
22
|
-
<% url = update_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]) %>
|
22
|
+
<% url = update_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)) %>
|
23
23
|
<% else %>
|
24
|
-
<% url = update_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q]) %>
|
24
|
+
<% url = update_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)) %>
|
25
25
|
<% end %>
|
26
26
|
<% end %>
|
27
27
|
<% remote_form = false%>
|
@@ -87,7 +87,7 @@
|
|
87
87
|
<% if action[:options].present? && action[:options][:wiselink].present? && action[:options][:wiselink] %>
|
88
88
|
<% data = {push: "partial", target: "#form"} %>
|
89
89
|
<% end %>
|
90
|
-
<%= link_to I18n.t(action[:desc]), action_crud_path(model: @model.name.underscore, id: record.id, acao: action[:method], page: params[:page], q: params[:q]), class: "btn btn-primary btn-xs", data: data || {} %>
|
90
|
+
<%= link_to I18n.t(action[:desc]), action_crud_path(model: @model.name.underscore, id: record.id, acao: action[:method], page: params[:page], q: params[:q].try(:to_unsafe_h)), class: "btn btn-primary btn-xs", data: data || {} %>
|
91
91
|
<% end %>
|
92
92
|
<% end %>
|
93
93
|
<% @crud_helper.actions_links.each do |name, options| %>
|
@@ -122,25 +122,25 @@
|
|
122
122
|
<% if @crud_helper.view_action && should_view?(@crud_helper, record) %>
|
123
123
|
<% link_text = TemplusModels.configuration.usar_icones ? "<i class='fa fa-eye'></i>".html_safe : I18n.t("view") %>
|
124
124
|
<% if @crud_associacao.present? %>
|
125
|
-
<%= link_to link_text, crud_associacao_model_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
125
|
+
<%= link_to link_text, crud_associacao_model_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
126
126
|
<% else %>
|
127
|
-
<%= link_to link_text, crud_model_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
127
|
+
<%= link_to link_text, crud_model_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
128
128
|
<% end %>
|
129
129
|
<% end %>
|
130
130
|
<% if @crud_helper.edit_action && should_edit?(@crud_helper, record) %>
|
131
131
|
<% link_text = TemplusModels.configuration.usar_icones ? "<i class='fa fa-edit'></i>".html_safe : I18n.t("edit") %>
|
132
132
|
<% if @crud_associacao.present? %>
|
133
|
-
<%= link_to link_text, edit_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
133
|
+
<%= link_to link_text, edit_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
134
134
|
<% else %>
|
135
|
-
<%= link_to link_text, edit_crud_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
135
|
+
<%= link_to link_text, edit_crud_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
136
136
|
<% end %>
|
137
137
|
<% end %>
|
138
138
|
<% if @crud_helper.destroy_action && should_destroy?(@crud_helper, record) %>
|
139
139
|
<% link_text = TemplusModels.configuration.usar_icones ? "<i class='fa fa-trash'></i>".html_safe : I18n.t("destroy") %>
|
140
140
|
<% if @crud_associacao.present? %>
|
141
|
-
<%= link_to link_text, destroy_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
141
|
+
<%= link_to link_text, destroy_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-danger btn-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
142
142
|
<% else %>
|
143
|
-
<%= link_to link_text, destroy_crud_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
143
|
+
<%= link_to link_text, destroy_crud_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-danger btn-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
144
144
|
<% end %>
|
145
145
|
<% end %>
|
146
146
|
</div>
|
@@ -37,13 +37,13 @@
|
|
37
37
|
<% end %>
|
38
38
|
<% if params[:associacao] %>
|
39
39
|
<% if @crud_helper.listing_fields.present? && should_listing?(@crud_helper, @model_permission) && should_listing_excel?(@crud_helper, @model_permission) %>
|
40
|
-
<%= link_to listing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], q: params[:q], format: :xls), class: "btn btn-success btn-rounded" do %>
|
40
|
+
<%= link_to listing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], q: params[:q].try(:to_unsafe_h), format: :xls), class: "btn btn-success btn-rounded" do %>
|
41
41
|
<%= I18n.t("devise.reports.excel").html_safe %>
|
42
42
|
<% end %>
|
43
43
|
<% end %>
|
44
44
|
<% else %>
|
45
45
|
<% if @crud_helper.listing_fields.present? && should_listing?(@crud_helper, @model) && should_listing_excel?(@crud_helper, @model) %>
|
46
|
-
<%= link_to listing_crud_path(model: @model.name.underscore, q: params[:q], format: :xls), class: "btn btn-success btn-rounded" do %>
|
46
|
+
<%= link_to listing_crud_path(model: @model.name.underscore, q: params[:q].try(:to_unsafe_h), format: :xls), class: "btn btn-success btn-rounded" do %>
|
47
47
|
<%= I18n.t("devise.reports.excel").html_safe %>
|
48
48
|
<% end %>
|
49
49
|
<% end %>
|
@@ -80,27 +80,27 @@
|
|
80
80
|
|
81
81
|
<% if (@crud_helper.present? && @crud_helper.destroy_action) && should_destroy?(@crud_helper, @record) %>
|
82
82
|
<% if @crud_associacao.present? %>
|
83
|
-
<%= link_to I18n.t("destroy"), destroy_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
83
|
+
<%= link_to I18n.t("destroy"), destroy_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
84
84
|
<% else %>
|
85
|
-
<%= link_to I18n.t("destroy"), destroy_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
85
|
+
<%= link_to I18n.t("destroy"), destroy_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
86
86
|
<% end %>
|
87
87
|
<% end %>
|
88
88
|
|
89
89
|
<% if (@crud_helper.present? && @crud_helper.edit_action) && should_edit?(@crud_helper, @record) %>
|
90
90
|
<% if @crud_associacao.present? %>
|
91
|
-
<%= link_to I18n.t("edit"), edit_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
|
91
|
+
<%= link_to I18n.t("edit"), edit_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
|
92
92
|
<% else %>
|
93
|
-
<%= link_to I18n.t("edit"), edit_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
|
93
|
+
<%= link_to I18n.t("edit"), edit_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h)), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
|
94
94
|
<% end %>
|
95
95
|
<% end %>
|
96
96
|
|
97
97
|
<% if @crud_helper.printing_fields.present? && can_print_pdf?(@crud_helper, @record) %>
|
98
98
|
<% if @crud_associacao.present? %>
|
99
|
-
<%= link_to printing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q], format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
|
99
|
+
<%= link_to printing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h), format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
|
100
100
|
<%= I18n.t("devise.printing").html_safe %>
|
101
101
|
<% end %>
|
102
102
|
<% else %>
|
103
|
-
<%= link_to printing_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q], format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
|
103
|
+
<%= link_to printing_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q].try(:to_unsafe_h), format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
|
104
104
|
<%= I18n.t("devise.printing").html_safe %>
|
105
105
|
<% end %>
|
106
106
|
<% 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: 3.0.
|
4
|
+
version: 3.0.19
|
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: 2019-
|
13
|
+
date: 2019-06-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -980,7 +980,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
980
980
|
version: '0'
|
981
981
|
requirements: []
|
982
982
|
rubyforge_project:
|
983
|
-
rubygems_version: 2.7.
|
983
|
+
rubygems_version: 2.7.9
|
984
984
|
signing_key:
|
985
985
|
specification_version: 4
|
986
986
|
summary: Easy CRUD generator for Rails Projects
|