active_leonardo 0.7.0 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ed1b7e0a9371e0891efc8975e0b73cc63932c72
4
- data.tar.gz: bea921b9be90778fb47dc2d868da9af91ba8c8c5
3
+ metadata.gz: 0cfb73c3eaa24ed0ef71bef9e62cb62eeb3b74a9
4
+ data.tar.gz: 7707dd779544e0fa13251c8acadd73348b443151
5
5
  SHA512:
6
- metadata.gz: de5bb6c9ddfc1fe7059dc42b27ee4f26213ef31789b0832a455212a128cdc77949dd6cbf85db055447d50a8a78f0930fe78f7e279ddc89f897333eb456af859b
7
- data.tar.gz: c4aab0fbaf1450a0a40a5b32767b91dee1f772290019975bc8a31885aeb606ef9602441fb0925c7f61f0c8aab055d12039230edef151c2131e73929b82cc42eb
6
+ metadata.gz: e04c098a2d9736b7c68bd0eb0ae1712e71a61517fe8b58a70a182075e2d02f744e32621f2f0c10653a996d6557f5ba96283edd1c290a8a9ea092eb187535d387
7
+ data.tar.gz: b9c380447e04f4294cd254793042a696c1e9df009179f527369190ad9852e3a8f2506159b4017e772dcca7d44428bfa64472b8c82a1df1679f72ee7ffc29011e
@@ -1,3 +1,9 @@
1
+ 0.8.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.7.0...v0.8.0) February 17th, 2016
2
+ ------------------------------
3
+ * Permitted params now use the _id suffix for foreign key fields, in this way the parent resourse can be saved
4
+ * Improved the dsl generated for active admin
5
+ * Improved tests
6
+
1
7
  0.7.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.6.1...v0.7.0) February 16th, 2016
2
8
  ------------------------------
3
9
  * resources are now being created with dsl activeadmin like boilerplate parameter
data/README.md CHANGED
@@ -9,12 +9,9 @@ It generates the layout, the style, the internationalization and it helps you to
9
9
 
10
10
  ## Compatibility
11
11
 
12
- This version has been tested on Rails `3.2` to `5.0.beta2` and Ruby `1.9.3`+ on Windows OS and Linux
13
- For previous version go to the bottom of this read me.
12
+ This version has been tested on Rails `4.2` to `5.0.beta2` and Ruby `2.2.3` on Windows OS and Linux
14
13
  Click on Travis badge for more details.
15
-
16
- **Rails `3.2` and Ruby <= `2.2.2` tested until 0.6.x version**
17
-
14
+ For previous version go to the bottom of this read me.
18
15
 
19
16
  ## Install
20
17
 
@@ -200,6 +197,8 @@ of course you can even revert:
200
197
 
201
198
  This is very useful for a rapid prototyping and if you keep it updated you can use it as information center about the database.
202
199
 
200
+ _If you try that example remember to add the traslation of the two field foo and bar (added by migrations), otherwise you will get a translation error._
201
+
203
202
  ### Available layout
204
203
 
205
204
  Currently the only one available is provided by ActiveAdmin
@@ -305,4 +304,4 @@ Please open an issue.
305
304
  ## License
306
305
 
307
306
  The GNU Lesser General Public License, version 3.0 (LGPL-3.0)
308
- See LICENSE file
307
+ See LICENSE file
@@ -75,11 +75,11 @@ if rspec
75
75
  gem 'factory_girl_rails', group: :test
76
76
  end
77
77
 
78
- authentication = test_mode || yes?("Authentication ?")
79
- model_name = authorization = nil
78
+ authentication = test_mode || yes?("Authentication ?")
79
+ model_name = authorization = nil
80
80
  if authentication
81
- default_model_name = "User"
82
- model_name = test_mode ? "" : ask(" Insert model name: [#{default_model_name}]")
81
+ default_model_name = "User"
82
+ model_name = test_mode ? "" : ask(" Insert model name: [#{default_model_name}]")
83
83
  if model_name.empty? || model_name == 'y'
84
84
  model_name = default_model_name
