binda 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/Rakefile +2 -1
- data/app/assets/javascripts/binda/dist/binda.bundle.js +75 -75
- data/app/assets/stylesheets/binda/settings/common.scss +4 -0
- data/app/controllers/binda/application_controller.rb +1 -1
- data/app/controllers/binda/boards_controller.rb +73 -0
- data/app/controllers/binda/components_controller.rb +18 -44
- data/app/controllers/binda/field_groups_controller.rb +36 -24
- data/app/controllers/binda/field_settings_controller.rb +5 -5
- data/app/controllers/binda/manage/users_controller.rb +2 -9
- data/app/controllers/binda/structures_controller.rb +6 -13
- data/app/controllers/concerns/binda/default_helpers.rb +226 -0
- data/app/controllers/concerns/binda/fieldable_helpers.rb +44 -0
- data/app/helpers/binda/boards_helper.rb +13 -0
- data/app/helpers/binda/components_helper.rb +0 -5
- data/app/helpers/binda/field_settings_helper.rb +1 -1
- data/app/models/binda/asset.rb +0 -8
- data/app/models/binda/binda.rb +7 -0
- data/app/models/binda/binding.rb +4 -4
- data/app/models/binda/board.rb +41 -0
- data/app/models/binda/category.rb +7 -3
- data/app/models/binda/checkbox.rb +1 -3
- data/app/models/binda/choice.rb +31 -1
- data/app/models/binda/component.rb +7 -22
- data/app/models/binda/field_group.rb +13 -7
- data/app/models/binda/field_setting.rb +40 -29
- data/app/models/binda/gallery.rb +0 -7
- data/app/models/binda/radio.rb +1 -1
- data/app/models/binda/repeater.rb +13 -20
- data/app/models/binda/selection.rb +17 -0
- data/app/models/binda/string.rb +4 -0
- data/app/models/binda/structure.rb +65 -7
- data/app/models/concerns/binda/{component_model_helper.rb → fieldable_associations.rb} +102 -31
- data/app/views/binda/boards/edit.html.erb +7 -0
- data/app/views/binda/components/edit.html.erb +4 -1
- data/app/views/binda/components/index.html.erb +2 -0
- data/app/views/binda/components/new.html.erb +1 -1
- data/app/views/binda/field_groups/_form_body.html.erb +8 -8
- data/app/views/binda/field_groups/_form_item.html.erb +3 -3
- data/app/views/binda/field_groups/_form_item_choice.erb +11 -8
- data/app/views/binda/field_groups/_form_section.html.erb +5 -5
- data/app/views/binda/field_groups/_form_section_repeater.html.erb +3 -3
- data/app/views/binda/field_groups/edit.html.erb +1 -1
- data/app/views/binda/field_groups/new.html.erb +1 -1
- data/app/views/binda/{components → fieldable}/_form_body.html.erb +9 -9
- data/app/views/binda/{components → fieldable}/_form_item_asset.html.erb +0 -0
- data/app/views/binda/{components → fieldable}/_form_item_date.html.erb +0 -0
- data/app/views/binda/{components → fieldable}/_form_item_gallery.html.erb +0 -0
- data/app/views/binda/{components → fieldable}/_form_item_new_repeater.html.erb +5 -5
- data/app/views/binda/{components → fieldable}/_form_item_repeater.html.erb +8 -9
- data/app/views/binda/fieldable/_form_item_selections.html.erb +99 -0
- data/app/views/binda/fieldable/_form_item_string.html.erb +19 -0
- data/app/views/binda/{components → fieldable}/_form_item_text.html.erb +2 -11
- data/app/views/binda/fieldable/_form_section.html.erb +52 -0
- data/app/views/binda/fieldable/_form_section_repeater.html.erb +48 -0
- data/app/views/binda/fieldable/_form_sidebar.html.erb +35 -0
- data/app/views/binda/structures/_form_body.html.erb +6 -0
- data/app/views/binda/structures/_form_section.html.erb +1 -1
- data/app/views/binda/structures/edit.html.erb +3 -0
- data/app/views/binda/structures/index.html.erb +2 -0
- data/app/views/layouts/binda/_flash.html.erb +3 -3
- data/app/views/layouts/binda/_sidebar.html.erb +20 -15
- data/config/locales/en.yml +4 -0
- data/config/routes.rb +18 -21
- data/db/migrate/1_create_binda_tables.rb +12 -6
- data/lib/binda/engine.rb +5 -1
- data/lib/binda/version.rb +1 -1
- data/lib/generators/binda/install/install_generator.rb +9 -0
- data/lib/generators/binda/setup/setup_generator.rb +50 -7
- data/lib/tasks/binda.rake +78 -24
- metadata +100 -31
- data/app/controllers/binda/settings_controller.rb +0 -75
- data/app/controllers/concerns/binda/component_controller_helper.rb +0 -16
- data/app/helpers/binda/settings_helper.rb +0 -13
- data/app/models/binda/select.rb +0 -7
- data/app/models/binda/setting.rb +0 -42
- data/app/views/binda/components/_form_item_selectable.html.erb +0 -72
- data/app/views/binda/components/_form_section.html.erb +0 -42
- data/app/views/binda/components/_form_section_repeater.html.erb +0 -41
- data/app/views/binda/components/_form_sidebar.html.erb +0 -34
- data/app/views/binda/settings/_dashboard_form.html.erb +0 -51
- data/app/views/binda/settings/_form.html.erb +0 -52
- data/app/views/binda/settings/dashboard.html.erb +0 -9
- data/app/views/binda/settings/edit.html.erb +0 -8
- data/app/views/binda/settings/index.html.erb +0 -34
- data/app/views/binda/settings/new.html.erb +0 -8
@@ -1,42 +0,0 @@
|
|
1
|
-
<%# - - - - - - - - - - - - %>
|
2
|
-
<%# TEXT / STRING %>
|
3
|
-
<%# - - - - - - - - - - - - %>
|
4
|
-
<% if field_setting.field_type == 'text' || field_setting.field_type == 'string' %>
|
5
|
-
<% current = @component.find_or_create_a_field_by( field_setting.id, 'text' ) %>
|
6
|
-
<%= f.simple_fields_for "texts_attributes[]", current do |ff| %>
|
7
|
-
<%= render 'form_item_text', ff: ff, field_setting: field_setting %>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
|
11
|
-
<%# - - - - - - - - - - - - %>
|
12
|
-
<%# DATE %>
|
13
|
-
<%# - - - - - - - - - - - - %>
|
14
|
-
<% elsif field_setting.field_type == 'date' %>
|
15
|
-
<% current = @component.find_or_create_a_field_by( field_setting.id, 'date' ) %>
|
16
|
-
<%= f.simple_fields_for "dates_attributes[]", current do |ff| %>
|
17
|
-
<%= render 'form_item_date', ff: ff, field_setting: field_setting %>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
|
21
|
-
<%# - - - - - - - - - - - - %>
|
22
|
-
<%# ASSET %>
|
23
|
-
<%# - - - - - - - - - - - - %>
|
24
|
-
<% elsif field_setting.field_type == 'asset' %>
|
25
|
-
<% current = @component.find_or_create_a_field_by( field_setting.id, 'asset' ) %>
|
26
|
-
<%= f.simple_fields_for "assets_attributes[]", current do |ff| %>
|
27
|
-
<%= render 'form_item_asset', ff: ff, field_setting: field_setting %>
|
28
|
-
<% end %>
|
29
|
-
|
30
|
-
|
31
|
-
<%# - - - - - - - - - - - - %>
|
32
|
-
<%# REPEATER %>
|
33
|
-
<%# - - - - - - - - - - - - %>
|
34
|
-
<% elsif field_setting.field_type == 'repeater' %>
|
35
|
-
<% repeaters = @component.repeaters.where( field_setting: field_setting ).order('position') %>
|
36
|
-
<%= render 'form_item_repeater', f: f, repeater_setting: field_setting, repeaters: repeaters %>
|
37
|
-
|
38
|
-
|
39
|
-
<% elsif ['radio', 'select', 'checkbox'].include? field_setting.field_type %>
|
40
|
-
<%= render 'form_item_selectable', f: f, field_setting: field_setting %>
|
41
|
-
|
42
|
-
<% end %>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
<%# - - - - - - - - - - - - %>
|
2
|
-
<%# TEXT / STRING %>
|
3
|
-
<%# - - - - - - - - - - - - %>
|
4
|
-
<% if repeater_setting_child.field_type == 'text' || repeater_setting_child.field_type == 'string' %>
|
5
|
-
<% current = repeater.find_or_create_a_field_by( repeater_setting_child.id, 'text' ) %>
|
6
|
-
<%= f.simple_fields_for "texts_attributes[]", current do |ff| %>
|
7
|
-
<%= render 'form_item_text', ff: ff, field_setting: repeater_setting_child %>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
|
11
|
-
<%# - - - - - - - - - - - - %>
|
12
|
-
<%# DATE %>
|
13
|
-
<%# - - - - - - - - - - - - %>
|
14
|
-
<% elsif repeater_setting_child.field_type == 'date' %>
|
15
|
-
<% current = repeater.find_or_create_a_field_by( repeater_setting_child.id, 'date' ) %>
|
16
|
-
<%= f.simple_fields_for "dates_attributes[]", current do |ff| %>
|
17
|
-
<%= render 'form_item_date', ff: ff, field_setting: repeater_setting_child %>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
|
21
|
-
<%# - - - - - - - - - - - - %>
|
22
|
-
<%# ASSET %>
|
23
|
-
<%# - - - - - - - - - - - - %>
|
24
|
-
<% elsif repeater_setting_child.field_type == 'asset' %>
|
25
|
-
<% current = repeater.find_or_create_a_field_by( repeater_setting_child.id, 'asset' ) %>
|
26
|
-
<%= f.simple_fields_for "assets_attributes[]", current do |ff| %>
|
27
|
-
<%= render 'form_item_asset', ff: ff, field_setting: repeater_setting_child %>
|
28
|
-
<% end %>
|
29
|
-
|
30
|
-
|
31
|
-
<%# - - - - - - - - - - - - %>
|
32
|
-
<%# RADIO %>
|
33
|
-
<%# - - - - - - - - - - - - %>
|
34
|
-
<% elsif repeater_setting_child.field_type == 'radio' %>
|
35
|
-
<% current = repeater.find_or_create_a_field_by( repeater_setting_child.id, 'radio' ) %>
|
36
|
-
<%= f.simple_fields_for "radios_attributes[]", current do |ff| %>
|
37
|
-
<%= render 'form_item_radio', ff: ff, field_setting: repeater_setting_child %>
|
38
|
-
<% end %>
|
39
|
-
|
40
|
-
|
41
|
-
<% end %>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<h4><%= "#{ t :setting }".pluralize.capitalize %></h4>
|
2
|
-
|
3
|
-
<% if @structure.has_categories %>
|
4
|
-
|
5
|
-
<% if @structure.categories.any? %>
|
6
|
-
<h5><%= t(:category).capitalize %></h5>
|
7
|
-
<%= f.association :categories, as: :radio_buttons, collection: @structure.categories ,checked: @component.category_ids, include_blank: false %>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
<% if @component.slug.nil? %>
|
11
|
-
<h5>
|
12
|
-
<%= t( :hint_create_parent_before_child, arg1: "#{ t :category }", arg2: "#{ t :component }" ).capitalize %>
|
13
|
-
</h5>
|
14
|
-
<% else %>
|
15
|
-
<a class="main-header--link btn btn-default" href="<%= new_structure_category_path %>">
|
16
|
-
<%= "#{ t :new }".capitalize %> <%= t :category %>
|
17
|
-
</a>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
<hr>
|
23
|
-
|
24
|
-
<h5><%= t(:publish_settings).capitalize %></h5>
|
25
|
-
<%= f.input :publish_state, as: :radio_buttons, collection: [ 'draft', 'published' ], checked: f.object.publish_state %>
|
26
|
-
|
27
|
-
<hr>
|
28
|
-
|
29
|
-
<%= f.button :submit, 'Save changes', class: 'btn btn-primary' %>
|
30
|
-
|
31
|
-
|
32
|
-
<% unless @component.new_record? %>
|
33
|
-
<a class="form-body--delete btn btn-default" href="<%= structure_component_path( structure_id: @structure.id, id: @component.id ) %>" data-method="delete" data-confirm="This operation will delete this <%= @structure.name %> and there is no coming back. Are you ok with that?">Delete <%= @structure.name.capitalize %> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
|
34
|
-
<% end %>
|
@@ -1,51 +0,0 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<div class="form-body--container col-sm-12">
|
3
|
-
|
4
|
-
<%= simple_form_for 'dashboard', url: dashboard_path, defaults: { label: false } do |f| %>
|
5
|
-
|
6
|
-
<%# render 'layouts/binda/flash' %>
|
7
|
-
|
8
|
-
<div class="row">
|
9
|
-
<div class="col-sm-8">
|
10
|
-
|
11
|
-
<div class="form-section--wide-container row">
|
12
|
-
<div class="col-sm-12">
|
13
|
-
|
14
|
-
<h4><%= "#{ t :dashboard_title }".capitalize %></h4>
|
15
|
-
|
16
|
-
<%= f.simple_fields_for 'settings[]', dashboard.website_name do |website_name| %>
|
17
|
-
<h5><%= website_name.object.name.capitalize %></h5>
|
18
|
-
<%= website_name.input :content, as: :string %>
|
19
|
-
<%= website_name.input :id, as: :hidden %>
|
20
|
-
<% end %>
|
21
|
-
|
22
|
-
<%= f.simple_fields_for 'settings[]', dashboard.website_description do |website_description| %>
|
23
|
-
<h5><%= website_description.object.name.capitalize %></h5>
|
24
|
-
<%= website_description.input :content, as: :string %>
|
25
|
-
<%= website_description.input :id, as: :hidden %>
|
26
|
-
<% end %>
|
27
|
-
|
28
|
-
<%= f.simple_fields_for 'settings[]', dashboard.maintenance_mode do |maintenance_mode| %>
|
29
|
-
<h5><%= maintenance_mode.object.name.capitalize %></h5>
|
30
|
-
<%= maintenance_mode.input :is_true, as: :radio_buttons %>
|
31
|
-
<%= maintenance_mode.input :id, as: :hidden %>
|
32
|
-
<% end %>
|
33
|
-
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
|
37
|
-
</div>
|
38
|
-
<div class="col-sm-4">
|
39
|
-
<div class="form-section--narrow-container row">
|
40
|
-
<div class="col-sm-12">
|
41
|
-
<div class="form-actions">
|
42
|
-
<h4>Settings</h4>
|
43
|
-
<%= f.button :submit, 'Save changes', class: 'btn btn-primary' %>
|
44
|
-
</div>
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
</div>
|
48
|
-
<% end %>
|
49
|
-
|
50
|
-
</div>
|
51
|
-
</div>
|
@@ -1,52 +0,0 @@
|
|
1
|
-
<div class="row">
|
2
|
-
<div class="form-body--container col-sm-12">
|
3
|
-
|
4
|
-
<%= simple_form_for setting, defaults: { label: false } do |f| %>
|
5
|
-
<% if setting.errors.any? %>
|
6
|
-
<div id="error_explanation">
|
7
|
-
<h2><%= pluralize( setting.errors.count, "error") %> prohibited this setting from being saved:</h2>
|
8
|
-
|
9
|
-
<ul>
|
10
|
-
<% setting.errors.full_messages.each do |message| %>
|
11
|
-
<li><%= message %></li>
|
12
|
-
<% end %>
|
13
|
-
</ul>
|
14
|
-
</div>
|
15
|
-
<% end %>
|
16
|
-
|
17
|
-
<div class="row">
|
18
|
-
<div class="col-sm-8">
|
19
|
-
|
20
|
-
<div class="form-section--wide-container row">
|
21
|
-
<div class="col-sm-12">
|
22
|
-
|
23
|
-
<h4>Page Details</h4>
|
24
|
-
|
25
|
-
<h5>Title</h5>
|
26
|
-
<%= f.input :name %>
|
27
|
-
|
28
|
-
<h5>Slug</h5>
|
29
|
-
<%= f.input :slug %>
|
30
|
-
|
31
|
-
<h5>Content</h5>
|
32
|
-
<%= f.input :content %>
|
33
|
-
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
|
37
|
-
</div>
|
38
|
-
<div class="col-sm-4">
|
39
|
-
<div class="form-section--narrow-container row">
|
40
|
-
<div class="col-sm-12">
|
41
|
-
<div class="form-actions">
|
42
|
-
<h4>Settings</h4>
|
43
|
-
<hr>
|
44
|
-
<%= f.button :submit, 'Save changes', class: 'btn btn-primary' %>
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
</div>
|
48
|
-
</div>
|
49
|
-
<% end %>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
</div>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% content_for :header do %>
|
2
|
-
<h3>Editing Setting</h3>
|
3
|
-
<a href="<%= settings_path %>" class="main-header--back"><span class="glyphicon glyphicon-list"></span> Back to list</a>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<% content_for :content do %>
|
7
|
-
<%= render 'form', setting: @setting %>
|
8
|
-
<% end %>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<% content_for :header do %>
|
2
|
-
<div class="main-header--buttons">
|
3
|
-
<%= link_to 'New Setting', new_setting_path, class: 'main-header--link btn btn-primary' %>
|
4
|
-
</div>
|
5
|
-
<h3>Settings</h3>
|
6
|
-
<% end %>
|
7
|
-
|
8
|
-
<% content_for :content do %>
|
9
|
-
<div class="main-table--row row">
|
10
|
-
<div class="col-sm-12">
|
11
|
-
|
12
|
-
<table class="table table-striped">
|
13
|
-
<thead>
|
14
|
-
<tr>
|
15
|
-
<th colspan="3">Setting</th>
|
16
|
-
<th></th>
|
17
|
-
</tr>
|
18
|
-
</thead>
|
19
|
-
|
20
|
-
<tbody>
|
21
|
-
<% @settings.order( :name ).each do |setting| %>
|
22
|
-
<tr id="setting_<%= setting.id %>">
|
23
|
-
<td colspan="3"><%= setting.name %></td>
|
24
|
-
<td><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> <%= link_to 'Edit', edit_setting_path(setting) %> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> <%= link_to 'Destroy', setting, method: :delete, data: { confirm: 'Are you sure?' }, class: 'text-danger' %></td>
|
25
|
-
</tr>
|
26
|
-
<% end %>
|
27
|
-
<tbody>
|
28
|
-
</table>
|
29
|
-
|
30
|
-
<%= link_to 'New Setting', new_setting_path, class: 'main-header--link btn btn-default' %>
|
31
|
-
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
<% end %>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% content_for :header do %>
|
2
|
-
<h3>New Setting</h3>
|
3
|
-
<a href="<%= settings_path %>" class="main-header--back"><span class="glyphicon glyphicon-list"></span> Back to list</a>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<% content_for :content do %>
|
7
|
-
<%= render 'form', setting: @setting %>
|
8
|
-
<% end %>
|