activeadmin 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeadmin might be problematic. Click here for more details.

Files changed (66) hide show
  1. data/CHANGELOG.rdoc +60 -11
  2. data/Gemfile +7 -3
  3. data/README.rdoc +118 -8
  4. data/Rakefile +5 -1
  5. data/activeadmin.gemspec +20 -13
  6. data/cucumber.yml +1 -0
  7. data/features/comments/commenting.feature +5 -1
  8. data/features/dashboard.feature +26 -0
  9. data/features/menu.feature +26 -0
  10. data/features/step_definitions/dashboard_steps.rb +11 -0
  11. data/features/step_definitions/menu_steps.rb +7 -0
  12. data/features/sti_resource.feature +49 -0
  13. data/lib/active_admin.rb +20 -13
  14. data/lib/active_admin/arbre/tag.rb +10 -2
  15. data/lib/active_admin/comments.rb +15 -0
  16. data/lib/active_admin/form_builder.rb +1 -1
  17. data/lib/active_admin/resource.rb +9 -4
  18. data/lib/active_admin/resource_controller.rb +4 -4
  19. data/lib/active_admin/resource_controller/collection.rb +3 -2
  20. data/lib/active_admin/stylesheets/active_admin.scss +9 -2
  21. data/lib/active_admin/stylesheets/active_admin/_forms.scss +2 -2
  22. data/lib/active_admin/version.rb +1 -1
  23. data/lib/active_admin/view_helpers/filter_form_helper.rb +1 -1
  24. data/lib/active_admin/views/components/table_for.rb +1 -1
  25. data/lib/active_admin/views/index_as_table.rb +3 -3
  26. data/lib/active_admin/views/pages/base.rb +8 -1
  27. data/lib/active_admin/views/pages/dashboard.rb +0 -2
  28. data/lib/active_admin/views/pages/index.rb +3 -1
  29. data/lib/active_admin/views/templates/active_admin/devise/sessions/new.html.erb +1 -1
  30. data/lib/active_admin/views/templates/layouts/active_admin_logged_out.html.erb +1 -1
  31. data/lib/generators/active_admin/devise/devise_generator.rb +7 -3
  32. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +7 -6
  33. data/lib/generators/active_admin/install/templates/dashboards.rb +4 -3
  34. data/spec/{integration → controllers}/index_as_csv_spec.rb +8 -13
  35. data/spec/integration/belongs_to_spec.rb +1 -1
  36. data/spec/spec_helper.rb +10 -4
  37. data/spec/support/integration_example_group.rb +0 -4
  38. data/spec/support/rails_template.rb +2 -1
  39. data/spec/unit/action_builder_spec.rb +1 -1
  40. data/spec/unit/action_items_spec.rb +1 -1
  41. data/spec/unit/active_admin_spec.rb +19 -6
  42. data/spec/unit/arbre/html_spec.rb +26 -1
  43. data/spec/unit/asset_registration_spec.rb +1 -1
  44. data/spec/unit/belongs_to_spec.rb +1 -1
  45. data/spec/unit/breadcrumbs_spec.rb +1 -1
  46. data/spec/unit/comments_spec.rb +1 -1
  47. data/spec/unit/controller_filters_spec.rb +1 -1
  48. data/spec/unit/dashboard_controller_spec.rb +1 -1
  49. data/spec/unit/dashboard_section_spec.rb +1 -1
  50. data/spec/unit/dashboards_spec.rb +1 -1
  51. data/spec/unit/filter_form_builder_spec.rb +1 -1
  52. data/spec/unit/form_builder_spec.rb +1 -1
  53. data/spec/unit/menu_item_spec.rb +1 -1
  54. data/spec/unit/menu_spec.rb +1 -1
  55. data/spec/unit/namespace_spec.rb +1 -1
  56. data/spec/unit/registration_spec.rb +1 -1
  57. data/spec/unit/renderer_spec.rb +1 -1
  58. data/spec/unit/resource_controller/collection_spec.rb +34 -0
  59. data/spec/unit/resource_controller_spec.rb +1 -1
  60. data/spec/unit/resource_spec.rb +23 -2
  61. data/spec/unit/routing_spec.rb +1 -1
  62. data/spec/unit/tabs_renderer_spec.rb +1 -1
  63. metadata +36 -13
  64. data/spec/integration/dashboard_spec.rb +0 -44
  65. data/spec/integration/index_as_table_spec.rb +0 -41
  66. data/spec/integration/layout_spec.rb +0 -48
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe ActiveAdmin::ResourceController do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module ActiveAdmin
4
4
  describe Resource do