85
85
  else
@@ -112,7 +112,7 @@ if /^5/ === rails_version
112
112
  gem 'formtastic', git: 'https://github.com/justinfrench/formtastic.git'
113
113
  else
114
114
  gem 'formtastic'
115
- end
115
+ end
116
116
 
117
117
  dashboard_root = test_mode || yes?("Would you use dashboard as root ? (recommended)")
118
118
  home = test_mode || yes?("Ok. Would you create home controller as root ?") unless dashboard_root
@@ -24,16 +24,6 @@ module ActiveLeonardo
24
24
  return unless options[:auth_class]
25
25
  options[:auth_class].classify
26
26
  end
27
- #def formtastic?
28
- # return false unless options.formtastic?
29
- # File.exists? "config/initializers/formtastic.rb"
30
- #end
31
- #def jquery_ui?
32
- # File.exists? "vendor/assets/javascripts/jquery-ui"
33
- #end
34
- #def pagination?
35
- # File.exists? "config/initializers/kaminari_config.rb"
36
- #end
37
27
  end
38
28
 
39
29
  module Leosca
@@ -162,18 +152,20 @@ module ActiveLeonardo
162
152
  def attributes_to_hints(attributes, file_name)
163
153
  content = "#{CRLF} #{file_name}:#{CRLF}"
164
154
  attributes.each do |attribute|
165
- attr_name = attribute.name.humanize
155
+ attribute_name_for_desc = attribute.name.humanize.downcase
166
156
  case attribute.type
167
157
  when :integer, :decimal, :float
168
- content << " #{attribute.name}: \"Fill the #{attr_name} with a#{"n" if attribute.type == :integer} #{attribute.type.to_s} number\"#{CRLF}"
158
+ content << " #{attribute.name}: \"Fill the #{attribute_name_for_desc} with a#{"n" if attribute.type == :integer} #{attribute.type.to_s} number\"#{CRLF}"
169
159
  when :boolean
170
- content << " #{attribute.name}: \"Select if this #{file_name} should be #{attr_name} or not\"#{CRLF}"
171
- when :string, :text
172
- content << " #{attribute.name}: \"Choose a good #{attr_name} for this #{file_name}\"#{CRLF}"
160
+ content << " #{attribute.name}: \"Select if this #{file_name} should be #{attribute_name_for_desc} or not\"#{CRLF}"
161
+ when :string
162
+ content << " #{attribute.name}: \"Choose a good #{attribute_name_for_desc} for this #{file_name}\"#{CRLF}"
163
+ when :text
164
+ content << " #{attribute.name}: \"Write something as #{attribute_name_for_desc}\"#{CRLF}"
173
165
  when :date, :datetime, :time, :timestamp
174
- content << " #{attribute.name}: \"Choose a #{attribute.type.to_s} for #{attr_name}\"#{CRLF}"
166
+ content << " #{attribute.name}: \"Choose a #{attribute.type.to_s} for #{attribute_name_for_desc}\"#{CRLF}"
175
167
  else
176
- content << " #{attribute.name}: \"Choose a #{attr_name}\"#{CRLF}"
168
+ content << " #{attribute.name}: \"Choose the #{attribute_name_for_desc}\"#{CRLF}"
177
169
  end
178
170
  end
179
171
  content
@@ -181,6 +173,49 @@ module ActiveLeonardo
181
173
 
182
174
  end
183
175
 
