zutils 0.3.9 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/shared/_fields.html.erb +12 -1
- data/app/views/shared/_form.html.erb +6 -1
- data/lib/zutils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b83f5d8d6ad65447a77d8d18cc7a9e7fde4dbd61b92a31b9034f06f23f4b702f
|
4
|
+
data.tar.gz: 3b2b365d34da3b2115dad406518eb6f7d420f898de46ea22a09f36970643a49b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72886011e7625a2a9af5a84e044ca90b036e2164d58266f88d67a3a39dfba55cf0dfe17b7f6937d930c0d7a2d280b209e3e6b3614ed7a6dc52019f505994dba9
|
7
|
+
data.tar.gz: 1e46a9037a3cdd8ba0be4f41a2020f80224c27ae8f077fd5ceb9e67565f02d576d9beff095d191cf72d523c0b5598fc3fdc7b6cecd43e0dc2352438428e98eb7
|
@@ -1,11 +1,12 @@
|
|
1
1
|
<% excluded_columns ||= [] %>
|
2
|
+
<% additional_columns ||= [] %>
|
2
3
|
<% restricted_columns ||= {} %>
|
3
4
|
|
4
5
|
<% form_fields ||= (object.class.respond_to?('form_fields') ? object.class.form_fields : {}) %>
|
5
6
|
<% form_ordered_fields ||= (form_fields.empty? ? object.class.column_names : form_fields.keys) %>
|
6
7
|
|
7
8
|
<div class="row">
|
8
|
-
<% (form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns).each do |column| %>
|
9
|
+
<% (form_ordered_fields - ['id', 'created_at', 'updated_at', 'deleted_at'] - excluded_columns + additional_columns).each do |column| %>
|
9
10
|
<% wphtml = "col-md-#{(form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:size] : form_fields[column.to_sym] ) || 12}" %>
|
10
11
|
<% hint = (form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:hint] : '') %>
|
11
12
|
<% placeholder = (form_fields[column.to_sym].class == Hash ? form_fields[column.to_sym][:placeholder] : '') %>
|
@@ -13,6 +14,16 @@
|
|
13
14
|
<%= f.input column, input_html: { rows: 10, cols: 20 }, wrapper_html: { class: wphtml }, hint: hint, placeholder: placeholder %>
|
14
15
|
<% elsif [:date, :datetime].include?(object.class.column_for_attribute(column).type) %>
|
15
16
|
<%= f.input column, html5: true, wrapper_html: { class: wphtml }, hint: hint, placeholder: placeholder %>
|
17
|
+
<% elsif object.send(column).respond_to? 'attached?' %>
|
18
|
+
<% if object.send(column).class == ActiveStorage::Attached::Many %>
|
19
|
+
<%= f.input column, wrapper_html: { class: wphtml }, hint: hint, input_html: { multiple: true, class: 'fileinput',
|
20
|
+
data: {
|
21
|
+
initial: object.send(column).map{|im| rails_blob_path(im, only_path: true)}
|
22
|
+
}
|
23
|
+
} %>
|
24
|
+
<% else %>
|
25
|
+
<%= f.input column, wrapper_html: { class: wphtml }, hint: hint, input_html: { class: 'fileinput', 'data-initial': [rails_blob_path(object.send(column))] } %>
|
26
|
+
<% end %>
|
16
27
|
<% elsif /_id$/ =~ column && object.respond_to?(column.split('_id')[0]) %>
|
17
28
|
<% if restricted_columns.keys.include?(column.to_sym) %>
|
18
29
|
<%= f.association column.split("_id")[0],
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% excluded_columns ||= [] %>
|
2
|
+
<% additional_columns ||= [] %>
|
2
3
|
<% restricted_columns ||= {} %>
|
3
4
|
<% nested_resource ||= false %>
|
4
5
|
<% parent_resource ||= false %>
|
@@ -22,7 +23,11 @@
|
|
22
23
|
</h3>
|
23
24
|
</div>
|
24
25
|
<div class="box-body">
|
25
|
-
<%= render 'shared/fields', object: object, f: f,
|
26
|
+
<%= render 'shared/fields', object: object, f: f,
|
27
|
+
excluded_columns: excluded_columns,
|
28
|
+
additional_columns: additional_columns,
|
29
|
+
restricted_columns: restricted_columns
|
30
|
+
%>
|
26
31
|
</div>
|
27
32
|
<div class="box-footer">
|
28
33
|
<% if back_link %>
|
data/lib/zutils/version.rb
CHANGED