binda 0.1.0 → 0.1.1
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 +3 -2
- data/app/assets/javascripts/binda/components/fileupload.js +11 -2
- data/app/assets/javascripts/binda/components/form_item.js +25 -45
- data/app/assets/javascripts/binda/components/form_item_choice.js +42 -32
- data/app/assets/javascripts/binda/components/form_item_repeater.js +29 -32
- data/app/assets/javascripts/binda/components/sortable.js +24 -19
- data/app/assets/javascripts/binda/dist/binda.bundle.js +133 -138
- data/app/assets/stylesheets/binda/components/b-alert.scss +24 -0
- data/app/assets/stylesheets/binda/components/form_item.scss +20 -17
- data/app/assets/stylesheets/binda/components/form_item_choice.scss +20 -0
- data/app/assets/stylesheets/binda/components/main_header.scss +1 -1
- data/app/assets/stylesheets/binda/components/main_sidebar.scss +33 -13
- data/app/assets/stylesheets/binda/components/main_table.scss +11 -3
- data/app/assets/stylesheets/binda/components/select2.scss +27 -18
- data/app/assets/stylesheets/binda/components/sortable.scss +1 -1
- data/app/assets/stylesheets/binda/components/standard-form.scss +41 -56
- data/app/assets/stylesheets/binda/index.scss +2 -0
- data/app/assets/stylesheets/binda/settings/common.scss +4 -3
- data/app/assets/stylesheets/binda/settings/tiny_mce_overrides.scss +21 -5
- data/app/assets/stylesheets/binda/settings/variables.scss +2 -2
- data/app/controllers/binda/components_controller.rb +3 -1
- data/app/controllers/binda/field_groups_controller.rb +9 -5
- data/app/controllers/binda/structures_controller.rb +1 -3
- data/app/models/binda/choice.rb +15 -9
- data/app/views/binda/categories/_form.html.erb +4 -6
- data/app/views/binda/categories/index.html.erb +3 -3
- data/app/views/binda/components/index.html.erb +6 -6
- data/app/views/binda/components/sort_index.html.erb +6 -6
- data/app/views/binda/field_groups/_form_body.html.erb +9 -9
- data/app/views/binda/field_groups/_form_item.html.erb +95 -104
- data/app/views/binda/field_groups/_form_item_choice.erb +5 -2
- data/app/views/binda/field_groups/_form_section.html.erb +5 -3
- data/app/views/binda/field_groups/_form_section_repeater.html.erb +6 -3
- data/app/views/binda/fieldable/_form_body.html.erb +5 -7
- data/app/views/binda/fieldable/_form_item_new_repeater.html.erb +1 -1
- data/app/views/binda/fieldable/_form_item_repeater.html.erb +2 -2
- data/app/views/binda/fieldable/_form_item_selections.html.erb +1 -1
- data/app/views/binda/fieldable/_form_sidebar.html.erb +4 -6
- data/app/views/binda/manage/users/_form_body.html.erb +4 -6
- data/app/views/binda/manage/users/index.html.erb +3 -3
- data/app/views/binda/structures/_form_body.html.erb +3 -5
- data/app/views/binda/structures/_form_section.html.erb +49 -25
- data/app/views/binda/structures/_form_sidebar.html.erb +1 -1
- data/app/views/binda/structures/index.html.erb +4 -4
- data/app/views/binda/structures/sort_index.html.erb +6 -6
- data/app/views/binda/users/sessions/new.html.erb +1 -1
- data/app/views/layouts/binda/_flash.html.erb +14 -16
- data/app/views/layouts/binda/_sidebar.html.erb +3 -0
- data/config/initializers/simple_form_custom.rb +1 -1
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +1 -1
- data/db/migrate/1_create_binda_tables.rb +1 -0
- data/lib/binda.rb +1 -0
- data/lib/binda/version.rb +1 -1
- data/lib/generators/binda/setup/setup_generator.rb +3 -1
- metadata +26 -5
- data/db/migrate/20171214140451_add_preview_mode.rb +0 -5
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
// Standard UI
|
9
9
|
@import "components/b-btn";
|
10
|
+
@import "components/b-alert";
|
10
11
|
|
11
12
|
// Components
|
12
13
|
@import "components/main_sidebar";
|
@@ -18,6 +19,7 @@
|
|
18
19
|
@import "components/login";
|
19
20
|
@import "components/standard-form";
|
20
21
|
@import "components/form_item";
|
22
|
+
@import "components/form_item_choice";
|
21
23
|
@import "components/form_item_image";
|
22
24
|
@import "components/form_item_video";
|
23
25
|
@import "components/sortable";
|
@@ -1,7 +1,8 @@
|
|
1
1
|
body
|
2
2
|
{
|
3
|
+
min-height: 100vh;
|
3
4
|
padding: 0;
|
4
|
-
background-
|
5
|
+
background-image: linear-gradient( to bottom, $color-gray-lightest, darken($color-gray-lightest, 6%));
|
5
6
|
}
|
6
7
|
|
7
8
|
// this could be avoided using more recent version of bootstrap or with bourbon
|
@@ -49,6 +50,6 @@ body
|
|
49
50
|
.pagination
|
50
51
|
{
|
51
52
|
float: left;
|
52
|
-
margin-top: 0px;
|
53
53
|
width: 100%;
|
54
|
-
|
54
|
+
margin-top: 0;
|
55
|
+
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
body#tinymce
|
4
4
|
{
|
5
5
|
padding: 12px;
|
6
|
-
background-color: $color-
|
6
|
+
background-color: $color-white;
|
7
7
|
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075) !important;
|
8
8
|
}
|
9
9
|
|
@@ -12,7 +12,7 @@ body#tinymce
|
|
12
12
|
{
|
13
13
|
margin-bottom: $font-size-base * .5 !important;
|
14
14
|
border: none !important;
|
15
|
-
background-color: $color-
|
15
|
+
background-color: $color-white !important;
|
16
16
|
}
|
17
17
|
|
18
18
|
.mce-toolbar
|
@@ -21,7 +21,7 @@ body#tinymce
|
|
21
21
|
}
|
22
22
|
|
23
23
|
.mce-btn-group .mce-btn,
|
24
|
-
.mce-flow-layout-item
|
24
|
+
.mce-flow-layout-item
|
25
25
|
{
|
26
26
|
margin-right: 2px !important;
|
27
27
|
margin-left: 0 !important;
|
@@ -39,7 +39,7 @@ body#tinymce
|
|
39
39
|
|
40
40
|
.mce-edit-area
|
41
41
|
{
|
42
|
-
border: 1px solid $color-
|
42
|
+
border: 1px solid $color-gray-lightest !important;
|
43
43
|
border-radius: 1px !important;
|
44
44
|
}
|
45
45
|
|
@@ -53,7 +53,7 @@ body#tinymce
|
|
53
53
|
{
|
54
54
|
border: none !important;
|
55
55
|
border-top: none !important;
|
56
|
-
background-color: $color-
|
56
|
+
background-color: $color-white !important;
|
57
57
|
}
|
58
58
|
|
59
59
|
.mce-menubar
|
@@ -80,3 +80,19 @@ body#tinymce
|
|
80
80
|
{
|
81
81
|
box-shadow: none !important;
|
82
82
|
}
|
83
|
+
|
84
|
+
.mce-btn
|
85
|
+
{
|
86
|
+
background-color: $color-gray-lightest !important;
|
87
|
+
}
|
88
|
+
|
89
|
+
.mce-btn:hover,
|
90
|
+
.mce-btn:active
|
91
|
+
{
|
92
|
+
border-color: $color-gray-lighter !important;
|
93
|
+
}
|
94
|
+
|
95
|
+
div.mce-edit-area
|
96
|
+
{
|
97
|
+
border-color: $color-gray-lightest !important;
|
98
|
+
}
|
@@ -25,10 +25,10 @@ $color-gray-dark: rgb( 102, 102, 102 );
|
|
25
25
|
$color-gray: rgb( 128, 128, 128 );
|
26
26
|
$color-gray-light: rgb( 153, 153, 153 );
|
27
27
|
$color-gray-lighter: rgb( 193, 193, 193 );
|
28
|
-
$color-gray-lightest: rgb(
|
28
|
+
$color-gray-lightest: rgb( 238, 238, 238 );
|
29
29
|
|
30
30
|
$color-primary: #337ab7;
|
31
|
-
$color-success: #
|
31
|
+
$color-success: #67CD9B;
|
32
32
|
$color-info: #5bc0de;
|
33
33
|
$color-warning: #f0ad4e;
|
34
34
|
$color-danger: #fc4242;
|
@@ -35,7 +35,8 @@ module Binda
|
|
35
35
|
if @component.save
|
36
36
|
redirect_to structure_component_path( @structure.slug, @component.slug ), notice: "#{ @structure.name } was successfully created."
|
37
37
|
else
|
38
|
-
|
38
|
+
@instance = @component
|
39
|
+
render :edit, flash: { alert: @component.errors }
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -63,6 +64,7 @@ module Binda
|
|
63
64
|
params[:repeater].each_with_index do |id, i|
|
64
65
|
Repeater.find( id ).update({ position: i + 1 })
|
65
66
|
end
|
67
|
+
render js: "$('.popup-warning').addClass('popup-warning--hidden');"
|
66
68
|
head :ok
|
67
69
|
end
|
68
70
|
|
@@ -35,7 +35,6 @@ module Binda
|
|
35
35
|
# Add nested classes
|
36
36
|
add_new_field_settings
|
37
37
|
add_new_choices
|
38
|
-
|
39
38
|
update_choices
|
40
39
|
|
41
40
|
# Update the other ones
|
@@ -145,15 +144,20 @@ module Binda
|
|
145
144
|
unless new_params[:new_choices].nil?
|
146
145
|
new_params[:new_choices].each do |choice|
|
147
146
|
unless choice[:label].blank? || choice[:value].blank?
|
148
|
-
|
149
|
-
unless new_choice
|
150
|
-
return redirect_to edit_structure_field_group_path( @structure.slug, @field_group.slug ), flash: { error: new_choice.errors }
|
151
|
-
end
|
147
|
+
create_new_choice choice
|
152
148
|
end
|
153
149
|
end
|
154
150
|
end
|
155
151
|
end
|
156
152
|
|
153
|
+
# Create new choice (depends directly from add_new_choice method)
|
154
|
+
def create_new_choice choice
|
155
|
+
new_choice = Choice.create( choice )
|
156
|
+
unless new_choice
|
157
|
+
return redirect_to edit_structure_field_group_path( @structure.slug, @field_group.slug ), flash: { error: new_choice.errors }
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
157
161
|
def update_choices
|
158
162
|
return if field_group_params[:field_settings_attributes].nil?
|
159
163
|
field_group_params[:field_settings_attributes].each do |_, field_setting_params|
|
@@ -61,14 +61,12 @@ module Binda
|
|
61
61
|
params[:structure].each_with_index do |id, i|
|
62
62
|
Structure.find( id ).update({ position: i + 1 })
|
63
63
|
end
|
64
|
+
render js: "$('.popup-warning').addClass('popup-warning--hidden');"
|
64
65
|
head :ok
|
65
66
|
end
|
66
67
|
|
67
68
|
def sort_index
|
68
69
|
@structures = Structure.order('position').all.page params[:page]
|
69
|
-
=begin
|
70
|
-
return redirect_to structure_components_path, alert: "There are too many #{@structure.name.pluralize}. It's not possible to sort more than #{Component.sort_limit} #{@structure.name.pluralize}." if @structure.components.length > Component.sort_limit
|
71
|
-
=end
|
72
70
|
end
|
73
71
|
|
74
72
|
private
|
data/app/models/binda/choice.rb
CHANGED
@@ -54,22 +54,28 @@ module Binda
|
|
54
54
|
field_setting.default_choice_id = nil
|
55
55
|
end
|
56
56
|
|
57
|
+
# Update field setting with the new default choice
|
58
|
+
update_default_choice_of field_setting
|
59
|
+
end
|
60
|
+
|
61
|
+
# Update field setting with a default choice
|
62
|
+
#
|
63
|
+
# This method is used by reset_default_choice method.
|
64
|
+
#
|
65
|
+
# @param field_setting [ActiveRecord Object]
|
66
|
+
def update_default_choice_of field_setting
|
67
|
+
|
57
68
|
# Save and check if it's alright
|
58
|
-
unless field_setting.save
|
59
|
-
raise "It hasn't been possible to set the default choice for the current setting (#{field_setting.slug})."
|
60
|
-
end
|
69
|
+
raise "It hasn't been possible to set the default choice for the current setting (#{field_setting.slug})." unless field_setting.save
|
61
70
|
|
62
71
|
# Create an empty array in order to avoid generating an error on the following each loop
|
63
72
|
selections = Selection.joins(:field_setting).where(binda_field_settings: {id: field_setting.id })
|
64
73
|
|
65
74
|
# Make sure none of the Binda::Selection instances (radios/checkboxes/selects) are left without a choice
|
66
75
|
selections.each do |selection|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
raise "It hasn't been possible to set the default choice for Binda::Selection with id=#{selection.id}"
|
71
|
-
end
|
72
|
-
end
|
76
|
+
next if selection.choices.any?
|
77
|
+
selection.choices << Choice.find(self.field_setting.default_choice_id)
|
78
|
+
raise "It hasn't been possible to set the default choice for Binda::Selection with id=#{selection.id}" unless selection.save
|
73
79
|
end
|
74
80
|
end
|
75
81
|
|
@@ -5,10 +5,8 @@
|
|
5
5
|
<%= f.error_notification %>
|
6
6
|
|
7
7
|
<% if f.object.errors.any? %>
|
8
|
-
<div class="standard-form--error-explanation">
|
9
|
-
|
10
|
-
<%= t('binda.standard_form_error_heading') %> <%= pluralize(f.object.errors.count, t("binda.standard_form_error")) %>.
|
11
|
-
</div>
|
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")) %>:
|
12
10
|
<ul>
|
13
11
|
<% f.object.errors.full_messages.each do |msg| %>
|
14
12
|
<li><%= msg %></li>
|
@@ -22,7 +20,7 @@
|
|
22
20
|
<div class="standard-form--container">
|
23
21
|
|
24
22
|
<div class="standard-form--header">
|
25
|
-
<
|
23
|
+
<small><%= "#{ t :details }".capitalize %></small>
|
26
24
|
</div>
|
27
25
|
|
28
26
|
<div class="standard-form--fields">
|
@@ -46,7 +44,7 @@
|
|
46
44
|
<div class="standard-form--container standard-form--sidebar">
|
47
45
|
|
48
46
|
<div class="standard-form--header">
|
49
|
-
<
|
47
|
+
<small><%= t(:setting).capitalize.pluralize %></small>
|
50
48
|
</div>
|
51
49
|
<div class="standard-form--main-actions">
|
52
50
|
<%= button_tag "<i class=\"fas fa-check\"></i>Save changes".html_safe, { class: 'b-btn b-btn-primary b-btn-settings', id: 'save' }%>
|
@@ -9,10 +9,10 @@
|
|
9
9
|
<div class="main-table--container">
|
10
10
|
|
11
11
|
<table class="standard-form--container">
|
12
|
-
<thead>
|
12
|
+
<thead class="standard-form--header">
|
13
13
|
<tr>
|
14
|
-
<th style="width: 70%;"
|
15
|
-
<th style="width: 30%;"
|
14
|
+
<th style="width: 70%;"><%= t(:category).capitalize.pluralize %></th>
|
15
|
+
<th style="width: 30%;"></th>
|
16
16
|
</tr>
|
17
17
|
</thead>
|
18
18
|
|
@@ -16,9 +16,9 @@
|
|
16
16
|
|
17
17
|
<table class="standard-form--container" cellspacing="0">
|
18
18
|
|
19
|
-
<thead>
|
20
|
-
|
21
|
-
<th style="width: 50%"
|
19
|
+
<thead class="standard-form--header">
|
20
|
+
<tr>
|
21
|
+
<th style="width: 50%">
|
22
22
|
<a href="<%=
|
23
23
|
if params[:order] == 'LOWER(name) ASC'
|
24
24
|
structure_components_path([@structure], order:'LOWER(name) DESC')
|
@@ -34,7 +34,7 @@
|
|
34
34
|
<% end %>
|
35
35
|
</a>
|
36
36
|
</th>
|
37
|
-
<th style="width: 20%"
|
37
|
+
<th style="width: 20%">
|
38
38
|
<a href="<%=
|
39
39
|
if params[:order] == 'publish_state ASC, LOWER(name) ASC'
|
40
40
|
structure_components_path([@structure], order:'publish_state DESC, LOWER(name) ASC')
|
@@ -50,8 +50,8 @@
|
|
50
50
|
<% end %>
|
51
51
|
</a>
|
52
52
|
</th>
|
53
|
-
<th style="width: 30%"
|
54
|
-
|
53
|
+
<th style="width: 30%">Actions</th>
|
54
|
+
</tr>
|
55
55
|
</thead>
|
56
56
|
<tbody>
|
57
57
|
<% @components.each do |component| %>
|
@@ -8,8 +8,8 @@
|
|
8
8
|
<% end %>
|
9
9
|
|
10
10
|
<% content_for :content do %>
|
11
|
-
<div class="
|
12
|
-
<div class="
|
11
|
+
<div class="popup-warning popup-warning--hidden">
|
12
|
+
<div class="popup-warning--loader">
|
13
13
|
<span></span>
|
14
14
|
<span></span>
|
15
15
|
<span></span>
|
@@ -22,11 +22,11 @@
|
|
22
22
|
<h5 class="text-muted"><%= t('binda.sort_index_hint', { arg1: @structure.name.humanize.split.join(' ').pluralize }).html_safe %></h5>
|
23
23
|
|
24
24
|
<table class="standard-form--container table-sort">
|
25
|
-
<thead>
|
25
|
+
<thead class="standard-form--header">
|
26
26
|
<tr>
|
27
|
-
<th style="width: 50%;"
|
28
|
-
<th style="width: 50%;"
|
29
|
-
<th
|
27
|
+
<th style="width: 50%;">Title</th>
|
28
|
+
<th style="width: 50%;">Publish state</th>
|
29
|
+
<th></th>
|
30
30
|
</tr>
|
31
31
|
</thead>
|
32
32
|
<tbody id="<%= @structure.slug %>-components--sort-index" class="sortable" data-update-url="<%= structure_components_sort_path( @structure.slug ) %>">
|
@@ -5,10 +5,8 @@
|
|
5
5
|
<%= f.error_notification %>
|
6
6
|
|
7
7
|
<% if f.object.errors.any? %>
|
8
|
-
<div class="standard-form--error-explanation">
|
9
|
-
|
10
|
-
<%= t('binda.standard_form_error_heading') %> <%= pluralize(f.object.errors.count, t("binda.standard_form_error")) %>.
|
11
|
-
</div>
|
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")) %>:
|
12
10
|
<ul>
|
13
11
|
<% f.object.errors.full_messages.each do |msg| %>
|
14
12
|
<li><%= msg %></li>
|
@@ -22,7 +20,7 @@
|
|
22
20
|
<div class="standard-form--container">
|
23
21
|
|
24
22
|
<div class="standard-form--header">
|
25
|
-
<
|
23
|
+
<small><%= "#{ t :details }" %></small>
|
26
24
|
</div>
|
27
25
|
|
28
26
|
<%= f.input :name, label: "#{ t :title }" %>
|
@@ -40,11 +38,12 @@
|
|
40
38
|
<div id="form-section--field-group-<%= @field_group.id %>" class="form-section--wide-container">
|
41
39
|
|
42
40
|
<div class="standard-form--header">
|
43
|
-
<
|
41
|
+
<small><%= "#{ t 'binda.field_settings' }" %></small>
|
44
42
|
</div>
|
45
43
|
|
46
44
|
<%= render "form_section", f: f %>
|
47
|
-
|
45
|
+
|
46
|
+
<div class="clearfix"></div>
|
48
47
|
</div>
|
49
48
|
|
50
49
|
<% @field_group.field_settings.where( field_type: 'repeater' ).order( :position, :id ).each do |repeater| %>
|
@@ -52,11 +51,12 @@
|
|
52
51
|
<div class="form-section">
|
53
52
|
|
54
53
|
<div class="standard-form--header field-settings-header">
|
55
|
-
<
|
54
|
+
<small><%= "#{ t('binda.repeater_field_settings', arg1: repeater.name ) }" %></small>
|
56
55
|
</div>
|
57
56
|
|
58
57
|
<%= render "form_section_repeater", f: f, repeater: repeater %>
|
59
58
|
|
59
|
+
<div class="clearfix"></div>
|
60
60
|
</div>
|
61
61
|
</div>
|
62
62
|
<% end %>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
<div class="standard-form--container">
|
71
71
|
|
72
72
|
<div class="standard-form--header">
|
73
|
-
<
|
73
|
+
<small><%= "#{ t :setting }".pluralize %></small>
|
74
74
|
</div>
|
75
75
|
|
76
76
|
<div class="standard-form--main-actions">
|
@@ -1,133 +1,124 @@
|
|
1
|
-
|
2
|
-
<%= ff.input :id, as: :hidden %>
|
3
|
-
<%= ff.input :ancestry, as: :hidden unless ff.object.is_root? %>
|
1
|
+
<div class="standard-form--container field-settings-container form-item--collapsable form-item--collapsed">
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<% if ff.object.slug.nil? %>
|
9
|
-
<a class="form-item--remove-item-with-js"
|
10
|
-
data-confirm="This operation will delete this setting and all related component content. Are you ok with that?">
|
3
|
+
<%= ff.input :field_group_id, as: :hidden %>
|
4
|
+
<%= ff.input :id, as: :hidden %>
|
5
|
+
<%= ff.input :ancestry, as: :hidden unless ff.object.is_root? %>
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
7
|
+
<div class="standard-form--secondary-header form-item--header form-item--repeater-header">
|
8
|
+
<%# - - - - - - - - - - - - %>
|
9
|
+
<%# BUTTONS %>
|
10
|
+
<%# - - - - - - - - - - - - %>
|
11
|
+
<% if ff.object.slug.nil? %>
|
12
|
+
<a class="form-item--delete-repeater-item form-item--remove-item-with-js"
|
13
|
+
data-confirm="This operation will delete this setting and all related component content. Are you ok with that?">
|
14
|
+
<i class="far fa-trash-alt"></i> <%= t('binda.delete').capitalize %>
|
15
|
+
</a>
|
16
|
+
<p><%= t('binda.new_item_in_repeater', { arg1: '' })%></p>
|
17
|
+
<% else %>
|
18
|
+
<a class="form-item--collapse-btn" href="#">
|
19
|
+
<span><i class="fas fa-angle-up"></i> <%= t('binda.collapse') %></span>
|
20
|
+
<span><i class="fas fa-angle-down"></i> <%= t('binda.expand') %></span>
|
21
|
+
</a>
|
22
|
+
<%= link_to "<i class=\"far fa-trash-alt\"></i> #{t('binda.delete').capitalize}".html_safe,
|
26
23
|
structure_field_group_field_setting_path( @structure, @field_group, ff.object ),
|
27
24
|
method: :delete,
|
28
|
-
data: { confirm: '
|
29
|
-
class: '
|
30
|
-
|
31
|
-
|
25
|
+
data: { confirm: t('binda.confirm_delete') },
|
26
|
+
class: 'form-item--delete-repeater-item' %>
|
27
|
+
<p><%= ff.object.name %> (<%= ff.object.field_type.humanize.capitalize %>)</p>
|
28
|
+
<% end %>
|
32
29
|
</div>
|
33
30
|
|
34
|
-
|
35
|
-
|
36
|
-
<div class="form-item--editor">
|
37
|
-
|
38
|
-
<%# - - - - - - - - - - - - %>
|
39
|
-
<%# NAME %>
|
40
|
-
<%# - - - - - - - - - - - - %>
|
41
|
-
<div class="form-item--half-size">
|
42
|
-
|
43
|
-
<%= ff.input :name, as: :string, input_html: { class: "form-item--input" } %>
|
44
|
-
</div>
|
45
|
-
|
46
|
-
|
47
|
-
<% if ff.object.new_record? %>
|
31
|
+
<div class="form-item--editor">
|
48
32
|
|
49
33
|
<%# - - - - - - - - - - - - %>
|
50
|
-
<%#
|
34
|
+
<%# NAME %>
|
51
35
|
<%# - - - - - - - - - - - - %>
|
52
36
|
<div class="form-item--half-size">
|
53
|
-
<%= ff.input :
|
37
|
+
<%= ff.input :name, as: :string, input_html: { class: "form-item--input" } %>
|
54
38
|
</div>
|
55
39
|
|
56
|
-
<%# - - - - - - - - - - - - %>
|
57
|
-
<%# FIELD TYPE %>
|
58
|
-
<%# - - - - - - - - - - - - %>
|
59
|
-
<div class="form-item--full-size">
|
60
40
|
|
61
|
-
|
62
|
-
<%= ff.input :field_type, as: :select, collection: get_field_types, include_blank: false, prompt: t(:select_field_type), input_html: { class: 'form-item--select-input' } %>
|
63
|
-
<% else %>
|
64
|
-
<%= ff.input :field_type, as: :string, disabled: true, input_html: { class: "form-item--input" } %>
|
65
|
-
<% end %>
|
66
|
-
</div>
|
41
|
+
<% if ff.object.new_record? %>
|
67
42
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
<%# - - - - - - - - - - - - %>
|
73
|
-
<div class="form-item--half-size">
|
74
|
-
<%= ff.input :slug, as: :string, input_html: { class: "form-item--input" } %>
|
75
|
-
</div>
|
43
|
+
<%# - - - - - - - - - - - - %>
|
44
|
+
<%# SLUG %>
|
45
|
+
<%# - - - - - - - - - - - - %>
|
46
|
+
<%= ff.input :slug, as: :hidden, input_html: { class: "form-item--input" } %>
|
76
47
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
48
|
+
<%# - - - - - - - - - - - - %>
|
49
|
+
<%# FIELD TYPE %>
|
50
|
+
<%# - - - - - - - - - - - - %>
|
51
|
+
<div class="form-item--half-size">
|
81
52
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
53
|
+
<% if ff.object.field_type.nil? %>
|
54
|
+
<%= ff.input :field_type, as: :select, collection: get_field_types, include_blank: false, prompt: t(:select_field_type), input_html: { class: 'form-item--select-input' } %>
|
55
|
+
<% else %>
|
56
|
+
<%= ff.input :field_type, as: :string, disabled: true, input_html: { class: "form-item--input" } %>
|
57
|
+
<% end %>
|
58
|
+
</div>
|
88
59
|
|
89
|
-
|
90
|
-
<%# DESCRIPTION %>
|
91
|
-
<%# - - - - - - - - - - - - %>
|
92
|
-
<div class="form-item--full-size">
|
93
|
-
<%= ff.input :description, input_html: { class: "form-item--input" } %>
|
94
|
-
</div>
|
60
|
+
<% else %>
|
95
61
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
62
|
+
<%# - - - - - - - - - - - - %>
|
63
|
+
<%# SLUG %>
|
64
|
+
<%# - - - - - - - - - - - - %>
|
65
|
+
<div class="form-item--half-size">
|
66
|
+
<%= ff.input :slug, as: :string, input_html: { class: "form-item--input" } %>
|
67
|
+
</div>
|
102
68
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
<% if ff.object.field_type == 'relation' %>
|
69
|
+
<%# - - - - - - - - - - - - %>
|
70
|
+
<%# FIELD TYPE %>
|
71
|
+
<%# - - - - - - - - - - - - %>
|
107
72
|
<div class="form-item--full-size">
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
include_blank: false,
|
114
|
-
include_hidden: false %>
|
73
|
+
<% if ff.object.field_type.nil? %>
|
74
|
+
<%= ff.input :field_type, as: :select, collection: get_field_types, include_blank: false, prompt: t(:select_field_type), input_html: { class: 'form-item--select-input' } %>
|
75
|
+
<% else %>
|
76
|
+
<%= ff.input :field_type, as: :string, disabled: true, input_html: { class: "form-item--input" } %>
|
77
|
+
<% end %>
|
115
78
|
</div>
|
116
|
-
<% end %>
|
117
|
-
|
118
79
|
|
119
|
-
|
120
|
-
|
80
|
+
<%# - - - - - - - - - - - - %>
|
81
|
+
<%# DESCRIPTION %>
|
82
|
+
<%# - - - - - - - - - - - - %>
|
83
|
+
<div class="form-item--full-size">
|
84
|
+
<%= ff.input :description, input_html: { class: "form-item--input" } %>
|
85
|
+
</div>
|
121
86
|
|
122
87
|
<%# - - - - - - - - - - - - %>
|
123
|
-
<%#
|
88
|
+
<%# POSITION %>
|
124
89
|
<%# - - - - - - - - - - - - %>
|
125
|
-
|
90
|
+
<div class="form-item--full-size">
|
91
|
+
<%= ff.input :position, as: :integer, input_html: { class: "form-item--input" } %>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<%# - - - - - - - - - - - - %>
|
95
|
+
<%# ACCEPTED STRUCTURES %>
|
96
|
+
<%# - - - - - - - - - - - - %>
|
97
|
+
<% if ff.object.field_type == 'relation' %>
|
98
|
+
<div class="form-item--full-size">
|
99
|
+
<%= ff.input :accepted_structure_ids,
|
100
|
+
collection: Binda::Structure.all,
|
101
|
+
as: :select,
|
102
|
+
input_html: { multiple: true, class: 'select2-item' },
|
103
|
+
checked: ff.object.accepted_structures,
|
104
|
+
include_blank: false,
|
105
|
+
include_hidden: false %>
|
106
|
+
</div>
|
107
|
+
<% end %>
|
108
|
+
|
109
|
+
|
110
|
+
<% choiceables = ['radio', 'selection', 'checkbox'] %>
|
111
|
+
<% if choiceables.include? ff.object.field_type %>
|
112
|
+
|
113
|
+
<%# - - - - - - - - - - - - %>
|
114
|
+
<%# CHOICES %>
|
115
|
+
<%# - - - - - - - - - - - - %>
|
116
|
+
<%= render 'form_item_choice', f: f, ff: ff %>
|
117
|
+
|
118
|
+
<% end %>
|
126
119
|
|
127
120
|
<% end %>
|
128
|
-
|
129
|
-
|
130
|
-
<div class="clearfix"></div>
|
131
|
-
|
121
|
+
<div class="clearfix"></div>
|
122
|
+
</div>
|
132
123
|
</div>
|
133
124
|
|