176
+ module Activeadmin
177
+ ACTIVEADMIN_INDENT_SPACES = 25
178
+ def attributes_to_aa_permit_params(attributes)
179
+ attributes.map do |attr|
180
+ case attr.type
181
+ when :references, :belongs_to then ":#{attr.name}_id"
182
+ else ":#{attr.name}"
183
+ end
184
+ end.join(', ')
185
+ end
186
+ def attributes_to_aa_index(attributes)
187
+ attributes.map do |attr|
188
+ case attr.type
189
+ when :references, :belongs_to then " # column(:#{attr.name})"
190
+ when :boolean then " # column(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| status_tag #{singular_table_name}.#{attr.name}}"
191
+ else " # column(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"
192
+ end
193
+ end.join("\n")
194
+ end
195
+ def attributes_to_aa_show(attributes)
196
+ attributes.map do |attr|
197
+ case attr.type
198
+ when :references, :belongs_to then " # row(:#{attr.name})"
199
+ when :boolean then " # row(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| status_tag #{singular_table_name}.#{attr.name}}"
200
+ else " # row(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"
201
+ end
202
+ end.join("\n")
203
+ end
204
+ def attributes_to_aa_filter(attributes)
205
+ attributes.map{|attr| " #filter :#{attr.name}"}.join("\n")
206
+ end
207
+ def attributes_to_aa_form(attributes)
208
+ attributes.map do |attr|
209
+ case attr.type
210
+ when :date then " # f.input :#{attr.name}, as: :datepicker, input_html: { class: 'calendar' }"
211
+ else " # f.input :#{attr.name}"
212
+ end
213
+ end.join("\n")
214
+ end
215
+ def attributes_to_aa_csv(attributes)
216
+ attributes.map{|attr| " # column(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"}.join("\n")
217
+ end
218
+ end
184
219
  end
185
220
 
186
221
  end
@@ -196,6 +196,7 @@ en:
196
196
  labels:
197
197
  <<: *attributes
198
198
  hints:
199
+ #Hints zone - do not remove
199
200
  actions:
200
201
  <<: *actions
201
202
  authentication:
@@ -225,6 +225,7 @@ it:
225
225
  labels:
226
226
  <<: *attributes
227
227
  hints:
228
+ #Hints zone - do not remove
228
229
  actions:
229
230
  <<: *actions
230
231
  authentication:
@@ -1,25 +1,25 @@
1
- //Uncomment these lines in production to have a different color
2
- //$env-color: rgb(250,50,50);
3
- //
4
- //@mixin primary-gradient {
5
- // @include gradient(darken($env-color, 20%), darken($env-color, 33%));
6
- // border-bottom: 1px solid darken($env-color, 38%);
7
- //}
8
- //
9
- //#header {
10
- // @include primary-gradient;
11
- // ul#tabs > li.current > a {
12
- // background-color: darken($env-color, 15%);
13
- // }
14
- // ul#tabs > li:hover > a {
15
- // background-color: darken($env-color, 10%);
16
- // }
17
- //}
18
- //.table_tools_segmented_control li.selected {
19
- // a {
20
- // color: $env-color;
21
- // }
22
- // a:hover {
23
- // color: darken($env-color, 20%);
24
- // }
1
+ //Uncomment these lines in production to have a different color
2
+ //$env-color: rgb(250,50,50);
3
+ //
4
+ //@mixin primary-gradient {
5
+ // @include gradient(darken($env-color, 20%), darken($env-color, 33%));
6
+ // border-bottom: 1px solid darken($env-color, 38%);
7
+ //}
8
+ //
9
+ //#header {
10
+ // @include primary-gradient;
11
+ // ul#tabs > li.current > a {
12
+ // background-color: darken($env-color, 15%);
13
+ // }
14
+ // ul#tabs > li:hover > a {
15
+ // background-color: darken($env-color, 10%);
16
+ // }
17
+ //}
18
+ //.table_tools_segmented_control li.selected {
19
+ // a {
20
+ // color: $env-color;
21
+ // }
22
+ // a:hover {
23
+ // color: darken($env-color, 20%);
24
+ // }
25
25
  //}
