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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfad85131bd19efb453328996e69385d9e4c9342
4
- data.tar.gz: c8d4b46fddeda767f28b832c3ca9bd460a0aa74d
3
+ metadata.gz: 845ed602a56f3be89f09e342b94271ab7afc03b8
4
+ data.tar.gz: bfa20f896c77a17e5a47d01c59427d96240933b2
5
5
  SHA512:
6
- metadata.gz: 603316b3e62cc51bda580620a885b7731056106c9a7902735f5d0c6d7b6295b41d6cef997e200f49a37a2e7679fdd0bb7f24578efa61f6e7be1120395bd8a9aa
7
- data.tar.gz: 483f928f955f6803c94c099bb0e70148848b9ebde9a18da9b2fcc68eb8abeb1773e392fb18e82b29731354e146b13747eda17428c6c2cb7ec8507ceff6df48e7
6
+ metadata.gz: aa2e7956fa605a9edc246d53bed6b4ed539b0c4ded42b1b9a011f4c6db3eb6f164189112cf45cb2b7eb76a426c3e42c85e0fda279c5dd203fb4292833f343de1
7
+ data.tar.gz: 08ee0caac1acf183ff72da72d5bbec6ca8c87f572fd4cafca828177d67d47e5d93c679b0847e5b7d73df25009299528174fda57de0f8aceda039b1194ace0015
@@ -61,7 +61,12 @@ module CrudHelper
61
61
 
62
62
 
63
63
  def render_link(link)
64
- "<a href='#{link[:link]}' class='#{link[:class]}' #{data(link)}>#{gen_icon(link[:icon])} #{link[:text]}</a>".html_safe
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
- buffer = ""
77
- link[:data].each_key{|k| buffer << " data-#{k}='#{link[:data][k]}' "} if link[:data]
78
- return buffer
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
@@ -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
- can: opts[:can]
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
- <%= link_to "Voltar", "/crud/#{@model.name.underscore}", class: 'btn btn-default', data: {push: 'partial', target: "#form"} %>
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 %>
@@ -1,3 +1,3 @@
1
1
  module TemplusModels
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -8,12 +8,13 @@ $ ->
8
8
  # "plugins": ["html_data"]
9
9
  # "core" : { "initially_open" : [ "root" ] }
10
10
 
11
- # $(document).off('page:loading').on(
12
- # 'page:loading'
13
- # (event, $target, render, url) ->
14
- # NProgress.start()
15
- # bloqueia()
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? }
@@ -0,0 +1,3 @@
1
+ <%= link_to "http://rarolabs.com.br" do %>
2
+ <i class="fa fa-users fa-2x"></i>
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: 1.3.1
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