active_scaffold 3.4.22 → 3.4.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +5 -0
- data/MIT-LICENSE +1 -1
- data/app/assets/javascripts/jquery/active_scaffold_chosen.js +1 -1
- data/app/assets/stylesheets/active_scaffold_colors.scss +2 -1
- data/app/assets/stylesheets/active_scaffold_layout.css +21 -3
- data/app/views/active_scaffold_overrides/_show.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_show_association.html.erb +2 -0
- data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +17 -0
- data/app/views/active_scaffold_overrides/_show_association_vertical.html.erb +4 -0
- data/app/views/active_scaffold_overrides/_show_columns.html.erb +4 -4
- data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +25 -0
- data/lib/active_scaffold/data_structures/column.rb +6 -1
- data/lib/active_scaffold/helpers/show_column_helpers.rb +25 -3
- data/lib/active_scaffold/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7165870ea614c4b6716d2e3471179817ddff211
|
4
|
+
data.tar.gz: d8cf35a1036360fc2f78e061b1f1e34d54b4449f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85707d87e834e46b05a286db1dd795980c9329c53563d28238a69e459a72a7825d2faf78ff55898d0cf58b4180932d5cd4eafba81c9ca62a743e5ea23d0a3884
|
7
|
+
data.tar.gz: 262c83c84c084418072a6706d9db22b0f9d04d93b5fa6fa4be552b386663ffd18f2c3b2ca252cf039f2e302ea7fc4c5c0d44ba954d9d63bab349d6a2deebb70b
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
= 3.4.23
|
2
|
+
- fix chosen on new subform rows
|
3
|
+
- add show_ui to column
|
4
|
+
- add :vertical and :horizontal show_ui for associations
|
5
|
+
|
1
6
|
= 3.4.22
|
2
7
|
- fix has_one/many tableless model through association
|
3
8
|
- fix check default value for checkboxes, so if record in subform, with checkbox, is left as default, is not saved, but setting checkbox would save record
|
data/MIT-LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
jQuery(document).ready(function() {
|
2
|
-
jQuery(document).on('as:element_updated', function(event) {
|
2
|
+
jQuery(document).on('as:element_updated as:element_created', function(event) {
|
3
3
|
jQuery('select.chosen', event.target).chosen();
|
4
4
|
});
|
5
5
|
jQuery(document).on('as:action_success', 'a.as_action', function(event, action_link) {
|
@@ -149,8 +149,12 @@ text-align: left;
|
|
149
149
|
}
|
150
150
|
|
151
151
|
.active-scaffold th a,
|
152
|
-
.active-scaffold th p
|
152
|
+
.active-scaffold th p,
|
153
|
+
.active-scaffold .show-view th {
|
153
154
|
font: bold 11px arial, sans-serif;
|
155
|
+
}
|
156
|
+
.active-scaffold th a,
|
157
|
+
.active-scaffold th p {
|
154
158
|
display: block;
|
155
159
|
}
|
156
160
|
|
@@ -158,7 +162,8 @@ display: block;
|
|
158
162
|
padding: 2px 2px 2px 5px;
|
159
163
|
}
|
160
164
|
|
161
|
-
.active-scaffold th p
|
165
|
+
.active-scaffold th p,
|
166
|
+
.active-scaffold .show-view th {
|
162
167
|
padding: 2px 5px;
|
163
168
|
}
|
164
169
|
|
@@ -183,8 +188,11 @@ display: none;
|
|
183
188
|
/* Table :: Record Rows
|
184
189
|
============================= */
|
185
190
|
|
186
|
-
.active-scaffold tr.record td
|
191
|
+
.active-scaffold tr.record td,
|
192
|
+
.active-scaffold .show-view td {
|
187
193
|
padding: 5px 4px;
|
194
|
+
}
|
195
|
+
.active-scaffold tr.record td {
|
188
196
|
font-family: Verdana, sans-serif;
|
189
197
|
font-size: 11px;
|
190
198
|
border: solid 1px;
|
@@ -555,6 +563,16 @@ margin-left: 5px;
|
|
555
563
|
}
|
556
564
|
.active-scaffold .show-view dl dl {
|
557
565
|
margin-left: 0px;
|
566
|
+
margin-top: 5px;
|
567
|
+
}
|
568
|
+
.active-scaffold .show-view dl dl:first-child {
|
569
|
+
margin-top: 0;
|
570
|
+
}
|
571
|
+
.active-scaffold .show-view dl dl:after {
|
572
|
+
display: block;
|
573
|
+
content: "";
|
574
|
+
height: 1px;
|
575
|
+
clear: both;
|
558
576
|
}
|
559
577
|
|
560
578
|
.active-scaffold .show-view dt {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h4><%= active_scaffold_config.show.label(@record.to_label.nil? ? nil : h(@record.to_label)) %></h4>
|
2
2
|
|
3
|
-
<%= render :partial => 'show_columns', :locals => {:columns => active_scaffold_config.show.columns} -%>
|
3
|
+
<%= render :partial => 'show_columns', :locals => {:columns => active_scaffold_config.show.columns, :record => @record} -%>
|
4
4
|
|
5
5
|
<p class="form-footer">
|
6
6
|
<%= link_to as_(:close), main_path_to_return, :class => 'as_cancel', :remote => request.xhr? %>
|
@@ -0,0 +1,2 @@
|
|
1
|
+
<% associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a -%>
|
2
|
+
<%= render :partial => "show_association_#{show_partial}", :locals => {:column => column, :parent_record => parent_record, :associated => associated} if associated.present? %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%
|
2
|
+
columns_hash = {}
|
3
|
+
%>
|
4
|
+
<table>
|
5
|
+
<thead>
|
6
|
+
<tr>
|
7
|
+
<% show_columns_for(associated.first, column, columns_hash).each(:skip_groups => true) do |column| -%>
|
8
|
+
<th><%= show_label(column) %></th>
|
9
|
+
<% end -%>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<% associated.each do |record| -%>
|
14
|
+
<%= render :partial => 'show_horizontal_record', :locals => {:record => record, :parent_record => parent_record, :columns => show_columns_for(associated.first, column, columns_hash)} %>
|
15
|
+
<% end -%>
|
16
|
+
</tbody>
|
17
|
+
</table>
|
@@ -1,14 +1,14 @@
|
|
1
1
|
<dl>
|
2
|
-
<% columns.each :for =>
|
3
|
-
<dt><%= column
|
2
|
+
<% columns.each :for => record do |column| %>
|
3
|
+
<dt><%= show_label(column) -%></dt>
|
4
4
|
<% if column.respond_to? :each -%>
|
5
5
|
<dd>
|
6
|
-
<%= render :partial => 'show_columns', :locals => {:columns => column} %>
|
6
|
+
<%= render :partial => 'show_columns', :locals => {:columns => column, :record => record} %>
|
7
7
|
<% else -%>
|
8
8
|
<% css_class = "#{column.name}-view"
|
9
9
|
css_class.concat(" #{column.css_class}") unless column.css_class.nil? %>
|
10
10
|
<dd class="<%= css_class.strip %>">
|
11
|
-
<%= show_column_value(
|
11
|
+
<%= show_column_value(record, column) -%>
|
12
12
|
<% end -%>
|
13
13
|
</dd>
|
14
14
|
<% end -%>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%
|
2
|
+
columns_length = 0
|
3
|
+
columns_groups = []
|
4
|
+
%>
|
5
|
+
<tr>
|
6
|
+
<% columns.each :for => record do |column| -%>
|
7
|
+
<%
|
8
|
+
if column.respond_to? :each
|
9
|
+
columns_groups << column
|
10
|
+
next
|
11
|
+
end
|
12
|
+
columns_length += 1
|
13
|
+
%>
|
14
|
+
<%= content_tag :td, content_tag(:span, show_column_value(record, column)), :class => "#{column.name}-column #{:numeric if column.number?}" %>
|
15
|
+
<% end -%>
|
16
|
+
</tr>
|
17
|
+
<% columns_groups.each do |columns| %>
|
18
|
+
<tr>
|
19
|
+
<td colspan="<%= columns_length %>">
|
20
|
+
<% columns.each do |column| %>
|
21
|
+
<%= show_column_value(record, column) %>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end -%>
|
@@ -10,7 +10,7 @@ module ActiveScaffold
|
|
10
10
|
# performance of our default formatting. see issue #138.
|
11
11
|
send(method, record, column)
|
12
12
|
# second, check if the dev has specified a valid list_ui for this column
|
13
|
-
elsif column.
|
13
|
+
elsif column.show_ui && (method = override_show_column_ui(column.show_ui))
|
14
14
|
send(method, record, column)
|
15
15
|
else
|
16
16
|
if column.column && (method = override_show_column_ui(column.column.type))
|
@@ -25,13 +25,35 @@ module ActiveScaffold
|
|
25
25
|
simple_format(clean_column_value(record.send(column.name)))
|
26
26
|
end
|
27
27
|
|
28
|
+
def active_scaffold_show_horizontal(record, column)
|
29
|
+
raise ":horizontal show_ui must be used on association column" unless column.association
|
30
|
+
render :partial => 'show_association', :locals => {:column => column, :parent_record => record, :show_partial => :horizontal}
|
31
|
+
end
|
32
|
+
|
33
|
+
def active_scaffold_show_vertical(record, column)
|
34
|
+
raise ":vertical show_ui must be used on association column" unless column.association
|
35
|
+
render :partial => 'show_association', :locals => {:column => column, :parent_record => record, :show_partial => :vertical}
|
36
|
+
end
|
37
|
+
|
38
|
+
def show_columns_for(record, parent_column = nil, hash = {})
|
39
|
+
hash[record.class] ||= begin
|
40
|
+
columns = active_scaffold_config_for(record.class).show.columns
|
41
|
+
columns.constraint_columns = [parent_column.association.reverse] if parent_column
|
42
|
+
columns
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def show_label(column)
|
47
|
+
column.label
|
48
|
+
end
|
49
|
+
|
28
50
|
def show_column_override(column)
|
29
51
|
override_helper column, 'show_column'
|
30
52
|
end
|
31
53
|
|
32
54
|
# the naming convention for overriding show types with helpers
|
33
|
-
def override_show_column_ui(
|
34
|
-
method = "active_scaffold_show_#{
|
55
|
+
def override_show_column_ui(show_ui)
|
56
|
+
method = "active_scaffold_show_#{show_ui}"
|
35
57
|
method if respond_to? method
|
36
58
|
end
|
37
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Many, see README
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brakeman
|
@@ -162,7 +162,11 @@ files:
|
|
162
162
|
- app/views/active_scaffold_overrides/_row.html.erb
|
163
163
|
- app/views/active_scaffold_overrides/_search.html.erb
|
164
164
|
- app/views/active_scaffold_overrides/_show.html.erb
|
165
|
+
- app/views/active_scaffold_overrides/_show_association.html.erb
|
166
|
+
- app/views/active_scaffold_overrides/_show_association_horizontal.html.erb
|
167
|
+
- app/views/active_scaffold_overrides/_show_association_vertical.html.erb
|
165
168
|
- app/views/active_scaffold_overrides/_show_columns.html.erb
|
169
|
+
- app/views/active_scaffold_overrides/_show_horizontal_record.html.erb
|
166
170
|
- app/views/active_scaffold_overrides/_update_actions.html.erb
|
167
171
|
- app/views/active_scaffold_overrides/_update_calculations.js.erb
|
168
172
|
- app/views/active_scaffold_overrides/_update_column.js.erb
|