activeadmin 0.4.0 → 0.4.1

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 (57) hide show
  1. data/CHANGELOG.md +46 -0
  2. data/Gemfile +1 -0
  3. data/README.rdoc +1 -1
  4. data/activeadmin.gemspec +1 -1
  5. data/app/assets/stylesheets/active_admin/_base.css.scss +2 -1
  6. data/app/assets/stylesheets/active_admin/components/_columns.scss +3 -0
  7. data/app/assets/stylesheets/active_admin/mixins/_sections.css.scss +1 -1
  8. data/app/views/active_admin/devise/sessions/new.html.erb +1 -1
  9. data/docs/2-resource-customization.md +13 -0
  10. data/docs/3-index-pages.md +23 -0
  11. data/docs/3-index-pages/index-as-grid.md +2 -2
  12. data/docs/7-sidebars.md +7 -0
  13. data/docs/8-custom-actions.md +6 -0
  14. data/features/action_item.feature +73 -0
  15. data/features/index/filters.feature +55 -22
  16. data/features/index/index_parameters.feature +12 -0
  17. data/features/index/index_scope_to.feature +29 -0
  18. data/features/index/index_scopes.feature +13 -0
  19. data/features/index/pagination.feature +14 -5
  20. data/features/sidebar_sections.feature +45 -0
  21. data/features/step_definitions/action_item_steps.rb +4 -0
  22. data/features/step_definitions/factory_steps.rb +3 -2
  23. data/features/step_definitions/filter_steps.rb +17 -0
  24. data/features/step_definitions/format_steps.rb +4 -0
  25. data/features/step_definitions/index_scope_steps.rb +5 -0
  26. data/lib/active_admin/arbre/html/tag.rb +9 -1
  27. data/lib/active_admin/helpers/optional_display.rb +13 -3
  28. data/lib/active_admin/locales/da.yml +15 -0
  29. data/lib/active_admin/locales/es.yml +18 -2
  30. data/lib/active_admin/locales/he_il.yml +45 -0
  31. data/lib/active_admin/menu_item.rb +0 -21
  32. data/lib/active_admin/page.rb +9 -0
  33. data/lib/active_admin/page_controller.rb +4 -0
  34. data/lib/active_admin/page_dsl.rb +7 -0
  35. data/lib/active_admin/reloader.rb +0 -1
  36. data/lib/active_admin/resource.rb +6 -0
  37. data/lib/active_admin/resource/action_items.rb +2 -2
  38. data/lib/active_admin/resource/pagination.rb +19 -0
  39. data/lib/active_admin/resource/sidebars.rb +2 -2
  40. data/lib/active_admin/resource_controller/callbacks.rb +13 -1
  41. data/lib/active_admin/resource_controller/collection.rb +17 -10
  42. data/lib/active_admin/router.rb +3 -0
  43. data/lib/active_admin/version.rb +1 -1
  44. data/lib/active_admin/views/components/columns.rb +115 -12
  45. data/lib/active_admin/views/components/scopes.rb +4 -4
  46. data/lib/active_admin/views/index_as_table.rb +14 -2
  47. data/lib/active_admin/views/pages/base.rb +2 -2
  48. data/lib/active_admin/views/pages/index.rb +25 -13
  49. data/lib/active_admin/views/tabbed_navigation.rb +14 -2
  50. data/spec/unit/menu_item_spec.rb +0 -14
  51. data/spec/unit/namespace/register_resource_spec.rb +1 -1
  52. data/spec/unit/resource/pagination_spec.rb +38 -0
  53. data/spec/unit/resource_controller/collection_spec.rb +1 -1
  54. data/spec/unit/views/components/columns_spec.rb +61 -4
  55. data/spec/unit/views/tabbed_navigation_spec.rb +2 -2
  56. metadata +20 -11
  57. data/features/index/filter_with_check_boxes.feature +0 -25
