binda 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/binda/field_groups_controller.rb +48 -6
- data/app/controllers/binda/structures_controller.rb +2 -2
- data/app/models/binda/field_group.rb +9 -0
- data/app/views/binda/field_groups/index.html.erb +2 -2
- data/app/views/binda/structures/_form_section.html.erb +1 -1
- data/lib/binda/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a0ed652cd145d7bd16c1e6488c5fdd9a3177018
|
4
|
+
data.tar.gz: ae29ad9b71bd43ba1a40eeb67b69ab9c919fe847
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00f4c1845cfeb066332494f6213d92abccdc41f5d6f8be0a7d2901b9b06f7d47a3a61a1ef324a08665db8d0f998f71bca1868a149ed3e33bbca002e72bb2285f
|
7
|
+
data.tar.gz: 738f6490b90e4efd030938c372f70ba1fb8e65150571e02204a11e3221a1b051c07ad18785cd80bedbc72074953221461a7f081a716f2c2eb2d1aa2b690a5975
|
data/README.md
CHANGED
@@ -82,16 +82,58 @@ module Binda
|
|
82
82
|
# Only allow a trusted parameter "white list" through.
|
83
83
|
def field_group_params
|
84
84
|
params.require(:field_group).permit(
|
85
|
-
:name,
|
86
|
-
|
87
|
-
|
88
|
-
|
85
|
+
:name,
|
86
|
+
:slug,
|
87
|
+
:description,
|
88
|
+
:position,
|
89
|
+
:layout,
|
90
|
+
:structure_id,
|
91
|
+
field_settings_attributes:
|
92
|
+
[ :id,
|
93
|
+
:field_group_id,
|
94
|
+
:field_setting_id,
|
95
|
+
:name,
|
96
|
+
:slug,
|
97
|
+
:description,
|
98
|
+
:field_type,
|
99
|
+
:position,
|
100
|
+
:required,
|
101
|
+
:default_text,
|
102
|
+
:ancestry,
|
103
|
+
:default_choice_id_id,
|
104
|
+
:allow_null,
|
105
|
+
choices: [],
|
106
|
+
choices_attributes:
|
107
|
+
[ :field_setting_id,
|
108
|
+
:label,
|
109
|
+
:value
|
110
|
+
]
|
111
|
+
]
|
112
|
+
)
|
89
113
|
end
|
90
114
|
|
91
115
|
def new_params
|
92
116
|
params.require(:field_group).permit(
|
93
|
-
new_field_settings:
|
94
|
-
|
117
|
+
new_field_settings:
|
118
|
+
[ :field_group_id,
|
119
|
+
:field_setting_id,
|
120
|
+
:name,
|
121
|
+
:slug,
|
122
|
+
:description,
|
123
|
+
:field_type,
|
124
|
+
:position,
|
125
|
+
:required,
|
126
|
+
:ancestry,
|
127
|
+
:default_choice_id,
|
128
|
+
:allow_null,
|
129
|
+
choices: []
|
130
|
+
],
|
131
|
+
new_choices:
|
132
|
+
[ :field_setting_id,
|
133
|
+
:label,
|
134
|
+
:value
|
135
|
+
]
|
136
|
+
)
|
95
137
|
end
|
96
138
|
|
97
139
|
def reset_field_settings_cache
|
@@ -24,9 +24,9 @@ module Binda
|
|
24
24
|
|
25
25
|
if @structure.save
|
26
26
|
# Creates a default empty field group
|
27
|
-
@
|
27
|
+
@field_group = @structure.field_groups.build( name: 'General Details', position: 1 )
|
28
28
|
# Unless there is a problem...
|
29
|
-
unless @
|
29
|
+
unless @field_group.save
|
30
30
|
return redirect_to structure_path( @structure.slug ), flash: { error: 'General Details group hasn\'t been created' }
|
31
31
|
end
|
32
32
|
# ... redirect to the new structure path
|
@@ -17,6 +17,7 @@ module Binda
|
|
17
17
|
extend FriendlyId
|
18
18
|
friendly_id :default_slug, use: [:slugged, :finders]
|
19
19
|
|
20
|
+
after_create :update_position
|
20
21
|
|
21
22
|
# CUSTOM METHODS
|
22
23
|
# --------------
|
@@ -36,5 +37,13 @@ module Binda
|
|
36
37
|
attributes['name'].blank? && attributes['field_type'].blank?
|
37
38
|
end
|
38
39
|
|
40
|
+
private
|
41
|
+
|
42
|
+
def update_position
|
43
|
+
if self.position.nil?
|
44
|
+
self.update_attribute( 'position', self.structure.field_groups.length )
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
39
48
|
end
|
40
49
|
end
|
@@ -17,11 +17,11 @@
|
|
17
17
|
</tr>
|
18
18
|
</thead>
|
19
19
|
|
20
|
-
<tbody class="sortable" data-update-url="<%= structure_field_groups_sort_path
|
20
|
+
<tbody class="sortable" data-update-url="<%= structure_field_groups_sort_path %>">
|
21
21
|
<% @field_groups.order( :position, :name ).each do |field_group| %>
|
22
22
|
<tr id="field_group_<%= field_group.id %>">
|
23
23
|
<td colspan="3"><%= field_group.name %></td>
|
24
|
-
<td><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> <%= link_to 'Edit', edit_structure_field_group_path( @structure.slug, field_group ) %> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> <%= link_to 'Destroy',
|
24
|
+
<td><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> <%= link_to 'Edit', edit_structure_field_group_path( structure_id: @structure.slug, field_group.slug ) %> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> <%= link_to 'Destroy', structure_field_group_path, method: :delete, data: { confirm: 'This operation will delete this group and all related field settings and component content. Are you ok with that?' }, class: 'text-danger' %></td>
|
25
25
|
</tr>
|
26
26
|
<% end %>
|
27
27
|
<tbody>
|
data/lib/binda/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Barbieri
|
@@ -432,10 +432,10 @@ dependencies:
|
|
432
432
|
- - "~>"
|
433
433
|
- !ruby/object:Gem::Version
|
434
434
|
version: '0.9'
|
435
|
-
description:
|
436
|
-
to manage and customize components.
|
437
|
-
process and concentrate directly on what your application is about.
|
438
|
-
the documentation for more information and a quick
|
435
|
+
description: A modular CMS for Ruby on Rails 5 with an intuitive out-of-the-box interface
|
436
|
+
to manage and customize components. Use Binda if you want to speed up your setup
|
437
|
+
process and concentrate directly on what your application is about. Please read
|
438
|
+
the documentation for more information and a quick start guide.
|
439
439
|
email:
|
440
440
|
- alessandro@lacolonia.studio
|
441
441
|
executables: []
|