binda 0.0.3 → 0.0.5

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -29
  3. data/Rakefile +16 -10
  4. data/app/assets/javascripts/binda/components/form_item.js +12 -1
  5. data/app/assets/javascripts/binda/components/form_item_asset.js +1 -0
  6. data/app/assets/javascripts/binda/components/form_item_choice.js +58 -0
  7. data/app/assets/javascripts/binda/components/form_item_editor.js +39 -0
  8. data/app/assets/javascripts/binda/components/form_item_repeater.js +7 -0
  9. data/app/assets/javascripts/binda/components/sortable.js +0 -1
  10. data/app/assets/javascripts/binda/dist/binda.bundle.js +175 -8
  11. data/app/assets/javascripts/binda/index.js +4 -0
  12. data/app/assets/stylesheets/binda/components/form_item.scss +64 -2
  13. data/app/controllers/binda/application_controller.rb +2 -10
  14. data/app/controllers/binda/choices_controller.rb +19 -0
  15. data/app/controllers/binda/components_controller.rb +38 -134
  16. data/app/controllers/binda/field_groups_controller.rb +18 -30
  17. data/app/controllers/binda/structures_controller.rb +6 -6
  18. data/app/controllers/concerns/binda/component_controller_helper.rb +16 -0
  19. data/app/models/binda/checkbox.rb +7 -0
  20. data/app/models/binda/choice.rb +11 -0
  21. data/app/models/binda/component.rb +12 -136
  22. data/app/models/binda/field_group.rb +1 -1
  23. data/app/models/binda/field_setting.rb +40 -8
  24. data/app/models/binda/radio.rb +5 -0
  25. data/app/models/binda/repeater.rb +11 -79
  26. data/app/models/binda/select.rb +7 -0
  27. data/app/models/binda/structure.rb +13 -13
  28. data/app/models/concerns/binda/component_model_helper.rb +170 -0
  29. data/app/views/binda/components/_form_item_new_repeater.html.erb +3 -5
  30. data/app/views/binda/components/_form_item_selectable.html.erb +72 -0
  31. data/app/views/binda/components/_form_section.html.erb +7 -2
  32. data/app/views/binda/components/_form_section_repeater.html.erb +10 -0
  33. data/app/views/binda/field_groups/_form_item.html.erb +54 -26
  34. data/app/views/binda/field_groups/_form_item_choice.erb +96 -0
  35. data/app/views/binda/field_groups/_form_section.html.erb +2 -2
  36. data/app/views/binda/field_groups/_form_section_repeater.html.erb +2 -2
  37. data/config/locales/en.yml +7 -0
  38. data/config/routes.rb +2 -1
  39. data/db/migrate/1_create_binda_tables.rb +17 -0
  40. data/lib/binda/engine.rb +6 -0
  41. data/lib/binda/version.rb +1 -1
  42. data/lib/generators/binda/install/install_generator.rb +6 -8
  43. data/lib/generators/binda/setup/setup_generator.rb +8 -4
  44. metadata +66 -42
  45. data/app/controllers/binda/dates_controller.rb +0 -62
  46. data/app/controllers/binda/texts_controller.rb +0 -62
  47. data/app/views/binda/dates/_form.html.erb +0 -22
  48. data/app/views/binda/dates/edit.html.erb +0 -6
  49. data/app/views/binda/dates/index.html.erb +0 -27
  50. data/app/views/binda/dates/new.html.erb +0 -5
  51. data/app/views/binda/dates/show.html.erb +0 -9
  52. data/app/views/binda/repeaters/_form.html.erb +0 -27
  53. data/app/views/binda/repeaters/edit.html.erb +0 -6
  54. data/app/views/binda/repeaters/index.html.erb +0 -29
  55. data/app/views/binda/repeaters/new.html.erb +0 -5
  56. data/app/views/binda/repeaters/show.html.erb +0 -14
  57. data/app/views/binda/structures/add_child.html.erb +0 -0
  58. data/app/views/binda/texts/_form.html.erb +0 -22
  59. data/app/views/binda/texts/edit.html.erb +0 -6
  60. data/app/views/binda/texts/index.html.erb +0 -27
  61. data/app/views/binda/texts/new.html.erb +0 -5
  62. data/app/views/binda/texts/show.html.erb +0 -9