@@ -26,7 +26,7 @@ describe ActiveAdmin::ResourceController::Collection do
26
26
  let(:params){ {:order => "id_asc" }}
27
27
  it "should prepend the table name" do
28
28
  chain = mock("ChainObj")
29
- chain.should_receive(:order).with("\"posts\".id asc").once.and_return(Post.search)
29
+ chain.should_receive(:order).with("\"posts\".\"id\" asc").once.and_return(Post.search)
30
30
  controller.send :sort_order, chain
31
31
  end
32
32
  end
@@ -20,8 +20,8 @@ describe ActiveAdmin::Views::Columns do
20
20
  cols.children.first.class_list.should include("column")
21
21
  end
22
22
 
23
- it "should have one column with the width 100%" do
24
- cols.children.first.attr(:style).should include("width: 100%")
23
+ it "should have one column with the width 100.0%" do
24
+ cols.children.first.attr(:style).should include("width: 100.0%")
25
25
  end
26
26
  end
27
27
 
@@ -38,11 +38,11 @@ describe ActiveAdmin::Views::Columns do
38
38
  end
39
39
 
40
40
  it "should have a first column with width 49% and margin 2%" do
41
- cols.children.first.attr(:style).should == "width: 49%; margin-right: 2%;"
41
+ cols.children.first.attr(:style).should == "width: 49.0%; margin-right: 2%;"
42
42
  end
43
43
 
44
44
  it "should have a second column with width 49% and no right margin" do
45
- cols.children.last.attr(:style).should == "width: 49%;"
45
+ cols.children.last.attr(:style).should == "width: 49.0%;"
46
46
  end
47
47
  end
48
48
 
@@ -72,4 +72,61 @@ describe ActiveAdmin::Views::Columns do
72
72
  end
73
73
  end
74
74
 
75
+
76
+ describe "Column Spans" do
77
+ let(:cols) do
78
+ columns do
79
+ column(:span => 2){ "Hello World" }
80
+ column(){ "Hello World" }
81
+ column(){ "Hello World" }
82
+ end
83
+ end
84
+
85
+ it "should set the span when declared" do
86
+ cols.children.first.attr(:style).should == "width: 49.0%; margin-right: 2%;"
87
+ end
88
+
89
+ it "should default to 1 if not passed in" do
90
+ cols.children.last.attr(:style).should == "width: 23.5%;"
91
+ end
92
+ end
93
+
94
+ describe "Column max width" do
95
+
96
+ let(:cols) do
97
+ columns do
98
+ column(:max_width => "100px"){ "Hello World" }
99
+ column(){ "Hello World" }
100
+ end
101
+ end
102
+
103
+ it "should set the max with if passed in" do
104
+ cols.children.first.attr(:style).should == "width: 49.0%; max-width: 100px; margin-right: 2%;"
105
+ end
106
+
107
+ it "should omit the value if not presetn" do
108
+ cols.children.last.attr(:style).should == "width: 49.0%;"
109
+ end
110
+
111
+ end
112
+
113
+ describe "Column min width" do
114
+
115
+ let(:cols) do
116
+ columns do
117
+ column(:min_width => "100px"){ "Hello World" }
118
+ column(){ "Hello World" }
119
+ end
120
+ end
121
+
122
+ it "should set the min with if passed in" do
123
+ cols.children.first.attr(:style).should == "width: 49.0%; min-width: 100px; margin-right: 2%;"
124
+ end
125
+
126
+ it "should omit the value if not presetn" do
127
+ cols.children.last.attr(:style).should == "width: 49.0%;"
128
+ end
129
+
130
+ end
131
+
75
132
  end
@@ -16,7 +16,7 @@ describe ActiveAdmin::Views::TabbedNavigation do
16
16
  describe "rendering a menu" do
17
17
 
18
18
  before do
19
- menu.add "Blog Posts", "/admin/blog-posts"
19
+ menu.add "Blog Posts", :admin_posts_path
20
20
  menu.add "Reports", "/admin/reports"