@@ -43,13 +43,24 @@ module ActiveAdmin
43
43
  it "should return the plural version" do
44
44
  config.plural_resource_name.should == "Categories"
45
45
  end
46
- context "when the :as option is give" do
46
+ context "when the :as option is given" do
47
47
  it "should return the custom name" do
48
48
  config(:as => "My Category").resource_name.should == "My Category"
49
49
  end
50
50
  end
51
51
  end
52
52
 
53
+ describe "#resource_table_name" do
54
+ it "should return the resource's table name" do
55
+ config.resource_table_name.should == 'categories'
56
+ end
57
+ context "when the :as option is given" do
58
+ it "should return the resource's table name" do
59
+ config(:as => "My Category").resource_table_name.should == 'categories'
60
+ end
61
+ end
62
+ end
63
+
53
64
  describe "namespace" do
54
65
  it "should return the namespace" do
55
66
  config.namespace.should == namespace
@@ -90,6 +101,16 @@ module ActiveAdmin
90
101
  end
91
102
  end
92
103
 
104
+ describe "menu item name" do
105
+ it "should be the resource name when not set" do
106
+ config.menu_item_name.should == "Categories"
107
+ end
108
+ it "should be settable" do
109
+ config.menu :label => "My Label"
110
+ config.menu_item_name.should == "My Label"
111
+ end
112
+ end
113
+
93
114
  describe "parent menu item name" do
94
115
  it "should be nil when not set" do
95
116
  config.parent_menu_item_name.should == nil
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe ActiveAdmin, "Routing" do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe ActiveAdmin::Views::TabsRenderer do
4
4
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: activeadmin
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Greg Bell
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-12 00:00:00 Z
13
+ date: 2011-05-27 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -79,13 +79,13 @@ dependencies:
79
79
  prerelease: false
80
80
  version_requirements: *id006
81
81
  - !ruby/object:Gem::Dependency
82
- name: haml
82
+ name: sass
83
83
  requirement: &id007 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ">="
87
87
  - !ruby/object:Gem::Version
88
- version: 3.0.18
88
+ version: 3.1.0
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: *id007
@@ -111,6 +111,28 @@ dependencies:
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: *id009
114
+ - !ruby/object:Gem::Dependency
115
+ name: rake
116
+ requirement: &id010 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - "="
120
+ - !ruby/object:Gem::Version
121
+ version: 0.8.7
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: *id010
125
+ - !ruby/object:Gem::Dependency
126
+ name: haml
127
+ requirement: &id011 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ version: 3.1.1
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: *id011
114
136
  description: The administration framework for Ruby on Rails.
115
137
  email: gregdbell@gmail.com
116
138
  executables: []
@@ -131,6 +153,7 @@ files:
131
153
  - cucumber.yml
132
154
  - features/comments/commenting.feature
133
155
  - features/comments/viewing_index.feature
156
+ - features/dashboard.feature
134
157
  - features/edit_page.feature
135
158
  - features/first_boot.feature
136
159
  - features/global_navigation.feature
@@ -141,6 +164,7 @@ files:
141
164
  - features/index/index_as_table.feature
142
165
  - features/index/index_scopes.feature
143
166
  - features/index/pagination.feature
167
+ - features/menu.feature
144
168
  - features/new_page.feature
145
169
  - features/registering_assets.feature
