templus_models 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/raro_crud.js +2 -2
- data/app/helpers/crud_helper.rb +5 -0
- data/lib/templus_models/version.rb +1 -1
- data/test/dummy/app/assets/javascripts/initializer.js +2 -1
- data/test/dummy/app/models/ability.rb +1 -0
- data/test/dummy/app/raro_crud/teste_crud.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 401e0317c45af852e7658e9b2e01637bff0e0f7f
|
4
|
+
data.tar.gz: 90d65d031941c8a03256dd78a8080dc27ea65408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb87febe26cfbf079f2a6cc285edc3d4f865c33359b3db3e98e86fe409cd044d0ea2b76d4ad7ec041de469d34876de5c87ff3ac26fa31590f9b0aa4edfc8342e
|
7
|
+
data.tar.gz: da7c2ddf625dbf5a4a206e22db3760ca88637c710b3c566853dab4dda75628b2a4be0bc11857980c0c6e4e7f0035cfff5687a3d1193616a763771a577aaeeb77
|
@@ -1,5 +1,5 @@
|
|
1
|
-
function new_record(id,name){
|
2
|
-
|
1
|
+
function new_record(id,name,model_name){
|
2
|
+
model_name = name.split("[")[1].split("_id]")[0];
|
3
3
|
|
4
4
|
$('#modal_new_record').attr("class","modal inmodal")
|
5
5
|
$('#modal_new_record').addClass(model_name);
|
data/app/helpers/crud_helper.rb
CHANGED
@@ -176,14 +176,19 @@ module CrudHelper
|
|
176
176
|
|
177
177
|
#Permissions
|
178
178
|
def shold_view?(crud_helper,record)
|
179
|
+
return false unless can?(:read, record)
|
179
180
|
return true if crud_helper.condition_view_action.nil?
|
180
181
|
crud_helper.condition_view_action.call(record)
|
181
182
|
end
|
183
|
+
|
182
184
|
def shold_edit?(crud_helper,record)
|
185
|
+
return false unless can?(:update, record)
|
183
186
|
return true if crud_helper.condition_edit_action.nil?
|
184
187
|
crud_helper.condition_edit_action.call(record)
|
185
188
|
end
|
189
|
+
|
186
190
|
def shold_destroy?(crud_helper,record)
|
191
|
+
return false unless can?(:destroy, record)
|
187
192
|
return true if crud_helper.condition_destroy_action.nil?
|
188
193
|
crud_helper.condition_destroy_action.call(record)
|
189
194
|
end
|
@@ -45,7 +45,8 @@ function atualiza_campos_crud(){
|
|
45
45
|
var select = $(this).siblings().last().find('select')
|
46
46
|
var id = select.attr('id')
|
47
47
|
var name = select.attr('name')
|
48
|
-
|
48
|
+
var modelname = select.data('model-name')
|
49
|
+
new_record(id,name,modelname)
|
49
50
|
return false;
|
50
51
|
});
|
51
52
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class TesteCrud < RaroCrud
|
2
2
|
titulo "Testes"
|
3
3
|
|
4
|
-
link_superior "Novo Teste", id: "novo-button", icon: "plus", link: "new"
|
4
|
+
link_superior "Novo Teste", id: "novo-button", icon: "plus", link: "new", can: Proc.new {|obj| Usuario.current.ability.can?(:create, obj)}
|
5
5
|
|
6
6
|
ordenar_por :created_at
|
7
7
|
itens_por_pagina 20
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Sol
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|