@@ -1,53 +1,53 @@
1
- @import "active_admin/mixins";
2
- @import "active_admin/base";
3
-
4
- body.active_admin {
5
- @import "enviroment";
6
- @import "active_admin/pages/logged_out";
7
- #header {
8
- #session {
9
- display: inline-block;
10
- color: #cdcdcd;
11
- float: right;
12
- margin-right: 20px;
13
- margin-bottom: 0px;
14
- padding-top: 3px;
15
- font-size: 1em;
16
- font-weight: normal;
17
- }
18
- }
19
- body.logged_out #content_wrapper {
20
- width: 600px;
21
- }
22
- ul li {
23
- list-style-type: circle;
24
- }
25
-
26
- #login {
27
- form {
28
- input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], textarea {
29
- //width: 76%;
30
- //border: 1px solid #c9d0d6;
31
- //@include rounded;
32
- //font-size: 0.95em;
33
- //@include sans-family;
34
- //outline: none;
35
- padding: 8px 7px;
36
-
37
- //&:focus {
38
- // border: 1px solid #99a2aa;
39
- // @include shadow(0,0,4px,#99a2aa);
40
- //}
41
- }
42
- input[type=submit] {
43
- @include dark-button;
44
- margin-left: 20px;
45
- //padding: 4px 8px;
46
- }
47
- //.buttons {
48
- // margin-top: 15px;
49
- // //input[type=submit] { margin-right: 10px; }
50
- //}
51
- }
52
- }
1
+ @import "active_admin/mixins";
2
+ @import "active_admin/base";
3
+
4
+ body.active_admin {
5
+ @import "enviroment";
6
+ @import "active_admin/pages/logged_out";
7
+ #header {
8
+ #session {
9
+ display: inline-block;
10
+ color: #cdcdcd;
11
+ float: right;
12
+ margin-right: 20px;
13
+ margin-bottom: 0px;
14
+ padding-top: 3px;
15
+ font-size: 1em;
16
+ font-weight: normal;
17
+ }
18
+ }
19
+ body.logged_out #content_wrapper {
20
+ width: 600px;
21
+ }
22
+ ul li {
23
+ list-style-type: circle;
24
+ }
25
+
26
+ #login {
27
+ form {
28
+ input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], textarea {
29
+ //width: 76%;
30
+ //border: 1px solid #c9d0d6;
31
+ //@include rounded;
32
+ //font-size: 0.95em;
33
+ //@include sans-family;
34
+ //outline: none;
35
+ padding: 8px 7px;
36
+
37
+ //&:focus {
38
+ // border: 1px solid #99a2aa;
39
+ // @include shadow(0,0,4px,#99a2aa);
40
+ //}
41
+ }
42
+ input[type=submit] {
43
+ @include dark-button;
44
+ margin-left: 20px;
45
+ //padding: 4px 8px;
46
+ }
47
+ //.buttons {
48
+ // margin-top: 15px;
49
+ // //input[type=submit] { margin-right: 10px; }
50
+ //}
51
+ }
52
+ }
53
53
  }