146
170
  - features/registering_resources.feature
@@ -154,15 +178,18 @@ files:
154
178
  - features/step_definitions/attribute_steps.rb
155
179
  - features/step_definitions/comment_steps.rb
156
180
  - features/step_definitions/configuration_steps.rb
181
+ - features/step_definitions/dashboard_steps.rb
157
182
  - features/step_definitions/factory_steps.rb
158
183
  - features/step_definitions/flash_steps.rb
159
184
  - features/step_definitions/format_steps.rb
160
185
  - features/step_definitions/index_scope_steps.rb
186
+ - features/step_definitions/menu_steps.rb
161
187
  - features/step_definitions/pagination_steps.rb
162
188
  - features/step_definitions/sidebar_steps.rb
163
189
  - features/step_definitions/tab_steps.rb
164
190
  - features/step_definitions/user_steps.rb
165
191
  - features/step_definitions/web_steps.rb
192
+ - features/sti_resource.feature
166
193
  - features/support/env.rb
167
194
  - features/support/paths.rb
168
195
  - features/users/logging_in.feature
@@ -310,11 +337,8 @@ files:
310
337
  - lib/generators/active_admin/install/templates/migrations/2_move_admin_notes_to_comments.rb
311
338
  - lib/generators/active_admin/resource/resource_generator.rb
312
339
  - lib/generators/active_admin/resource/templates/admin.rb
340
+ - spec/controllers/index_as_csv_spec.rb
313
341
  - spec/integration/belongs_to_spec.rb
314
- - spec/integration/dashboard_spec.rb
315
- - spec/integration/index_as_csv_spec.rb
316
- - spec/integration/index_as_table_spec.rb
317
- - spec/integration/layout_spec.rb
318
342
  - spec/spec_helper.rb
319
343
  - spec/support/integration_example_group.rb
320
344
  - spec/support/rails_template.rb
@@ -354,6 +378,7 @@ files:
354
378
  - spec/unit/pretty_format_spec.rb
355
379
  - spec/unit/registration_spec.rb
356
380
  - spec/unit/renderer_spec.rb
381
+ - spec/unit/resource_controller/collection_spec.rb
357
382
  - spec/unit/resource_controller_spec.rb
358
383
  - spec/unit/resource_spec.rb
359
384
  - spec/unit/routing_spec.rb
@@ -373,7 +398,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
373
398
  requirements:
374
399
  - - ">="
375
400
  - !ruby/object:Gem::Version
376
- hash: -2250250716977270514
401
+ hash: 1760359075122338459
377
402
  segments:
378
403
  - 0
379
404
  version: "0"
@@ -391,11 +416,8 @@ signing_key:
391
416
  specification_version: 3
392
417
  summary: The administration framework for Ruby on Rails.
393
418
  test_files:
419
+ - spec/controllers/index_as_csv_spec.rb
394
420
  - spec/integration/belongs_to_spec.rb
395
- - spec/integration/dashboard_spec.rb
396
- - spec/integration/index_as_csv_spec.rb
397
- - spec/integration/index_as_table_spec.rb
398
- - spec/integration/layout_spec.rb
399
421
  - spec/spec_helper.rb
400
422
  - spec/support/integration_example_group.rb
401
423
  - spec/support/rails_template.rb
@@ -435,6 +457,7 @@ test_files:
435
457
  - spec/unit/pretty_format_spec.rb
436
458
  - spec/unit/registration_spec.rb
437
459
  - spec/unit/renderer_spec.rb
460
+ - spec/unit/resource_controller/collection_spec.rb
438
461
  - spec/unit/resource_controller_spec.rb
439
462
  - spec/unit/resource_spec.rb
440
463
  - spec/unit/routing_spec.rb