@@ -1,62 +0,0 @@
1
- require_dependency "binda/application_controller"
2
-
3
- module Binda
4
- class TextsController < ApplicationController
5
- before_action :set_text, only: [:show, :edit, :update, :destroy]
6
-
7
- # GET /texts
8
- def index
9
- @texts = Text.all
10
- end
11
-
12
- # GET /texts/1
13
- def show
14
- end
15
-
16
- # GET /texts/new
17
- def new
18
- @text = Text.new
19
- end
20
-
21
- # GET /texts/1/edit
22
- def edit
23
- end
24
-
25
- # POST /texts
26
- def create
27
- @text = Text.new(text_params)
28
-
29
- if @text.save
30
- redirect_to text_path( @text.id ), notice: 'Text was successfully created.'
31
- else
32
- render :new
33
- end
34
- end
35
-
36
- # PATCH/PUT /texts/1
37
- def update
38
- if @text.update(text_params)
39
- redirect_to text_path( @text.id ), notice: 'Text was successfully updated.'
40
- else
41
- render :edit
42
- end
43
- end
44
-
45
- # DELETE /texts/1
46
- def destroy
47
- @text.destroy
48
- redirect_to texts_url, notice: 'Text was successfully destroyed.'
49
- end
50
-
51
- private
52
- # Use callbacks to share common setup or constraints between actions.
53
- def set_text
54
- @text = Text.find(params[:id])
55
- end
56
-
57
- # Only allow a trusted parameter "white list" through.
58
- def text_params
59
- params.require(:text).permit(:content, :position)
60
- end
61
- end
62
- end
@@ -1,22 +0,0 @@
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 %>
@@ -1,6 +0,0 @@
1
- <h1>Editing Date</h1>
2
-
3
- <%= render 'form', date: @date %>
4
-
5
- <%= link_to 'Show', @date %> |
6
- <%= link_to 'Back', dates_path %>
@@ -1,27 +0,0 @@
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 %>
@@ -1,5 +0,0 @@
1
- <h1>New Date</h1>
2
-
3
- <%= render 'form', date: @date %>
4
-
5
- <%= link_to 'Back', dates_path %>
@@ -1,9 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <p>
4
- <strong>Date:</strong>
5
- <%= @date.date %>
6
- </p>
7
-
8
- <%= link_to 'Edit', edit_date_path(@date) %> |
9
- <%= link_to 'Back', dates_path %>
@@ -1,27 +0,0 @@
1
- <%= form_for(repeater) do |f| %>
2
- <% if repeater.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(repeater.errors.count, "error") %> prohibited this repeater from being saved:</h2>
5
-
6
- <ul>
7
- <% repeater.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 :name %>
16
- <%= f.text_field :name %>
17
- </div>
18
-
19
- <div class="field">
20
- <%= f.label :slug %>
21
- <%= f.text_field :slug %>
22
- </div>
23
-
24
- <div class="actions">
25
- <%= f.submit %>
26
- </div>
27
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing Repeater</h1>
2
-
3
- <%= render 'form', repeater: @repeater %>
4
-
5
- <%= link_to 'Show', @repeater %> |
6
- <%= link_to 'Back', repeaters_path %>
@@ -1,29 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <h1>Repeaters</h1>
4
-
5
- <table>
6
- <thead>
7
- <tr>
8
- <th>Name</th>
9
- <th>Slug</th>
10
- <th colspan="3"></th>
11
- </tr>
12
- </thead>
13
-
14
- <tbody>
15
- <% @repeaters.each do |repeater| %>
16
- <tr>
17
- <td><%= repeater.name %></td>
18
- <td><%= repeater.slug %></td>
19
- <td><%= link_to 'Show', repeater %></td>
20
- <td><%= link_to 'Edit', edit_repeater_path(repeater) %></td>
21
- <td><%= link_to 'Destroy', repeater, method: :delete, data: { confirm: 'Are you sure?' } %></td>
22
- </tr>
23
- <% end %>
24
- </tbody>
25
- </table>
26
-
27
- <br>
28
-
29
- <%= link_to 'New Repeater', new_repeater_path %>
@@ -1,5 +0,0 @@
1
- <h1>New Repeater</h1>
2
-
3
- <%= render 'form', repeater: @repeater %>
4
-
5
- <%= link_to 'Back', repeaters_path %>
@@ -1,14 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <p>
4
- <strong>Name:</strong>
5
- <%= @repeater.name %>
6
- </p>
7
-
8
- <p>
9
- <strong>Slug:</strong>
10
- <%= @repeater.slug %>
11
- </p>
12
-
13
- <%= link_to 'Edit', edit_repeater_path(@repeater) %> |
14
- <%= link_to 'Back', repeaters_path %>
File without changes
@@ -1,22 +0,0 @@
1
- <%= form_for(text) do |f| %>
2
- <% if text.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(text.errors.count, "error") %> prohibited this text from being saved:</h2>
5
-
6
- <ul>
7
- <% text.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 :content %>
16
- <%= f.text_area :content %>
17
- </div>
18
-
19
- <div class="actions">
20
- <%= f.submit %>
21
- </div>
22
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing Text</h1>
2
-
3
- <%= render 'form', text: @text %>
4
-
5
- <%= link_to 'Show', @text %> |
6
- <%= link_to 'Back', texts_path %>
@@ -1,27 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <h1>Texts</h1>
4
-
5
- <table>
6
- <thead>
7
- <tr>
8
- <th>Content</th>
9
- <th colspan="3"></th>
10
- </tr>
11
- </thead>
12
-
13
- <tbody>
14
- <% @texts.each do |text| %>
15
- <tr>
16
- <td><%= text.content %></td>
17
- <td><%= link_to 'Show', text %></td>
18
- <td><%= link_to 'Edit', edit_text_path(text) %></td>
19
- <td><%= link_to 'Destroy', text, method: :delete, data: { confirm: 'Are you sure?' } %></td>
20
- </tr>
21
- <% end %>
22
- </tbody>
23
- </table>
24
-
25
- <br>
26
-
27
- <%= link_to 'New Text', new_text_path %>
@@ -1,5 +0,0 @@
1
- <h1>New Text</h1>
2
-
3
- <%= render 'form', text: @text %>
4
-
5
- <%= link_to 'Back', texts_path %>
@@ -1,9 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <p>
4
- <strong>Content:</strong>
5
- <%= @text.content %>
6
- </p>
7
-
8
- <%= link_to 'Edit', edit_text_path(@text) %> |
9
- <%= link_to 'Back', texts_path %>