@@ -1,86 +1,86 @@
1
- module Leosca
2
- module Generators
3
- class Thor
4
- attr_reader :_initializer
5
- end
6
- class MassiveGenerator < Rails::Generators::Base
7
- source_root File.expand_path('../../', __FILE__)
8
- class_option :seeds, :type => :boolean, :default => true, :desc => "Create seeds to run with rake db:seed"
9
- class_option :seeds_elements, :type => :string, :default => "30", :banner => "NUMBER", :desc => "Choose seeds elements"
10
- class_option :auth_class, :type => :string, :default => 'User', :desc => "Set the authentication class name"
11
- class_option :activeadmin, :type => :boolean, :default => true, :desc => "Add code to manage activeadmin gem"
12
-
13
- def scaffold
14
- # puts "args #{self.args}"
15
- # puts "options #{self.options}"
16
- puts "behavior #{self.behavior}"
17
- # puts "shell #{self.shell}"
18
- # puts "in_group #{self.instance_variable_get(:@in_group)}"
19
- # puts "_invocations #{self.instance_variable_get(:@_invocations)}"
20
- # puts "_initializer #{self.instance_variable_get(:@_initializer)}"
21
- # return nil
22
-
23
- num_ok, num_ko, num_discards = 0, 0, 0
24
- time = Time.now
25
- begin
26
- filename = "scaffold.txt"
27
- raise "Write all your resources into #{filename} in the app root" unless File.exist? filename
28
- puts "#{time.strftime("%H:%M:%S")} - Starting generations, please wait..."
29
- puts "-" * 45
30
- File.open(filename, "r") do |file|
31
- while (line = file.gets)
32
- begin
33
- case generate line
34
- when true
35
- num_ok += 1
36
- when false
37
- num_ko += 1
38
- when nil
39
- num_discards += 1
40
- end
41
- rescue
42
- num_ko += 1
43
- puts "*** #{$!.message} ***"
44
- end
45
- end
46
- end
47
- rescue
48
- puts "Oh oh, generation interrupted! #{$!.message} ***"
49
- end
50
-
51
- puts "-" * 45
52
- puts "Generations started at #{time.strftime("%H:%M:%S")}"
53
- puts "#{Time.now.strftime("%H:%M:%S")} - generations ended in #{(Time.now-time).to_i} second(s)"
54
- puts "#{num_ok} generation#{'s' unless num_ok == 1} executed"
55
- puts "#{num_discards} line#{'s' unless num_discards == 1} discarded (comments etc.)" if num_discards>0
56
- puts "#{num_ko} generation#{'s' unless num_ko == 1} *** FAILED ***" if num_ko>0
57
- puts "-" * 45
58
- end
59
-
60
- private
61
-
62
- def generate line
63
- regexp_rails_g = 'rails [dg][a-z]*\s'
64
- line.strip!
65
- unless line.empty? or line[0..0]=="#"
66
- if /#{regexp_rails_g}/i === line
67
- # Will invoke a custom generator specified in the line
68
- line.sub! /#{regexp_rails_g}/i, ''
69
- generator_name = line.match(/\w+/).to_s
70
- line.sub! /#{generator_name}/, ''
71
- line.strip!
72
- else
73
- generator_name = 'leosca'
74
- end
75
- raise "Generator not recognized! #{line[0..20]}..." if /^rails/ === line
76
- puts "#{generator_name} #{line}"
77
- Rails::Generators.invoke generator_name, line.split(' '), :behavior => self.behavior
78
- true
79
- else
80
- nil
81
- end
82
- end
83
-
84
- end
85
- end
1
+ module Leosca
2
+ module Generators
3
+ class Thor
4
+ attr_reader :_initializer
5
+ end
6
+ class MassiveGenerator < Rails::Generators::Base
7
+ source_root File.expand_path('../../', __FILE__)
8
+ class_option :seeds, :type => :boolean, :default => true, :desc => "Create seeds to run with rake db:seed"
9
+ class_option :seeds_elements, :type => :string, :default => "30", :banner => "NUMBER", :desc => "Choose seeds elements"
10
+ class_option :auth_class, :type => :string, :default => 'User', :desc => "Set the authentication class name"
11
+ class_option :activeadmin, :type => :boolean, :default => true, :desc => "Add code to manage activeadmin gem"
12
+
13
+ def scaffold
14
+ # puts "args #{self.args}"
15
+ # puts "options #{self.options}"
16
+ puts "behavior #{self.behavior}"
17
+ # puts "shell #{self.shell}"
18
+ # puts "in_group #{self.instance_variable_get(:@in_group)}"
19
+ # puts "_invocations #{self.instance_variable_get(:@_invocations)}"
20
+ # puts "_initializer #{self.instance_variable_get(:@_initializer)}"
21
+ # return nil
22
+
23
+ num_ok, num_ko, num_discards = 0, 0, 0
24
+ time = Time.now
25
+ begin
26
+ filename = "scaffold.txt"
27
+ raise "Write all your resources into #{filename} in the app root" unless File.exist? filename
28
+ puts "#{time.strftime("%H:%M:%S")} - Starting generations, please wait..."
29
+ puts "-" * 45
30
+ File.open(filename, "r") do |file|
31
+ while (line = file.gets)
32
+ begin
33
+ case generate line
34
+ when true
35
+ num_ok += 1
36
+ when false
37
+ num_ko += 1
38
+ when nil
39
+ num_discards += 1
40
+ end
41
+ rescue
42
+ num_ko += 1
43
+ puts "*** #{$!.message} ***"
44
+ end
45
+ end
46
+ end
47
+ rescue
48
+ puts "Oh oh, generation interrupted! #{$!.message} ***"
49
+ end
50
+
51
+ puts "-" * 45
52
+ puts "Generations started at #{time.strftime("%H:%M:%S")}"
53
+ puts "#{Time.now.strftime("%H:%M:%S")} - generations ended in #{(Time.now-time).to_i} second(s)"
54
+ puts "#{num_ok} generation#{'s' unless num_ok == 1} executed"
55
+ puts "#{num_discards} line#{'s' unless num_discards == 1} discarded (comments etc.)" if num_discards>0
56
+ puts "#{num_ko} generation#{'s' unless num_ko == 1} *** FAILED ***" if num_ko>0
57
+ puts "-" * 45
58
+ end
59
+
60
+ private
61
+
62
+ def generate line
63
+ regexp_rails_g = 'rails [dg][a-z]*\s'
64
+ line.strip!
65
+ unless line.empty? or line[0..0]=="#"
66
+ if /#{regexp_rails_g}/i === line
67
+ # Will invoke a custom generator specified in the line
68
+ line.sub! /#{regexp_rails_g}/i, ''
69
+ generator_name = line.match(/\w+/).to_s
70
+ line.sub! /#{generator_name}/, ''
71
+ line.strip!
72
+ else
73
+ generator_name = 'leosca'
74
+ end
75
+ raise "Generator not recognized! #{line[0..20]}..." if /^rails/ === line
76
+ puts "#{generator_name} #{line}"
77
+ Rails::Generators.invoke generator_name, line.split(' '), :behavior => self.behavior
78
+ true
79
+ else
80
+ nil
81
+ end
82
+ end
83
+
84
+ end
85
+ end
86
86
  end
