templus_models 2.0.16 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/crud_controller.rb +59 -117
- data/app/helpers/crud_helper.rb +17 -43
- data/app/helpers/search_helper.rb +18 -47
- data/app/raro_crud/raro_crud.rb +186 -190
- data/app/views/crud/_form.html.erb +11 -3
- data/app/views/crud/_record.html.erb +14 -30
- data/app/views/crud/_records.html.erb +51 -51
- data/app/views/crud/_search.html.erb +28 -28
- data/app/views/crud/_shared.html.erb +94 -105
- data/app/views/crud/listing.pdf.erb +41 -48
- data/app/views/crud/listing.xls.erb +39 -44
- data/app/views/crud/printing.pdf.erb +55 -50
- data/config/initializers/raro_search.rb +0 -7
- data/lib/templus_models/version.rb +1 -1
- data/lib/templus_models.rb +1 -1
- data/test/dummy/config/locales/pt-BR.yml +3 -4
- metadata +631 -633
- data/app/helpers/attributes_helper.rb +0 -32
- data/app/helpers/imagens_helper.rb +0 -15
@@ -1,32 +0,0 @@
|
|
1
|
-
module AttributesHelper
|
2
|
-
|
3
|
-
def association?(model, attribute)
|
4
|
-
!!model.reflect_on_association(attribute)
|
5
|
-
end
|
6
|
-
|
7
|
-
def belongs_to_association?(model, attribute)
|
8
|
-
association_type?(model, attribute, :belongs_to)
|
9
|
-
end
|
10
|
-
|
11
|
-
def has_one_association?(model, attribute)
|
12
|
-
association_type?(model, attribute, :has_one)
|
13
|
-
end
|
14
|
-
|
15
|
-
def array?(record, attribute)
|
16
|
-
attribute_class?(record, attribute, Array)
|
17
|
-
end
|
18
|
-
|
19
|
-
def boolean?(record, attribute)
|
20
|
-
['false', 'true'].include? record.send(attribute).to_s
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def association_type?(model, attribute, association_type)
|
26
|
-
association?(model, attribute) && model.reflect_on_association(attribute).macro == association_type
|
27
|
-
end
|
28
|
-
|
29
|
-
def attribute_class?(record, attribute, klass)
|
30
|
-
record.send(attribute).class == klass
|
31
|
-
end
|
32
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module ImagensHelper
|
2
|
-
|
3
|
-
def carrier_wave_uploader?(model, attribute)
|
4
|
-
model.new.send(attribute).class.ancestors.include?(CarrierWave::Uploader::Base)
|
5
|
-
end
|
6
|
-
|
7
|
-
def possui_url?(record, attribute)
|
8
|
-
record.send(attribute).respond_to?(:url)
|
9
|
-
end
|
10
|
-
|
11
|
-
def deve_renderizar_imagem?(opts)
|
12
|
-
opts.has_key?(:render) && !!opts[:render]
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|