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.
- checksums.yaml +4 -4
- data/README.md +14 -29
- data/Rakefile +16 -10
- data/app/assets/javascripts/binda/components/form_item.js +12 -1
- data/app/assets/javascripts/binda/components/form_item_asset.js +1 -0
- data/app/assets/javascripts/binda/components/form_item_choice.js +58 -0
- data/app/assets/javascripts/binda/components/form_item_editor.js +39 -0
- data/app/assets/javascripts/binda/components/form_item_repeater.js +7 -0
- data/app/assets/javascripts/binda/components/sortable.js +0 -1
- data/app/assets/javascripts/binda/dist/binda.bundle.js +175 -8
- data/app/assets/javascripts/binda/index.js +4 -0
- data/app/assets/stylesheets/binda/components/form_item.scss +64 -2
- data/app/controllers/binda/application_controller.rb +2 -10
- data/app/controllers/binda/choices_controller.rb +19 -0
- data/app/controllers/binda/components_controller.rb +38 -134
- data/app/controllers/binda/field_groups_controller.rb +18 -30
- data/app/controllers/binda/structures_controller.rb +6 -6
- data/app/controllers/concerns/binda/component_controller_helper.rb +16 -0
- data/app/models/binda/checkbox.rb +7 -0
- data/app/models/binda/choice.rb +11 -0
- data/app/models/binda/component.rb +12 -136
- data/app/models/binda/field_group.rb +1 -1
- data/app/models/binda/field_setting.rb +40 -8
- data/app/models/binda/radio.rb +5 -0
- data/app/models/binda/repeater.rb +11 -79
- data/app/models/binda/select.rb +7 -0
- data/app/models/binda/structure.rb +13 -13
- data/app/models/concerns/binda/component_model_helper.rb +170 -0
- data/app/views/binda/components/_form_item_new_repeater.html.erb +3 -5
- data/app/views/binda/components/_form_item_selectable.html.erb +72 -0
- data/app/views/binda/components/_form_section.html.erb +7 -2
- data/app/views/binda/components/_form_section_repeater.html.erb +10 -0
- data/app/views/binda/field_groups/_form_item.html.erb +54 -26
- data/app/views/binda/field_groups/_form_item_choice.erb +96 -0
- data/app/views/binda/field_groups/_form_section.html.erb +2 -2
- data/app/views/binda/field_groups/_form_section_repeater.html.erb +2 -2
- data/config/locales/en.yml +7 -0
- data/config/routes.rb +2 -1
- data/db/migrate/1_create_binda_tables.rb +17 -0
- data/lib/binda/engine.rb +6 -0
- data/lib/binda/version.rb +1 -1
- data/lib/generators/binda/install/install_generator.rb +6 -8
- data/lib/generators/binda/setup/setup_generator.rb +8 -4
- metadata +66 -42
- data/app/controllers/binda/dates_controller.rb +0 -62
- data/app/controllers/binda/texts_controller.rb +0 -62
- data/app/views/binda/dates/_form.html.erb +0 -22
- data/app/views/binda/dates/edit.html.erb +0 -6
- data/app/views/binda/dates/index.html.erb +0 -27
- data/app/views/binda/dates/new.html.erb +0 -5
- data/app/views/binda/dates/show.html.erb +0 -9
- data/app/views/binda/repeaters/_form.html.erb +0 -27
- data/app/views/binda/repeaters/edit.html.erb +0 -6
- data/app/views/binda/repeaters/index.html.erb +0 -29
- data/app/views/binda/repeaters/new.html.erb +0 -5
- data/app/views/binda/repeaters/show.html.erb +0 -14
- data/app/views/binda/structures/add_child.html.erb +0 -0
- data/app/views/binda/texts/_form.html.erb +0 -22
- data/app/views/binda/texts/edit.html.erb +0 -6
- data/app/views/binda/texts/index.html.erb +0 -27
- data/app/views/binda/texts/new.html.erb +0 -5
- 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,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,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,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,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,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 %>
|