templus_models 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/crud_helper.rb +9 -4
- data/app/raro_crud/raro_crud.rb +3 -1
- data/app/views/crud/_form.html.erb +3 -2
- data/lib/templus_models/version.rb +1 -1
- data/test/dummy/app/assets/javascripts/atualizacoes.js.coffee +7 -6
- data/test/dummy/app/raro_crud/usuario_crud.rb +2 -0
- data/test/dummy/app/views/usuarios/_actions.html.erb +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 845ed602a56f3be89f09e342b94271ab7afc03b8
|
4
|
+
data.tar.gz: bfa20f896c77a17e5a47d01c59427d96240933b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa2e7956fa605a9edc246d53bed6b4ed539b0c4ded42b1b9a011f4c6db3eb6f164189112cf45cb2b7eb76a426c3e42c85e0fda279c5dd203fb4292833f343de1
|
7
|
+
data.tar.gz: 08ee0caac1acf183ff72da72d5bbec6ca8c87f572fd4cafca828177d67d47e5d93c679b0847e5b7d73df25009299528174fda57de0f8aceda039b1194ace0015
|
data/app/helpers/crud_helper.rb
CHANGED
@@ -61,7 +61,12 @@ module CrudHelper
|
|
61
61
|
|
62
62
|
|
63
63
|
def render_link(link)
|
64
|
-
|
64
|
+
if link[:partial].present?
|
65
|
+
render link[:partial]
|
66
|
+
else
|
67
|
+
url = link[:url] || link[:link]
|
68
|
+
link_to "#{gen_icon(link[:icon])} #{link[:text]}".html_safe, url, class: link[:class], data: data(link)
|
69
|
+
end
|
65
70
|
end
|
66
71
|
|
67
72
|
def gen_icon(i)
|
@@ -73,9 +78,9 @@ module CrudHelper
|
|
73
78
|
end
|
74
79
|
|
75
80
|
def data(link)
|
76
|
-
|
77
|
-
link[:data].each_key{|k|
|
78
|
-
return
|
81
|
+
data = {}
|
82
|
+
link[:data].each_key{|k| data[k] = link[:data][k]} if link[:data]
|
83
|
+
return data
|
79
84
|
end
|
80
85
|
|
81
86
|
def raro_models
|
data/app/raro_crud/raro_crud.rb
CHANGED
@@ -190,7 +190,9 @@ class RaroCrud
|
|
190
190
|
icon: "fa fa-#{opts[:icon]}",
|
191
191
|
class: 'btn btn-small btn-primary btn-rounded',
|
192
192
|
link: "#{self.root_path}/#{opts[:link]}",
|
193
|
-
|
193
|
+
url: opts[:url],
|
194
|
+
can: opts[:can],
|
195
|
+
partial: opts[:partial]
|
194
196
|
}
|
195
197
|
)
|
196
198
|
end
|
@@ -10,7 +10,6 @@
|
|
10
10
|
</div>
|
11
11
|
</div>
|
12
12
|
</div>
|
13
|
-
|
14
13
|
<%unless params[:render] == 'modal'%>
|
15
14
|
<% url = "/crud/#{@model.name.underscore}/#{@record.new_record? ? 'create' : @record.id.to_s+'/create'}" %>
|
16
15
|
<% remote_form = false%>
|
@@ -62,7 +61,9 @@
|
|
62
61
|
<div class="form-group">
|
63
62
|
<div class="col-sm-4 col-sm-offset-2">
|
64
63
|
<%= f.submit "Salvar", class: 'btn btn-primary' %>
|
65
|
-
|
64
|
+
<%unless params[:render] == 'modal'%>
|
65
|
+
<%= link_to "Voltar", "/crud/#{@model.name.underscore}", class: 'btn btn-default', data: {push: 'partial', target: "#form"} %>
|
66
|
+
<% end %>
|
66
67
|
</div>
|
67
68
|
</div>
|
68
69
|
<% end %>
|
@@ -8,12 +8,13 @@ $ ->
|
|
8
8
|
# "plugins": ["html_data"]
|
9
9
|
# "core" : { "initially_open" : [ "root" ] }
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
$(document).off('page:loading').on(
|
12
|
+
'page:loading'
|
13
|
+
(event, $target, render, url) ->
|
14
|
+
$("#modal_search").remove()
|
15
|
+
$("#modal_new_record").remove()
|
16
|
+
# bloqueia()
|
17
|
+
)
|
17
18
|
#
|
18
19
|
# $(document).off('page:redirected').on(
|
19
20
|
# 'page:redirected'
|
@@ -2,6 +2,8 @@ class UsuarioCrud < RaroCrud
|
|
2
2
|
titulo "Usuários"
|
3
3
|
|
4
4
|
link_superior "Novo Usuário", id: "novo-button", icon: "plus", link: "new"
|
5
|
+
link_superior "Inicio", id: "novo-button", icon: "", url: :busca_api_cidades
|
6
|
+
link_superior "Novo", partial: "/usuarios/actions"
|
5
7
|
|
6
8
|
ordenar_por :nome
|
7
9
|
edicao Proc.new {|obj| !obj.root? }
|
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: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Sol
|
@@ -347,6 +347,7 @@ files:
|
|
347
347
|
- test/dummy/app/views/layouts/login2.html.erb
|
348
348
|
- test/dummy/app/views/layouts/wiselinks.html.erb
|
349
349
|
- test/dummy/app/views/papeis/_associar.html.erb
|
350
|
+
- test/dummy/app/views/usuarios/_actions.html.erb
|
350
351
|
- test/dummy/app/views/usuarios/_edit.html.erb
|
351
352
|
- test/dummy/app/views/usuarios/_form.html.erb
|
352
353
|
- test/dummy/app/views/usuarios/edit.html.erb
|
@@ -1119,6 +1120,7 @@ test_files:
|
|
1119
1120
|
- test/dummy/app/views/layouts/login2.html.erb
|
1120
1121
|
- test/dummy/app/views/layouts/wiselinks.html.erb
|
1121
1122
|
- test/dummy/app/views/papeis/_associar.html.erb
|
1123
|
+
- test/dummy/app/views/usuarios/_actions.html.erb
|
1122
1124
|
- test/dummy/app/views/usuarios/_edit.html.erb
|
1123
1125
|
- test/dummy/app/views/usuarios/_form.html.erb
|
1124
1126
|
- test/dummy/app/views/usuarios/edit.html.erb
|