templus_models 1.6.6 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/views/crud/_record.html.erb +67 -49
- data/app/views/crud/_records.html.erb +19 -0
- data/app/views/crud/_scopes.html.erb +2 -2
- data/app/views/kaminari/templus/_paginator.html.erb +2 -2
- data/config/initializers/simple_form.rb +4 -4
- data/lib/templus_models/version.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: ef59b6b6ca001d18f4107b3a02209ff5e9d0b1af
|
4
|
+
data.tar.gz: 01af5e6e3fd8679393928547f969a280c26b8cd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d272ec0276019b2768b030df5d35e945a02e56bc8cb8180315e763a85cd8771a2e3622517d25589a4198fef8a8366944e332e32f169d56321499487abd6dd4a4
|
7
|
+
data.tar.gz: ed59770d7e625668f8e7cb72f525750bb35ca644272b66af91eb7e805b0d655356d44219ae8fb82e74eaa70ba905b416328273520b3128a04bf07a31808e3e28
|
@@ -8,12 +8,20 @@
|
|
8
8
|
<% if record.send(att[:attribute]).present? or record.send(att[:attribute]).to_s == "false"%>
|
9
9
|
<% if @model.columns_hash[att[:attribute].to_s].present? && [:date, :datetime].include?(@model.columns_hash[att[:attribute].to_s].type)%>
|
10
10
|
<% if att[:date_format].present?%>
|
11
|
-
<td
|
11
|
+
<td class="row">
|
12
|
+
<div class="col-xs-9">
|
13
|
+
<%= record.send(att[:attribute]).strftime(att[:date_format]) %>
|
14
|
+
</div>
|
15
|
+
</td>
|
12
16
|
<% else %>
|
13
|
-
<td
|
17
|
+
<td class="row">
|
18
|
+
<div class="col-xs-9">
|
19
|
+
<%= l record.send(att[:attribute]) %>
|
20
|
+
</div>
|
21
|
+
</td>
|
14
22
|
<% end %>
|
15
23
|
<% 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%>
|
16
|
-
<td>
|
24
|
+
<td class="row">
|
17
25
|
<% record.send(att[:attribute]).each do |rec| %>
|
18
26
|
<li>
|
19
27
|
<%= rec.to_s %>
|
@@ -21,7 +29,7 @@
|
|
21
29
|
<% end %>
|
22
30
|
</td>
|
23
31
|
<% elsif record.send(att[:attribute]).class == Array %>
|
24
|
-
<td>
|
32
|
+
<td class="row">
|
25
33
|
<% record.send(att[:attribute]).each do |rec| %>
|
26
34
|
<li>
|
27
35
|
<%= rec.to_s %>
|
@@ -29,65 +37,75 @@
|
|
29
37
|
<% end %>
|
30
38
|
</td>
|
31
39
|
<% elsif record.send(att[:attribute]).respond_to?(:url) and record.send(att[:attribute]).url(:thumb) %>
|
32
|
-
<td><%= image_tag(record.send(att[:attribute]).url(:thumb)) %></td>
|
40
|
+
<td class="row"><%= image_tag(record.send(att[:attribute]).url(:thumb)) %></td>
|
33
41
|
<% else %>
|
34
42
|
<% if record.send(att[:attribute]).to_s == "false" or record.send(att[:attribute]).to_s == "true" %>
|
35
|
-
<td
|
43
|
+
<td class="row">
|
44
|
+
<div class="col-xs-9">
|
45
|
+
<%= record.send(att[:attribute]) ? "Sim" : "Não" %>
|
46
|
+
</div>
|
47
|
+
</td>
|
36
48
|
<% else %>
|
37
|
-
<td
|
49
|
+
<td class="row">
|
50
|
+
<div class="col-xs-9">
|
51
|
+
<%= record.send(att[:attribute]).to_s %>
|
52
|
+
</div>
|
53
|
+
</td>
|
38
54
|
<% end %>
|
39
55
|
<% end %>
|
40
56
|
<% else %>
|
41
|
-
<td></td>
|
57
|
+
<td class="row"></td>
|
42
58
|
<% end %>
|
43
59
|
<%end%>
|
44
|
-
<td>
|
45
|
-
|
46
|
-
|
47
|
-
|
60
|
+
<td class="row">
|
61
|
+
<div class="col-xs-9">
|
62
|
+
<%@crud_helper.actions.each do |a|%>
|
63
|
+
<% if ((a[2].present? && a[2].call(record)) || !a[2].present?) %>
|
64
|
+
<%= link_to a[1], action_crud_path(model: @model.name.underscore, id: record.id, acao: a[0], page: params[:page], q: params[:q]), class: "btn btn-primary btn-xs", data: {push: "partial", target: "#form"}%>
|
65
|
+
<% end %>
|
48
66
|
<% end %>
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
<%
|
67
|
+
<%@crud_helper.actions_links.each do |name, options|%>
|
68
|
+
<% if options[:url].present? %>
|
69
|
+
<% url = options[:url] %>
|
70
|
+
<% if options[:id] %>
|
71
|
+
<% url += options[:url].include?("?") ? "&id=#{record.id}" : "?id=#{record.id}" %>
|
72
|
+
<% end %>
|
73
|
+
<% if options[:wiselink].present? && options[:wiselink] %>
|
74
|
+
<a href="<%= url %>" class="btn btn-success btn-xs" data-push="partial" data-target="#form">
|
75
|
+
<%=name%>
|
76
|
+
</a>
|
77
|
+
<% else %>
|
78
|
+
<a href="<%= url %>" class="btn btn-success btn-xs">
|
79
|
+
<%=name%>
|
80
|
+
</a>
|
81
|
+
<% end %>
|
82
|
+
<% elsif options[:associacao].present? %>
|
83
|
+
<%= link_to name, crud_associacao_models_path(model: @model.name.underscore, id: record.id, associacao: options[:associacao].to_s), class: "btn btn-success btn-xs", data: {push: "partial", target: "#form"} %>
|
84
|
+
<% elsif options[:partial].present? %>
|
85
|
+
<%= render options[:partial], record: record %>
|
55
86
|
<% end %>
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
87
|
+
<% end %>
|
88
|
+
<%if @crud_helper.view_action && should_view?(@crud_helper, record)%>
|
89
|
+
<% if @crud_associacao.present? %>
|
90
|
+
<%= link_to "Visualizar", crud_associacao_model_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', data: {push: 'partial', target: '#form'} %>
|
60
91
|
<% else %>
|
61
|
-
|
62
|
-
<%=name%>
|
63
|
-
</a>
|
92
|
+
<%= link_to "Visualizar", crud_model_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
64
93
|
<% end %>
|
65
|
-
<% elsif options[:associacao].present? %>
|
66
|
-
<%= link_to name, crud_associacao_models_path(model: @model.name.underscore, id: record.id, associacao: options[:associacao].to_s), class: "btn btn-success btn-xs", data: {push: "partial", target: "#form"} %>
|
67
|
-
<% elsif options[:partial].present? %>
|
68
|
-
<%= render options[:partial], record: record %>
|
69
|
-
<% end %>
|
70
|
-
<% end %>
|
71
|
-
<%if @crud_helper.view_action && should_view?(@crud_helper, record)%>
|
72
|
-
<% if @crud_associacao.present? %>
|
73
|
-
<%= link_to "Visualizar", crud_associacao_model_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', data: {push: 'partial', target: '#form'} %>
|
74
|
-
<% else %>
|
75
|
-
<%= link_to "Visualizar", crud_model_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
76
94
|
<% end %>
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
95
|
+
<%if @crud_helper.edit_action && should_edit?(@crud_helper, record) %>
|
96
|
+
<% if @crud_associacao.present? %>
|
97
|
+
<%= link_to "Editar", 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', data: {push: 'partial', target: '#form'} %>
|
98
|
+
<% else %>
|
99
|
+
<%= link_to "Editar", edit_crud_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-primary btn-xs', data: {push: 'partial', target: '#form'} %>
|
100
|
+
<% end %>
|
83
101
|
<% end %>
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
102
|
+
<%if @crud_helper.destroy_action && should_destroy?(@crud_helper, record)%>
|
103
|
+
<% if @crud_associacao.present? %>
|
104
|
+
<%= link_to "Excluir", 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', data: {method: 'delete', confirm: 'Você tem certeza?'} %>
|
105
|
+
<% else %>
|
106
|
+
<%= link_to "Excluir", destroy_crud_path(model: @model.name.underscore, id: record.id, page: params[:page], q: params[:q]), class: 'btn btn-danger btn-xs', data: {method: 'delete', confirm: 'Você tem certeza?'} %>
|
107
|
+
<% end %>
|
90
108
|
<% end %>
|
91
|
-
|
109
|
+
</div>
|
92
110
|
</td>
|
93
111
|
<% end %>
|
@@ -34,3 +34,22 @@
|
|
34
34
|
<%= paginate @records, target: '#form', theme: 'templus'%>
|
35
35
|
</div>
|
36
36
|
<% end %>
|
37
|
+
<script type="text/javascript">
|
38
|
+
var theadtxt = [];
|
39
|
+
var headers = document.querySelectorAll("thead");
|
40
|
+
var tablebody = document.querySelectorAll("tbody");
|
41
|
+
for (var x = 0; x < headers.length; x++) {
|
42
|
+
theadtxt[x]=[];
|
43
|
+
for (var j = 0, headrow; headrow = headers[x].rows[0].cells[j]; j++) {
|
44
|
+
var current = headrow;
|
45
|
+
theadtxt[x].push(current.innerHTML);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
for (var v = 0, tbody; tbody = tablebody[v]; v++) {
|
49
|
+
for (var x = 0, row; row = tbody.rows[x]; x++) {
|
50
|
+
for (var j = 0, col; col = row.cells[j]; j++) {
|
51
|
+
col.insertAdjacentHTML('afterbegin', '<div class="col-xs-3 no-padding">' + theadtxt[v][j] + '</div>');
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
</script>
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<% @crud_helper.scopes.each do |escopo| %>
|
4
4
|
<% url = params[:associacao].present? ? crud_associacao_models_path(model: params[:model], id: params[:id], associacao: params[:associacao], scope: escopo[0]) : crud_models_path(model: @model.name.underscore, scope: escopo[0])%>
|
5
5
|
<%= link_to url, id: "#{escopo[0]}", data: {push: true, crumb: 'wielka'} do%>
|
6
|
-
<div style="float: left; margin-left: 10px;
|
7
|
-
<div class="widget style1 gray-bg" style="padding:15px
|
6
|
+
<div style="float: left; margin-left: 10px; ">
|
7
|
+
<div class="widget style1 gray-bg" style="padding: 15px 10px!important;">
|
8
8
|
<div class="row vertical-align text-center" style="margin:0!important;">
|
9
9
|
<h3 class="font-bold" style="width:100%;">
|
10
10
|
<%= escopo[1] %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= paginator.render do -%>
|
2
2
|
<div class="row">
|
3
|
-
<div class="col-xs-4">
|
3
|
+
<div class="col-xs-12 col-md-4">
|
4
4
|
<div class="pagination pull-left">
|
5
5
|
<% if @options[:current_page].number < 2 %>
|
6
6
|
<% inicio = 1 %>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
Exibindo <%= inicio %> - <%= fim %> de um total de <%= @options[:total_count] %>
|
16
16
|
</div>
|
17
17
|
</div>
|
18
|
-
<div class="col-xs-8">
|
18
|
+
<div class="col-xs-12 col-md-8">
|
19
19
|
<div class="dataTables_paginate paging_simple_numbers">
|
20
20
|
<ul class="pagination">
|
21
21
|
<%= first_page_tag unless current_page.first? %>
|
@@ -144,7 +144,7 @@ SimpleForm.setup do |config|
|
|
144
144
|
b.use :html5
|
145
145
|
b.wrapper :tag => 'div', :class => 'form-group' do |ba|
|
146
146
|
ba.use :label, :class => 'col-sm-2 control-label'
|
147
|
-
ba.wrapper :tag => 'div', :class => 'col-sm-
|
147
|
+
ba.wrapper :tag => 'div', :class => 'col-sm-11 col-xs-11' do |ba2|
|
148
148
|
ba2.use :input, :class => 'form-control'
|
149
149
|
ba2.use :error, :wrap_with => { :tag => 'span', :class => 'help-block m-b-none text-danger' }
|
150
150
|
ba2.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block text-muted' }
|
@@ -154,15 +154,15 @@ SimpleForm.setup do |config|
|
|
154
154
|
|
155
155
|
config.wrappers :with_button, class: :input, :tag => 'div', :error_class => 'has-error' do |b|
|
156
156
|
b.use :html5
|
157
|
-
b.wrapper :tag => 'div', :class => 'form-group' do |ba|
|
157
|
+
b.wrapper :tag => 'div', :class => 'form-group select-double' do |ba|
|
158
158
|
ba.use :label, :class => 'col-sm-2 control-label'
|
159
|
-
ba.wrapper :tag => 'div', :class => 'col-sm-9' do |ba2|
|
159
|
+
ba.wrapper :tag => 'div', :class => 'col-sm-9 col-xs-9' do |ba2|
|
160
160
|
ba2.use :input, :class => 'form-control'
|
161
161
|
ba2.use :error, :wrap_with => { :tag => 'span', :class => 'help-block m-b-none text-danger' }
|
162
162
|
ba2.use :hint, :wrap_with => { :tag => 'span', :class => 'help-block text-muted' }
|
163
163
|
end
|
164
164
|
ba.wrapper :tag => 'a', :class => "btn btn-success crud-new-record" do |ba2|
|
165
|
-
ba2.wrapper :tag => 'i'
|
165
|
+
ba2.wrapper :tag => 'i', :class => "fa fa-plus" do
|
166
166
|
end
|
167
167
|
end
|
168
168
|
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.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Sol
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-04-
|
13
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|