@@ -12,6 +12,7 @@ module Rails
12
12
  include ::ActiveLeonardo::Leosca::Locale
13
13
  include ::ActiveLeonardo::Leosca::Rspec
14
14
  include ::ActiveLeonardo::Leosca::Seed
15
+ include ::ActiveLeonardo::Leosca::Activeadmin
15
16
 
16
17
  source_root File.expand_path('../templates', __FILE__)
17
18
  argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
@@ -54,7 +55,7 @@ module Rails
54
55
  end
55
56
 
56
57
  #Formtastic
57
- inject_into_file file, :after => " hints:" do
58
+ inject_into_file file, :after => "#Hints zone - do not remove" do
58
59
  attributes_to_hints(attributes, file_name)
59
60
  end
60
61
 
@@ -98,50 +99,49 @@ module Rails
98
99
  end
99
100
 
100
101
  def invoke_active_admin
101
- return unless activeadmin? and options[:activeadmin]
102
+ return unless activeadmin? && options[:activeadmin]
102
103
 
103
104
  invoke "active_admin:resource", [singular_table_name]
104
105
  file = "app/admin/#{singular_table_name}.rb"
105
106
 
106
- indent_spaces = 25
107
+
107
108
  inject_into_file file, :after => "ActiveAdmin.register #{class_name} do" do
108
109
  <<-FILE.gsub(/^ /, '')
109
110
  # ActiveLeonardo: Remove comments where you need it
110
111
  #index do
111
112
  # selectable_column
112
113
  # id_column
113
- #{attributes.map{|attr| " # column(:#{attr.name})#{' ' * (indent_spaces-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"}.join("\n")}
114
+ #{attributes_to_aa_index(attributes)}
114
115
  # actions
115
116
  #end
116
117
 
117
118
  #show do |#{singular_table_name}|
118
119
  # attributes_table do
119
- #{attributes.map{|attr| " # row(:#{attr.name})#{' ' * (indent_spaces-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"}.join("\n")}
120
+ # row :id
121
+ #{attributes_to_aa_show(attributes)}
120
122
  # row :created_at
121
123
  # row :updated_at
122
124
  # end
123
125
  # # Insert here child tables
