binda 0.0.2
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +63 -0
- data/Rakefile +37 -0
- data/app/assets/config/binda_manifest.js +2 -0
- data/app/assets/javascripts/binda/application.js +18 -0
- data/app/assets/javascripts/binda/components/form_item.js +54 -0
- data/app/assets/javascripts/binda/components/form_item_asset.js +24 -0
- data/app/assets/javascripts/binda/components/form_item_repeater.js +66 -0
- data/app/assets/javascripts/binda/components/sortable.js +44 -0
- data/app/assets/javascripts/binda/dist/binda.bundle.js +336 -0
- data/app/assets/javascripts/binda/index.js +16 -0
- data/app/assets/stylesheets/binda/application.css +6 -0
- data/app/assets/stylesheets/binda/components/assets_manager.scss +46 -0
- data/app/assets/stylesheets/binda/components/button.scss +7 -0
- data/app/assets/stylesheets/binda/components/form_body.scss +2 -0
- data/app/assets/stylesheets/binda/components/form_item.scss +169 -0
- data/app/assets/stylesheets/binda/components/form_item_asset.scss +20 -0
- data/app/assets/stylesheets/binda/components/form_section.scss +40 -0
- data/app/assets/stylesheets/binda/components/login.scss +6 -0
- data/app/assets/stylesheets/binda/components/main_container.scss +0 -0
- data/app/assets/stylesheets/binda/components/main_content.scss +5 -0
- data/app/assets/stylesheets/binda/components/main_header.scss +25 -0
- data/app/assets/stylesheets/binda/components/main_table.scss +28 -0
- data/app/assets/stylesheets/binda/components/sidebar.scss +131 -0
- data/app/assets/stylesheets/binda/components/sortable.scss +98 -0
- data/app/assets/stylesheets/binda/index.scss +24 -0
- data/app/assets/stylesheets/binda/layout/components_index.scss +9 -0
- data/app/assets/stylesheets/binda/layout/dashboard.scss +7 -0
- data/app/assets/stylesheets/binda/layout/users_sign_in.scss +29 -0
- data/app/assets/stylesheets/binda/settings/common.scss +93 -0
- data/app/assets/stylesheets/binda/settings/fonts.scss +90 -0
- data/app/assets/stylesheets/binda/settings/variables.scss +83 -0
- data/app/assets/stylesheets/scaffolds.scss +89 -0
- data/app/controllers/binda/application_controller.rb +29 -0
- data/app/controllers/binda/assets_controller.rb +62 -0
- data/app/controllers/binda/bindings_controller.rb +62 -0
- data/app/controllers/binda/categories_controller.rb +60 -0
- data/app/controllers/binda/components_controller.rb +223 -0
- data/app/controllers/binda/dates_controller.rb +62 -0
- data/app/controllers/binda/field_groups_controller.rb +114 -0
- data/app/controllers/binda/field_settings_controller.rb +66 -0
- data/app/controllers/binda/galleries_controller.rb +62 -0
- data/app/controllers/binda/manage/users_controller.rb +97 -0
- data/app/controllers/binda/repeaters_controller.rb +67 -0
- data/app/controllers/binda/settings_controller.rb +75 -0
- data/app/controllers/binda/structures_controller.rb +89 -0
- data/app/controllers/binda/texts_controller.rb +62 -0
- data/app/controllers/binda/users/confirmations_controller.rb +33 -0
- data/app/controllers/binda/users/omniauth_callbacks_controller.rb +33 -0
- data/app/controllers/binda/users/passwords_controller.rb +37 -0
- data/app/controllers/binda/users/registrations_controller.rb +89 -0
- data/app/controllers/binda/users/sessions_controller.rb +30 -0
- data/app/controllers/binda/users/unlocks_controller.rb +33 -0
- data/app/helpers/binda/application_helper.rb +25 -0
- data/app/helpers/binda/assets_helper.rb +4 -0
- data/app/helpers/binda/bindings_helper.rb +4 -0
- data/app/helpers/binda/categories_helper.rb +10 -0
- data/app/helpers/binda/components_helper.rb +10 -0
- data/app/helpers/binda/dates_helper.rb +4 -0
- data/app/helpers/binda/field_groups_helper.rb +10 -0
- data/app/helpers/binda/field_settings_helper.rb +14 -0
- data/app/helpers/binda/galleries_helper.rb +4 -0
- data/app/helpers/binda/repeaters_helper.rb +4 -0
- data/app/helpers/binda/settings_helper.rb +13 -0
- data/app/helpers/binda/structures_helper.rb +4 -0
- data/app/helpers/binda/texts_helper.rb +4 -0
- data/app/jobs/binda/application_job.rb +4 -0
- data/app/mailers/binda/application_mailer.rb +6 -0
- data/app/models/binda/application_record.rb +5 -0
- data/app/models/binda/asset.rb +21 -0
- data/app/models/binda/binding.rb +24 -0
- data/app/models/binda/category.rb +31 -0
- data/app/models/binda/component.rb +186 -0
- data/app/models/binda/date.rb +9 -0
- data/app/models/binda/field_group.rb +40 -0
- data/app/models/binda/field_setting.rb +95 -0
- data/app/models/binda/gallery.rb +18 -0
- data/app/models/binda/repeater.rb +108 -0
- data/app/models/binda/setting.rb +42 -0
- data/app/models/binda/structure.rb +31 -0
- data/app/models/binda/text.rb +9 -0
- data/app/models/binda/user.rb +8 -0
- data/app/uploaders/binda/asset/image_uploader.rb +76 -0
- data/app/views/binda/assets/_form.html.erb +22 -0
- data/app/views/binda/assets/edit.html.erb +6 -0
- data/app/views/binda/assets/index.html.erb +29 -0
- data/app/views/binda/assets/new.html.erb +5 -0
- data/app/views/binda/assets/show.html.erb +19 -0
- data/app/views/binda/bindings/_form.html.erb +32 -0
- data/app/views/binda/bindings/edit.html.erb +6 -0
- data/app/views/binda/bindings/index.html.erb +31 -0
- data/app/views/binda/bindings/new.html.erb +5 -0
- data/app/views/binda/bindings/show.html.erb +19 -0
- data/app/views/binda/categories/_form.html.erb +58 -0
- data/app/views/binda/categories/edit.html.erb +8 -0
- data/app/views/binda/categories/index.html.erb +34 -0
- data/app/views/binda/categories/new.html.erb +8 -0
- data/app/views/binda/components/_form_body.html.erb +86 -0
- data/app/views/binda/components/_form_item_asset.html.erb +20 -0
- data/app/views/binda/components/_form_item_date.html.erb +16 -0
- data/app/views/binda/components/_form_item_gallery.html.erb +0 -0
- data/app/views/binda/components/_form_item_new_repeater.html.erb +33 -0
- data/app/views/binda/components/_form_item_repeater.html.erb +81 -0
- data/app/views/binda/components/_form_item_text.html.erb +28 -0
- data/app/views/binda/components/_form_section.html.erb +37 -0
- data/app/views/binda/components/_form_section_repeater.html.erb +31 -0
- data/app/views/binda/components/_form_sidebar.html.erb +34 -0
- data/app/views/binda/components/edit.html.erb +8 -0
- data/app/views/binda/components/index.html.erb +43 -0
- data/app/views/binda/components/new.html.erb +8 -0
- data/app/views/binda/dates/_form.html.erb +22 -0
- data/app/views/binda/dates/edit.html.erb +6 -0
- data/app/views/binda/dates/index.html.erb +27 -0
- data/app/views/binda/dates/new.html.erb +5 -0
- data/app/views/binda/dates/show.html.erb +9 -0
- data/app/views/binda/field_groups/_form_body.html.erb +71 -0
- data/app/views/binda/field_groups/_form_item.html.erb +62 -0
- data/app/views/binda/field_groups/_form_section.html.erb +37 -0
- data/app/views/binda/field_groups/_form_section_repeater.html.erb +25 -0
- data/app/views/binda/field_groups/edit.html.erb +8 -0
- data/app/views/binda/field_groups/index.html.erb +34 -0
- data/app/views/binda/field_groups/new.html.erb +8 -0
- data/app/views/binda/field_settings/_form_body.html.erb +60 -0
- data/app/views/binda/field_settings/edit.html.erb +8 -0
- data/app/views/binda/field_settings/index.html.erb +31 -0
- data/app/views/binda/field_settings/new.html.erb +8 -0
- data/app/views/binda/galleries/_form.html.erb +27 -0
- data/app/views/binda/galleries/edit.html.erb +6 -0
- data/app/views/binda/galleries/index.html.erb +29 -0
- data/app/views/binda/galleries/new.html.erb +5 -0
- data/app/views/binda/galleries/show.html.erb +14 -0
- data/app/views/binda/manage/users/_admin_manage_user.json.jbuilder +2 -0
- data/app/views/binda/manage/users/_form_body.html.erb +58 -0
- data/app/views/binda/manage/users/edit.html.erb +8 -0
- data/app/views/binda/manage/users/index.html.erb +38 -0
- data/app/views/binda/manage/users/index.json.jbuilder +1 -0
- data/app/views/binda/manage/users/new.html.erb +8 -0
- data/app/views/binda/manage/users/show.json.jbuilder +1 -0
- data/app/views/binda/repeaters/_form.html.erb +27 -0
- data/app/views/binda/repeaters/edit.html.erb +6 -0
- data/app/views/binda/repeaters/index.html.erb +29 -0
- data/app/views/binda/repeaters/new.html.erb +5 -0
- data/app/views/binda/repeaters/show.html.erb +14 -0
- data/app/views/binda/settings/_dashboard_form.html.erb +51 -0
- data/app/views/binda/settings/_form.html.erb +52 -0
- data/app/views/binda/settings/dashboard.html.erb +9 -0
- data/app/views/binda/settings/edit.html.erb +8 -0
- data/app/views/binda/settings/index.html.erb +34 -0
- data/app/views/binda/settings/new.html.erb +8 -0
- data/app/views/binda/structures/_form_body.html.erb +56 -0
- data/app/views/binda/structures/_form_section.html.erb +64 -0
- data/app/views/binda/structures/add_child.html.erb +0 -0
- data/app/views/binda/structures/edit.html.erb +8 -0
- data/app/views/binda/structures/index.html.erb +34 -0
- data/app/views/binda/structures/new.html.erb +8 -0
- data/app/views/binda/texts/_form.html.erb +22 -0
- data/app/views/binda/texts/edit.html.erb +6 -0
- data/app/views/binda/texts/index.html.erb +27 -0
- data/app/views/binda/texts/new.html.erb +5 -0
- data/app/views/binda/texts/show.html.erb +9 -0
- data/app/views/layouts/binda/_flash.html.erb +26 -0
- data/app/views/layouts/binda/_header.html.erb +9 -0
- data/app/views/layouts/binda/_sidebar.html.erb +50 -0
- data/app/views/layouts/binda/application.html.erb +29 -0
- data/app/views/users/confirmations/new.html.erb +16 -0
- data/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/users/mailer/password_change.html.erb +3 -0
- data/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/users/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/users/passwords/edit.html.erb +31 -0
- data/app/views/users/passwords/new.html.erb +28 -0
- data/app/views/users/registrations/edit.html.erb +27 -0
- data/app/views/users/registrations/new.html.erb +17 -0
- data/app/views/users/sessions/new.html.erb +27 -0
- data/app/views/users/shared/_links.html.erb +25 -0
- data/app/views/users/unlocks/new.html.erb +16 -0
- data/config/initializers/assets.rb +3 -0
- data/config/initializers/devise.rb +278 -0
- data/config/initializers/devise_patch.rb +50 -0
- data/config/initializers/friendly_id.rb +88 -0
- data/config/initializers/simple_form.rb +165 -0
- data/config/initializers/simple_form_bootstrap.rb +149 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/en.yml +37 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/routes.rb +67 -0
- data/config/tinymce.yml +15 -0
- data/db/migrate/1_create_binda_tables.rb +172 -0
- data/lib/binda.rb +5 -0
- data/lib/binda/engine.rb +30 -0
- data/lib/binda/version.rb +3 -0
- data/lib/generators/binda/install/USAGE +9 -0
- data/lib/generators/binda/install/install_generator.rb +107 -0
- data/lib/generators/binda/install/templates/config/initializers/carrierwave.rb +32 -0
- data/lib/generators/binda/install/templates/config/initializers/devise.rb +280 -0
- data/lib/generators/binda/setup/USAGE +8 -0
- data/lib/generators/binda/setup/setup_generator.rb +43 -0
- data/lib/tasks/binda.rake +25 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- metadata +637 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<%# HEADING %>
|
|
2
|
+
<h5 class="form-item--<%= field_setting.field_type.underscore %>-caption"><%= field_setting.name.capitalize %></h5>
|
|
3
|
+
|
|
4
|
+
<% unless field_setting.description.blank? %>
|
|
5
|
+
<small class="text-muted"><%= field_setting.description %></small>
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<%# INPUT / TEXTAREA %>
|
|
10
|
+
<% if @component.has_text( field_setting.slug ) %>
|
|
11
|
+
<% if field_setting.field_type == 'text' %>
|
|
12
|
+
<%= ff.input :content, input_html: { value: @component.get_text( field_setting.slug ), class: 'tinymce' }, as: :text %>
|
|
13
|
+
<% else %>
|
|
14
|
+
<%= ff.input :content, input_html: { value: @component.get_text( field_setting.slug ) }, as: :string %>
|
|
15
|
+
<% end %>
|
|
16
|
+
<% else %>
|
|
17
|
+
<% if field_setting.field_type == 'text' %>
|
|
18
|
+
<%= ff.input :content, input_html: { class: 'tinymce' }, as: :text %>
|
|
19
|
+
<% else %>
|
|
20
|
+
<%= ff.input :content, as: :string %>
|
|
21
|
+
<% end %>
|
|
22
|
+
<% end %>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<%= ff.input :field_setting_id, as: :hidden, input_html: { value: field_setting.id } %>
|
|
26
|
+
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
|
27
|
+
<%= ff.input :fieldable_id, as: :hidden %>
|
|
28
|
+
<%= ff.input :fieldable_type, as: :hidden %>
|
|
@@ -0,0 +1,37 @@
|
|
|
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 ) %>
|
|
36
|
+
<%= render 'form_item_repeater', f: f, repeater_setting: field_setting, repeaters: repeaters %>
|
|
37
|
+
<% end %>
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
<% end %>
|
|
@@ -0,0 +1,34 @@
|
|
|
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 %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% content_for :header do %>
|
|
2
|
+
<h3><%= "#{ t :edit }".capitalize %> <%= @structure.name.humanize.split.map(&:capitalize).join(' ') %></h3>
|
|
3
|
+
<a href="<%= structure_components_path %>" class="main-header--back"><span class="glyphicon glyphicon-list"></span> <%= "#{ t :back_to_index }".capitalize %></a>
|
|
4
|
+
<% end %>
|
|
5
|
+
|
|
6
|
+
<% content_for :content do %>
|
|
7
|
+
<%= render 'form_body' %>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<% content_for :header do %>
|
|
2
|
+
<div class="main-header--buttons">
|
|
3
|
+
<%= link_to "New #{ @structure.name.humanize.split.map(&:capitalize).join(' ') }", new_structure_component_path , class: 'main-header--link btn btn-primary' %>
|
|
4
|
+
</div>
|
|
5
|
+
<h3><%= @structure.name.humanize.split.map(&:capitalize).join(' ').pluralize %></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 class="col-sm-1"></th>
|
|
16
|
+
<th class="col-sm-5">Title</th>
|
|
17
|
+
<th class="col-sm-2">Publish state</th>
|
|
18
|
+
<th class="col-sm-3"></th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
|
|
22
|
+
<tbody class="sortable" data-update-url="<%= structure_components_sort_path( @structure.slug ) %>">
|
|
23
|
+
<% @components.order( :position, :name ).each do |component| %>
|
|
24
|
+
<tr id="component_<%= component.id %>">
|
|
25
|
+
<td><span class="sortable--handle"></span></td>
|
|
26
|
+
<td><%= link_to component.name, structure_component_path( @structure.slug, component ) %></td>
|
|
27
|
+
<td><%= component.publish_state %></td>
|
|
28
|
+
<td>
|
|
29
|
+
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
|
|
30
|
+
<%= link_to 'Edit', edit_structure_component_path( @structure.slug, component ) %>
|
|
31
|
+
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
|
|
32
|
+
<%= link_to 'Destroy', structure_component_path( @structure.slug, component.slug ), method: :delete, data: { confirm: 'Are you sure?' }, class: 'text-danger' %>
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<% end %>
|
|
36
|
+
<tbody>
|
|
37
|
+
</table>
|
|
38
|
+
|
|
39
|
+
<%= link_to "New #{ @structure.name.humanize.split.map(&:capitalize).join(' ') }", new_structure_component_path, class: 'main-header--link btn btn-default', action: "new" %>
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% content_for :header do %>
|
|
2
|
+
<h3><%= "#{ t :new }".capitalize %> <%= @structure.name.humanize.split.map(&:capitalize).join(' ') %></h3>
|
|
3
|
+
<a href="<%= structure_components_path %>" class="main-header--back"><span class="glyphicon glyphicon-list"></span> <%= "#{ t :back_to_index }".capitalize %></a>
|
|
4
|
+
<% end %>
|
|
5
|
+
|
|
6
|
+
<% content_for :content do %>
|
|
7
|
+
<%= render 'form_body' %>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<%= form_for(date) do |f| %>
|
|
2
|
+
<% if date.errors.any? %>
|
|
3
|
+
<div id="error_explanation">
|
|
4
|
+
<h2><%= pluralize(date.errors.count, "error") %> prohibited this date from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% date.errors.full_messages.each do |message| %>
|
|
8
|
+
<li><%= message %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div class="field">
|
|
15
|
+
<%= f.label :date %>
|
|
16
|
+
<%= f.datetime_select :date %>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div class="actions">
|
|
20
|
+
<%= f.submit %>
|
|
21
|
+
</div>
|
|
22
|
+
<% end %>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<h1>Dates</h1>
|
|
4
|
+
|
|
5
|
+
<table>
|
|
6
|
+
<thead>
|
|
7
|
+
<tr>
|
|
8
|
+
<th>Date</th>
|
|
9
|
+
<th colspan="3"></th>
|
|
10
|
+
</tr>
|
|
11
|
+
</thead>
|
|
12
|
+
|
|
13
|
+
<tbody>
|
|
14
|
+
<% @dates.each do |date| %>
|
|
15
|
+
<tr>
|
|
16
|
+
<td><%= date.date %></td>
|
|
17
|
+
<td><%= link_to 'Show', date %></td>
|
|
18
|
+
<td><%= link_to 'Edit', edit_date_path(date) %></td>
|
|
19
|
+
<td><%= link_to 'Destroy', date, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
|
20
|
+
</tr>
|
|
21
|
+
<% end %>
|
|
22
|
+
</tbody>
|
|
23
|
+
</table>
|
|
24
|
+
|
|
25
|
+
<br>
|
|
26
|
+
|
|
27
|
+
<%= link_to 'New Date', new_date_path %>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<div class="row">
|
|
2
|
+
<div class="form-body--container col-sm-12">
|
|
3
|
+
|
|
4
|
+
<%= simple_form_for field_group, url: get_form_field_group_url, defaults: { label: false }, html: { class: 'form-body' } do |f| %>
|
|
5
|
+
|
|
6
|
+
<% if field_group.errors.any? %>
|
|
7
|
+
<div id="error_explanation">
|
|
8
|
+
<h2><%= pluralize( field_group.errors.count, "error") %> prohibited this field_group from being saved:</h2>
|
|
9
|
+
|
|
10
|
+
<ul>
|
|
11
|
+
<% field_group.errors.full_messages.each do |message| %>
|
|
12
|
+
<li><%= message %></li>
|
|
13
|
+
<% end %>
|
|
14
|
+
</ul>
|
|
15
|
+
</div>
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
<div class="row">
|
|
19
|
+
<div class="col-sm-8">
|
|
20
|
+
<div class="form-section--wide-container row">
|
|
21
|
+
<div class="col-sm-12">
|
|
22
|
+
|
|
23
|
+
<h4><%= "#{ t :details }".capitalize %></h4>
|
|
24
|
+
|
|
25
|
+
<h5><%= "#{ t :title }".capitalize %></h5>
|
|
26
|
+
<%= f.input :name %>
|
|
27
|
+
|
|
28
|
+
<% if field_group.slug.nil? %>
|
|
29
|
+
<%= f.input :slug, as: :hidden %>
|
|
30
|
+
<% else %>
|
|
31
|
+
<h5><%= "#{ t :slug }".capitalize %></h5>
|
|
32
|
+
<%= f.input :slug, disabled: true, hint: "#{ t :slug_disable_hint }" %>
|
|
33
|
+
<% end %>
|
|
34
|
+
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="form-section--wide-container row">
|
|
38
|
+
<div class="col-sm-12 form-section">
|
|
39
|
+
|
|
40
|
+
<%= render "form_section", section: field_group, f: f, structure: @structure %>
|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<% field_group.field_settings.where( field_type: 'repeater' ).order( :position ).each do |repeater| %>
|
|
45
|
+
<div class="form-section--wide-container row">
|
|
46
|
+
<div class="col-sm-12 form-section">
|
|
47
|
+
|
|
48
|
+
<h4><%= repeater.name.capitalize %></h4>
|
|
49
|
+
|
|
50
|
+
<%= render "form_section_repeater", section: field_group, f: f, structure: @structure, repeater: repeater %>
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<% end %>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="col-sm-4">
|
|
57
|
+
<div class="form-section--narrow-container row">
|
|
58
|
+
<div class="col-sm-12">
|
|
59
|
+
<div class="form-actions">
|
|
60
|
+
|
|
61
|
+
<h4><%= "#{ t :setting }".pluralize.capitalize %></h4>
|
|
62
|
+
<%= f.button :submit, 'Save changes', class: 'btn btn-primary' %>
|
|
63
|
+
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<% end %>
|
|
69
|
+
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<%= ff.input :field_group_id, as: :hidden %>
|
|
2
|
+
<%= ff.input :id, as: :hidden %>
|
|
3
|
+
<%= ff.input :ancestry, as: :hidden unless ff.object.is_root? %>
|
|
4
|
+
|
|
5
|
+
<%# - - - - - - - - - - - - %>
|
|
6
|
+
<%# REMOVE BUTTON %>
|
|
7
|
+
<%# - - - - - - - - - - - - %>
|
|
8
|
+
<% if ff.object.slug.nil? %>
|
|
9
|
+
<a class="form-item--remove-item-with-js" data-confirm="This operation will delete this setting and all related component content. Are you ok with that?"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
|
|
10
|
+
<% else %>
|
|
11
|
+
<a href="<%= structure_field_group_field_setting_path( field_group_id: section.slug, id: ff.object.slug ) %>" data-method="delete" data-confirm="This operation will delete this setting and all related component content. Are you ok with that?"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
|
|
12
|
+
<a class="form-item--close-button"><span class="glyphicon glyphicon-chevron-up" aria-hidden="true"></span></a>
|
|
13
|
+
<a class="form-item--open-button"><span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span></a>
|
|
14
|
+
<div class="form-item--label">
|
|
15
|
+
<h4><%= ff.object.name %></h4>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
18
|
+
|
|
19
|
+
<div class="form-item--editor">
|
|
20
|
+
|
|
21
|
+
<%# - - - - - - - - - - - - %>
|
|
22
|
+
<%# NAME %>
|
|
23
|
+
<%# - - - - - - - - - - - - %>
|
|
24
|
+
<h5><%= "#{ t :name }".capitalize %></h5>
|
|
25
|
+
<%= ff.input :name, as: :string, input_html: { class: "form-item--input" } %>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<%# - - - - - - - - - - - - %>
|
|
29
|
+
<%# SLUG %>
|
|
30
|
+
<%# - - - - - - - - - - - - %>
|
|
31
|
+
<h5><%= "#{ t :slug }".capitalize %></h5>
|
|
32
|
+
<%= ff.input :slug, as: :string, input_html: { class: "form-item--input" } %>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<%# - - - - - - - - - - - - %>
|
|
36
|
+
<%# DESCRIPTION %>
|
|
37
|
+
<%# - - - - - - - - - - - - %>
|
|
38
|
+
<h5><%= "#{ t :description }".capitalize %></h5>
|
|
39
|
+
<%= ff.input :description, input_html: { class: "form-item--input" } %>
|
|
40
|
+
<div class="clearfix"></div>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<%# - - - - - - - - - - - - %>
|
|
44
|
+
<%# POSITION %>
|
|
45
|
+
<%# - - - - - - - - - - - - %>
|
|
46
|
+
<h5><%= "#{ t :position }".capitalize %></h5>
|
|
47
|
+
<%= ff.input :position, as: :integer, input_html: { class: "form-item--input" } %>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<%# - - - - - - - - - - - - %>
|
|
51
|
+
<%# FIELD TYPE %>
|
|
52
|
+
<%# - - - - - - - - - - - - %>
|
|
53
|
+
<h5><%= "#{ t :field_type }".capitalize %></h5>
|
|
54
|
+
<% if ff.object.field_type.nil? %>
|
|
55
|
+
<%= 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' } %>
|
|
56
|
+
<% else %>
|
|
57
|
+
<%= ff.input :field_type, as: :string, disabled: true, input_html: { class: "form-item--input" } %>
|
|
58
|
+
<% end %>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="clearfix"></div>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<h4><%= "#{ t :field_setting }".pluralize.capitalize %></h4>
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<%# - - - - - - - - - - - - %>
|
|
5
|
+
<%# FORM ITEM %>
|
|
6
|
+
<%# - - - - - - - - - - - - %>
|
|
7
|
+
<%# This form is only for settings which are not part of any repeater. %>
|
|
8
|
+
<%# This is done using `where( ancestry: nil )` %>
|
|
9
|
+
<%= f.simple_fields_for :field_settings, f.object.field_settings.where( ancestry: nil ).order( :position ) do |ff| %>
|
|
10
|
+
<div class="form-item <%= "form-item--#{ ff.object.field_type }" unless ff.object.field_type.nil? %>">
|
|
11
|
+
<%= render 'form_item', ff: ff, section: section %>
|
|
12
|
+
</div>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<%# - - - - - - - - - - - - %>
|
|
17
|
+
<%# NEW FORM ITEM %>
|
|
18
|
+
<%# - - - - - - - - - - - - %>
|
|
19
|
+
<%= f.simple_fields_for 'new_field_settings[]', @field_group.field_settings.build( field_group: @field_group ) do |ff| %>
|
|
20
|
+
<div id="new-child-<%= f.object.id %>" class="form-item form-item--new">
|
|
21
|
+
<%= render 'form_item', ff: ff, section: section %>
|
|
22
|
+
</div>
|
|
23
|
+
<% end %>
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<%# - - - - - - - - - - - - - - %>
|
|
27
|
+
<%# 'ADD NEW FORM ITEM' BUTTON %>
|
|
28
|
+
<%# - - - - - - - - - - - - - - %>
|
|
29
|
+
<% if section.slug.nil? %>
|
|
30
|
+
<h5>
|
|
31
|
+
<%= t( :hint_create_parent_before_child, arg1: "#{ t :field_group }", arg2: "#{ t :field_setting }" ).capitalize %>
|
|
32
|
+
</h5>
|
|
33
|
+
<% else %>
|
|
34
|
+
<a class="form-item--add-new main-header--link btn btn-default" href="<%= new_structure_field_group_field_setting_path( field_group_id: section.slug ) %>" data-new-child-id="new-child-<%= f.object.id %>">
|
|
35
|
+
<%= "#{ t :new }".capitalize %> <%= t :field_setting %>
|
|
36
|
+
</a>
|
|
37
|
+
<% end %>
|