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,30 +1,30 @@
|
|
1
1
|
<div class="modal inmodal" id="modal_search" tabindex="-1" role="dialog" aria-hidden="true">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
2
|
+
<div class="modal-dialog modal-lg">
|
3
|
+
<div class="modal-content animated bounceInRight">
|
4
|
+
<div class="modal-header">
|
5
|
+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only"><%= I18n.t("close") %></span></button>
|
6
|
+
<i class="fa fa-search modal-icon"></i>
|
7
|
+
<h4 class="modal-title"><%= I18n.t("search") %></h4>
|
8
|
+
<small class="font-bold"></small>
|
9
|
+
</div>
|
10
|
+
<div class="modal-body">
|
11
|
+
<% if @crud_associacao.present? %>
|
12
|
+
<% url = query_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao]) %>
|
13
|
+
<% else %>
|
14
|
+
<% url = query_crud_path(model: @model.name.underscore) %>
|
15
|
+
<% end %>
|
16
|
+
<%=raro_search_form(@model, 'records','records', url) do%>
|
17
|
+
<%raro_group "#{@crud_helper.title}"%>
|
18
|
+
<%@crud_helper.search_fields.each do |att| %>
|
19
|
+
<% if att[:sf].present? && !att[:sf][:visible_if].nil?%>
|
20
|
+
<% if ((att[:sf][:visible_if].class == Proc && !att[:sf][:visible_if].call(att)) || (att[:sf][:visible_if].class != Proc && !att[:sf][:visible_if])) %>
|
21
|
+
<% next %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
<%raro_field att[:attribute], att[:sf]%>
|
25
|
+
<%end%>
|
26
|
+
<%end%>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
30
|
</div>
|
@@ -1,109 +1,98 @@
|
|
1
|
-
<%
|
1
|
+
<%unless params[:render] == 'modal'%>
|
2
2
|
<div class="wrapper wrapper-content animated fadeInRight">
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<% end %>
|
96
|
-
<% end %>
|
97
|
-
<% end %>
|
98
|
-
<% end %>
|
99
|
-
</div>
|
100
|
-
<div class="ibox-content">
|
101
|
-
<% block.call %>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
</div>
|
105
|
-
</div>
|
3
|
+
<div class="row">
|
4
|
+
<div class="col-lg-12">
|
5
|
+
<div class="ibox float-e-margins">
|
6
|
+
<div class="ibox-title">
|
7
|
+
<% if content_for?(:ibox_title) %>
|
8
|
+
<%= yield :ibox_title %>
|
9
|
+
<% elsif is_action_edit? && @model.present?%>
|
10
|
+
<h5>
|
11
|
+
<%= I18n.t("edit") %>
|
12
|
+
<small style="margin-left: 2px;"><%= @record.to_s %> - #<%= @record.id %></small>
|
13
|
+
</h5>
|
14
|
+
<% elsif (is_action_create? || is_action_new?) && @model.present? %>
|
15
|
+
<h5><%= I18n.t("new", model: I18n.t("model.#{@model.name.underscore}")) %></h5>
|
16
|
+
<% elsif @record.present? && !@record.new_record? %>
|
17
|
+
<h5>
|
18
|
+
<%= @record.to_s %>
|
19
|
+
<small style="margin-left: 2px;">#<%= @record.id %></small>
|
20
|
+
</h5>
|
21
|
+
<% elsif @crud_helper.present? %>
|
22
|
+
<h5>
|
23
|
+
<%= @crud_helper.subtitle(:index) %>
|
24
|
+
<small><%= @crud_helper.description(:index) %></small>
|
25
|
+
</h5>
|
26
|
+
<% end %>
|
27
|
+
<% if (@crud_helper.present? && (is_action_index? || is_action_query?))%>
|
28
|
+
<div class="pull-right actions">
|
29
|
+
<% @crud_helper.top_links.each do |link| %>
|
30
|
+
<% if link[:can].present? %>
|
31
|
+
<%=render_link(link,@clean_url) if self.instance_eval &link[:can]%>
|
32
|
+
<% else %>
|
33
|
+
<%=render_link(link,@clean_url)%>
|
34
|
+
<% end %>
|
35
|
+
<%end%>
|
36
|
+
<% if params[:associacao] %>
|
37
|
+
<% if @crud_helper.listing_fields.present? && should_listing?(@crud_helper, @model_permission) %>
|
38
|
+
<%= link_to listing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], q: params[:q], format: :xls), class: "btn btn-success btn-rounded" do %>
|
39
|
+
<%= I18n.t("devise.reports.excel").html_safe %>
|
40
|
+
<% end if should_listing_excel?(@crud_helper, @model_permission) %>
|
41
|
+
<%= link_to listing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], q: params[:q], format: :pdf), class: "btn btn-success btn-rounded", target: '_blank' do %>
|
42
|
+
<%= I18n.t("devise.reports.pdf").html_safe %>
|
43
|
+
<% end if should_listing_pdf?(@crud_helper, @model_permission) %>
|
44
|
+
<% end %>
|
45
|
+
<% else %>
|
46
|
+
<% if @crud_helper.listing_fields.present? && should_listing?(@crud_helper, @model) %>
|
47
|
+
<%= link_to listing_crud_path(model: @model.name.underscore, q: params[:q], format: :xls), class: "btn btn-success btn-rounded" do %>
|
48
|
+
<%= I18n.t("devise.reports.excel").html_safe %>
|
49
|
+
<% end if should_listing_excel?(@crud_helper, @model) %>
|
50
|
+
<%= link_to listing_crud_path(model: @model.name.underscore, q: params[:q], target: '_blank', format: :pdf), class: "btn btn-success btn-rounded", target: '_blank' do %>
|
51
|
+
<%= I18n.t("devise.reports.pdf").html_safe %>
|
52
|
+
<% end if should_listing_pdf?(@crud_helper, @model) %>
|
53
|
+
<% end %>
|
54
|
+
<% end %>
|
55
|
+
<% if @crud_helper.search_fields.present? %>
|
56
|
+
<button id="button_search_<%=@model.name.underscore%>" class="btn btn-warning btn-rounded" data-toggle="modal" data-target="#modal_search">
|
57
|
+
<i class="fa fa-search"></i>
|
58
|
+
</button>
|
59
|
+
<% end %>
|
60
|
+
</div>
|
61
|
+
<% elsif is_action_show? %>
|
62
|
+
<% if (@crud_helper.present? && @crud_helper.destroy_action) && should_destroy?(@crud_helper, @record) %>
|
63
|
+
<% if @crud_associacao.present? %>
|
64
|
+
<%= link_to I18n.t("destroy"), destroy_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
65
|
+
<% else %>
|
66
|
+
<%= link_to I18n.t("destroy"), destroy_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs pull-right m-l-xs', data: {method: 'delete', confirm: I18n.t('mensagem_confirm_destroy')} %>
|
67
|
+
<% end %>
|
68
|
+
<% end %>
|
69
|
+
<% if (@crud_helper.present? && @crud_helper.edit_action) && should_edit?(@crud_helper, @record) %>
|
70
|
+
<% if @crud_associacao.present? %>
|
71
|
+
<%= link_to I18n.t("edit"), edit_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
|
72
|
+
<% else %>
|
73
|
+
<%= link_to I18n.t("edit"), edit_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs pull-right m-l-xs', data: {push: 'partial', target: '#form'} %>
|
74
|
+
<% end %>
|
75
|
+
<% end %>
|
76
|
+
<% if @crud_helper.printing_fields.present? && should_printing?(@crud_helper, @record) %>
|
77
|
+
<% if @crud_associacao.present? %>
|
78
|
+
<%= link_to printing_crud_associacao_path(model: params[:model], id: params[:id], associacao: params[:associacao], associacao_id: @record.id, page: params[:page], q: params[:q], format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
|
79
|
+
<%= I18n.t("devise.printing").html_safe %>
|
80
|
+
<% end %>
|
81
|
+
<% else %>
|
82
|
+
<%= link_to printing_crud_path(model: @model.name.underscore, id: @record.id, page: params[:page], q: params[:q], format: :pdf), class: "btn btn-success btn-xs pull-right m-l-xs", target: "_blank" do %>
|
83
|
+
<%= I18n.t("devise.printing").html_safe %>
|
84
|
+
<% end %>
|
85
|
+
<% end %>
|
86
|
+
<% end %>
|
87
|
+
<% end %>
|
88
|
+
</div>
|
89
|
+
<div class="ibox-content">
|
90
|
+
<% block.call %>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
</div>
|
106
95
|
</div>
|
107
96
|
<% else %>
|
108
|
-
|
97
|
+
<% block.call %>
|
109
98
|
<% end %>
|
@@ -3,68 +3,61 @@
|
|
3
3
|
<div class="widget-box" id="relatorio">
|
4
4
|
<div class="widget-body">
|
5
5
|
<div class="widget-main">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<div class="col-lg-12">
|
10
|
-
<h2>
|
11
|
-
<small><%= @crud_helper.title %></small><br />
|
12
|
-
</h2>
|
13
|
-
</div>
|
6
|
+
<div class="profile-element">
|
7
|
+
<div class="header">
|
8
|
+
<h1><%= @crud_helper.title %></h1>
|
14
9
|
</div>
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
</div>
|
18
11
|
<table class="table table-bordered table-striped">
|
19
12
|
<thead>
|
20
13
|
<tr>
|
21
|
-
<% @crud_helper.listing_fields.each do |att
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
<% @crud_helper.listing_fields.each do |att|%>
|
15
|
+
<% if !att[:visible_if].nil?%>
|
16
|
+
<% if ((att[:visible_if].class == Proc && !att[:visible_if].call(att)) || (att[:visible_if].class != Proc && !att[:visible_if])) %>
|
17
|
+
<% next %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% if att[:sf].present? && att[:sf][:label].present? %>
|
21
|
+
<th><%= att[:sf][:label].to_s.mb_chars.upcase.to_s %></th>
|
22
|
+
<% else %>
|
23
|
+
<th><%= I18n.t(att[:sf][:label]) %></th>
|
24
|
+
<% end %>
|
25
|
+
<% end %>
|
26
26
|
</tr>
|
27
27
|
</thead>
|
28
28
|
<tbody>
|
29
29
|
<% @records.each do |record| %>
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<%= record.send(att[:attribute]).to_s %>
|
56
|
-
<% end %>
|
57
|
-
<% end %>
|
58
|
-
</td>
|
59
|
-
<% end %>
|
60
|
-
</tr>
|
30
|
+
<tr>
|
31
|
+
<%@crud_helper.listing_fields.each do |att| %>
|
32
|
+
<% if record.send(att[:attribute]).present? or record.send(att[:attribute]).to_s == "false"%>
|
33
|
+
<% if @model.columns_hash[att[:attribute].to_s].present? && [:date, :datetime].include?(@model.columns_hash[att[:attribute].to_s].type)%>
|
34
|
+
<% if att[:date_format].present?%>
|
35
|
+
<td><%= record.send(att[:attribute]).strftime(att[:date_format]) %></td>
|
36
|
+
<% else %>
|
37
|
+
<td><%= l record.send(att[:attribute]) %></td>
|
38
|
+
<% end %>
|
39
|
+
<% elsif ((@model.reflect_on_association(att[:attribute]) && @model.reflect_on_association(att[:attribute]).macro != :belongs_to && @model.reflect_on_association(att[:attribute]).macro != :has_one) || record.send(att[:attribute]).class == Array)%>
|
40
|
+
<td><%= record.send(att[:attribute]).map{|rec| rec.to_s}.join(",") %></td>
|
41
|
+
<% else %>
|
42
|
+
<% if record.send(att[:attribute]).to_s == "false" or record.send(att[:attribute]).to_s == "true" %>
|
43
|
+
<td><%= I18n.t(record.send(att[:attribute]) ? "shared.sim" : "shared.nao") %></td>
|
44
|
+
<% elsif att[:sf][:label_method].present? %>
|
45
|
+
<td><%= record.send(att[:attribute]).send(att[:sf][:label_method]).to_s %></td>
|
46
|
+
<% else %>
|
47
|
+
<td><%= record.send(att[:attribute]).to_s %></td>
|
48
|
+
<% end %>
|
49
|
+
<% end %>
|
50
|
+
<% else %>
|
51
|
+
<td></td>
|
52
|
+
<% end %>
|
53
|
+
<% end %>
|
54
|
+
</tr>
|
61
55
|
<% end %>
|
62
56
|
</tbody>
|
63
57
|
</table>
|
64
58
|
</div>
|
65
59
|
</div>
|
66
60
|
</div>
|
67
|
-
|
68
61
|
<style>
|
69
62
|
#relatorio {
|
70
63
|
clear: both;
|
@@ -5,49 +5,44 @@ xmlns:x="urn:schemas-microsoft-com:office:excel"
|
|
5
5
|
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
6
6
|
xmlns:html="http://www.w3.org/TR/REC-html40">
|
7
7
|
<Worksheet ss:Name="<%= @crud_helper.title %>">
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<% end %>
|
48
|
-
<% end %>
|
49
|
-
</Row>
|
50
|
-
<% end %>
|
51
|
-
</Table>
|
8
|
+
<Table>
|
9
|
+
<Row>
|
10
|
+
<% @crud_helper.listing_fields.each do |att|%>
|
11
|
+
<% if !att[:visible_if].nil?%>
|
12
|
+
<% if ((att[:visible_if].class == Proc && !att[:visible_if].call(att)) || (att[:visible_if].class != Proc && !att[:visible_if])) %>
|
13
|
+
<% next %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
<Cell><Data ss:Type="String"><%= I18n.t(att[:sf][:label]) %></Data></Cell>
|
17
|
+
<% end %>
|
18
|
+
</Row>
|
19
|
+
<% @records.each do |record| %>
|
20
|
+
<Row>
|
21
|
+
<%@crud_helper.listing_fields.each do |att| %>
|
22
|
+
<% if record.send(att[:attribute]).present? or record.send(att[:attribute]).to_s == "false"%>
|
23
|
+
<% if @model.columns_hash[att[:attribute].to_s].present? && [:date, :datetime].include?(@model.columns_hash[att[:attribute].to_s].type)%>
|
24
|
+
<% if att[:date_format].present?%>
|
25
|
+
<Cell><Data ss:Type="String"><%= record.send(att[:attribute]).strftime(att[:date_format]) %></Data></Cell>
|
26
|
+
<% else %>
|
27
|
+
<Cell><Data ss:Type="String"><%= l record.send(att[:attribute]) %></Data></Cell>
|
28
|
+
<% end %>
|
29
|
+
<% elsif ((@model.reflect_on_association(att[:attribute]) && @model.reflect_on_association(att[:attribute]).macro != :belongs_to && @model.reflect_on_association(att[:attribute]).macro != :has_one) || record.send(att[:attribute]).class == Array)%>
|
30
|
+
<Cell><Data ss:Type="String"><%= record.send(att[:attribute]).map{|rec| rec.to_s}.join(",") %></Data></Cell>
|
31
|
+
<% else %>
|
32
|
+
<% if record.send(att[:attribute]).to_s == "false" or record.send(att[:attribute]).to_s == "true" %>
|
33
|
+
<Cell><Data ss:Type="String"><%= I18n.t(record.send(att[:attribute]) ? "shared.sim" : "shared.nao") %></Data></Cell>
|
34
|
+
<% elsif att[:sf][:label_method].present? %>
|
35
|
+
<Cell><Data ss:Type="String"><%= record.send(att[:attribute]).send(att[:sf][:label_method]).to_s %></Data></Cell>
|
36
|
+
<% else %>
|
37
|
+
<Cell><Data ss:Type="String"><%= record.send(att[:attribute]).to_s %></Data></Cell>
|
38
|
+
<% end %>
|
39
|
+
<% end %>
|
40
|
+
<% else %>
|
41
|
+
<Cell><Data ss:Type="String"></Data></Cell>
|
42
|
+
<% end %>
|
43
|
+
<% end %>
|
44
|
+
</Row>
|
45
|
+
<% end %>
|
46
|
+
</Table>
|
52
47
|
</Worksheet>
|
53
48
|
</Workbook>
|
@@ -3,73 +3,78 @@
|
|
3
3
|
<div class="widget-box" id="relatorio">
|
4
4
|
<div class="widget-body">
|
5
5
|
<div class="widget-main">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<% unless @crud_helper.setup_report_printing[:header].present? %>
|
11
|
-
<small><%= @crud_helper.title %></small><br />
|
12
|
-
<% end %>
|
6
|
+
<div class="profile-element">
|
7
|
+
<div class="header">
|
8
|
+
<h1>
|
9
|
+
<small><%= @crud_helper.title %></small><br />
|
13
10
|
<%= @record.to_s %>
|
14
|
-
</
|
11
|
+
</h1>
|
15
12
|
</div>
|
16
13
|
</div>
|
17
|
-
|
18
14
|
<table class="table table-bordered table-striped">
|
19
15
|
<tbody>
|
20
|
-
<% @crud_helper.
|
21
|
-
<% next if field[:sf].present? && !field[:sf][:visible_if].nil? && ((field[:sf][:visible_if].class == Proc && !field[:sf][:visible_if].call(@record)) || (field[:sf][:visible_if].class != Proc && !field[:sf][:visible_if])) %>
|
16
|
+
<% @crud_helper.view_fields.each do |field|%>
|
22
17
|
<tr>
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
18
|
+
<% if field[:sf].present? && !field[:sf][:visible_if].nil?%>
|
19
|
+
<% if ((field[:sf][:visible_if].class == Proc && !field[:sf][:visible_if].call(@record)) || (field[:sf][:visible_if].class != Proc && !field[:sf][:visible_if])) %>
|
20
|
+
<% next %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
<% if field[:sf].present? && field[:sf][:label].present? %>
|
24
|
+
<th><%= field[:sf][:label].to_s.mb_chars.upcase.to_s %></th>
|
25
|
+
<% else %>
|
26
|
+
<th><%= I18n.t("simple_form.labels.#{@model.name.underscore}.#{field[:attribute]}") %></th>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<% if @model.columns_hash[field[:attribute].to_s].present? && [:date, :datetime].include?(@model.columns_hash[field[:attribute].to_s].type)%>
|
30
|
+
<% if field[:date_format].present?%>
|
31
|
+
<td><%= l @record.send(field[:attribute]).strftime(field[:date_format]) if @record.send(field[:attribute]).present?%></td>
|
32
|
+
<% else %>
|
33
|
+
<td><%= l @record.send(field[:attribute]) if @record.send(field[:attribute]).present?%></td>
|
34
|
+
<% end %>
|
35
|
+
<% elsif @model.reflect_on_association(field[:attribute]) && @model.reflect_on_association(field[:attribute]).macro != :belongs_to && @model.reflect_on_association(field[:attribute]).macro != :has_one%>
|
36
|
+
<td>
|
32
37
|
<% @record.send(field[:attribute]).each do |rec| %>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
<%= render_field_file(rec.send(field[:sf][:label_method])) %>
|
38
|
-
<% else %>
|
39
|
-
<%= rec.send(field[:sf][:label_method]).url %>
|
40
|
-
<% end %>
|
41
|
-
<% else %>
|
42
|
-
<%= rec.send(field[:sf][:label_method]) %>
|
43
|
-
<% end %>
|
38
|
+
<li>
|
39
|
+
<% if field[:sf].present? && field[:sf][:label_method].present? %>
|
40
|
+
<% if rec.send(field[:sf][:label_method]).respond_to?(:url) %>
|
41
|
+
<%= render_field_file(rec.send(field[:sf][:label_method])) %>
|
44
42
|
<% else %>
|
45
|
-
|
46
|
-
<%= render_field_file(rec.to_s) %>
|
47
|
-
<% else %>
|
48
|
-
<%= rec.to_s %>
|
49
|
-
<% end %>
|
43
|
+
<%= rec.send(field[:sf][:label_method]) %>
|
50
44
|
<% end %>
|
51
|
-
|
45
|
+
<% else %>
|
46
|
+
<% if rec.to_s.respond_to?(:url) %>
|
47
|
+
<%= render_field_file(rec.to_s) %>
|
48
|
+
<% else %>
|
49
|
+
<%= rec.to_s %>
|
50
|
+
<% end %>
|
51
|
+
<% end %>
|
52
|
+
</li>
|
52
53
|
<% end %>
|
53
|
-
|
54
|
+
</td>
|
55
|
+
<% elsif @record.send(field[:attribute]).class == Array %>
|
56
|
+
<td>
|
54
57
|
<% @record.send(field[:attribute]).each do |rec| %>
|
55
|
-
<li
|
56
|
-
|
57
|
-
|
58
|
-
<% if deve_renderizar_imagem?(field[:sf]) %>
|
59
|
-
<%= render_field_file(@record.send(field[:attribute])) %>
|
60
|
-
<% else %>
|
61
|
-
<%= @record.send(field[:attribute]).url %>
|
58
|
+
<li>
|
59
|
+
<%= rec.to_s %>
|
60
|
+
</li>
|
62
61
|
<% end %>
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
</td>
|
63
|
+
<% elsif @record.send(field[:attribute]).respond_to?(:url) %>
|
64
|
+
<td>
|
65
|
+
<%= render_field_file(@record.send(field[:attribute])) %>
|
66
|
+
</td>
|
67
|
+
<% elsif ["false","true"].include? @record.send(field[:attribute]).to_s %>
|
68
|
+
<td><%= I18n.t(@record.send(field[:attribute]) ? "shared.sim" : "shared.nao") %></td>
|
69
|
+
<% else %>
|
70
|
+
<td>
|
66
71
|
<% if field[:sf].present? && field[:sf][:label_method].present? && @record.send(field[:attribute]).present?%>
|
67
72
|
<%= @record.send(field[:attribute]).send(field[:sf][:label_method]) %>
|
68
73
|
<% else %>
|
69
74
|
<%= @record.send(field[:attribute]) %>
|
70
75
|
<% end %>
|
71
|
-
|
72
|
-
|
76
|
+
</td>
|
77
|
+
<% end %>
|
73
78
|
</tr>
|
74
79
|
<% end %>
|
75
80
|
</tbody>
|