fae-rails 1.7.1 → 2.2.0
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 -2
- data/Rakefile +0 -3
- data/app/assets/images/fae/tutorial_model_location.png +0 -0
- data/app/assets/javascripts/fae/_deploy.js +198 -0
- data/app/assets/javascripts/fae/_modals.js +94 -0
- data/app/assets/javascripts/fae/_tables.js +11 -25
- data/app/assets/javascripts/fae/application.js +4 -2
- data/app/assets/javascripts/fae/fae_init.js +0 -4
- data/app/assets/javascripts/fae/form/_ajax.js +26 -7
- data/app/assets/javascripts/fae/form/_cancel.js +1 -0
- data/app/assets/javascripts/fae/form/_filtering.js +34 -0
- data/app/assets/javascripts/fae/form/_form.js +1 -0
- data/app/assets/javascripts/fae/form/_form_manager.js +295 -0
- data/app/assets/javascripts/fae/form/_slugger.js.erb +2 -2
- data/app/assets/javascripts/fae/form/_validator.js +24 -14
- data/app/assets/javascripts/fae/form/inputs/_color.js +2 -1
- data/app/assets/javascripts/fae/form/inputs/_select.js +5 -2
- data/app/assets/javascripts/fae/navigation/_language.js +1 -1
- data/app/assets/javascripts/fae/navigation/_navigation.js +9 -21
- data/app/assets/javascripts/fae/navigation/_subnav_highlighter.js +7 -41
- data/app/assets/javascripts/fae/vendor/jqColorPicker.min.js +0 -1
- data/app/assets/stylesheets/fae/base.scss +7 -8
- data/app/assets/stylesheets/fae/globals/imports/_variables.scss +1 -2
- data/app/assets/stylesheets/fae/globals/layout/_base.scss +7 -2
- data/app/assets/stylesheets/fae/globals/layout/_content-header.scss +17 -31
- data/app/assets/stylesheets/fae/globals/navigation/_header.scss +2 -2
- data/app/assets/stylesheets/fae/globals/navigation/_multi-col-subnav.scss +50 -0
- data/app/assets/stylesheets/fae/modules/_buttons.scss +11 -0
- data/app/assets/stylesheets/fae/modules/_deploy.scss +25 -0
- data/app/assets/stylesheets/fae/modules/_modal.scss +25 -0
- data/app/assets/stylesheets/fae/modules/_toggles.scss +39 -23
- data/app/assets/stylesheets/fae/modules/forms/_asset-actions.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_base.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_checkbox.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_date.scss +16 -0
- data/app/assets/stylesheets/fae/modules/forms/_form-manager.scss +82 -0
- data/app/assets/stylesheets/fae/modules/forms/_radio.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_select.scss +7 -6
- data/app/assets/stylesheets/fae/modules/forms/_simple-mde.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_textarea.scss +1 -1
- data/app/assets/stylesheets/fae/modules/tables/_filters.scss +4 -0
- data/app/assets/stylesheets/fae/pages/_home.scss +18 -0
- data/app/assets/stylesheets/fae/pages/_login.scss +4 -0
- data/app/controllers/fae/application_controller.rb +22 -1
- data/app/controllers/fae/base_controller.rb +6 -2
- data/app/controllers/fae/deploy_controller.rb +24 -0
- data/app/controllers/fae/deploy_hooks_controller.rb +71 -0
- data/app/controllers/fae/form_managers_controller.rb +19 -0
- data/app/controllers/fae/options_controller.rb +1 -0
- data/app/controllers/fae/pages_controller.rb +3 -2
- data/app/controllers/fae/static_pages_controller.rb +6 -1
- data/app/controllers/fae/users_controller.rb +19 -1
- data/app/controllers/fae/utilities_controller.rb +18 -6
- data/app/helpers/fae/application_helper.rb +27 -2
- data/app/helpers/fae/form_helper.rb +40 -8
- data/app/helpers/fae/nested_form_helper.rb +2 -2
- data/app/helpers/fae/view_helper.rb +99 -43
- data/app/models/concerns/fae/base_model_concern.rb +10 -7
- data/app/models/concerns/fae/user_concern.rb +10 -1
- data/app/models/fae/change.rb +18 -5
- data/app/models/fae/deploy_hook.rb +12 -0
- data/app/models/fae/file.rb +1 -1
- data/app/models/fae/form_manager.rb +24 -0
- data/app/models/fae/image.rb +1 -1
- data/app/models/fae/option.rb +1 -1
- data/app/models/fae/role.rb +1 -1
- data/app/models/fae/static_page.rb +11 -2
- data/app/models/fae/user.rb +4 -5
- data/app/services/fae/netlify_api.rb +197 -0
- data/app/uploaders/fae/file_uploader.rb +2 -5
- data/app/uploaders/fae/image_uploader.rb +3 -3
- data/app/views/devise/unlocks/new.html.slim +5 -9
- data/app/views/fae/application/_content_form.html.slim +16 -11
- data/app/views/fae/application/_file_uploader.html.slim +11 -3
- data/app/views/fae/application/_global_search_results.html.slim +2 -2
- data/app/views/fae/application/_header.slim +12 -9
- data/app/views/fae/application/_markdown_helper.slim +17 -17
- data/app/views/fae/application/_mobilenav.slim +9 -6
- data/app/views/fae/application/_user_log.html.slim +2 -2
- data/app/views/fae/deploy/index.html.slim +40 -0
- data/app/views/fae/deploy_hooks/_form.html.slim +18 -0
- data/app/views/fae/deploy_hooks/_table.html.slim +28 -0
- data/app/views/fae/deploy_hooks/edit.html.slim +3 -0
- data/app/views/fae/deploy_hooks/new.html.slim +3 -0
- data/app/views/fae/images/_image_uploader.html.slim +15 -6
- data/app/views/fae/options/_form.html.slim +11 -8
- data/app/views/fae/pages/activity_log.html.slim +16 -12
- data/app/views/fae/pages/disabled_environment.html.slim +2 -2
- data/app/views/fae/pages/error404.html.slim +5 -3
- data/app/views/fae/pages/home.html.slim +32 -21
- data/app/views/fae/setup/first_user.html.slim +3 -3
- data/app/views/fae/shared/_form_header.html.slim +37 -33
- data/app/views/fae/shared/_index_header.html.slim +3 -2
- data/app/views/fae/shared/_nested_table.html.slim +6 -6
- data/app/views/fae/shared/_recent_changes.html.slim +6 -6
- data/app/views/fae/shared/_shared_nested_table.html.slim +5 -2
- data/app/views/fae/static_pages/index.html.slim +2 -2
- data/app/views/fae/users/_form.html.slim +8 -12
- data/app/views/fae/users/index.html.slim +7 -7
- data/app/views/layouts/fae/application.html.slim +1 -0
- data/config/deploy.rb +3 -1
- data/config/initializers/devise.rb +6 -6
- data/config/locales/devise.cs.yml +59 -0
- data/config/locales/fae.cs.yml +125 -0
- data/config/locales/fae.en.yml +145 -0
- data/config/locales/fae.zh-CN.yml +109 -0
- data/config/routes.rb +9 -1
- data/db/migrate/20140809222030_add_user_table.rb +2 -2
- data/db/migrate/20140822224029_create_fae_roles.rb +1 -1
- data/db/migrate/20141008180718_create_fae_images_table.rb +1 -1
- data/db/migrate/20141017194616_create_fae_options.rb +1 -1
- data/db/migrate/20141021181327_create_fae_files.rb +1 -1
- data/db/migrate/20141021183047_create_fae_text_areas.rb +1 -1
- data/db/migrate/20141021184311_create_fae_pages.rb +1 -1
- data/db/migrate/20141105214814_create_fae_text_fields.rb +1 -1
- data/db/migrate/20150930224821_create_fae_changes.rb +1 -1
- data/db/migrate/20190925153222_create_fae_form_managers.rb +11 -0
- data/db/migrate/20220118192729_create_fae_publish_hooks.rb +10 -0
- data/db/migrate/20220128133730_rename_publish_hooks.rb +5 -0
- data/db/migrate/20220202153607_add_position_to_deploy_hooks.rb +6 -0
- data/lib/fae/options.rb +4 -2
- data/lib/fae/version.rb +1 -1
- data/lib/generators/fae/base_generator.rb +62 -8
- data/lib/generators/fae/nested_index_scaffold_generator.rb +1 -1
- data/lib/generators/fae/nested_scaffold_generator.rb +16 -2
- data/lib/generators/fae/page_generator.rb +8 -0
- data/lib/generators/fae/scaffold_generator.rb +1 -1
- data/lib/generators/fae/templates/assets/fae.js +1 -1
- data/lib/generators/fae/templates/controllers/nested_scaffold_controller.rb +14 -0
- data/lib/generators/fae/templates/graphql/graphql_page_type.rb +17 -0
- data/lib/generators/fae/templates/graphql/graphql_type.rb +13 -0
- data/lib/generators/fae/templates/initializers/fae.rb +16 -1
- data/lib/generators/fae/templates/views/_form.html.slim +11 -4
- data/lib/generators/fae/templates/views/_form_index_nested.html.slim +15 -1
- data/lib/generators/fae/templates/views/_form_nested.html.slim +19 -2
- data/lib/generators/fae/templates/views/index_nested.html.slim +1 -0
- data/lib/generators/fae/templates/views/static_page_form.html.slim +14 -3
- metadata +70 -47
- data/app/views/fae/shared/_form_buttons.html.slim +0 -11
- data/app/views/fae/shared/_nested_table_advanced.html.slim +0 -18
- data/lib/sub_test_task_patch.rb +0 -129
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateFaeFormManagers < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :fae_form_managers do |t|
|
4
|
+
t.string :form_manager_model_name, index: true
|
5
|
+
t.integer :form_manager_model_id, index: true
|
6
|
+
t.text :fields
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/fae/options.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'validation_helper_collection'
|
|
5
5
|
module Fae
|
6
6
|
# configurable defaults
|
7
7
|
class << self
|
8
|
-
mattr_accessor :devise_secret_key, :devise_mailer_sender, :dashboard_exclusions, :max_image_upload_size, :max_file_upload_size, :languages, :recreate_versions, :validation_helpers, :track_changes, :tracker_history_length, :slug_separator, :
|
8
|
+
mattr_accessor :devise_secret_key, :devise_mailer_sender, :dashboard_exclusions, :max_image_upload_size, :max_file_upload_size, :languages, :recreate_versions, :validation_helpers, :track_changes, :tracker_history_length, :slug_separator, :disabled_environments, :per_page, :use_cache, :use_form_manager, :netlify
|
9
9
|
|
10
10
|
self.devise_secret_key = ''
|
11
11
|
self.devise_mailer_sender = 'change-me@example.com'
|
@@ -21,6 +21,8 @@ module Fae
|
|
21
21
|
self.disabled_environments = []
|
22
22
|
self.per_page = 25
|
23
23
|
self.use_cache = false
|
24
|
+
self.use_form_manager = false
|
25
|
+
self.netlify = {}
|
24
26
|
end
|
25
27
|
|
26
28
|
# this function maps the vars from your app into your engine
|
@@ -32,4 +34,4 @@ module Fae
|
|
32
34
|
Devise.mailer_sender = Fae.devise_mailer_sender
|
33
35
|
Kaminari.config.default_per_page = Fae.per_page
|
34
36
|
end
|
35
|
-
end
|
37
|
+
end
|
data/lib/fae/version.rb
CHANGED
@@ -4,11 +4,13 @@ module Fae
|
|
4
4
|
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
|
5
5
|
class_option :namespace, type: :string, default: 'admin', desc: 'Sets the namespace of the generator'
|
6
6
|
class_option :template, type: :string, default: 'slim', desc: 'Sets the template engine of the generator'
|
7
|
+
class_option :polymorphic, type: :boolean, default: false, desc: 'Makes the model and scaffolding polymorphic. parent-model is ignored if passed.'
|
7
8
|
|
8
9
|
@@attributes_flat = []
|
9
10
|
@@attribute_names = []
|
10
11
|
@@association_names = []
|
11
12
|
@@attachments = []
|
13
|
+
@@graphql_attributes = []
|
12
14
|
@@has_position = false
|
13
15
|
@@display_field = ''
|
14
16
|
|
@@ -25,21 +27,28 @@ module Fae
|
|
25
27
|
if is_attachment(arg)
|
26
28
|
@@attachments << arg
|
27
29
|
else
|
28
|
-
@@attributes_flat << "#{arg.name}:#{arg.type}"
|
30
|
+
@@attributes_flat << "#{arg.name}:#{arg.type}" + (arg.has_index? ? ":index" : "")
|
29
31
|
end
|
30
32
|
|
31
|
-
if
|
32
|
-
@@
|
33
|
+
if options.polymorphic
|
34
|
+
@@attributes_flat << "#{polymorphic_name}:references{polymorphic}"
|
35
|
+
end
|
36
|
+
|
37
|
+
if is_association(arg)
|
38
|
+
@@association_names << arg.name.gsub(/_id$/, '')
|
33
39
|
elsif !is_attachment(arg)
|
34
40
|
@@attribute_names << arg.name
|
35
41
|
end
|
36
42
|
@@has_position = true if arg.name === 'position'
|
43
|
+
|
44
|
+
@@graphql_attributes << graphql_object(arg)
|
37
45
|
end
|
38
46
|
|
39
47
|
@@attributes_flat = @@attributes_flat.uniq.join(' ')
|
40
48
|
@@association_names.uniq!
|
41
49
|
@@attribute_names.uniq!
|
42
50
|
@@attachments.uniq!
|
51
|
+
@@graphql_attributes.uniq!
|
43
52
|
end
|
44
53
|
end
|
45
54
|
|
@@ -50,8 +59,9 @@ module Fae
|
|
50
59
|
def generate_model
|
51
60
|
generate "model #{file_name} #{@@attributes_flat}"
|
52
61
|
inject_concern
|
53
|
-
|
62
|
+
inject_display_field_to_model
|
54
63
|
inject_model_attachments
|
64
|
+
inject_position_scope
|
55
65
|
end
|
56
66
|
|
57
67
|
def generate_controller_file
|
@@ -66,6 +76,7 @@ module Fae
|
|
66
76
|
@attachments = @@attachments
|
67
77
|
@has_position = @@has_position
|
68
78
|
@display_field = @@display_field
|
79
|
+
@polymorphic_name = polymorphic_name
|
69
80
|
template "views/index.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/index.html.#{options.template}"
|
70
81
|
template "views/_form.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/_form.html.#{options.template}"
|
71
82
|
copy_file "views/new.html.#{options.template}", "app/views/#{options.namespace}/#{plural_file_name}/new.html.#{options.template}"
|
@@ -73,7 +84,7 @@ module Fae
|
|
73
84
|
end
|
74
85
|
|
75
86
|
def add_route
|
76
|
-
inject_into_file "config/routes.rb", after: "namespace :#{options.namespace} do\n" do <<-RUBY
|
87
|
+
inject_into_file "config/routes.rb", after: "namespace :#{options.namespace} do\n", force: true do <<-RUBY
|
77
88
|
resources :#{plural_file_name}
|
78
89
|
RUBY
|
79
90
|
end
|
@@ -105,9 +116,9 @@ RUBY
|
|
105
116
|
end
|
106
117
|
|
107
118
|
inject_into_file "app/models/#{file_name}.rb", after: "include Fae::BaseModelConcern\n" do <<-RUBY
|
108
|
-
|
119
|
+
def fae_display_field
|
109
120
|
#{@@display_field}
|
110
|
-
end
|
121
|
+
end
|
111
122
|
RUBY
|
112
123
|
end
|
113
124
|
|
@@ -117,7 +128,7 @@ RUBY
|
|
117
128
|
if @@has_position
|
118
129
|
inject_into_file "app/models/#{file_name}.rb", after: "include Fae::BaseModelConcern\n" do <<-RUBY
|
119
130
|
\n acts_as_list add_new_at: :top
|
120
|
-
default_scope { order(:position) }
|
131
|
+
default_scope { order(:position) }\n
|
121
132
|
RUBY
|
122
133
|
end
|
123
134
|
end
|
@@ -147,9 +158,52 @@ RUBY
|
|
147
158
|
inject_into_file 'app/models/concerns/fae/navigation_concern.rb', line, before: '# scaffold inject marker'
|
148
159
|
end
|
149
160
|
|
161
|
+
def graphql_object(arg)
|
162
|
+
if is_association(arg)
|
163
|
+
assoc_name = arg.name.gsub(/_id$/, '')
|
164
|
+
assoc_type = "Types::#{assoc_name.classify}Type"
|
165
|
+
{ attr: assoc_name.to_sym, type: assoc_type }
|
166
|
+
else
|
167
|
+
{ attr: arg.name.to_sym, type: graphql_type(arg.type) }
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def graphql_type(type)
|
172
|
+
case type.to_s
|
173
|
+
when 'integer'
|
174
|
+
'Integer'
|
175
|
+
when 'boolean'
|
176
|
+
'Boolean'
|
177
|
+
when 'image'
|
178
|
+
'Types::FaeImageType'
|
179
|
+
when 'file'
|
180
|
+
'Types::FaeFileType'
|
181
|
+
else
|
182
|
+
'String'
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def generate_graphql_type
|
187
|
+
return unless uses_graphql
|
188
|
+
@graphql_attributes = @@graphql_attributes
|
189
|
+
template "graphql/graphql_type.rb", "app/graphql/types/#{file_name}_type.rb"
|
190
|
+
end
|
191
|
+
|
192
|
+
def uses_graphql
|
193
|
+
defined?(GraphQL)
|
194
|
+
end
|
195
|
+
|
196
|
+
def is_association(arg)
|
197
|
+
arg.name.end_with?('_id') || arg.type.to_s == 'references'
|
198
|
+
end
|
199
|
+
|
150
200
|
def is_attachment(arg)
|
151
201
|
[:image,:file].include?(arg.type)
|
152
202
|
end
|
153
203
|
|
204
|
+
def polymorphic_name
|
205
|
+
"#{file_name.underscore}able"
|
206
|
+
end
|
207
|
+
|
154
208
|
end
|
155
209
|
end
|
@@ -6,6 +6,7 @@ module Fae
|
|
6
6
|
|
7
7
|
def go
|
8
8
|
generate_nested_model_file
|
9
|
+
generate_graphql_type
|
9
10
|
generate_nested_controller_file
|
10
11
|
generate_view_files
|
11
12
|
add_route
|
@@ -16,14 +17,16 @@ module Fae
|
|
16
17
|
def generate_nested_model_file
|
17
18
|
generate "model #{file_name} #{@@attributes_flat}"
|
18
19
|
inject_concern
|
19
|
-
inject_position_scope
|
20
|
-
inject_model_attachments
|
21
20
|
inject_display_field_to_model
|
21
|
+
inject_model_attachments
|
22
|
+
inject_position_scope
|
22
23
|
inject_parent_info if options.parent_model.present?
|
24
|
+
inject_polymorphic_info if options.polymorphic
|
23
25
|
end
|
24
26
|
|
25
27
|
def generate_nested_controller_file
|
26
28
|
@attachments = @@attachments
|
29
|
+
@polymorphic_name = polymorphic_name
|
27
30
|
template "controllers/nested_scaffold_controller.rb", "app/controllers/#{options.namespace}/#{file_name.pluralize}_controller.rb"
|
28
31
|
end
|
29
32
|
|
@@ -43,6 +46,17 @@ module Fae
|
|
43
46
|
def fae_nested_parent
|
44
47
|
:#{options.parent_model.underscore}
|
45
48
|
end
|
49
|
+
RUBY
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def inject_polymorphic_info
|
54
|
+
inject_into_file "app/models/#{file_name}.rb", after: "BaseModelConcern\n" do <<-RUBY
|
55
|
+
|
56
|
+
def fae_nested_parent
|
57
|
+
:#{polymorphic_name}
|
58
|
+
end
|
59
|
+
|
46
60
|
RUBY
|
47
61
|
end
|
48
62
|
end
|
@@ -11,6 +11,7 @@ module Fae
|
|
11
11
|
if attributes.present?
|
12
12
|
attributes.each do |attr|
|
13
13
|
@@attributes[attr.name.to_sym] = convert_attr_type(attr.type)
|
14
|
+
@@graphql_attributes << graphql_object(attr)
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -18,6 +19,7 @@ module Fae
|
|
18
19
|
def go
|
19
20
|
generate_static_page_controller
|
20
21
|
generate_static_page_model
|
22
|
+
generate_graphql_type
|
21
23
|
generate_static_page_view
|
22
24
|
end
|
23
25
|
|
@@ -37,6 +39,12 @@ module Fae
|
|
37
39
|
template "models/pages_model.rb", "app/models/#{file_name}_page.rb"
|
38
40
|
end
|
39
41
|
|
42
|
+
def generate_graphql_type
|
43
|
+
return unless uses_graphql
|
44
|
+
@graphql_attributes = @@graphql_attributes
|
45
|
+
template "graphql/graphql_page_type.rb", "app/graphql/types/#{file_name}_page_type.rb"
|
46
|
+
end
|
47
|
+
|
40
48
|
def generate_static_page_view
|
41
49
|
@attributes = @@attributes
|
42
50
|
template "views/static_page_form.html.#{options.template}", "app/views/#{options.namespace}/content_blocks/#{file_name}.html.#{options.template}"
|
@@ -1,5 +1,19 @@
|
|
1
1
|
module <%= options.namespace.capitalize %>
|
2
2
|
class <%= class_name.pluralize %>Controller < Fae::NestedBaseController
|
3
|
+
|
4
|
+
<% if options.polymorphic %>
|
5
|
+
def new
|
6
|
+
@item = @klass.new
|
7
|
+
raise_undefined_parent if @item.fae_nested_foreign_key.blank?
|
8
|
+
|
9
|
+
item_id = params[:item_id].to_i || nil
|
10
|
+
item_class = params[:item_class] || nil
|
11
|
+
@item.send("<%= @polymorphic_name %>_id=", item_id)
|
12
|
+
@item.send("<%= @polymorphic_name %>_type=", item_class)
|
13
|
+
build_assets
|
14
|
+
end
|
15
|
+
<% end %>
|
16
|
+
|
3
17
|
<% if @attachments.present? %>
|
4
18
|
private
|
5
19
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Types::<%= class_name %>PageType < Types::BaseObject
|
2
|
+
|
3
|
+
graphql_name '<%= class_name %>Page'
|
4
|
+
|
5
|
+
field :title, String, null: false
|
6
|
+
<% if @graphql_attributes.present? -%>
|
7
|
+
<% @graphql_attributes.each do |graphql_object| -%>
|
8
|
+
<% if graphql_object[:type]['Types::'] -%>
|
9
|
+
field :<%= graphql_object[:attr] %>, <%= graphql_object[:type] %>, null: true
|
10
|
+
<% else -%>
|
11
|
+
field :<%= graphql_object[:attr] %>, <%= graphql_object[:type] %>,
|
12
|
+
null: true,
|
13
|
+
method: :<%= graphql_object[:attr] %>_content
|
14
|
+
<% end -%>
|
15
|
+
<% end -%>
|
16
|
+
<% end -%>
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Types::<%= class_name %>Type < Types::BaseObject
|
2
|
+
|
3
|
+
graphql_name '<%= class_name %>'
|
4
|
+
|
5
|
+
field :id, ID, null: false
|
6
|
+
<% if @graphql_attributes.present? -%>
|
7
|
+
<% @graphql_attributes.each do |graphql_object| -%>
|
8
|
+
field :<%= graphql_object[:attr] %>, <%= graphql_object[:type] %>, null: true
|
9
|
+
<% end -%>
|
10
|
+
<% end -%>
|
11
|
+
field :created_at, String, null: false
|
12
|
+
field :updated_at, String, null: false
|
13
|
+
end
|
@@ -60,4 +60,19 @@ Fae.setup do |config|
|
|
60
60
|
# on the parent app
|
61
61
|
# Defaults to false
|
62
62
|
# config.use_cache = true
|
63
|
-
|
63
|
+
|
64
|
+
## use_form_manager
|
65
|
+
# Enable Manage Form buttons in form headers
|
66
|
+
# Defaults to false
|
67
|
+
# config.use_form_manager = true
|
68
|
+
|
69
|
+
## Netlify configs
|
70
|
+
# Environment variables are recommended for any sensitive Netlify configuration details.
|
71
|
+
# config.netlify = {
|
72
|
+
# api_user: 'netlify-api-user',
|
73
|
+
# api_token: 'netlify-api-token',
|
74
|
+
# site: 'site-name-in-netlify',
|
75
|
+
# site_id: 'site-id-in-netlify',
|
76
|
+
# api_base: 'https://api.netlify.com/api/v1/'
|
77
|
+
# }
|
78
|
+
end
|
@@ -1,7 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
ruby:
|
2
|
+
form_options = {
|
3
|
+
html: {
|
4
|
+
data: {
|
5
|
+
form_manager_model: @item.fae_form_manager_model_name,
|
6
|
+
form_manager_info: (@form_manager.present? ? @form_manager.to_json : nil)
|
7
|
+
}
|
8
|
+
}
|
9
|
+
}
|
10
|
+
= simple_form_for([:admin, @item], form_options) do |f|
|
11
|
+
== render 'fae/shared/form_header', header: @klass_name
|
5
12
|
|
6
13
|
main.content
|
7
14
|
<% @form_attrs.each do |attr| -%>
|
@@ -1,4 +1,18 @@
|
|
1
|
-
|
1
|
+
ruby:
|
2
|
+
form_options = {
|
3
|
+
html: {
|
4
|
+
multipart: true,
|
5
|
+
novalidate: true,
|
6
|
+
class: 'js-file-form',
|
7
|
+
remote: true,
|
8
|
+
data: {
|
9
|
+
type: "html",
|
10
|
+
form_manager_model: @item.fae_form_manager_model_name,
|
11
|
+
form_manager_info: (@form_manager.present? ? @form_manager.to_json : nil)
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
= simple_form_for(['<%= options.namespace %>', @item], form_options) do |f|
|
2
16
|
<% @form_attrs.each do |attr| -%>
|
3
17
|
= fae_input f, :<%= attr %>
|
4
18
|
<% end -%>
|
@@ -1,4 +1,18 @@
|
|
1
|
-
|
1
|
+
ruby:
|
2
|
+
form_options = {
|
3
|
+
html: {
|
4
|
+
multipart: true,
|
5
|
+
novalidate: true,
|
6
|
+
class: 'js-file-form',
|
7
|
+
remote: true,
|
8
|
+
data: {
|
9
|
+
type: "html",
|
10
|
+
form_manager_model: @item.fae_form_manager_model_name,
|
11
|
+
form_manager_info: (@form_manager.present? ? @form_manager.to_json : nil)
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
= simple_form_for([:admin, @item], form_options) do |f|
|
2
16
|
<% @form_attrs.each do |attr| -%>
|
3
17
|
= fae_input f, :<%= attr %>
|
4
18
|
<% end -%>
|
@@ -9,7 +23,10 @@
|
|
9
23
|
= fae_file_form f, :<%= attachment.name -%>
|
10
24
|
<% end -%>
|
11
25
|
<% end -%>
|
12
|
-
<% if options.
|
26
|
+
<% if options.polymorphic %>
|
27
|
+
= f.hidden_field :<%= @polymorphic_name %>_id
|
28
|
+
= f.hidden_field :<%= @polymorphic_name %>_type
|
29
|
+
<% elsif options.parent_model.present? %>
|
13
30
|
= f.hidden_field :<%= options.parent_model.underscore %>_id
|
14
31
|
<% end -%>
|
15
32
|
|
@@ -1,6 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
ruby:
|
2
|
+
form_options = {
|
3
|
+
url: fae.update_content_block_path(slug: @item.slug),
|
4
|
+
method: :put,
|
5
|
+
html: {
|
6
|
+
data: {
|
7
|
+
form_manager_model: @item.fae_form_manager_model_name,
|
8
|
+
form_manager_model_id: @item.fae_form_manager_model_id,
|
9
|
+
form_manager_info: (@form_manager.present? ? @form_manager.to_json : nil)
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
= simple_form_for @item, form_options do |f|
|
14
|
+
== render 'fae/shared/form_header', header: @item
|
4
15
|
|
5
16
|
main.content
|
6
17
|
= fae_input f, :title
|