binda 0.1.3 → 0.1.4
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/README.md +83 -25
- data/app/assets/javascripts/binda/application.js +3 -3
- data/app/assets/javascripts/binda/components/bootstrap.js +3 -4
- data/app/assets/javascripts/binda/components/field_group_editor.js +10 -10
- data/app/assets/javascripts/binda/components/field_setting_choices.js +61 -49
- data/app/assets/javascripts/binda/components/fileupload.js +135 -118
- data/app/assets/javascripts/binda/components/form_item.js +65 -65
- data/app/assets/javascripts/binda/components/form_item_editor.js +19 -19
- data/app/assets/javascripts/binda/components/form_item_image.js +11 -13
- data/app/assets/javascripts/binda/components/form_item_repeater.js +77 -71
- data/app/assets/javascripts/binda/components/login-shader.js +171 -164
- data/app/assets/javascripts/binda/components/login_form.js +65 -73
- data/app/assets/javascripts/binda/components/radio-toggle.js +8 -12
- data/app/assets/javascripts/binda/components/select2.js +19 -14
- data/app/assets/javascripts/binda/components/sortable.js +76 -71
- data/app/assets/javascripts/binda/dist/binda.bundle.js +735 -727
- data/app/assets/javascripts/binda/index.js +49 -35
- data/app/assets/stylesheets/binda/components/assets_manager.scss +13 -22
- data/app/assets/stylesheets/binda/components/b-alert.scss +18 -14
- data/app/assets/stylesheets/binda/components/b-btn.scss +24 -43
- data/app/assets/stylesheets/binda/components/field_setting_choices.scss +16 -31
- data/app/assets/stylesheets/binda/components/fileupload.scss +25 -42
- data/app/assets/stylesheets/binda/components/form_item.scss +51 -93
- data/app/assets/stylesheets/binda/components/form_item_choices.scss +7 -10
- data/app/assets/stylesheets/binda/components/login.scss +2 -2
- data/app/assets/stylesheets/binda/components/main_header.scss +5 -10
- data/app/assets/stylesheets/binda/components/main_sidebar.scss +42 -46
- data/app/assets/stylesheets/binda/components/main_sortable_table.scss +12 -21
- data/app/assets/stylesheets/binda/components/main_table.scss +18 -35
- data/app/assets/stylesheets/binda/components/popup_warning.scss +14 -27
- data/app/assets/stylesheets/binda/components/select2.scss +46 -48
- data/app/assets/stylesheets/binda/components/sortable.scss +25 -45
- data/app/assets/stylesheets/binda/components/standard-form.scss +43 -73
- data/app/assets/stylesheets/binda/controllers/users_sessions_new.scss +52 -89
- data/app/assets/stylesheets/binda/index.scss +0 -1
- data/app/assets/stylesheets/binda/settings/buttons.scss +9 -10
- data/app/assets/stylesheets/binda/settings/common.scss +17 -22
- data/app/assets/stylesheets/binda/settings/fonts.scss +112 -67
- data/app/assets/stylesheets/binda/settings/tiny_mce_overrides.scss +20 -36
- data/app/assets/stylesheets/binda/settings/variables.scss +38 -43
- data/app/controllers/binda/choices_controller.rb +14 -11
- data/app/controllers/binda/components_controller.rb +6 -4
- data/app/controllers/binda/structures_controller.rb +7 -3
- data/app/helpers/binda/components_helper.rb +69 -3
- data/app/helpers/binda/field_groups_helper.rb +16 -6
- data/app/helpers/binda/structures_helper.rb +1 -4
- data/app/models/binda/application_record.rb +4 -1
- data/app/models/binda/asset.rb +3 -1
- data/app/models/binda/b.rb +1 -0
- data/app/models/binda/category.rb +1 -0
- data/app/models/binda/checkbox.rb +2 -0
- data/app/models/binda/choice.rb +74 -41
- data/app/models/binda/component.rb +1 -1
- data/app/models/binda/date.rb +4 -0
- data/app/models/binda/deprecation.rb +7 -0
- data/app/models/binda/field_group.rb +16 -3
- data/app/models/binda/field_setting.rb +168 -41
- data/app/models/binda/image.rb +1 -0
- data/app/models/binda/radio.rb +2 -0
- data/app/models/binda/relation.rb +3 -0
- data/app/models/binda/repeater.rb +3 -0
- data/app/models/binda/selection.rb +237 -0
- data/app/models/binda/string.rb +4 -0
- data/app/models/binda/structure.rb +25 -14
- data/app/models/binda/text.rb +9 -0
- data/app/models/binda/video.rb +1 -0
- data/app/models/concerns/binda/default_helpers.rb +40 -31
- data/app/models/concerns/binda/deprecations.rb +6 -0
- data/app/models/concerns/binda/fieldable_association_helpers.rb +366 -0
- data/app/models/concerns/binda/fieldable_associations.rb +32 -369
- data/app/views/binda/boards/edit.html.erb +15 -2
- data/app/views/binda/categories/_form.html.erb +24 -51
- data/app/views/binda/categories/edit.html.erb +23 -3
- data/app/views/binda/categories/index.html.erb +49 -25
- data/app/views/binda/categories/new.html.erb +21 -2
- data/app/views/binda/components/edit.html.erb +27 -4
- data/app/views/binda/components/index.html.erb +47 -50
- data/app/views/binda/components/new.html.erb +12 -2
- data/app/views/binda/components/sort_index.html.erb +28 -13
- data/app/views/binda/field_groups/_form_body.html.erb +43 -82
- data/app/views/binda/field_groups/_form_item.html.erb +3 -120
- data/app/views/binda/field_groups/_form_section.html.erb +11 -16
- data/app/views/binda/field_groups/_form_section_repeater.html.erb +7 -15
- data/app/views/binda/field_groups/edit.html.erb +14 -2
- data/app/views/binda/field_groups/form_item/_form_item_choice_editor.html.erb +11 -0
- data/app/views/binda/field_groups/form_item/_form_item_editor.html.erb +14 -0
- data/app/views/binda/field_groups/form_item/_form_item_header.html.erb +25 -0
- data/app/views/binda/field_groups/form_item/_form_item_new_editor.html.erb +8 -0
- data/app/views/binda/field_groups/form_item/_form_item_persisted_editor.html.erb +27 -0
- data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_allow_null_choice.html.erb +11 -0
- data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_choice_header.html.erb +11 -0
- data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_default_choice.html.erb +11 -0
- data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_new_choice.html.erb +16 -0
- data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_persisted_choices.html.erb +16 -0
- data/app/views/binda/field_groups/new.html.erb +14 -2
- data/app/views/binda/field_settings/_form_body.html.erb +1 -3
- data/app/views/binda/field_settings/edit.html.erb +1 -1
- data/app/views/binda/field_settings/new.html.erb +1 -1
- data/app/views/binda/fieldable/_form_body.html.erb +24 -72
- data/app/views/binda/fieldable/_form_item_date.html.erb +1 -4
- data/app/views/binda/fieldable/_form_item_image.html.erb +3 -7
- data/app/views/binda/fieldable/_form_item_new_repeater.html.erb +0 -13
- data/app/views/binda/fieldable/_form_item_selections.html.erb +20 -112
- data/app/views/binda/fieldable/form_item_selections/_form_item_checkbox.html.erb +34 -0
- data/app/views/binda/fieldable/form_item_selections/_form_item_radio.html.erb +28 -0
- data/app/views/binda/fieldable/form_item_selections/_form_item_selection.html.erb +30 -0
- data/app/views/binda/manage/users/_form_body.html.erb +1 -31
- data/app/views/binda/manage/users/edit.html.erb +12 -2
- data/app/views/binda/manage/users/index.html.erb +36 -19
- data/app/views/binda/manage/users/new.html.erb +14 -3
- data/app/views/binda/structures/_form_body.html.erb +2 -25
- data/app/views/binda/structures/_form_section.html.erb +43 -65
- data/app/views/binda/structures/_form_sidebar.html.erb +19 -12
- data/app/views/binda/structures/edit.html.erb +20 -3
- data/app/views/binda/structures/index.html.erb +46 -26
- data/app/views/binda/structures/new.html.erb +13 -2
- data/app/views/binda/structures/sort_index.html.erb +37 -17
- data/app/views/binda/users/sessions/new.html.erb +25 -20
- data/app/views/layouts/binda/_form_errors.html.erb +10 -0
- data/app/views/layouts/binda/_sidebar.html.erb +6 -6
- data/app/views/layouts/binda/application.html.erb +1 -1
- data/config/initializers/carrierwave.rb +3 -2
- data/config/locales/en.yml +56 -12
- data/config/tinymce.yml +2 -2
- data/db/migrate/1_create_binda_tables.rb +1 -1
- data/lib/binda/version.rb +1 -1
- data/lib/generators/binda/setup/setup_generator.rb +2 -2
- data/lib/tasks/add_default_choice_to_all_selections_with_no_choices_task.rake +6 -0
- metadata +58 -8
- data/app/assets/stylesheets/binda/components/form_item_image.scss +0 -0
- data/app/views/binda/field_groups/_form_item_choice.erb +0 -104
data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_allow_null_choice.html.erb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% if ff.object.field_type != 'radio' %>
|
|
2
|
+
<div class="form-item--full-size standard-form--checkbox field-setting-choices--allow-null">
|
|
3
|
+
<%= ff.input :allow_null,
|
|
4
|
+
as: :radio_buttons,
|
|
5
|
+
label: t('binda.allow_null'),
|
|
6
|
+
collection: [[t('binda.allow_null_true'), true], [t('binda.allow_null_false'), false]],
|
|
7
|
+
label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[0]}".html_safe },
|
|
8
|
+
checked: ff.object.allow_null,
|
|
9
|
+
default: true %>
|
|
10
|
+
</div>
|
|
11
|
+
<% end %>
|
data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_choice_header.html.erb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<div class="field-setting-choices--header field-settings-header">
|
|
2
|
+
<a href="#"
|
|
3
|
+
class="field-setting-choices--toggle-choice field-setting-choices--add-choice"
|
|
4
|
+
data-choices-id="field-setting-choices-<%= ff.object.id %>">
|
|
5
|
+
<i class="fa fa-plus" aria-hidden="true"></i>
|
|
6
|
+
<%= t(:add_choice).capitalize %>
|
|
7
|
+
</a>
|
|
8
|
+
<p class="control-label">
|
|
9
|
+
<%= t(:choices).capitalize %>
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_default_choice.html.erb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<% if ff.object.choices.find_all{|c| c.persisted? }.any? && !ff.object.allow_null? %>
|
|
2
|
+
<div class="form-item--full-size">
|
|
3
|
+
<%= ff.input :default_choice_id,
|
|
4
|
+
as: :select, collection: ff.object.choices.find_all{|c| c.persisted? },
|
|
5
|
+
label_method: :label,
|
|
6
|
+
include_blank: false,
|
|
7
|
+
selected: ff.object.default_choice_id,
|
|
8
|
+
hint: t(:default_choice_description),
|
|
9
|
+
input_html: {class: 'select2-item'} %>
|
|
10
|
+
</div>
|
|
11
|
+
<% end %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%= f.simple_fields_for "new_choices[]", ff.object.choices.build(), defaults: { label: false } do |fff| %>
|
|
2
|
+
<div class="field-setting-choices--choice <%= choice_class %>">
|
|
3
|
+
<%= fff.association :field_setting, as: :hidden %>
|
|
4
|
+
<div class="field-setting-choices--choice-label">
|
|
5
|
+
<%= fff.input :label, placeholder: t('binda.choice_label') %>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="field-setting-choices--choice-value">
|
|
8
|
+
<%= fff.input :value, placeholder: t('binda.choice_value') %>
|
|
9
|
+
</div>
|
|
10
|
+
<a href="#" class="field-setting-choices--toggle-choice field-setting-choices--js-delete-choice">
|
|
11
|
+
<i class="far fa-trash-alt"></i>
|
|
12
|
+
</a>
|
|
13
|
+
<div class="clearfix"></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<% end %>
|
data/app/views/binda/field_groups/form_item/form_item_choice/_form_item_persisted_choices.html.erb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%= ff.simple_fields_for :choices, ff.object.choices.order( :label ), defaults: {label: false} do |fff| %>
|
|
2
|
+
<div id="field-setting-choices--choice-<%= fff.object.id %>" class="field-setting-choices--choice">
|
|
3
|
+
<%= fff.input :id, as: :hidden %>
|
|
4
|
+
<%= fff.association :field_setting, as: :hidden %>
|
|
5
|
+
<div class="field-setting-choices--choice-label">
|
|
6
|
+
<%= fff.input :label, placeholder: t('binda.choice_label') %>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="field-setting-choices--choice-value">
|
|
9
|
+
<%= fff.input :value, placeholder: t('binda.choice_value') %>
|
|
10
|
+
</div>
|
|
11
|
+
<a href="<%= choice_path( fff.object ) %>" class="field-setting-choices--delete-choice">
|
|
12
|
+
<i class="far fa-trash-alt"></i>
|
|
13
|
+
</a>
|
|
14
|
+
<div class="clearfix"></div>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
<% content_for :title do %>
|
|
2
|
+
<%= t('binda.new_field_group') %>
|
|
3
|
+
<% end %>
|
|
4
|
+
|
|
5
|
+
|
|
1
6
|
<% content_for :header do %>
|
|
2
|
-
<h3>
|
|
3
|
-
|
|
7
|
+
<h3>
|
|
8
|
+
<%= t('binda.new_field_group') %>
|
|
9
|
+
</h3>
|
|
10
|
+
<a href="<%= structure_path( @structure.slug ) %>"
|
|
11
|
+
class="main-header--back">
|
|
12
|
+
<i class="fas fa-list-ul"></i>
|
|
13
|
+
<%= "#{ t :back_to }".capitalize %>
|
|
14
|
+
<%= @structure.name.capitalize %>
|
|
15
|
+
</a>
|
|
4
16
|
<% end %>
|
|
5
17
|
|
|
6
18
|
<% content_for :content do %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% content_for :header do %>
|
|
2
2
|
<h3><%= "#{ t :edit }" %><%= @field_group.name.humanize.split.map(&:capitalize).join(' ') %></h3>
|
|
3
|
-
<a href="<%= structure_field_group_path( id: @field_group.slug ) %>" class="main-header--back"><
|
|
3
|
+
<a href="<%= structure_field_group_path( id: @field_group.slug ) %>" class="main-header--back"><i class="fas fa-list-ul"></i> <%= "#{ t :back_to }".capitalize %> <%= @field_group.name.capitalize %></a>
|
|
4
4
|
<% end %>
|
|
5
5
|
|
|
6
6
|
<% content_for :content do %>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% content_for :header do %>
|
|
2
2
|
<h3><%= "#{ t :new }".capitalize %><%= @field_group.name.humanize.split.map(&:capitalize).join(' ') %></h3>
|
|
3
|
-
<a href="<%= structure_field_group_path( id: @field_group.slug ) %>" class="main-header--back"><
|
|
3
|
+
<a href="<%= structure_field_group_path( id: @field_group.slug ) %>" class="main-header--back"><i class="fas fa-list-ul"></i> <%= "#{ t :back_to }".capitalize %> <%= @field_group.name.capitalize %></a>
|
|
4
4
|
<% end %>
|
|
5
5
|
|
|
6
6
|
<% content_for :content do %>
|
|
@@ -1,90 +1,42 @@
|
|
|
1
1
|
<%= render 'layouts/binda/popup_warning' %>
|
|
2
|
-
|
|
3
2
|
<%= simple_form_for [ @instance.structure, @instance ], html: { class: 'form-body', multipart: true } do |f| %>
|
|
4
|
-
|
|
5
3
|
<%= f.error_notification %>
|
|
6
|
-
|
|
7
|
-
<% if f.object.errors.any? %>
|
|
8
|
-
<div class="standard-form--error-explanation b-alert b-alert--error">
|
|
9
|
-
<%= t('binda.standard_form_error_heading') %> <%= pluralize(f.object.errors.count, t("binda.standard_form_error")) %>:
|
|
10
|
-
<ul>
|
|
11
|
-
<% f.object.errors.full_messages.each do |msg| %>
|
|
12
|
-
<li><%= msg %></li>
|
|
13
|
-
<% end %>
|
|
14
|
-
</ul>
|
|
15
|
-
</div>
|
|
16
|
-
<% end %>
|
|
17
|
-
|
|
18
|
-
<%# - - - - - - - - - - - - %>
|
|
19
|
-
<%# SET POSITION %>
|
|
20
|
-
<%# - - - - - - - - - - - - %>
|
|
4
|
+
<%= render 'layouts/binda/form_errors', f: f %>
|
|
21
5
|
<% unless f.object.new_record? %>
|
|
22
6
|
<%= f.input :position, as: :hidden %>
|
|
23
7
|
<% end %>
|
|
24
|
-
|
|
25
8
|
<div class="standard-form--body">
|
|
26
|
-
|
|
27
|
-
<%# - - - - - - - - - - - - %>
|
|
28
|
-
<%# NOTICE / ERRORS %>
|
|
29
|
-
<%# - - - - - - - - - - - - %>
|
|
30
9
|
<div class="standard-form--container">
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<%= f.input :slug, disabled: true, hint: "#{ t :slug_disable_hint }" %>
|
|
44
|
-
<% end %>
|
|
45
|
-
|
|
46
|
-
<%= f.input :structure_id, as: :hidden, input_html: { value: @structure.id } %>
|
|
47
|
-
|
|
48
|
-
</div>
|
|
49
|
-
|
|
10
|
+
<div class="standard-form--header">
|
|
11
|
+
<small><%= "#{ t :details }".capitalize %></small>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="standard-form--fields">
|
|
14
|
+
<%= f.input :name, label: "#{t('binda.title')}".capitalize %>
|
|
15
|
+
<% if f.object.slug.nil? %>
|
|
16
|
+
<%= f.input :slug, as: :hidden %>
|
|
17
|
+
<% else %>
|
|
18
|
+
<%= f.input :slug, disabled: true, hint: "#{ t :slug_disable_hint }" %>
|
|
19
|
+
<% end %>
|
|
20
|
+
<%= f.input :structure_id, as: :hidden, input_html: { value: @structure.id } %>
|
|
21
|
+
</div>
|
|
50
22
|
</div>
|
|
51
|
-
|
|
52
|
-
<%# - - - - - - - - - - - - %>
|
|
53
|
-
<%# FIELD GROUP LOOP %>
|
|
54
|
-
<%# - - - - - - - - - - - - %>
|
|
55
23
|
<% @structure.field_groups.order( :position, :name ).each_with_index do |field_group, index| %>
|
|
56
|
-
|
|
57
24
|
<div class="standard-form--container">
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<% else %>
|
|
68
|
-
|
|
69
|
-
<% field_group.field_settings.order( :position, :name ).each do |field_setting| %>
|
|
70
|
-
<% next unless field_setting.is_root? %>
|
|
71
|
-
<%= render "binda/fieldable/form_section", f: f, field_setting: field_setting %>
|
|
72
|
-
<% end %>
|
|
73
|
-
|
|
25
|
+
<div class="standard-form--header">
|
|
26
|
+
<small><%= field_group.name.capitalize %></small>
|
|
27
|
+
</div>
|
|
28
|
+
<% if f.object.new_record? %>
|
|
29
|
+
<p class="standard-form--hint-on-new-record"><%= t( :hint_create_parent_before_child, arg1: "#{@structure.name} #{@structure.instance_type}", arg2: "#{ t :detail }" ).capitalize %></p>
|
|
30
|
+
<% else %>
|
|
31
|
+
<% field_group.field_settings.order( :position, :name ).each do |field_setting| %>
|
|
32
|
+
<% next unless field_setting.is_root? %>
|
|
33
|
+
<%= render "binda/fieldable/form_section", f: f, field_setting: field_setting %>
|
|
74
34
|
<% end %>
|
|
75
|
-
|
|
35
|
+
<% end %>
|
|
76
36
|
</div>
|
|
77
|
-
|
|
78
37
|
<% end %>
|
|
79
38
|
</div>
|
|
80
|
-
|
|
81
|
-
<%# - - - - - - - - - - - - %>
|
|
82
|
-
<%# SIDEBAR %>
|
|
83
|
-
<%# - - - - - - - - - - - - %>
|
|
84
39
|
<div class="standard-form--container standard-form--sidebar">
|
|
85
|
-
|
|
86
40
|
<%= render "binda/fieldable/form_sidebar", f: f %>
|
|
87
|
-
|
|
88
41
|
</div>
|
|
89
|
-
|
|
90
|
-
<% end %>
|
|
42
|
+
<% end %>
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
<div id="standard-form--date-<%= field_setting.id %>" class="standard-form--date form-item">
|
|
2
|
-
|
|
3
2
|
<%= ff.input :date,
|
|
4
3
|
as: :date,
|
|
5
4
|
start_year: Date.today.year - 200,
|
|
6
5
|
end_year: Date.today.year + 200,
|
|
7
6
|
hint: field_setting.description,
|
|
8
7
|
label: field_setting.name.capitalize,
|
|
9
|
-
input_html: { class: 'select2-item' } %>
|
|
10
|
-
|
|
8
|
+
input_html: { class: 'select2-item' } %>
|
|
11
9
|
<%= ff.input :field_setting_id, as: :hidden, input_html: { value: field_setting.id } %>
|
|
12
10
|
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
|
13
11
|
<%= ff.input :fieldable_id, as: :hidden %>
|
|
14
12
|
<%= ff.input :fieldable_type, as: :hidden %>
|
|
15
|
-
|
|
16
13
|
</div>
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
class="fileupload form-group"
|
|
4
4
|
data-message="<%= t('binda.upload_loading_message') %>"
|
|
5
5
|
data-error="<%= t('binda.upload_error_message')%>">
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<p class="control-label">
|
|
7
|
+
<%= field_setting.name.capitalize %>
|
|
8
|
+
</p>
|
|
9
9
|
<% image = ff.object.image.thumb.url if ff.object.image.present? %>
|
|
10
10
|
<div class="fileupload--dashboard">
|
|
11
|
-
|
|
12
11
|
<%= ff.input :image,
|
|
13
12
|
label: "<i class=\"fa fa-upload\" aria-hidden=\"true\"></i> #{t('binda.choose_file_button')}".html_safe,
|
|
14
13
|
hint: field_setting.description,
|
|
@@ -23,15 +22,12 @@
|
|
|
23
22
|
repeater: { id: "#{field_setting.parent_id}" }]),
|
|
24
23
|
'data-id': ff.object.id
|
|
25
24
|
} %>
|
|
26
|
-
|
|
27
25
|
</div>
|
|
28
|
-
|
|
29
26
|
<%= ff.input :image_cache, as: :hidden %>
|
|
30
27
|
<%= ff.input :field_setting_id, as: :hidden, input_html: { value: field_setting.id } %>
|
|
31
28
|
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
|
32
29
|
<%= ff.input :fieldable_id, as: :hidden %>
|
|
33
30
|
<%= ff.input :fieldable_type, as: :hidden %>
|
|
34
31
|
<div class="clearfix"></div>
|
|
35
|
-
|
|
36
32
|
</div>
|
|
37
33
|
</div>
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
<%# - - - - - - - - - - - - - - %>
|
|
2
|
-
<%# REPEATER NEW FIELDS %>
|
|
3
|
-
<%# - - - - - - - - - - - - - - %>
|
|
4
1
|
<%= simple_form_for [@instance.structure, @instance], defaults: { label: false }, html: { multipart: true } do |f| %>
|
|
5
2
|
<!-- SPLIT -->
|
|
6
3
|
<li id="repeater_<%= @repeater.id %>" class="form-item--repeater form-item--collapsable">
|
|
7
|
-
|
|
8
|
-
<%# - - - - - - - - - - - - %>
|
|
9
|
-
<%# REPEATER HEADER %>
|
|
10
|
-
<%# - - - - - - - - - - - - %>
|
|
11
4
|
<div class="form-item--header">
|
|
12
5
|
<a class="form-item--collapse-btn" href="#">
|
|
13
6
|
<span><i class="fas fa-angle-up"></i> <%= t('binda.collapse') %></span>
|
|
@@ -16,10 +9,6 @@
|
|
|
16
9
|
<a class="form-item--delete-repeater-item" href="<%= repeater_path( id: @repeater.id ) %>" data-id="<%= @repeater.id %>" data-confirm="<%= t 'binda.confirm_delete' %>"><i class="far fa-trash-alt"></i> <%= t('binda.delete') %></a>
|
|
17
10
|
<p><%= @repeater.field_setting.name %> <%= t('binda.item') %> #<%= @repeater.id %></p>
|
|
18
11
|
</div>
|
|
19
|
-
|
|
20
|
-
<%# - - - - - - - - - - - - - - %>
|
|
21
|
-
<%# FIRST REPEATER %>
|
|
22
|
-
<%# - - - - - - - - - - - - - - %>
|
|
23
12
|
<div class="form-item--repeater-fields">
|
|
24
13
|
<%= f.simple_fields_for "repeaters_attributes[]", @repeater do |ff| %>
|
|
25
14
|
<%= ff.input :fieldable_id, as: :hidden %>
|
|
@@ -31,8 +20,6 @@
|
|
|
31
20
|
<% end %>
|
|
32
21
|
<% end %>
|
|
33
22
|
</div>
|
|
34
|
-
|
|
35
23
|
</li>
|
|
36
|
-
|
|
37
24
|
<!-- SPLIT -->
|
|
38
25
|
<% end %>
|
|
@@ -1,121 +1,29 @@
|
|
|
1
1
|
<div id="standard-form--<%= field_setting.field_type %>-<%= field_setting.id %>" class="standard-form--<%= field_setting.field_type %> form-item">
|
|
2
|
-
|
|
3
2
|
<% if field_setting.choices.any? %>
|
|
4
|
-
|
|
5
|
-
<%# - - - - - - - - - - - - %>
|
|
6
|
-
<%# RADIO %>
|
|
7
|
-
<%# - - - - - - - - - - - - %>
|
|
8
3
|
<% if field_setting.field_type === 'radio' %>
|
|
9
|
-
|
|
10
|
-
<%= f.simple_fields_for "radios_attributes[]", current do |ff| %>
|
|
11
|
-
<% if ff.object.choices.any? %>
|
|
12
|
-
<%= ff.input :choice_ids,
|
|
13
|
-
label: field_setting.name.capitalize,
|
|
14
|
-
hint: prepare_description_for_form_hint(field_setting),
|
|
15
|
-
as: :radio_buttons,
|
|
16
|
-
collection: field_setting.choices.order(:label),
|
|
17
|
-
label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
|
|
18
|
-
value_method: :id,
|
|
19
|
-
checked: ff.object.choices.first.id,
|
|
20
|
-
include_blank: field_setting.allow_null %>
|
|
21
|
-
<% else %>
|
|
22
|
-
<%= ff.input :choice_ids,
|
|
23
|
-
label: field_setting.name.capitalize,
|
|
24
|
-
hint: prepare_description_for_form_hint(field_setting),
|
|
25
|
-
as: :radio_buttons,
|
|
26
|
-
collection: field_setting.choices.order(:label),
|
|
27
|
-
label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
|
|
28
|
-
value_method: :id,
|
|
29
|
-
checked: ( field_setting.default_choice.id unless field_setting.allow_null ),
|
|
30
|
-
include_blank: field_setting.allow_null %>
|
|
31
|
-
<% end %>
|
|
32
|
-
<%= ff.input :field_setting_id, as: :hidden, input_html: { value: field_setting.id } %>
|
|
33
|
-
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
|
34
|
-
<%= ff.input :fieldable_id, as: :hidden %>
|
|
35
|
-
<%= ff.input :fieldable_type, as: :hidden %>
|
|
36
|
-
<% end %>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<%# - - - - - - - - - - - - %>
|
|
40
|
-
<%# SELECT %>
|
|
41
|
-
<%# - - - - - - - - - - - - %>
|
|
4
|
+
<%= render 'binda/fieldable/form_item_selections/form_item_radio', f: f, field_setting: field_setting %>
|
|
42
5
|
<% elsif field_setting.field_type === 'selection' %>
|
|
43
|
-
|
|
44
|
-
<%= f.simple_fields_for "selections_attributes[]", current do |ff| %>
|
|
45
|
-
<% if ff.object.choices.any? %>
|
|
46
|
-
<%= ff.input :choice_ids,
|
|
47
|
-
label: field_setting.name.capitalize,
|
|
48
|
-
hint: prepare_description_for_form_hint(field_setting),
|
|
49
|
-
as: :select,
|
|
50
|
-
collection: field_setting.choices.order(:label),
|
|
51
|
-
label_method: :label,
|
|
52
|
-
value_method: :id,
|
|
53
|
-
selected: ff.object.choices.first.id,
|
|
54
|
-
include_blank: field_setting.allow_null,
|
|
55
|
-
input_html: { class: 'select2-item' } %>
|
|
56
|
-
<% else %>
|
|
57
|
-
<%= ff.input :choice_ids,
|
|
58
|
-
label: field_setting.name.capitalize,
|
|
59
|
-
hint: prepare_description_for_form_hint(field_setting),
|
|
60
|
-
as: :select,
|
|
61
|
-
collection: field_setting.choices.order(:label),
|
|
62
|
-
label_method: :label,
|
|
63
|
-
value_method: :id,
|
|
64
|
-
selected: ( field_setting.default_choice.id unless field_setting.allow_null ),
|
|
65
|
-
include_blank: field_setting.allow_null,
|
|
66
|
-
input_html: { class: 'select2-item' } %>
|
|
67
|
-
<% end %>
|
|
68
|
-
<%= ff.input :field_setting_id, as: :hidden, input_html: { value: field_setting.id } %>
|
|
69
|
-
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
|
70
|
-
<%= ff.input :fieldable_id, as: :hidden %>
|
|
71
|
-
<%= ff.input :fieldable_type, as: :hidden %>
|
|
72
|
-
<% end %>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<%# - - - - - - - - - - - - %>
|
|
76
|
-
<%# CHECKBOX %>
|
|
77
|
-
<%# - - - - - - - - - - - - %>
|
|
6
|
+
<%= render 'binda/fieldable/form_item_selections/form_item_selection', f: f, field_setting: field_setting %>
|
|
78
7
|
<% elsif field_setting.field_type === 'checkbox' %>
|
|
79
|
-
|
|
80
|
-
<%= f.simple_fields_for "checkboxes_attributes[]", current do |ff| %>
|
|
81
|
-
<% if ff.object.choices.any? %>
|
|
82
|
-
<%= ff.input :choice_ids,
|
|
83
|
-
label: field_setting.name.capitalize,
|
|
84
|
-
hint: "#{t('binda.null_is_not_allowed')}. #{field_setting.description}",
|
|
85
|
-
as: :check_boxes,
|
|
86
|
-
collection: field_setting.choices.order(:label),
|
|
87
|
-
label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
|
|
88
|
-
value_method: :id,
|
|
89
|
-
checked: ff.object.choice_ids,
|
|
90
|
-
include_blank: field_setting.allow_null,
|
|
91
|
-
include_hidden: field_setting.allow_null %>
|
|
92
|
-
<% else %>
|
|
93
|
-
<%= ff.input :choice_ids,
|
|
94
|
-
label: field_setting.name.capitalize,
|
|
95
|
-
hint: "#{t('binda.null_is_not_allowed')}. #{field_setting.description}",
|
|
96
|
-
as: :check_boxes,
|
|
97
|
-
collection: field_setting.choices.order(:label),
|
|
98
|
-
label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
|
|
99
|
-
value_method: :id,
|
|
100
|
-
checked: ( field_setting.default_choice.id unless field_setting.allow_null ),
|
|
101
|
-
include_blank: field_setting.allow_null,
|
|
102
|
-
include_hidden: field_setting.allow_null %>
|
|
103
|
-
<% end %>
|
|
104
|
-
<%= ff.input :field_setting_id, as: :hidden, input_html: { value: field_setting.id } %>
|
|
105
|
-
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
|
106
|
-
<%= ff.input :fieldable_id, as: :hidden %>
|
|
107
|
-
<%= ff.input :fieldable_type, as: :hidden %>
|
|
108
|
-
<% end %>
|
|
8
|
+
<%= render 'binda/fieldable/form_item_selections/form_item_checkbox', f: f, field_setting: field_setting %>
|
|
109
9
|
<% end %>
|
|
110
|
-
|
|
111
10
|
<% else %>
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
11
|
+
<div class="form-group">
|
|
12
|
+
<p class="control-label">
|
|
13
|
+
<%= field_setting.name.capitalize %>
|
|
14
|
+
</p>
|
|
15
|
+
<p>
|
|
16
|
+
<%= t('binda.no_available_choice') %>
|
|
17
|
+
<% if current_user.is_superadmin %>
|
|
18
|
+
<%= t('binda.no_available_choice_superadmin_hint') %>
|
|
19
|
+
<a href="<%= edit_structure_field_group_path( structure_id: @structure.id, id: field_setting.field_group.id )%>">
|
|
20
|
+
<%= field_setting.field_group.name %>
|
|
21
|
+
<%= t('binda.field_group.singular').downcase %>
|
|
22
|
+
</a>
|
|
23
|
+
<% else %>
|
|
24
|
+
<%= t('binda.no_available_choice_user_hint') %>
|
|
25
|
+
<% end %>
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
119
28
|
<% end %>
|
|
120
|
-
|
|
121
29
|
</div>
|