21
21
  reports = menu["Reports"]
22
22
  reports.add "A Sub Reports", "/admin/a-sub-reports"
@@ -39,7 +39,7 @@ describe ActiveAdmin::Views::TabbedNavigation do
39
39
  end
40
40
 
41
41
  it "should generate a link for each item" do
42
- html.should have_tag("a", "Blog Posts", :attributes => { :href => '/admin/blog-posts' })
42
+ html.should have_tag("a", "Blog Posts", :attributes => { :href => '/admin/posts' })
43
43
  end
44
44
 
45
45
  it "should generate a nested list for children" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Greg Bell
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-30 00:00:00 Z
18
+ date: 2012-02-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -117,14 +117,12 @@ dependencies:
117
117
  version_requirements: &id007 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
- - - <
120
+ - - ">"
121
121
  - !ruby/object:Gem::Version
122
- hash: 27
122
+ hash: 3
123
123
  segments:
124
- - 1
125
- - 3
126
124
  - 0
127
- version: 1.3.0
125
+ version: "0"
128
126
  requirement: *id007
129
127
  prerelease: false
130
128
  name: inherited_resources
@@ -217,6 +215,7 @@ files:
217
215
  - app/assets/stylesheets/active_admin/components/_blank_slates.scss
218
216
  - app/assets/stylesheets/active_admin/components/_breadcrumbs.scss
219
217
  - app/assets/stylesheets/active_admin/components/_buttons.scss
218
+ - app/assets/stylesheets/active_admin/components/_columns.scss
220
219
  - app/assets/stylesheets/active_admin/components/_comments.css.scss
221
220
  - app/assets/stylesheets/active_admin/components/_date_picker.css.scss
222
221
  - app/assets/stylesheets/active_admin/components/_flash_messages.css.scss
@@ -275,6 +274,7 @@ files:
275
274
  - docs/7-sidebars.md
276
275
  - docs/8-custom-actions.md
277
276
  - docs/9-custom-pages.md
277
+ - features/action_item.feature
278
278
  - features/belongs_to.feature
279
279
  - features/comments/commenting.feature
280
280
  - features/comments/viewing_index.feature
@@ -283,7 +283,6 @@ files:
283
283
  - features/edit_page.feature
284
284
  - features/first_boot.feature
285
285
  - features/global_navigation.feature
286
- - features/index/filter_with_check_boxes.feature
287
286
  - features/index/filters.feature
288
287
  - features/index/format_as_csv.feature
289
288
  - features/index/formats.feature
@@ -292,6 +291,8 @@ files:
292
291
  - features/index/index_as_grid.feature
293
292
  - features/index/index_as_table.feature
294
293
  - features/index/index_blank_slate.feature
294
+ - features/index/index_parameters.feature
295
+ - features/index/index_scope_to.feature
295
296
  - features/index/index_scopes.feature
296
297
  - features/index/pagination.feature
297
298
  - features/menu.feature
@@ -313,6 +314,7 @@ files:
313
314
  - features/step_definitions/configuration_steps.rb
314
315
  - features/step_definitions/dashboard_steps.rb
315
316
  - features/step_definitions/factory_steps.rb
317
+ - features/step_definitions/filter_steps.rb
316
318
  - features/step_definitions/flash_steps.rb
317
319
  - features/step_definitions/format_steps.rb
318
320
  - features/step_definitions/index_scope_steps.rb
@@ -392,6 +394,7 @@ files:
392
394
  - lib/active_admin/locales/en.yml
393
395
  - lib/active_admin/locales/es.yml
394
396
  - lib/active_admin/locales/fr.yml
397
+ - lib/active_admin/locales/he_il.yml
395
398
  - lib/active_admin/locales/hr.yml
396
399
  - lib/active_admin/locales/hu.yml
397
400
  - lib/active_admin/locales/it.yml
@@ -421,6 +424,7 @@ files:
421
424
  - lib/active_admin/resource/menu.rb
