effective_developer 0.2.4 → 0.2.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/lib/effective_developer/version.rb +1 -1
- data/lib/generators/effective/datatable_generator.rb +1 -1
- data/lib/generators/effective/helpers.rb +3 -3
- data/lib/scaffolds/datatables/datatable.rb +15 -15
- data/lib/scaffolds/forms/fields/_field_inet.html.haml +1 -0
- data/lib/scaffolds/forms/tabpanel/_form.html.haml +3 -0
- data/lib/scaffolds/views/index.html.haml +2 -1
- data/lib/tasks/pg_pull.rake +5 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb87b48c7333c45473a85cf18fcc9e131e9b72b1
|
4
|
+
data.tar.gz: 90c2899c904190613ae1910ad569b381b05a1529
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f896654a9311c5cedb83cb921061a615d754ff739bf6a07527bd512d5979c87b1cf8ce9e0df3243759ddc9527b9c6e24ca080e491a84d1762ce8c714bc39cba
|
7
|
+
data.tar.gz: 5b9132b98cbb27b1a6439ba0dbb2036190b0833e616dc865e345fb919031577d080d0978b022cfb02859f24df4b8e44b2c727ab56b2e221b94b74f8efde6c292
|
@@ -19,7 +19,7 @@ module Effective
|
|
19
19
|
class_option :attributes, type: :array, default: [], desc: 'Included permitted params, otherwise read from model'
|
20
20
|
|
21
21
|
def assign_attributes
|
22
|
-
@attributes = invoked_attributes.presence || resource_attributes
|
22
|
+
@attributes = invoked_attributes.presence || resource_attributes(all: true)
|
23
23
|
self.class.send(:attr_reader, :attributes)
|
24
24
|
end
|
25
25
|
|
@@ -50,8 +50,8 @@ module Effective
|
|
50
50
|
attributes.map { |att| "#{att.name}:#{att.type}" }
|
51
51
|
end
|
52
52
|
|
53
|
-
def resource_attributes
|
54
|
-
klass_attributes = resource.klass_attributes
|
53
|
+
def resource_attributes(all: false)
|
54
|
+
klass_attributes = resource.klass_attributes(all: all)
|
55
55
|
|
56
56
|
if klass_attributes.blank?
|
57
57
|
if ActiveRecord::Migrator.new(:up, ActiveRecord::Migrator.migrations(ActiveRecord::Migrator.migrations_paths)).pending_migrations.present?
|
@@ -59,7 +59,7 @@ module Effective
|
|
59
59
|
system('bundle exec rake db:migrate') if migrate.to_s.include?('y')
|
60
60
|
end
|
61
61
|
|
62
|
-
klass_attributes = resource.klass_attributes
|
62
|
+
klass_attributes = resource.klass_attributes(all: all)
|
63
63
|
end
|
64
64
|
|
65
65
|
klass_attributes.presence || resource.written_attributes
|
@@ -1,19 +1,25 @@
|
|
1
1
|
class <%= resource.namespaced_class_name.pluralize %>Datatable < Effective::Datatable
|
2
|
-
<% if resource.scopes.present? -%>
|
3
|
-
filters do<% ([:all] + resource.scopes).uniq.each_with_index do |scope, index| %>
|
4
|
-
scope :<%= scope -%><%= ', default: true' if index == 0 -%>
|
5
|
-
<% end %>
|
6
|
-
end
|
7
2
|
|
8
|
-
<% end -%>
|
9
3
|
datatable do
|
10
|
-
order :<%= (attributes.find { |att| att.name == 'updated_at' } || attributes.first).name
|
4
|
+
order :<%= (attributes.find { |att| att.name == 'updated_at' } || attributes.first).name %>
|
11
5
|
|
6
|
+
<% if attributes.find { |att| att.name == 'updated_at' } -%>
|
7
|
+
col :updated_at, visible: false
|
8
|
+
<% end -%>
|
9
|
+
<% if attributes.find { |att| att.name == 'created_at' } -%>
|
10
|
+
col :created_at, visible: false
|
11
|
+
<% end -%>
|
12
|
+
<% if attributes.find { |att| att.name == 'id' } -%>
|
13
|
+
col :id, visible: false
|
14
|
+
|
15
|
+
<% end -%>
|
12
16
|
<% resource.belong_tos.each do |reference| -%>
|
13
17
|
col :<%= reference.name %>
|
14
18
|
<% end -%>
|
15
|
-
|
16
|
-
|
19
|
+
<% resource.nested_resources.each do |reference| -%>
|
20
|
+
col :<%= reference.name %>
|
21
|
+
<% end -%>
|
22
|
+
<% attributes.reject { |att| ['created_at', 'updated_at', 'id'].include?(att.name) }.each do |attribute| -%>
|
17
23
|
col :<%= attribute.name %>
|
18
24
|
<% end -%>
|
19
25
|
|
@@ -28,14 +34,8 @@ class <%= resource.namespaced_class_name.pluralize %>Datatable < Effective::Data
|
|
28
34
|
<% end -%>
|
29
35
|
end
|
30
36
|
|
31
|
-
<% if resource.scopes.blank? -%>
|
32
37
|
collection do
|
33
38
|
<%= resource.class_name %>.all
|
34
39
|
end
|
35
|
-
<% else -%>
|
36
|
-
collection do
|
37
|
-
<%= resource.class_name %>.all
|
38
|
-
end
|
39
|
-
<% end -%>
|
40
40
|
|
41
41
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= f.input :<%= attribute.name %>
|
@@ -11,6 +11,7 @@
|
|
11
11
|
<%= nested_resource.plural_name.titleize %>
|
12
12
|
|
13
13
|
<% end -%>
|
14
|
+
%br
|
14
15
|
.tab-content
|
15
16
|
#<%= resource.name %>-tab.tab-pane.active{role: 'tabpanel'}
|
16
17
|
= render 'form_<%= resource.name %>', f: f
|
@@ -20,6 +21,8 @@
|
|
20
21
|
= render 'form_<%= nested_resource.plural_name %>', f: f
|
21
22
|
<% end -%>
|
22
23
|
|
24
|
+
%hr
|
25
|
+
|
23
26
|
.form-actions
|
24
27
|
<% if defined?(EffectiveResources) -%>
|
25
28
|
= simple_form_submit(f)
|
@@ -7,7 +7,8 @@
|
|
7
7
|
<% end -%>
|
8
8
|
<% if defined?(EffectiveDatatables) -%>
|
9
9
|
- if @datatable.present?
|
10
|
-
=
|
10
|
+
= render_datatable_charts(@datatable)
|
11
|
+
= render_datatable_filters(@datatable)
|
11
12
|
= render_datatable(@datatable)
|
12
13
|
- else
|
13
14
|
%p There are no <%= resource.plural_name %>.
|
data/lib/tasks/pg_pull.rake
CHANGED
@@ -37,6 +37,11 @@ namespace :pg do
|
|
37
37
|
|
38
38
|
puts "=== Loading #{args.file_name} into local '#{db['database']}' database"
|
39
39
|
|
40
|
+
# bin/rails db:environment:set RAILS_ENV=development
|
41
|
+
if Rails.env != 'production'
|
42
|
+
ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK'] = '1'
|
43
|
+
end
|
44
|
+
|
40
45
|
Rake::Task['db:drop'].invoke
|
41
46
|
Rake::Task['db:create'].invoke
|
42
47
|
|
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.2.
|
4
|
+
version: 0.2.5
|
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: 2017-04-
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/scaffolds/forms/fields/_field_date.html.haml
|
77
77
|
- lib/scaffolds/forms/fields/_field_datetime.html.haml
|
78
78
|
- lib/scaffolds/forms/fields/_field_decimal.html.haml
|
79
|
+
- lib/scaffolds/forms/fields/_field_inet.html.haml
|
79
80
|
- lib/scaffolds/forms/fields/_field_integer.html.haml
|
80
81
|
- lib/scaffolds/forms/fields/_field_nested_resource.html.haml
|
81
82
|
- lib/scaffolds/forms/fields/_field_string.html.haml
|