124
- # panel I18n.t('models.your_child_tables') do
125
- # table_for #{singular_table_name}.your_child_tables do
126
- # column(:id) {|your_child_tables| link_to your_child_tables.id, [:admin, your_child_tables]}
127
- # end
128
- # end
126
+ # #panel I18n.t('models.childs') do
127
+ # # table_for #{singular_table_name}.childs do
128
+ # # column(:id) {|child| link_to child.id, [:admin, child]}
129
+ # # end
130
+ # #end
129
131
  # active_admin_comments
130
132
  #end
131
133
 
132
- #{attributes.map{|attr| " #filter :#{attr.name}"}.join("\n")}
134
+ #{attributes_to_aa_filter(attributes)}
133
135
 
134
136
  #form do |f|
135
137
  # f.inputs do
136
- #{attributes.map{|attr| " # f.input :#{attr.name}"}.join("\n")}
138
+ #{attributes_to_aa_form(attributes)}
137
139
  # end
138
- # #For date use as: :datepicker, input_html: { class: 'calendar' }
139
- # #For state machine data field as: :select, collection: (f.object.class.state_machine.states.collect { |state| [state.human_name.underscore.capitalize, state.value] }.sort_by { |name| name }), :for => :states, :include_blank => false
140
140
  # f.actions
141
141
  #end
142
142
 
143
143
  #csv do
144
- #{attributes.map{|attr| " # column(:#{attr.name})#{' ' * (indent_spaces-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"}.join("\n")}
144
+ #{attributes_to_aa_csv(attributes)}
145
145
  #end
146
146
  FILE
147
147
  end if File.exists?(file)
@@ -150,7 +150,7 @@ module Rails
150
150
  inject_into_file file, :after => "ActiveAdmin.register #{class_name} do" do
151
151
  <<-FILE.gsub(/^ /, '')
152
152
  permit_params do
153
- permitted = [:id, #{attributes.map{|attr| ":#{attr.name}"}.join(', ')}, :created_at, :updated_at]
153
+ permitted = [:id, #{attributes_to_aa_permit_params(attributes)}, :created_at, :updated_at]
154
154
  permitted
155
155
  end
156
156
 
@@ -191,20 +191,6 @@ module Rails
191
191
  end if File.exists?(file)
192
192
  end
193
193
 
194
- #def update_parent_controller
195
- # return unless nested?
196
- # file = "app/controllers/#{plural_last_parent}_controller.rb"
197
- # inject_into_file file, :before => " private" do
198
- # <<-FILE.gsub(/^ /, '')
199
- # def with_#{plural_table_name}
200
- # @#{last_parent} = #{last_parent.classify}.find params[:#{last_parent}_id]
201
- # @#{plural_table_name} = #{class_name}.where(:#{last_parent}_id => params[:#{last_parent}_id])
202
- # end
203
- #
204
- # FILE
205
- # end if File.exists?(file)
206
- #end
207
-
208
194
  end
209
195
  end
210
196
  end
@@ -0,0 +1,15 @@
1
+ # This is the main resource... i think
2
+ activity user:references name:string{100} body:text completed:boolean percentage_progression:integer{1}
3
+ #completed: when all tasks are completed
4
+ # Any other comments about fields
5
+
6
+ # This table acts as...
7
+ task user:references activity:references name:string{100} body:text completed:boolean percentage_progression:integer{1} deadline_date:date
8
+
9
+ hint user:belongs_to activity:references message:string
10
+
11
+ # I decided to add this because...
12
+ rails g migration AddFooToActivity foo:boolean
13
+
14
+ # I need this because...
15
+ rails g migration AddBarToTask bar:boolean
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_leonardo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Mastrodonato
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-16 00:00:00.000000000 Z
12
+ date: 2016-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -94,6 +94,7 @@ files:
94
94
  - lib/generators/rspec/leosca/templates/new_spec.rb
95
95
  - lib/generators/rspec/leosca/templates/routing_spec.rb
96
96
  - lib/generators/rspec/leosca/templates/show_spec.rb
97
+ - lib/test_assets/scaffold.txt
97
98
  homepage: https://github.com/marcomd/Active_Leonardo
98
99
  licenses:
99
100
  - LGPL-3.0