422
425
  - lib/active_admin/resource/naming.rb
423
426
  - lib/active_admin/resource/page_presenters.rb
427
+ - lib/active_admin/resource/pagination.rb
424
428
  - lib/active_admin/resource/scopes.rb
425
429
  - lib/active_admin/resource/sidebars.rb
426
430
  - lib/active_admin/resource_collection.rb
@@ -557,6 +561,7 @@ files:
557
561
  - spec/unit/resource/menu_spec.rb
558
562
  - spec/unit/resource/naming_spec.rb
559
563
  - spec/unit/resource/page_presenters_spec.rb
564
+ - spec/unit/resource/pagination_spec.rb
560
565
  - spec/unit/resource/scopes_spec.rb
561
566
  - spec/unit/resource/sidebars_spec.rb
562
567
  - spec/unit/resource_collection_spec.rb
@@ -615,6 +620,7 @@ signing_key:
615
620
  specification_version: 3
616
621
  summary: The administration framework for Ruby on Rails.
617
622
  test_files:
623
+ - features/action_item.feature
618
624
  - features/belongs_to.feature
619
625
  - features/comments/commenting.feature
620
626
  - features/comments/viewing_index.feature
@@ -623,7 +629,6 @@ test_files:
623
629
  - features/edit_page.feature
624
630
  - features/first_boot.feature
625
631
  - features/global_navigation.feature
626
- - features/index/filter_with_check_boxes.feature
627
632
  - features/index/filters.feature
628
633
  - features/index/format_as_csv.feature
629
634
  - features/index/formats.feature
@@ -632,6 +637,8 @@ test_files:
632
637
  - features/index/index_as_grid.feature
633
638
  - features/index/index_as_table.feature
634
639
  - features/index/index_blank_slate.feature
640
+ - features/index/index_parameters.feature
641
+ - features/index/index_scope_to.feature
635
642
  - features/index/index_scopes.feature
636
643
  - features/index/pagination.feature
637
644
  - features/menu.feature
@@ -653,6 +660,7 @@ test_files:
653
660
  - features/step_definitions/configuration_steps.rb
654
661
  - features/step_definitions/dashboard_steps.rb
655
662
  - features/step_definitions/factory_steps.rb
663
+ - features/step_definitions/filter_steps.rb
656
664
  - features/step_definitions/flash_steps.rb
657
665
  - features/step_definitions/format_steps.rb
658
666
  - features/step_definitions/index_scope_steps.rb
@@ -731,6 +739,7 @@ test_files:
731
739
  - spec/unit/resource/menu_spec.rb
732
740
  - spec/unit/resource/naming_spec.rb
733
741
  - spec/unit/resource/page_presenters_spec.rb
742
+ - spec/unit/resource/pagination_spec.rb
734
743
  - spec/unit/resource/scopes_spec.rb
735
744
  - spec/unit/resource/sidebars_spec.rb
736
745
  - spec/unit/resource_collection_spec.rb
@@ -1,25 +0,0 @@
1
- Feature: Filter with check boxes
2
-
3
- Background:
4
- Given an index configuration of:
5
- """
6
- ActiveAdmin.register Post do
7
- filter :author, :as => :check_boxes
8
- end
9
- """
10
- And a post with the title "Hello World" written by "Jane Doe" exists
11
- And 1 post exists
12
- And I am on the index page for posts
13
-
14
- Scenario: Filtering posts written by anyone
15
- When I press "Filter"
16
- Then I should see 2 posts in the table
17
- And I should see "Hello World" within ".index_table"
18
- And the "jane_doe" checkbox should not be checked
19
-
20
- Scenario: Filtering posts written by Jane Doe
21
- When I check "jane_doe"
22
- And I press "Filter"
23
- Then I should see 1 posts in the table
24
- And I should see "Hello World" within ".index_table"
25
- And the "jane_doe" checkbox should be checked