@@ -1,44 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe ActiveAdmin, "rendering the dashboard" do
4
-
5
- # Setup a controller spec
6
- include RSpec::Rails::ControllerExampleGroup
7
- render_views
8
- metadata[:behaviour][:describes] = Admin::DashboardController
9
-
10
- before :all do
11
- load_defaults!
12
- reload_routes!
13
- end
14
-
15
- context "when no configuration" do
16
- before do
17
- get :index
18
- end
19
- it "should render the default message" do
20
- response.should have_tag("p", :attributes => { :id => "dashboard_default_message" })
21
- end
22
- end
23
-
24
- context "when one configuration" do
25
- before do
26
- ActiveAdmin.dashboard_section 'Hello World' do
27
- content_tag :p, "Hello world from the content"
28
- end
29
- get :index
30
- end
31
- it "should render the section's title" do
32
- response.should have_tag("h3", "Hello World")
33
- end
34
- it "should render the section's content" do
35
- response.should have_tag("p", "Hello world from the content")
36
- end
37
- end
38
-
39
- context "when many configurations" do
40
- it "should render each section"
41
- it "should render the sections by priority, then alpha"
42
- end
43
-
44
- end
@@ -1,41 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe_with_render "Index as Table" do
4
-
5
- before :all do
6
- load_defaults!
7
- reload_routes!
8
- end
9
-
10
- describe "ordering get #index" do
11
- before(:each) do
12
- @yesterday = Post.create :title => "Yesterday", :created_at => Time.now - 1.day
13
- @today = Post.create :title => "Today"
14
- end
15
- it "should sort ascending" do
16
- get :index, 'order' => 'created_at_asc'
17
- response.body.scan(/Yesterday|Today/).should == ["Yesterday", "Today"]
18
- end
19
- it "should sort descending" do
20
- get :index, 'order' => 'created_at_desc'
21
- response.body.scan(/Yesterday|Today/).should == ["Today", "Yesterday"]
22
- end
23
- end
24
-
25
- describe "searching" do
26
- before do
27
- Post.create :title => "Hello World"
28
- Post.create :title => "Goodbye World"
29
- get :index, 'q' => { 'title_like' => 'hello' }
30
- end
31
- it "should find posts based on search" do
32
- response.body.should include("Hello World")
33
- end
34
- it "should not includes posts that don't meet the search" do
35
- response.body.should_not include("Goodbye")
36
- end
37
- it "should set @search for the view" do
38
- assigns["search"].should_not be_nil
39
- end
40
- end
41
- end
@@ -1,48 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe_with_render "Layout" do
4
-
5
- before do
6
- load_defaults!
7
- end
8
-
9
- it "should include active admin vendor js" do
10
- get :index
11
- response.should have_tag("script", :attributes => { :src => '/javascripts/active_admin_vendor.js' })
12
- end
13
-
14
- it "should include active admin js" do
15
- get :index
16
- response.should have_tag("script", :attributes => { :src => '/javascripts/active_admin.js' })
17
- end
18
-
19
- it "should display the site title" do
20
- get :index
21
- response.should have_tag("h1", ActiveAdmin.site_title)
22
- end
23
-
24
- describe "csrf meta tags" do
25
- # Turn on then off protect against forgery so that our tests
26
- # will render the required meta tags
27
- before(:each) do
28
- class Admin::PostsController
29
- def protect_against_forgery_with_mock?; true; end
30
- alias_method_chain :protect_against_forgery?, :mock
31
- end
32
- end
33
- after(:each) do
34
- Admin::PostsController.send :alias_method, :protect_against_forgery?, :protect_against_forgery_without_mock?
35
- end
36
- it "should include the csrf-param meta tag" do
37
- self.class.metadata[:behaviour][:describes] = Admin::PostsController
38
- get :index
39
- response.should have_tag("meta", :attributes => { :name => "csrf-param" })
40
- end
41
- it "should include the csrf-token meta tag" do
42
- self.class.metadata[:behaviour][:describes] = Admin::PostsController
43
- get :index
44
- response.should have_tag("meta", :attributes => { :name => "csrf-token" })
45
- end
46
- end
47
-
48
- end