active_leonardo 0.2.3 → 0.4.1

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: a51e2a1f9b84ce890c72d1e8d44be29a946648e2
4
- data.tar.gz: 4c03750211817703963ac3ce96a1e6f8e55f4abb
3
+ metadata.gz: 46fe1db72e27ba0a666f6a5fd477f78e47abfe19
4
+ data.tar.gz: 3a260b54254f4187ade5c37fae23e18e62d1b261
5
5
  SHA512:
6
- metadata.gz: 9940dc8d3f77a4c7536b7f5f3c110c0cdd379ae296ffa348bca765aa464c25dbade1220ba3aaa886d0a157dca8ce22240cebd5c3c042074924a4217eeb55d356
7
- data.tar.gz: 49eccbf92752be422046b168683d5e4098da61853af49ff7aa598505d9e1c744fb34df22ba95ce5fbaf6adedab7c183f6f21d40b506ee1bf70b920d5934b9dac
6
+ metadata.gz: d9450300646654cf2a2afcd8705857d12630dd9d1ab140d6a07f307367bfc991779c784305c63d55cc4121a95b2636ce01d4ad7e5bf063be46d2b1d362e0416e
7
+ data.tar.gz: 7c4db87e476226e9926e6c39d90567aef13ff8fcbe4623c368a73c414d18d2b3f44b401aecc6798215232f6aaa684766acd4781c9df0b59eb59cdd105f83610f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ 0.4.1 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.4.0...v0.4.1) July 22th, 2014
2
+ ------------------------------
3
+ * Added formtastic github url
4
+ * Turbolinks now works
5
+ * Several little improvements
6
+
7
+ 0.4.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.3.0...v0.4.0) April 11th, 2014
8
+ ------------------------------
9
+ * Rails 4.1 passed
10
+ * Improved rake tests, now active:tests:all perform test from rails 3.2 to 4.1
11
+ * Added Rails 4.1 tests to Travis CI
12
+
13
+ 0.3.0 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.2.3...v0.3.0) April 8th, 2014
14
+ ------------------------------
15
+ * New, edit and destroy buttons are now shown only if authorized
16
+ * The activeadmin method "default_actions" now show only authorized links
17
+ * Turned on turbolinks by default. You can remove jquery.turbolinks from active_admin.js.coffee
18
+
1
19
  0.2.3 [☰](https://github.com/marcomd/Active_Leonardo/compare/v0.2.2...v0.2.3) March 21th, 2014
2
20
  ------------------------------
3
21
  * Improved rake test to iterate several rails versions (currently 3.2.x and 4.0.x)
data/README.md CHANGED
@@ -9,7 +9,20 @@ 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 4.0.x and Ruby 2.0 on Windows OS
12
+ This version has been tested on:
13
+
14
+ * Rails `3.2.x` and Ruby `1.9.3` on Windows OS
15
+ * Rails `3.2.x` and Ruby `2.0.x` on Windows OS
16
+ * Rails `4.0.x` and Ruby `1.9.x` on Windows OS
17
+ * Rails `4.0.x` and Ruby `2.0.x` on Windows OS
18
+ * Rails `3.2.x` and Ruby `1.9.3` on Linux
19
+ * Rails `3.2.x` and Ruby `2.0.x` on Linux
20
+ * Rails `3.2.x` and Ruby `2.1.x` on Linux
21
+ * Rails `4.0.x` and Ruby `1.9.3` on Linux
22
+ * Rails `4.0.x` and Ruby `2.0.x` on Linux
23
+ * Rails `4.0.x` and Ruby `2.1.x` on Linux
24
+
25
+ We are pleased to have achieved this result :smile:
13
26
 
14
27
 
15
28
  ## Install
@@ -150,9 +163,54 @@ Currently the only one available is provided by ActiveAdmin
150
163
  * active [default]
151
164
 
152
165
 
166
+ ## How to perform tests
167
+
168
+ Check current tasks typing:
169
+
170
+ ```ruby
171
+ bundle exec rake -T
172
+ ```
173
+
174
+ rake active:tests:all[inspection] # Tests all rails versions
175
+ rake active:tests:newapp[inspection,rails] # Creates a test rails app for ...
176
+ rake active:tests:prepare[rails,path] # Prepare the environment passi...
177
+
178
+ if you want to test all, you can entrust to our package:
179
+ ```ruby
180
+ bundle exec rake active:tests:all[inspection]
181
+ ```
182
+
183
+ if you pass the argument inspection you can check the application under the test folder:
184
+
185
+ test/TestApp_xxx_32
186
+ test/TestApp_xxx_40
187
+
188
+ where xxx is the current ruby version and the last number the rails version.
189
+
190
+ Every rails version has its own bundle under mybundle_xx folder.
191
+
192
+ If you want to perform a custom test, firstly make sure Gemfile.lock is not present otherwise delete it
193
+ then you can type:
194
+
195
+ ```ruby
196
+ bundle exec active:tests:prepare['3.2','mybundle_path']
197
+ ```
198
+
199
+ _It sets the variable ENV[RAILS_CI] and prepares the package in the specified path_
200
+
201
+ ```ruby
202
+ bundle exec rake active:tests:newapp[inspection]
203
+ ```
204
+
205
+ the rails version has already been set by "active:tests:prepare" task.
206
+
207
+
208
+ If you execute tests with the inspection parameter remember to delete app folder under test/ before perform a new execution.
209
+
210
+
153
211
  ## Tutorial
154
212
 
155
- On my [Blog](http://marcomastrodonato.blogspot.it/) you can find some other info.
213
+ On my [Blog](http://mastrodonato.it/) you can find some other info.
156
214
 
157
215
 
158
216
  ## Found a bug?
data/active_template.rb CHANGED
@@ -10,13 +10,15 @@
10
10
  #
11
11
  #########################################################
12
12
 
13
+ rails_version = Rails::VERSION::STRING
14
+
13
15
  puts '*' * 40
14
- puts "* Processing template..."
16
+ puts "* Rails #{rails_version} Processing template..."
15
17
  puts '*' * 40
16
18
 
17
19
  test_mode = nil
18
20
  ARGV.each{|arg| test_mode = true if arg == "test_mode"}
19
- app_path = ARGV[0]
21
+ app_path = ARGV[1]
20
22
  puts "**** Starting app into #{app_path} in test mode! ****" if test_mode
21
23
 
22
24
  use_git = test_mode || yes?("Do you use git ?")
@@ -47,9 +49,10 @@ if use_git
47
49
  EOS
48
50
  end
49
51
 
50
- gem "activeadmin", git: 'http://github.com/gregbell/active_admin.git'
52
+
53
+ gem "activeadmin", git: 'http://github.com/gregbell/active_admin.git'
51
54
  if test_mode
52
- gem "active_leonardo", :path => "../../."
55
+ gem "active_leonardo", path: "../../."
53
56
  else
54
57
  gem "active_leonardo"
55
58
  end
@@ -58,9 +61,9 @@ gem "bourbon"
58
61
 
59
62
  easy_develop = test_mode || yes?("Do you want to make development easier?")
60
63
  if easy_develop
61
- gem "rack-mini-profiler", :group => :development
62
- gem "better_errors", :group => :development
63
- gem "awesome_print", :group => :development
64
+ gem "rack-mini-profiler", group: :development
65
+ gem "better_errors", group: :development
66
+ gem "awesome_print", group: :development
64
67
  end
65
68
 
66
69
  #use_editor = yes?("Do you want a wysihtml editor?")
@@ -71,16 +74,11 @@ end
71
74
 
72
75
  rspec = test_mode || yes?("Add rspec as testing framework ?")
73
76
  if rspec
74
- gem 'rspec-rails', :group => [:test, :development]
75
- gem 'capybara', :group => :test
76
- gem 'launchy', :group => :test
77
- gem 'database_cleaner', :group => :test
78
- if /1.8.*/ === RUBY_VERSION
79
- gem 'factory_girl', '2.6.4', :group => :test
80
- gem 'factory_girl_rails', '1.7.0', :group => :test
81
- else
82
- gem 'factory_girl_rails', :group => :test
83
- end
77
+ gem 'rspec-rails', group: [:test, :development]
78
+ gem 'capybara', group: :test
79
+ gem 'launchy', group: :test
80
+ gem 'database_cleaner', group: :test
81
+ gem 'factory_girl_rails', group: :test
84
82
  end
85
83
 
86
84
  authentication = test_mode || yes?("Authentication ?")
@@ -101,6 +99,7 @@ if authentication
101
99
  REMEM
102
100
  p stdout
103
101
  end
102
+ gem "devise"
104
103
 
105
104
  authorization = test_mode || yes?("Authorization ?")
106
105
  if authorization
@@ -110,6 +109,13 @@ end
110
109
 
111
110
  gem 'state_machine' if test_mode || yes?("Do you have to handle states ?")
112
111
 
112
+ # Updates for Rails 4.1
113
+ if /4.1.*/ === rails_version
114
+ gem 'ransack', git: 'http://github.com/activerecord-hackery/ransack.git', branch: 'rails-4.1'
115
+ gem 'polyamorous', git: 'http://github.com/activerecord-hackery/polyamorous.git'
116
+ gem 'formtastic', git: 'http://github.com/justinfrench/formtastic.git'
117
+ end
118
+
113
119
  dashboard_root = test_mode || yes?("Would you use dashboard as root ? (recommended)")
114
120
  home = test_mode || yes?("Ok. Would you create home controller as root ?") unless dashboard_root
115
121
 
@@ -130,10 +136,10 @@ end
130
136
  generate "leolay",
131
137
  "active", #specify theme
132
138
  "--auth_class=#{model_name}",
133
- (rspec ? nil : "--skip-rspec"),
134
- (authorization ? nil : "--skip-authorization"),
135
- (authentication ? nil : "--skip-authentication"),
136
- (test_mode ? "--no-verbose" : nil)
139
+ (rspec ? nil : "--skip-rspec"),
140
+ (authorization ? nil : "--skip-authorization"),
141
+ (authentication ? nil : "--skip-authentication"),
142
+ (test_mode ? "--no-verbose" : nil)
137
143
 
138
144
 
139
145
  if dashboard_root
@@ -174,16 +174,20 @@ class LeolayGenerator < Rails::Generators::Base
174
174
  copy_file file, file, :force => !options.verbose?
175
175
 
176
176
  file = "#{app_path}/active_admin.js.coffee"
177
- #gsub_file file, "#= require active_admin/base" do
178
- # <<-FILE.gsub(/^ /, '')
179
- # #= require jquery.turbolinks
180
- #
181
- # #= require active_admin/base
182
- #FILE
183
- #end
177
+ gsub_file file, "#= require active_admin/base" do
178
+ <<-FILE.gsub(/^ /, '')
179
+ #= require jquery
180
+ #= require turbolinks
181
+ #= require jquery.turbolinks
182
+
183
+ #= require active_admin/base
184
+ #= require custom
185
+ FILE
186
+ end
184
187
  append_file file do
185
188
  <<-FILE.gsub(/^ /, '')
186
189
  #= require turbolinks
190
+ #= require jquery.turbolinks
187
191
  #= require custom
188
192
  FILE
189
193
  end
@@ -1,31 +1,76 @@
1
- module ActiveAdmin
2
- module Views
3
- module Pages
4
- #Custom footer
5
- #\lib\active_admin\views\pages\base.rb
6
- class Base < Arbre::HTML::Document
7
- private
8
- def build_footer
9
- div :id => "footer" do
10
- para "#{CONFIG[:application][:name]} #{Rails.env} #{CONFIG[:application][:version]}, <%= Time.now.year %>.".html_safe
11
- para style_image_tag "logo.png"
12
- end
13
- end
14
-
15
- end
16
- end
17
-
18
- #Avoid xml and json from download
19
- #\lib\active_admin\views\components\paginated_collection.rb
20
- #class PaginatedCollection
21
- # def build_download_format_links(formats = [:csv])
22
- # links = formats.collect do |format|
23
- # link_to format.to_s.upcase, { :format => format}.merge(request.query_parameters.except(:commit, :format))
24
- # end
25
- # div :class => "download_links" do
26
- # text_node [I18n.t('active_admin.download'), links].flatten.join("&nbsp;").html_safe
27
- # end
28
- # end
29
- #end
30
- end
31
- end
1
+ module ActiveAdmin
2
+ module Views
3
+ module Pages
4
+ #Custom footer
5
+ #\lib\active_admin\views\pages\base.rb
6
+ class Base < Arbre::HTML::Document
7
+ private
8
+ def build_footer
9
+ div :id => "footer" do
10
+ para "#{CONFIG[:application][:name]} #{Rails.env} #{CONFIG[:application][:version]}, <%= Time.now.year %>.".html_safe
11
+ para style_image_tag "logo.png"
12
+ end
13
+ end
14
+
15
+ end
16
+ end
17
+
18
+ #Per integrare default_actions con cancan
19
+ #\lib\active_admin\views\index_as_table.rb
20
+ class IndexAsTable
21
+ class IndexTableFor
22
+ # Adds links to View, Edit and Delete
23
+ def default_actions(options = {})
24
+ options = {
25
+ :name => "",
26
+ :auth => true
27
+ }.merge(options)
28
+ column options[:name] do |resource|
29
+ links = ''.html_safe
30
+ if controller.action_methods.include?('show') && (options[:auth] ? can?(:read, resource) : true)
31
+ links += link_to I18n.t('active_admin.view'), resource_path(resource), :class => "member_link view_link"
32
+ end
33
+ if controller.action_methods.include?('edit') && (options[:auth] ? can?(:update, resource) : true)
34
+ links += link_to I18n.t('active_admin.edit'), edit_resource_path(resource), :class => "member_link edit_link"
35
+ end
36
+ if controller.action_methods.include?('destroy') && (options[:auth] ? can?(:destroy, resource) : true)
37
+ links += link_to I18n.t('active_admin.delete'), resource_path(resource), :method => :delete, :confirm => I18n.t('active_admin.delete_confirmation'), :class => "member_link delete_link"
38
+ end
39
+ links
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ class Resource
46
+ module ActionItems
47
+ private
48
+
49
+ # Adds the default action items to each resource
50
+ def add_default_action_items
51
+ # New Link on all actions except :new and :show
52
+ add_action_item :except => [:new, :show] do
53
+ if controller.action_methods.include?('new') && can?(:create, active_admin_config.resource_class)
54
+ link_to(I18n.t('active_admin.new_model', :model => active_admin_config.resource_name), new_resource_path)
55
+ end
56
+ end
57
+
58
+ # Edit link on show
59
+ add_action_item :only => :show do
60
+ if controller.action_methods.include?('edit') && can?(:edit, resource)
61
+ link_to(I18n.t('active_admin.edit_model', :model => active_admin_config.resource_name), edit_resource_path(resource))
62
+ end
63
+ end
64
+
65
+ # Destroy link on show
66
+ add_action_item :only => :show do
67
+ if controller.action_methods.include?("destroy") && can?(:destroy, resource)
68
+ link_to(I18n.t('active_admin.delete_model', :model => active_admin_config.resource_name),
69
+ resource_path(resource),
70
+ :method => :delete, :confirm => I18n.t('active_admin.delete_confirmation'))
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_leonardo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Mastrodonato, Marco Longhitano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-21 00:00:00.000000000 Z
11
+ date: 2014-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails