effective_developer 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -7
- data/lib/effective_developer/version.rb +1 -1
- data/lib/generators/effective/form_generator.rb +1 -1
- data/lib/scaffolds/forms/default/_form.html.haml +8 -7
- data/lib/scaffolds/forms/fields/_field_belongs_to.html.haml +1 -4
- data/lib/scaffolds/forms/fields/_field_boolean.html.haml +1 -2
- data/lib/scaffolds/forms/fields/_field_date.html.haml +1 -2
- data/lib/scaffolds/forms/fields/_field_datetime.html.haml +1 -2
- data/lib/scaffolds/forms/fields/_field_decimal.html.haml +1 -2
- data/lib/scaffolds/forms/fields/_field_integer.html.haml +1 -2
- data/lib/scaffolds/forms/fields/_field_string.html.haml +1 -2
- data/lib/scaffolds/forms/fields/_field_text.html.haml +1 -2
- data/lib/scaffolds/forms/tabpanel/_form.html.haml +7 -9
- data/lib/scaffolds/views/_resource.html.haml +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a98431485d3aaaaa800ff0ce881b3846fbc154f6
|
4
|
+
data.tar.gz: c7fd087d4e38a3859c85f92099fdb7210f7af038
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2150d74a7c45702968db18947d68b5d6a7eceed6c2fbae6f8801fcbc6b96afcfede8ce052bf7882f85e8d43468ff3762deed4dea09e5f320cf9904e8644c952a
|
7
|
+
data.tar.gz: d5f63dded7cf53a851dd397bbdd56250dc0b30c61eeaa1bc6094bf3605fc5ce628944ca472d76e4a30c7ab9859315bd3b35a6a1b7d2167ed7e4cf0feb0129a78
|
data/README.md
CHANGED
@@ -270,11 +270,11 @@ class Post < ApplicationRecord
|
|
270
270
|
belongs_to :category
|
271
271
|
|
272
272
|
# Attributes
|
273
|
-
#
|
273
|
+
# title :string
|
274
274
|
# body :text
|
275
275
|
# published_at :datetime
|
276
276
|
|
277
|
-
validates :
|
277
|
+
validates :title, presence: true
|
278
278
|
validates :description, presence: true
|
279
279
|
|
280
280
|
has_many :comments
|
@@ -283,16 +283,15 @@ class Post < ApplicationRecord
|
|
283
283
|
scope :published, -> { where.not(published_at: nil) }
|
284
284
|
|
285
285
|
def to_s
|
286
|
-
|
286
|
+
title || 'New Post'
|
287
287
|
end
|
288
288
|
end
|
289
289
|
```
|
290
290
|
|
291
|
-
and then run
|
292
|
-
|
291
|
+
and then run`
|
293
292
|
```console
|
294
|
-
rails generate scaffold post
|
295
|
-
rails generate scaffold_controller admin/post
|
293
|
+
rails generate effective:scaffold post
|
294
|
+
rails generate effective:scaffold_controller admin/post
|
296
295
|
```
|
297
296
|
|
298
297
|
Tweak from here
|
@@ -43,7 +43,7 @@ module Effective
|
|
43
43
|
resource.nested_resources.each do |_, nested_resource|
|
44
44
|
@nested_resource = nested_resource
|
45
45
|
template 'forms/tabpanel/_tab_nested_resource.html.haml', resource.view_file("form_#{nested_resource.plural_name}", partial: true)
|
46
|
-
template 'forms/fields/_nested_resource_fields.html.haml', File.join('app/views', resource.namespace, (resource.namespace.present? ? '' : resource.class_path), nested_resource.name.to_s.underscore.pluralize, '_fields.html.haml')
|
46
|
+
template 'forms/fields/_nested_resource_fields.html.haml', File.join('app/views', resource.namespace.to_s, (resource.namespace.present? ? '' : resource.class_path), nested_resource.name.to_s.underscore.pluralize, '_fields.html.haml')
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -5,11 +5,12 @@
|
|
5
5
|
<% attributes.each do |attribute| -%>
|
6
6
|
<%= render_field(attribute, depth: 1) %>
|
7
7
|
<% end -%>
|
8
|
-
|
8
|
+
|
9
|
+
.form-actions
|
10
|
+
<% if defined?(EffectiveResources) -%>
|
9
11
|
= simple_form_submit(f)
|
10
|
-
<% else -%>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
<% end -%>
|
12
|
+
<% else -%>
|
13
|
+
f.button :submit, 'Save', data: { disable_with: 'Saving...' }
|
14
|
+
f.button :submit, 'Save and Continue', data: { disable_with: 'Saving...' }
|
15
|
+
f.button :submit, 'Save and Add New', data: { disable_with: 'Saving...' }
|
16
|
+
<% end -%>
|
@@ -1,4 +1 @@
|
|
1
|
-
= f.input :<%= reference.foreign_key.presence || (reference.name.to_s + '_id') %>,
|
2
|
-
as: :effective_select, collection: <%= reference.name.to_s.classify %>.all,
|
3
|
-
hint: ''
|
4
|
-
|
1
|
+
= f.input :<%= reference.foreign_key.presence || (reference.name.to_s + '_id') %>, as: :effective_select, collection: <%= reference.name.to_s.classify %>.all
|
@@ -1,2 +1 @@
|
|
1
|
-
= f.input :<%= attribute.name %>, as: :boolean
|
2
|
-
hint: ''
|
1
|
+
= f.input :<%= attribute.name %>, as: :boolean
|
@@ -1,2 +1 @@
|
|
1
|
-
= f.input :<%= attribute.name %>, as: :effective_date_picker
|
2
|
-
hint: ''
|
1
|
+
= f.input :<%= attribute.name %>, as: :effective_date_picker
|
@@ -1,2 +1 @@
|
|
1
|
-
= f.input :<%= attribute.name %>, as: :effective_date_time_picker
|
2
|
-
hint: ''
|
1
|
+
= f.input :<%= attribute.name %>, as: :effective_date_time_picker
|
@@ -1,2 +1 @@
|
|
1
|
-
= f.input :<%= attribute.name
|
2
|
-
hint: ''
|
1
|
+
= f.input :<%= attribute.name %>
|
@@ -1,2 +1 @@
|
|
1
|
-
= f.input :<%= attribute.name
|
2
|
-
hint: ''
|
1
|
+
= f.input :<%= attribute.name %>
|
@@ -1,2 +1 @@
|
|
1
|
-
= f.input :<%= attribute.name
|
2
|
-
hint: ''
|
1
|
+
= f.input :<%= attribute.name %>
|
@@ -1,2 +1 @@
|
|
1
|
-
= f.input :<%= attribute.name %>, as: :text
|
2
|
-
hint: ''
|
1
|
+
= f.input :<%= attribute.name %>, as: :text
|
@@ -18,15 +18,13 @@
|
|
18
18
|
<% resource.nested_resources.each do |_, nested_resource| -%>
|
19
19
|
#<%= nested_resource.plural_name %>-tab.tab-pane{role: 'tabpanel'}
|
20
20
|
= render 'form_<%= nested_resource.plural_name %>', f: f
|
21
|
-
|
22
21
|
<% end -%>
|
23
|
-
%hr
|
24
22
|
|
25
|
-
|
23
|
+
.form-actions
|
24
|
+
<% if defined?(EffectiveResources) -%>
|
26
25
|
= simple_form_submit(f)
|
27
|
-
<% else -%>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
<% end -%>
|
26
|
+
<% else -%>
|
27
|
+
= f.button :submit, 'Save', data: { disable_with: 'Saving...' }
|
28
|
+
= f.button :submit, 'Save and Continue', data: { disable_with: 'Saving...' }
|
29
|
+
= f.button :submit, 'Save and Add New', data: { disable_with: 'Saving...' }
|
30
|
+
<% end -%>
|
@@ -4,9 +4,9 @@
|
|
4
4
|
%tr
|
5
5
|
%th <%= reference.name.to_s.titleize %>
|
6
6
|
%td= <%= resource.name %>.<%= reference.name %>
|
7
|
-
<% end
|
7
|
+
<% end -%>
|
8
8
|
<% attributes.each do |attribute| -%>
|
9
9
|
%tr
|
10
10
|
%th <%= attribute.name.titleize %>
|
11
11
|
%td= <%= resource.name %>.<%= attribute.name %>
|
12
|
-
<% end
|
12
|
+
<% end -%>
|