templus_models 3.0.4 → 3.0.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 +4 -4
- data/app/controllers/crud_controller.rb +1 -1
- data/app/helpers/search_helper.rb +1 -1
- data/app/raro_crud/raro_crud.rb +11 -11
- data/app/views/crud/_record.html.erb +14 -7
- data/lib/templus_models/version.rb +1 -1
- data/test/dummy/app/controllers/application_controller.rb +7 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 221017c24aa94567ccc8ca71bfb54309bbe585dd
|
4
|
+
data.tar.gz: 9bfa65fa03301259c1aedd8ac65b547d595fe00d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c19bb138c0d4b7e0f29da94e09501ebecf6e3b25ec710520a7d7d24d2cf028ba546a7919e1c02e62398fa2da7a59426228616fa51f2a4b4ea548c34b9de63508
|
7
|
+
data.tar.gz: fa21f4feaa893acc1d2b6edd9c1bf279e71d3504b2df8d0bdd84cdb095e789f2a53fe84d09011a227974f4f99fabebafafec3429b58ea7abc907aafc8c02ac7c
|
@@ -27,7 +27,7 @@ module SearchHelper
|
|
27
27
|
name = opts[:full_name]
|
28
28
|
end
|
29
29
|
label = I18n.t("simple_form.labels.#{modelo.name.underscore}.#{name}")
|
30
|
-
label = opts[:label] if opts[:label]
|
30
|
+
label = I18n.t(opts[:label]) if opts[:label]
|
31
31
|
|
32
32
|
@buffer << "<div class=\"form-group\">"
|
33
33
|
@buffer << raro_label(label,opts)
|
data/app/raro_crud/raro_crud.rb
CHANGED
@@ -53,9 +53,9 @@ class RaroCrud
|
|
53
53
|
(@@layout[self.to_s.to_sym]) ? @@layout[self.to_s.to_sym] : []
|
54
54
|
end
|
55
55
|
|
56
|
-
def self.set_layout(desc,proc = nil)
|
56
|
+
def self.set_layout(desc, proc = nil)
|
57
57
|
@@layout[self.to_s.to_sym] = [] unless @@layout[self.to_s.to_sym]
|
58
|
-
@@layout[self.to_s.to_sym] = [desc,proc]
|
58
|
+
@@layout[self.to_s.to_sym] = [desc, proc]
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.condition_edit_action
|
@@ -315,7 +315,7 @@ class RaroCrud
|
|
315
315
|
end
|
316
316
|
field[:grupo] = true
|
317
317
|
end
|
318
|
-
|
318
|
+
|
319
319
|
def self.set_default_label nome, opts
|
320
320
|
unless opts[:label].present?
|
321
321
|
opts[:label] = "simple_form.labels.#{self.modelo.underscore}.#{nome}"
|
@@ -404,19 +404,19 @@ class RaroCrud
|
|
404
404
|
@@condition_printing_action[self.to_s.to_sym] = condicao
|
405
405
|
end
|
406
406
|
|
407
|
-
def self.acoes(method,desc,proc = nil)
|
407
|
+
def self.acoes(method, desc, proc = nil, options={})
|
408
408
|
@@actions[self.to_s.to_sym] = [] unless @@actions[self.to_s.to_sym]
|
409
|
-
@@actions[self.to_s.to_sym].push(
|
409
|
+
@@actions[self.to_s.to_sym].push({method: method, desc: desc, proc: proc, options: options})
|
410
410
|
end
|
411
411
|
|
412
|
-
def self.links(name,options)
|
412
|
+
def self.links(name, options)
|
413
413
|
@@links[self.to_s.to_sym] = [] unless @@links[self.to_s.to_sym]
|
414
|
-
@@links[self.to_s.to_sym].push([name,options])
|
414
|
+
@@links[self.to_s.to_sym].push([name, options])
|
415
415
|
end
|
416
416
|
|
417
|
-
def self.opcoes(link,desc,proc = nil)
|
417
|
+
def self.opcoes(link, desc, proc = nil)
|
418
418
|
@@options_link[self.to_s.to_sym] = [] unless @@options_link[self.to_s.to_sym]
|
419
|
-
@@options_link[self.to_s.to_sym].push([link,desc,proc])
|
419
|
+
@@options_link[self.to_s.to_sym].push([link, desc, proc])
|
420
420
|
end
|
421
421
|
|
422
422
|
def self.escopos(scopes)
|
@@ -437,7 +437,7 @@ class RaroCrud
|
|
437
437
|
@@form_fields[self.to_s.to_sym].last[:sf][:separador] = true
|
438
438
|
end
|
439
439
|
|
440
|
-
def self.grupo_formulario(attribute,name,fields=nil)
|
440
|
+
def self.grupo_formulario(attribute, name, fields=nil)
|
441
441
|
if fields.nil?
|
442
442
|
fields = name
|
443
443
|
name = attribute.to_s.singularize.titleize
|
@@ -454,7 +454,7 @@ class RaroCrud
|
|
454
454
|
value[:sf][atr[0]] = atr[1]
|
455
455
|
end
|
456
456
|
end
|
457
|
-
@@form_group[self.to_s.to_sym][attribute][:fields].push({attribute: value[:attribute],sf: value[:sf]})
|
457
|
+
@@form_group[self.to_s.to_sym][attribute][:fields].push({attribute: value[:attribute], sf: value[:sf]})
|
458
458
|
end
|
459
459
|
end
|
460
460
|
|
@@ -55,12 +55,15 @@
|
|
55
55
|
<%end%>
|
56
56
|
<td class="row">
|
57
57
|
<div class="col-xs-9">
|
58
|
-
|
59
|
-
<% if ((
|
60
|
-
|
58
|
+
<% @crud_helper.actions.each do |action| %>
|
59
|
+
<% if ((action[:proc].present? && action[:proc].call(record)) || !action[:proc].present?) %>
|
60
|
+
<% if action[:options].present? && action[:options][:wiselink].present? && action[:options][:wiselink] %>
|
61
|
+
<% data = {push: "partial", target: "#form"} %>
|
62
|
+
<% end %>
|
63
|
+
<%= link_to I18n.t(action[:desc]), action_crud_path(model: @model.name.underscore, id: record.id, acao: action[:method]), class: "btn btn-primary btn-xs", data: data || {} %>
|
61
64
|
<% end %>
|
62
65
|
<% end %>
|
63
|
-
|
66
|
+
<% @crud_helper.actions_links.each do |name, options| %>
|
64
67
|
<% unless (options[:can].present? && !record.instance_eval(&options[:can])) %>
|
65
68
|
<% if options[:url].present? %>
|
66
69
|
<% url = options[:url] %>
|
@@ -71,15 +74,19 @@
|
|
71
74
|
<% end %>
|
72
75
|
<% if options[:wiselink].present? && options[:wiselink] %>
|
73
76
|
<a href="<%= url %>" class="btn btn-success btn-xs" data-push="partial" data-target="#form">
|
74
|
-
<%=I18n.t(name)%>
|
77
|
+
<%= I18n.t(name) %>
|
75
78
|
</a>
|
76
79
|
<% else %>
|
77
80
|
<a href="<%= url %>" class="btn btn-success btn-xs">
|
78
|
-
<%=I18n.t(name)%>
|
81
|
+
<%= I18n.t(name) %>
|
79
82
|
</a>
|
80
83
|
<% end %>
|
81
84
|
<% elsif options[:associacao].present? %>
|
82
|
-
|
85
|
+
<% if options[:wiselink].present? && options[:wiselink] %>
|
86
|
+
<%= link_to I18n.t(name), crud_associacao_models_path(model: @model.name.underscore, id: record.id, associacao: options[:associacao].to_s), class: "btn btn-success btn-xs", data: {push: "partial", target: "#form"} %>
|
87
|
+
<% else %>
|
88
|
+
<%= link_to I18n.t(name), crud_associacao_models_path(model: @model.name.underscore, id: record.id, associacao: options[:associacao].to_s), class: "btn btn-success btn-xs" %>
|
89
|
+
<% end %>
|
83
90
|
<% elsif options[:partial].present? %>
|
84
91
|
<%= render options[:partial], record: record %>
|
85
92
|
<% end %>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery with: :exception
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
before_action :authenticate_usuario!, :unless => :devise_controller?
|
4
|
+
around_action :set_current_usuario
|
5
|
+
|
6
6
|
rescue_from CanCan::AccessDenied do |exception|
|
7
7
|
respond_to do |format|
|
8
8
|
format.html {
|
@@ -19,18 +19,18 @@ class ApplicationController < ActionController::Base
|
|
19
19
|
}
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def current_ability
|
24
24
|
@current_ability ||= Ability.new(current_usuario)
|
25
25
|
end
|
26
26
|
|
27
27
|
def set_current_usuario
|
28
28
|
Usuario.current = current_usuario
|
29
|
-
yield
|
29
|
+
yield
|
30
30
|
ensure
|
31
31
|
Usuario.current = nil
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def query
|
35
35
|
@resource = Module.const_get(params[:model].classify)
|
36
36
|
@q = @resource.search(params[:q])
|
@@ -47,5 +47,5 @@ class ApplicationController < ActionController::Base
|
|
47
47
|
render :partial => params[:partial]
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
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.5
|
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-
|
13
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -979,7 +979,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
979
979
|
version: '0'
|
980
980
|
requirements: []
|
981
981
|
rubyforge_project:
|
982
|
-
rubygems_version: 2.
|
982
|
+
rubygems_version: 2.5.1
|
983
983
|
signing_key:
|
984
984
|
specification_version: 4
|
985
985
|
summary: Easy CRUD generator for Rails Projects
|