effective_developer 0.6.13 → 0.6.15
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/lib/effective_developer/version.rb +1 -1
- data/lib/generators/effective/controller_generator.rb +6 -1
- data/lib/generators/effective/datatable_generator.rb +8 -1
- data/lib/generators/effective/form_generator.rb +10 -13
- data/lib/generators/effective/helpers.rb +30 -0
- data/lib/generators/effective/model_generator.rb +2 -2
- data/lib/generators/effective/views_generator.rb +10 -1
- data/lib/scaffolds/admin_effective/controllers/controller.rb +15 -0
- data/lib/scaffolds/admin_effective/datatables/datatable.rb +30 -0
- data/lib/scaffolds/{importers → admin_effective/importers}/csv_importer.rb +0 -0
- data/lib/scaffolds/{models → admin_effective/models}/model.rb +0 -0
- data/lib/scaffolds/admin_effective/views/_form.html.haml +15 -0
- data/lib/scaffolds/admin_effective/views/_form_resource.html.haml +13 -0
- data/lib/scaffolds/admin_effective/views/_resource.html.haml +1 -0
- data/lib/scaffolds/{controllers → basic/controllers}/controller.rb +0 -0
- data/lib/scaffolds/{datatables → basic/datatables}/datatable.rb +0 -0
- data/lib/scaffolds/basic/importers/csv_importer.rb +14 -0
- data/lib/scaffolds/basic/models/model.rb +30 -0
- data/lib/scaffolds/basic/views/_form.html.haml +15 -0
- data/lib/scaffolds/{forms/tabbed → basic/views}/_form_resource.html.haml +0 -0
- data/lib/scaffolds/{views → basic/views}/_resource.html.haml +0 -0
- data/lib/scaffolds/effective/controllers/controller.rb +15 -0
- data/lib/scaffolds/effective/datatables/datatable.rb +28 -0
- data/lib/scaffolds/effective/importers/csv_importer.rb +14 -0
- data/lib/scaffolds/effective/models/model.rb +30 -0
- data/lib/scaffolds/{forms/tabbed → effective/views}/_form.html.haml +0 -0
- data/lib/scaffolds/effective/views/_form_resource.html.haml +13 -0
- data/lib/scaffolds/effective/views/_layout.html.haml +2 -0
- data/lib/scaffolds/effective/views/_resource.html.haml +13 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_belongs_to.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_boolean.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_date.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_datetime.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_decimal.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_email.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_float.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_hstore.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_inet.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_integer.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_nested_resource.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_phone.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_price.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_select.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_select_constant.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_string.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_field_text.html.haml +0 -0
- data/lib/scaffolds/{forms/fields → fields}/_nested_resource_fields.html.haml +0 -0
- data/lib/tasks/pg_pull.rake +8 -4
- metadata +42 -28
- data/lib/scaffolds/forms/flat/_form.html.haml +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bb9fc81f4fa250e8837722612ae2c349b863b57fb07e01e6f05bfddd4845a6f6
|
|
4
|
+
data.tar.gz: 8c41521fa64be2d74b8179628c84d9071c7610b0ab64646d2916eb29794711af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50c82d38e666ecb1c6b4237e543a7c27471cbfc828f049deb09563141d99014a84384a0803901b777e8e27e5a27ffe7a8d69c102b0390c373e7b4d5409890d4e
|
|
7
|
+
data.tar.gz: a072c91f4c049b98763f426380eee988496c829796f2e1ed6e5937de9b2019f414fa07f4076349fd6f7e392d9b74f120788c5fe0a5a6b5b6fea8ae41af8e1d58
|
|
@@ -35,7 +35,12 @@ module Effective
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def create_controller
|
|
38
|
-
|
|
38
|
+
if admin_effective_scaffold?
|
|
39
|
+
template "#{scaffold_path}/controllers/controller.rb", resource.admin_effective_controller_file
|
|
40
|
+
else
|
|
41
|
+
template "#{scaffold_path}/controllers/controller.rb", resource.controller_file
|
|
42
|
+
end
|
|
43
|
+
|
|
39
44
|
end
|
|
40
45
|
|
|
41
46
|
end
|
|
@@ -37,7 +37,14 @@ module Effective
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
with_resource_tenant do
|
|
40
|
-
|
|
40
|
+
if admin_effective_scaffold?
|
|
41
|
+
template "#{scaffold_path}/datatables/datatable.rb", resource.admin_effective_datatable_file
|
|
42
|
+
elsif effective_scaffold?
|
|
43
|
+
template "#{scaffold_path}/datatables/datatable.rb", resource.effective_datatable_file
|
|
44
|
+
else
|
|
45
|
+
template "#{scaffold_path}/datatables/datatable.rb", resource.datatable_file
|
|
46
|
+
end
|
|
47
|
+
|
|
41
48
|
end
|
|
42
49
|
|
|
43
50
|
end
|
|
@@ -18,7 +18,6 @@ module Effective
|
|
|
18
18
|
desc 'Creates a _form.html.haml in your app/views/model/ folder.'
|
|
19
19
|
|
|
20
20
|
argument :attributes, type: :array, default: [], banner: 'field[:type] field[:type]'
|
|
21
|
-
class_option :tabbed, type: :string, default: 'true'
|
|
22
21
|
|
|
23
22
|
def validate_resource
|
|
24
23
|
exit unless resource_valid?
|
|
@@ -33,20 +32,18 @@ module Effective
|
|
|
33
32
|
say_status :invoke, :form, :white
|
|
34
33
|
end
|
|
35
34
|
|
|
36
|
-
def
|
|
35
|
+
def create_form
|
|
37
36
|
with_resource_tenant do
|
|
38
|
-
if
|
|
39
|
-
template
|
|
37
|
+
if admin_effective_scaffold?
|
|
38
|
+
template "#{scaffold_path}/views/_form.html.haml", resource.admin_effective_view_file('form', partial: true)
|
|
39
|
+
template "#{scaffold_path}/views/_form_resource.html.haml", resource.admin_effective_view_file("form_#{resource.name}", partial: true)
|
|
40
|
+
elsif effective_scaffold?
|
|
41
|
+
template "#{scaffold_path}/views/_form_resource.html.haml", resource.view_file("form", partial: true)
|
|
42
|
+
else
|
|
43
|
+
template "#{scaffold_path}/views/_form.html.haml", resource.view_file('form', partial: true)
|
|
44
|
+
template "#{scaffold_path}/views/_form_resource.html.haml", resource.view_file("form_#{resource.name}", partial: true)
|
|
40
45
|
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
46
|
|
|
44
|
-
def create_tabbed_form
|
|
45
|
-
with_resource_tenant do
|
|
46
|
-
if options[:tabbed] == 'true'
|
|
47
|
-
template 'forms/tabbed/_form.html.haml', resource.view_file('form', partial: true)
|
|
48
|
-
template 'forms/tabbed/_form_resource.html.haml', resource.view_file("form_#{resource.name}", partial: true)
|
|
49
|
-
end
|
|
50
47
|
end
|
|
51
48
|
end
|
|
52
49
|
|
|
@@ -103,7 +100,7 @@ module Effective
|
|
|
103
100
|
end
|
|
104
101
|
|
|
105
102
|
html = ERB.new(
|
|
106
|
-
File.read("#{File.dirname(__FILE__)}/../../scaffolds/
|
|
103
|
+
File.read("#{File.dirname(__FILE__)}/../../scaffolds/fields/_field_#{partial}.html.haml")
|
|
107
104
|
).result(b).split("\n").map { |line| (' ' * depth) + line }
|
|
108
105
|
|
|
109
106
|
html.length > 1 ? (html.join("\n") + "\n") : html.join
|
|
@@ -4,6 +4,36 @@ module Effective
|
|
|
4
4
|
|
|
5
5
|
protected
|
|
6
6
|
|
|
7
|
+
# Based on the resource, effective or basic
|
|
8
|
+
def scaffold_path
|
|
9
|
+
return 'admin_effective' if admin_effective_scaffold?
|
|
10
|
+
return 'effective' if effective_scaffold?
|
|
11
|
+
'basic'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def admin_scaffold?
|
|
15
|
+
Array(resource.namespaces).include?('admin')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def admin_effective_scaffold?
|
|
19
|
+
admin_scaffold? && effective_scaffold?
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def basic_scaffold?
|
|
23
|
+
resource.klass.name.start_with?('Effective::') == false
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def effective_scaffold?
|
|
27
|
+
resource.klass.name.start_with?('Effective::')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns effective_messaging if run from that directory to scaffold
|
|
31
|
+
def effective_gem_name
|
|
32
|
+
path = Dir.pwd.split('/').last.to_s
|
|
33
|
+
raise('effective gem name not supported') unless path.start_with?('effective_')
|
|
34
|
+
path
|
|
35
|
+
end
|
|
36
|
+
|
|
7
37
|
# This is kind of a validate for the resource
|
|
8
38
|
def resource_valid?
|
|
9
39
|
if resource.klass.blank?
|
|
@@ -20,13 +20,13 @@ module Effective
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def create_model
|
|
23
|
-
template
|
|
23
|
+
template "#{scaffold_path}/models/model.rb", resource.model_file
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
protected
|
|
27
27
|
|
|
28
28
|
def parent_class_name
|
|
29
|
-
options[:parent] ||
|
|
29
|
+
options[:parent] || 'ApplicationRecord'
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def to_s_attribute
|
|
@@ -31,8 +31,17 @@ module Effective
|
|
|
31
31
|
|
|
32
32
|
def create_views
|
|
33
33
|
if invoked_actions.include?('show') || non_crud_actions.present?
|
|
34
|
-
|
|
34
|
+
if admin_effective_scaffold?
|
|
35
|
+
template "#{scaffold_path}/views/_resource.html.haml", resource.admin_effective_view_file(resource.name, partial: true)
|
|
36
|
+
else
|
|
37
|
+
template "#{scaffold_path}/views/_resource.html.haml", resource.view_file(resource.name, partial: true)
|
|
38
|
+
end
|
|
35
39
|
end
|
|
40
|
+
|
|
41
|
+
if effective_scaffold?
|
|
42
|
+
template "#{scaffold_path}/views/_layout.html.haml", resource.view_file('layout', partial: true)
|
|
43
|
+
end
|
|
44
|
+
|
|
36
45
|
end
|
|
37
46
|
|
|
38
47
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class <%= resource.class_name.sub('Effective::', '') %>Controller < ApplicationController
|
|
3
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
4
|
+
before_action { EffectiveResources.authorize!(self, :admin, :<%= effective_gem_name %>) }
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
def permitted_params
|
|
11
|
+
params.require(:<%= resource.resource_name %>).permit!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Admin
|
|
2
|
+
class Effective<%= resource.class_name.sub('Effective::', '') %>sDatatable < Effective::Datatable
|
|
3
|
+
datatable do
|
|
4
|
+
order :updated_at
|
|
5
|
+
|
|
6
|
+
col :updated_at, visible: false
|
|
7
|
+
col :created_at, visible: false
|
|
8
|
+
col :id, visible: false
|
|
9
|
+
|
|
10
|
+
<% if resource.belong_tos.present? || resource.has_anys.present? -%>
|
|
11
|
+
<% resource.belong_tos.each do |reference| -%>
|
|
12
|
+
col :<%= reference.name %>
|
|
13
|
+
<% end -%>
|
|
14
|
+
<% resource.has_anys.each do |reference| -%>
|
|
15
|
+
col :<%= reference.name %>
|
|
16
|
+
<% end -%>
|
|
17
|
+
|
|
18
|
+
<% end -%>
|
|
19
|
+
<% attributes.except(:created_at, :updated_at, :id).each do |name, _| -%>
|
|
20
|
+
col :<%= name %>
|
|
21
|
+
<% end -%>
|
|
22
|
+
|
|
23
|
+
actions_col
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
collection do
|
|
27
|
+
<%= resource.class_name %>.deep.all
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
= tabs do
|
|
2
|
+
= tab '<%= resource.human_name.titleize %>' do
|
|
3
|
+
= render '<%= resource.view_file_path("form_#{resource.name}").sub('effective/', '') %>', <%= resource.name %>: <%= resource.name %>
|
|
4
|
+
|
|
5
|
+
<%- if resource.nested_resources.present? || resource.instance.respond_to?(:log_changes_datatable) %>
|
|
6
|
+
- if <%= resource.name %>.persisted?
|
|
7
|
+
<%- resource.nested_resources.each do |nested_resource| -%>
|
|
8
|
+
= tab '<%= nested_resource.plural_name.titleize %>' do
|
|
9
|
+
= render_datatable(<%= nested_resource.klass.name %>Datatable.new(<%= resource.name %>_id: <%= resource.name %>.id))
|
|
10
|
+
|
|
11
|
+
<%- end -%>
|
|
12
|
+
<% end -%>
|
|
13
|
+
- if <%= resource.name %>.persisted? && <%= resource.name %>.respond_to?(:log_changes_datatable)
|
|
14
|
+
= tab 'Logs' do
|
|
15
|
+
= render_datatable(<%= resource.name %>.log_changes_datatable)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% if resource.namespace.present? -%>
|
|
2
|
+
= effective_form_with(model: [:<%= resource.namespace %>, <%= resource.name %>], engine: true) do |f|
|
|
3
|
+
<% else -%>
|
|
4
|
+
= effective_form_with(model: <%= resource.name %>, engine: true) do |f|
|
|
5
|
+
<% end -%>
|
|
6
|
+
<% resource.belong_tos.each do |reference| -%>
|
|
7
|
+
<%= render_field(reference, depth: 1) %>
|
|
8
|
+
<% end -%>
|
|
9
|
+
<% attributes.each do |attribute| -%>
|
|
10
|
+
<%= render_field(attribute, depth: 1) %>
|
|
11
|
+
<% end -%>
|
|
12
|
+
|
|
13
|
+
= effective_submit(f)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'effective/<%= resource.plural_name %>/<%= resource.name %>', <%= resource.name %>: <%= resource.name %>, admin: true
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module CsvImporters
|
|
2
|
+
class <%= klass %>Importer < Effective::CsvImporter
|
|
3
|
+
def columns
|
|
4
|
+
{<% columns.each_with_index do |column, index| %>
|
|
5
|
+
<%= column.to_s.underscore.tap { |name| [' ', '/', '(', ')', '__'].each { |str| name.gsub!(str, '_') } }.to_sym %>: <%= (letters[index] || index) %><%= ',' unless (index+1) == columns.length %><% end %>
|
|
6
|
+
}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def process_row
|
|
10
|
+
# assign_columns(<%= klass.singularize %>.new).save!
|
|
11
|
+
raise 'todo'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<% module_namespacing do -%>
|
|
2
|
+
class <%= resource.class_name %> < <%= parent_class_name.classify %>
|
|
3
|
+
<% resource.belong_tos.each do || ass -%>
|
|
4
|
+
belongs_to :<%= ass.name %><%= ', polymorphic: true' if ass.polymorphic? %>
|
|
5
|
+
<% end -%>
|
|
6
|
+
|
|
7
|
+
effective_resource do
|
|
8
|
+
<% invoked_attributes.each do |name, (type, _)| -%>
|
|
9
|
+
<%= name.to_s.ljust(max_attribute_name_length) %> :<%= type %>
|
|
10
|
+
<% end -%>
|
|
11
|
+
|
|
12
|
+
timestamps
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
scope :deep, -> { all }
|
|
16
|
+
|
|
17
|
+
<% invoked_attributes.each do |name, (type, _)| -%>
|
|
18
|
+
validates :<%= name %>, presence: true
|
|
19
|
+
<% end -%>
|
|
20
|
+
|
|
21
|
+
def to_s
|
|
22
|
+
<% if to_s_attribute.present? -%>
|
|
23
|
+
<%= to_s_attribute %> || 'New <%= resource.human_name %>'
|
|
24
|
+
<% else %>
|
|
25
|
+
'<%= resource.human_name %>'
|
|
26
|
+
<% end -%>
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
<% end -%>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
= tabs do
|
|
2
|
+
= tab '<%= resource.human_name.titleize %>' do
|
|
3
|
+
= render '<%= resource.view_file_path("form_#{resource.name}") %>', <%= resource.name %>: <%= resource.name %>
|
|
4
|
+
|
|
5
|
+
<%- if resource.nested_resources.present? %>
|
|
6
|
+
- if <%= resource.name %>.persisted?
|
|
7
|
+
<%- resource.nested_resources.each do |nested_resource| -%>
|
|
8
|
+
= tab '<%= nested_resource.plural_name.titleize %>' do
|
|
9
|
+
= render_datatable(<%= nested_resource.klass.name %>Datatable.new(<%= resource.name %>_id: <%= resource.name %>.id))
|
|
10
|
+
|
|
11
|
+
<%- end -%>
|
|
12
|
+
<% end -%>
|
|
13
|
+
- if <%= resource.name %>.persisted? && <%= resource.name %>.respond_to?(:logs_datatable)
|
|
14
|
+
= tab 'Logs' do
|
|
15
|
+
= render_datatable(<%= resource.name %>.logs_datatable, inline: true)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% if resource.module_name.present? -%>
|
|
2
|
+
module <%= resource.module_name %>
|
|
3
|
+
class <%= resource.module_namespaced %>Controller < <%= resource.module_namespace %>ApplicationController
|
|
4
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
5
|
+
|
|
6
|
+
include Effective::CrudController
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
<% else -%>
|
|
10
|
+
class <%= resource.namespaced_class_name.pluralize %>Controller < <%= resource.module_namespace %>ApplicationController
|
|
11
|
+
before_action(:authenticate_user!) if defined?(Devise)
|
|
12
|
+
|
|
13
|
+
include Effective::CrudController
|
|
14
|
+
end
|
|
15
|
+
<% end -%>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class <%= resource.module_name %><%= resource.module_namespaced %>Datatable < Effective::Datatable
|
|
2
|
+
datatable do
|
|
3
|
+
order :updated_at
|
|
4
|
+
|
|
5
|
+
col :updated_at, visible: false
|
|
6
|
+
col :created_at, visible: false
|
|
7
|
+
col :id, visible: false
|
|
8
|
+
|
|
9
|
+
<% if resource.belong_tos.present? || resource.has_anys.present? -%>
|
|
10
|
+
<% resource.belong_tos.each do |reference| -%>
|
|
11
|
+
col :<%= reference.name %>
|
|
12
|
+
<% end -%>
|
|
13
|
+
<% resource.has_anys.each do |reference| -%>
|
|
14
|
+
col :<%= reference.name %>
|
|
15
|
+
<% end -%>
|
|
16
|
+
|
|
17
|
+
<% end -%>
|
|
18
|
+
<% attributes.except(:created_at, :updated_at, :id).each do |name, _| -%>
|
|
19
|
+
col :<%= name %>
|
|
20
|
+
<% end -%>
|
|
21
|
+
|
|
22
|
+
actions_col
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
collection do
|
|
26
|
+
<%= resource.class_name %>.deep.all
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module CsvImporters
|
|
2
|
+
class <%= klass %>Importer < Effective::CsvImporter
|
|
3
|
+
def columns
|
|
4
|
+
{<% columns.each_with_index do |column, index| %>
|
|
5
|
+
<%= column.to_s.underscore.tap { |name| [' ', '/', '(', ')', '__'].each { |str| name.gsub!(str, '_') } }.to_sym %>: <%= (letters[index] || index) %><%= ',' unless (index+1) == columns.length %><% end %>
|
|
6
|
+
}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def process_row
|
|
10
|
+
# assign_columns(<%= klass.singularize %>.new).save!
|
|
11
|
+
raise 'todo'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<% module_namespacing do -%>
|
|
2
|
+
class <%= resource.class_name %> < <%= parent_class_name.classify %>
|
|
3
|
+
<% resource.belong_tos.each do || ass -%>
|
|
4
|
+
belongs_to :<%= ass.name %><%= ', polymorphic: true' if ass.polymorphic? %>
|
|
5
|
+
<% end -%>
|
|
6
|
+
|
|
7
|
+
effective_resource do
|
|
8
|
+
<% invoked_attributes.each do |name, (type, _)| -%>
|
|
9
|
+
<%= name.to_s.ljust(max_attribute_name_length) %> :<%= type %>
|
|
10
|
+
<% end -%>
|
|
11
|
+
|
|
12
|
+
timestamps
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
scope :deep, -> { all }
|
|
16
|
+
|
|
17
|
+
<% invoked_attributes.each do |name, (type, _)| -%>
|
|
18
|
+
validates :<%= name %>, presence: true
|
|
19
|
+
<% end -%>
|
|
20
|
+
|
|
21
|
+
def to_s
|
|
22
|
+
<% if to_s_attribute.present? -%>
|
|
23
|
+
<%= to_s_attribute %> || 'New <%= resource.human_name %>'
|
|
24
|
+
<% else %>
|
|
25
|
+
'<%= resource.human_name %>'
|
|
26
|
+
<% end -%>
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
<% end -%>
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% if resource.namespace.present? -%>
|
|
2
|
+
= effective_form_with(model: [:<%= resource.namespace %>, <%= resource.name %>], engine: true) do |f|
|
|
3
|
+
<% else -%>
|
|
4
|
+
= effective_form_with(model: <%= resource.name %>, engine: true) do |f|
|
|
5
|
+
<% end -%>
|
|
6
|
+
<% resource.belong_tos.each do |reference| -%>
|
|
7
|
+
<%= render_field(reference, depth: 1) %>
|
|
8
|
+
<% end -%>
|
|
9
|
+
<% attributes.each do |attribute| -%>
|
|
10
|
+
<%= render_field(attribute, depth: 1) %>
|
|
11
|
+
<% end -%>
|
|
12
|
+
|
|
13
|
+
= effective_submit(f)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
= render 'effective/<%= resource.plural_name %>/layout' do
|
|
2
|
+
%table.table
|
|
3
|
+
%tbody
|
|
4
|
+
<% resource.belong_tos.each do |reference| -%>
|
|
5
|
+
%tr
|
|
6
|
+
%th <%= reference.name.to_s.titleize %>
|
|
7
|
+
%td= <%= resource.name %>.<%= reference.name %>
|
|
8
|
+
<% end -%>
|
|
9
|
+
<% attributes.each do |name, (type, _)| -%>
|
|
10
|
+
%tr
|
|
11
|
+
%th <%= name.to_s.titleize %>
|
|
12
|
+
%td= <%= resource.name %>.<%= name %>
|
|
13
|
+
<% end -%>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/tasks/pg_pull.rake
CHANGED
|
@@ -130,10 +130,12 @@ namespace :pg do
|
|
|
130
130
|
|
|
131
131
|
puts "=== Loading #{args.filename} into local '#{db[:database]}' database"
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
command = "export PGPASSWORD=#{db[:password]}; pg_restore --no-acl --no-owner --clean --if-exists -h #{db[:host]} -U #{db[:username]} -d #{db[:database]} #{args.filename}"
|
|
134
|
+
|
|
135
|
+
if system(command)
|
|
136
|
+
puts "\nLoading database completed"
|
|
135
137
|
else
|
|
136
|
-
abort "
|
|
138
|
+
abort "\nLoading database completed with errors. It probably worked just fine."
|
|
137
139
|
end
|
|
138
140
|
end
|
|
139
141
|
|
|
@@ -183,7 +185,9 @@ namespace :pg do
|
|
|
183
185
|
|
|
184
186
|
exclude_table_data = "--exclude-table-data=logs" unless (args.logs == 'true')
|
|
185
187
|
|
|
186
|
-
|
|
188
|
+
command = "export PGPASSWORD=#{db[:password]}; pg_dump -Fc --no-acl --no-owner #{exclude_table_data} -h #{db[:host]} -p #{db[:port]} -U #{db[:username]} #{db[:database]} > #{args.filename}"
|
|
189
|
+
|
|
190
|
+
if system(command)
|
|
187
191
|
puts "Saving database completed"
|
|
188
192
|
else
|
|
189
193
|
abort "Error saving database"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_developer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-02-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -71,32 +71,46 @@ files:
|
|
|
71
71
|
- lib/generators/effective/scaffold_generator.rb
|
|
72
72
|
- lib/generators/effective/views_generator.rb
|
|
73
73
|
- lib/generators/effective_developer/install_generator.rb
|
|
74
|
-
- lib/scaffolds/controllers/controller.rb
|
|
75
|
-
- lib/scaffolds/datatables/datatable.rb
|
|
76
|
-
- lib/scaffolds/
|
|
77
|
-
- lib/scaffolds/
|
|
78
|
-
- lib/scaffolds/
|
|
79
|
-
- lib/scaffolds/
|
|
80
|
-
- lib/scaffolds/
|
|
81
|
-
- lib/scaffolds/
|
|
82
|
-
- lib/scaffolds/
|
|
83
|
-
- lib/scaffolds/
|
|
84
|
-
- lib/scaffolds/
|
|
85
|
-
- lib/scaffolds/
|
|
86
|
-
- lib/scaffolds/
|
|
87
|
-
- lib/scaffolds/
|
|
88
|
-
- lib/scaffolds/
|
|
89
|
-
- lib/scaffolds/
|
|
90
|
-
- lib/scaffolds/
|
|
91
|
-
- lib/scaffolds/
|
|
92
|
-
- lib/scaffolds/
|
|
93
|
-
- lib/scaffolds/
|
|
94
|
-
- lib/scaffolds/
|
|
95
|
-
- lib/scaffolds/
|
|
96
|
-
- lib/scaffolds/
|
|
97
|
-
- lib/scaffolds/
|
|
98
|
-
- lib/scaffolds/
|
|
99
|
-
- lib/scaffolds/
|
|
74
|
+
- lib/scaffolds/admin_effective/controllers/controller.rb
|
|
75
|
+
- lib/scaffolds/admin_effective/datatables/datatable.rb
|
|
76
|
+
- lib/scaffolds/admin_effective/importers/csv_importer.rb
|
|
77
|
+
- lib/scaffolds/admin_effective/models/model.rb
|
|
78
|
+
- lib/scaffolds/admin_effective/views/_form.html.haml
|
|
79
|
+
- lib/scaffolds/admin_effective/views/_form_resource.html.haml
|
|
80
|
+
- lib/scaffolds/admin_effective/views/_resource.html.haml
|
|
81
|
+
- lib/scaffolds/basic/controllers/controller.rb
|
|
82
|
+
- lib/scaffolds/basic/datatables/datatable.rb
|
|
83
|
+
- lib/scaffolds/basic/importers/csv_importer.rb
|
|
84
|
+
- lib/scaffolds/basic/models/model.rb
|
|
85
|
+
- lib/scaffolds/basic/views/_form.html.haml
|
|
86
|
+
- lib/scaffolds/basic/views/_form_resource.html.haml
|
|
87
|
+
- lib/scaffolds/basic/views/_resource.html.haml
|
|
88
|
+
- lib/scaffolds/effective/controllers/controller.rb
|
|
89
|
+
- lib/scaffolds/effective/datatables/datatable.rb
|
|
90
|
+
- lib/scaffolds/effective/importers/csv_importer.rb
|
|
91
|
+
- lib/scaffolds/effective/models/model.rb
|
|
92
|
+
- lib/scaffolds/effective/views/_form.html.haml
|
|
93
|
+
- lib/scaffolds/effective/views/_form_resource.html.haml
|
|
94
|
+
- lib/scaffolds/effective/views/_layout.html.haml
|
|
95
|
+
- lib/scaffolds/effective/views/_resource.html.haml
|
|
96
|
+
- lib/scaffolds/fields/_field_belongs_to.html.haml
|
|
97
|
+
- lib/scaffolds/fields/_field_boolean.html.haml
|
|
98
|
+
- lib/scaffolds/fields/_field_date.html.haml
|
|
99
|
+
- lib/scaffolds/fields/_field_datetime.html.haml
|
|
100
|
+
- lib/scaffolds/fields/_field_decimal.html.haml
|
|
101
|
+
- lib/scaffolds/fields/_field_email.html.haml
|
|
102
|
+
- lib/scaffolds/fields/_field_float.html.haml
|
|
103
|
+
- lib/scaffolds/fields/_field_hstore.html.haml
|
|
104
|
+
- lib/scaffolds/fields/_field_inet.html.haml
|
|
105
|
+
- lib/scaffolds/fields/_field_integer.html.haml
|
|
106
|
+
- lib/scaffolds/fields/_field_nested_resource.html.haml
|
|
107
|
+
- lib/scaffolds/fields/_field_phone.html.haml
|
|
108
|
+
- lib/scaffolds/fields/_field_price.html.haml
|
|
109
|
+
- lib/scaffolds/fields/_field_select.html.haml
|
|
110
|
+
- lib/scaffolds/fields/_field_select_constant.html.haml
|
|
111
|
+
- lib/scaffolds/fields/_field_string.html.haml
|
|
112
|
+
- lib/scaffolds/fields/_field_text.html.haml
|
|
113
|
+
- lib/scaffolds/fields/_nested_resource_fields.html.haml
|
|
100
114
|
- lib/tasks/annotate.rake
|
|
101
115
|
- lib/tasks/effective_csv_importer.rake
|
|
102
116
|
- lib/tasks/hatchbox.rake
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
= effective_form_with(model: <%= form_for %>) do |f|
|
|
2
|
-
<% resource.belong_tos.each do |reference| -%>
|
|
3
|
-
<%= render_field(reference, depth: 1) %>
|
|
4
|
-
<% end -%>
|
|
5
|
-
<% attributes.each do |attribute| -%>
|
|
6
|
-
<%= render_field(attribute, depth: 1) %>
|
|
7
|
-
<% end -%>
|
|
8
|
-
|
|
9
|
-
= effective_submit(f)
|