andrewroth_activeadmin 0.3.4.3 → 0.3.4.4

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.
Files changed (42) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +18 -32
  3. data/Gemfile +5 -7
  4. data/activeadmin.gemspec +1 -1
  5. data/features/step_definitions/additional_web_steps.rb +3 -3
  6. data/features/step_definitions/asset_steps.rb +1 -1
  7. data/features/step_definitions/comment_steps.rb +3 -3
  8. data/features/step_definitions/configuration_steps.rb +5 -5
  9. data/features/step_definitions/dashboard_steps.rb +2 -2
  10. data/features/step_definitions/index_scope_steps.rb +5 -5
  11. data/features/step_definitions/pagination_steps.rb +2 -2
  12. data/features/step_definitions/tab_steps.rb +1 -1
  13. data/features/step_definitions/user_steps.rb +1 -1
  14. data/features/step_definitions/web_steps.rb +4 -4
  15. data/lib/active_admin/arbre.rb +0 -1
  16. data/lib/active_admin/arbre/builder.rb +8 -5
  17. data/lib/active_admin/arbre/context.rb +1 -1
  18. data/lib/active_admin/arbre/html/attributes.rb +1 -1
  19. data/lib/active_admin/arbre/html/class_list.rb +0 -4
  20. data/lib/active_admin/arbre/html/collection.rb +2 -2
  21. data/lib/active_admin/arbre/html/document.rb +1 -1
  22. data/lib/active_admin/arbre/html/element.rb +5 -9
  23. data/lib/active_admin/arbre/html/tag.rb +3 -3
  24. data/lib/active_admin/arbre/html/text_node.rb +2 -2
  25. data/lib/active_admin/locales/de.yml +1 -0
  26. data/lib/active_admin/menu_item.rb +25 -17
  27. data/lib/active_admin/resource_controller/collection.rb +1 -1
  28. data/lib/active_admin/version.rb +1 -1
  29. data/lib/active_admin/views/components/columns.rb +4 -4
  30. data/script/use_rails +14 -7
  31. data/spec/spec_helper.rb +5 -11
  32. data/spec/spec_helper_without_rails.rb +10 -0
  33. data/spec/support/detect_rails_version.rb +22 -3
  34. data/spec/unit/arbre/context_spec.rb +1 -1
  35. data/spec/unit/arbre/html/element_spec.rb +5 -5
  36. data/spec/unit/arbre/html/tag_attributes_spec.rb +3 -3
  37. data/spec/unit/arbre/html_spec.rb +32 -22
  38. data/spec/unit/menu_item_spec.rb +25 -20
  39. data/spec/unit/views/tabbed_navigation_spec.rb +2 -1
  40. data/tasks/test.rake +15 -13
  41. metadata +10 -9
  42. data/lib/active_admin/arbre/core_extensions.rb +0 -5
data/.gitignore CHANGED
@@ -33,3 +33,4 @@ test-rails*
33
33
  public
34
34
  .rvmrc
35
35
  .rspec
36
+ .rails-version
@@ -10,6 +10,8 @@ since we've changed both the CSS and JS files.
10
10
  * In the initializer `config.allow_comments_in = []` is now
11
11
  `config.allow_comments = true`. Use the new namespace specific configurations
12
12
  to allow or disallow configuration within a specific namespace.
13
+ * Removed `Object#to_html` in favour of `to_s`. Any Arbre components
14
+ implementing a `to_html` method need to be updated to use `to_s` instead.
13
15
 
14
16
  ### New Features
15
17
 
@@ -47,6 +49,9 @@ since we've changed both the CSS and JS files.
47
49
  * [#780][]: Fix stack level too deep exception when logout path is setup to use
48
50
  `:logout_path` named route. ([@george][])
49
51
  * [#637][]: Fix scope all I18n ([@fbuenemann][])
52
+ * [#496][]: Remove global `Object#to_html` [@ebeigarts][]
53
+ * [#470][], [#154][]: Arbre properly supports blocks that return Numeric values
54
+ ([@bobbytables][], [@utkarshkukreti][], [@gregbell][])
50
55
 
51
56
  ### Dependencies
52
57
 
@@ -57,6 +62,9 @@ since we've changed both the CSS and JS files.
57
62
  * [#711][]: Active admin now depends on Bourbon > 1.0.0. If you're using Rails
58
63
  3.0.x, make sure to run `rails generate active_admin:assets` to ensure you
59
64
  have the correct css files ([@mattvague][])
65
+ * [#869][]: Upgraded Kaminari to >= 0.13.0 and added support for
66
+ `Kaminari.config.page_method_name`. Active Admin should now be happy if
67
+ `will_paginate` is installed with it. ([@j][]-manu)
60
68
 
61
69
  ### Contributors
62
70
 
@@ -123,36 +131,6 @@ since we've changed both the CSS and JS files.
123
131
 
124
132
  * Greg Bell
125
133
 
126
- ## 0.3.4
127
-
128
- 2 commits by 2 authors
129
-
130
- ### Bug Fixes
131
-
132
- * Fix reloading issues across operating systems.
133
- * Fix issue where SASS was recompiling on every request. This can seriously
134
- decrease the load time of applications when running in development mode.
135
- Thanks @dhiemstra for tracking this one down!
136
-
137
- ### Contributors
138
-
139
- * Danny Hiemstra
140
- * Greg Bell
141
-
142
- ## 0.3.3
143
-
144
- 1 commit by 1 author
145
-
146
- ### Enhancements
147
-
148
- * Only reload Active Admin when files in the load paths have changed. This is a
149
- major speed increase in development mode. Also helps with memory consumption
150
- because we aren't reloading Active admin all the time.
151
-
152
- ### Contributors
153
-
154
- * Greg Bell
155
-
156
134
  ## 0.3.2
157
135
 
158
136
  45 commits by 15 contributors
@@ -399,6 +377,7 @@ of the highlights. 250 commits. Enough said.
399
377
  [#122]: https://github.com/gregbell/active_admin/issues/122
400
378
  [#131]: https://github.com/gregbell/active_admin/issues/131
401
379
  [#135]: https://github.com/gregbell/active_admin/issues/135
380
+ [#154]: https://github.com/gregbell/active_admin/issues/154
402
381
  [#171]: https://github.com/gregbell/active_admin/issues/171
403
382
  [#186]: https://github.com/gregbell/active_admin/issues/186
404
383
  [#197]: https://github.com/gregbell/active_admin/issues/197
@@ -411,6 +390,8 @@ of the highlights. 250 commits. Enough said.
411
390
  [#381]: https://github.com/gregbell/active_admin/issues/381
412
391
  [#428]: https://github.com/gregbell/active_admin/issues/428
413
392
  [#468]: https://github.com/gregbell/active_admin/issues/468
393
+ [#470]: https://github.com/gregbell/active_admin/issues/470
394
+ [#496]: https://github.com/gregbell/active_admin/issues/496
414
395
  [#505]: https://github.com/gregbell/active_admin/issues/505
415
396
  [#527]: https://github.com/gregbell/active_admin/issues/527
416
397
  [#551]: https://github.com/gregbell/active_admin/issues/551
@@ -425,12 +406,15 @@ of the highlights. 250 commits. Enough said.
425
406
  [#644]: https://github.com/gregbell/active_admin/issues/644
426
407
  [#689]: https://github.com/gregbell/active_admin/issues/689
427
408
  [#711]: https://github.com/gregbell/active_admin/issues/711
409
+ [#723]: https://github.com/gregbell/active_admin/issues/723
428
410
  [#741]: https://github.com/gregbell/active_admin/issues/741
429
411
  [#751]: https://github.com/gregbell/active_admin/issues/751
430
412
  [#758]: https://github.com/gregbell/active_admin/issues/758
431
413
  [#780]: https://github.com/gregbell/active_admin/issues/780
414
+ [#869]: https://github.com/gregbell/active_admin/issues/869
432
415
  [@DMajrekar]: https://github.com/DMajrekar
433
416
  [@ZequeZ]: https://github.com/ZequeZ
417
+ [@bobbytables]: https://github.com/bobbytables
434
418
  [@dhiemstra]: https://github.com/dhiemstra
435
419
  [@doug316]: https://github.com/doug316
436
420
  [@ebeigarts]: https://github.com/ebeigarts
@@ -439,6 +423,7 @@ of the highlights. 250 commits. Enough said.
439
423
  [@fbuenemann]: https://github.com/fbuenemann
440
424
  [@george]: https://github.com/george
441
425
  [@gregbell]: https://github.com/gregbell
426
+ [@j]: https://github.com/j
442
427
  [@jbarket]: https://github.com/jbarket
443
428
  [@knoopx]: https://github.com/knoopx
444
429
  [@krug]: https://github.com/krug
@@ -453,5 +438,6 @@ of the highlights. 250 commits. Enough said.
453
438
  [@sftsang]: https://github.com/sftsang
454
439
  [@shayfrendt]: https://github.com/shayfrendt
455
440
  [@tricknotes]: https://github.com/tricknotes
456
- [@vairix]: https://github.com/vairix-ssierra
457
- [@watson]: https://github.com/watson
441
+ [@utkarshkukreti]: https://github.com/utkarshkukreti
442
+ [@vairix]: https://github.com/vairix
443
+ [@watson]: https://github.com/watson
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ gemspec
4
4
 
5
5
  require File.expand_path('../spec/support/detect_rails_version', __FILE__)
6
6
 
7
- rails_version = ENV['RAILS'] || detect_rails_version || "3.1.0"
7
+ rails_version = detect_rails_version
8
8
  gem 'rails', rails_version
9
9
 
10
10
  case rails_version
@@ -20,18 +20,16 @@ end
20
20
 
21
21
  group :development, :test do
22
22
  gem 'sqlite3-ruby', :require => 'sqlite3'
23
- gem 'rake', '0.8.7', :require => false
23
+ gem 'rake', '~> 0.9.2.2', :require => false
24
24
  gem 'haml', '~> 3.1.1', :require => false
25
25
  gem 'yard'
26
26
  gem 'rdiscount' # For yard
27
27
  end
28
28
 
29
29
  group :test do
30
- gem 'rspec', '~> 2.6.0'
31
- gem 'rspec-rails', '~> 2.6.0'
32
- gem 'capybara', '1.0.0'
33
- gem 'cucumber', '0.10.6'
34
- gem 'cucumber-rails', '0.5.2'
30
+ gem 'rspec-rails', '~> 2.8.1'
31
+ gem 'cucumber-rails', '1.2.1'
32
+ gem 'capybara', '1.1.2'
35
33
  gem 'database_cleaner'
36
34
  gem 'shoulda', '2.11.2', :require => nil
37
35
  gem 'launchy'
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency("devise", ">= 1.1.2")
25
25
  s.add_dependency("formtastic", ">= 2.0.0")
26
26
  s.add_dependency("inherited_resources", "< 1.3.0")
27
- s.add_dependency("kaminari", ">= 0.12.4")
27
+ s.add_dependency("kaminari", ">= 0.13.0")
28
28
  s.add_dependency("sass", ">= 3.1.0")
29
29
  s.add_dependency("fastercsv", ">= 0")
30
30
  end
@@ -11,7 +11,7 @@ Then /^I should see a sortable table header with "([^"]*)"$/ do |content|
11
11
  end
12
12
 
13
13
  Then /^I should not see a sortable table header$/ do
14
- Then "I should not see \"th.sortable\""
14
+ step "I should not see \"th.sortable\""
15
15
  end
16
16
 
17
17
  Then /^the table "([^"]*)" should have (\d+) rows/ do |selector, count|
@@ -48,7 +48,7 @@ end
48
48
 
49
49
  Then /^an "([^"]*)" exception should be raised when I follow "([^"]*)"$/ do |error, link|
50
50
  lambda {
51
- When "I follow \"#{link}\""
51
+ step "I follow \"#{link}\""
52
52
  }.should raise_error(error.constantize)
53
53
  end
54
54
 
@@ -58,7 +58,7 @@ end
58
58
 
59
59
  Then /^I should wait and see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
60
60
  sleep 1
61
- Then 'show me the page'
61
+ step 'show me the page'
62
62
  selector ||= "*"
63
63
  locate(:xpath, "//#{selector}[text()='#{text}']")
64
64
  end
@@ -1,5 +1,5 @@
1
1
  Then /^I should see the css file "([^"]*)"$/ do |path|
2
- Then %{I should see the css file "#{path}" of media "screen"}
2
+ step %{I should see the css file "#{path}" of media "screen"}
3
3
  end
4
4
 
5
5
  Then /^I should see the css file "([^"]*)" of media "([^"]*)"$/ do |path, media|
@@ -1,8 +1,8 @@
1
1
  Then /^I should see a comment by "([^"]*)"$/ do |name|
2
- Then %{I should see "#{name}" within ".active_admin_comment_author"}
2
+ step %{I should see "#{name}" within ".active_admin_comment_author"}
3
3
  end
4
4
 
5
5
  When /^I add a comment "([^"]*)"$/ do |comment|
6
- When %{I fill in "active_admin_comment_body" with "#{comment}"}
7
- And %{I press "Add Comment"}
6
+ step %{I fill in "active_admin_comment_body" with "#{comment}"}
7
+ step %{I press "Add Comment"}
8
8
  end
@@ -46,16 +46,16 @@ end
46
46
  Given /^an index configuration of:$/ do |configuration_content|
47
47
  load_active_admin_configuration(configuration_content)
48
48
 
49
- And 'I am logged in'
50
- When "I am on the index page for posts"
49
+ step 'I am logged in'
50
+ step "I am on the index page for posts"
51
51
  end
52
52
 
53
53
  Given /^a show configuration of:$/ do |configuration_content|
54
54
  load_active_admin_configuration(configuration_content)
55
55
 
56
- And 'I am logged in'
57
- When "I am on the index page for posts"
58
- And 'I follow "View"'
56
+ step 'I am logged in'
57
+ step "I am on the index page for posts"
58
+ step 'I follow "View"'
59
59
  end
60
60
 
61
61
  Given /^"([^"]*)" contains:$/ do |filename, contents|
@@ -1,9 +1,9 @@
1
1
  Then /^I should see the default welcome message$/ do
2
- Then %{I should see "Welcome to Active Admin" within "#dashboard_default_message"}
2
+ step %{I should see "Welcome to Active Admin" within "#dashboard_default_message"}
3
3
  end
4
4
 
5
5
  Then /^I should not see the default welcome message$/ do
6
- Then %{I should not see "Welcome to Active Admin"}
6
+ step %{I should not see "Welcome to Active Admin"}
7
7
  end
8
8
 
9
9
  Then /^I should see a dashboard widget "([^"]*)"$/ do |name|
@@ -1,22 +1,22 @@
1
1
  Then /^I should see the scope "([^"]*)"$/ do |name|
2
- Then %{I should see "#{name}" within ".scopes"}
2
+ step %{I should see "#{name}" within ".scopes"}
3
3
  end
4
4
 
5
5
  Then /^I should not see the scope "([^"]*)"$/ do |name|
6
- Then %{I should not see "#{name}" within ".scopes"}
6
+ step %{I should not see "#{name}" within ".scopes"}
7
7
  end
8
8
 
9
9
  Then /^I should see the scope "([^"]*)" selected$/ do |name|
10
- Then %{I should see "#{name}" within ".scopes .selected"}
10
+ step %{I should see "#{name}" within ".scopes .selected"}
11
11
  end
12
12
 
13
13
  Then /^I should see the scope "([^"]*)" not selected$/ do |name|
14
- Then %{I should see the scope "#{name}"}
14
+ step %{I should see the scope "#{name}"}
15
15
  page.should_not have_css('.scopes .selected', :text => name)
16
16
  end
17
17
 
18
18
  Then /^I should see the scope "([^"]*)" with the count (\d+)$/ do |name, count|
19
- Then %{I should see "#{count}" within ".scopes .#{name.gsub(" ", "").underscore.downcase} .count"}
19
+ step %{I should see "#{count}" within ".scopes .#{name.gsub(" ", "").underscore.downcase} .count"}
20
20
  end
21
21
 
22
22
  Then /^I should see (\d+) ([\w]*) in the table$/ do |count, resource_type|
@@ -3,6 +3,6 @@ Then /^I should not see pagination$/ do
3
3
  end
4
4
 
5
5
  Then /^I should see pagination with (\d+) pages$/ do |count|
6
- Then %{I should see "#{count}" within ".pagination a"}
7
- Then %{I should not see "#{count.to_i + 1}" within ".pagination a"}
6
+ step %{I should see "#{count}" within ".pagination a"}
7
+ step %{I should not see "#{count.to_i + 1}" within ".pagination a"}
8
8
  end
@@ -1,3 +1,3 @@
1
1
  Then /^the "([^"]*)" tab should be selected$/ do |name|
2
- Then %{I should see "#{name}" within "ul#tabs li.current"}
2
+ step %{I should see "#{name}" within "ul#tabs li.current"}
3
3
  end
@@ -5,7 +5,7 @@ Given /^I am logged out$/ do
5
5
  end
6
6
 
7
7
  Given /^I am logged in$/ do
8
- Given 'an admin user "admin@example.com" exists'
8
+ step 'an admin user "admin@example.com" exists'
9
9
 
10
10
  if page.all(:css, "a", :text => "Logout").size > 0
11
11
  click_link "Logout"
@@ -32,13 +32,13 @@ end
32
32
  World(WithinHelpers)
33
33
 
34
34
  # Single-line step scoper
35
- When /^(.*) within (.*[^:])$/ do |step, parent|
36
- with_scope(parent) { When step }
35
+ When /^(.*) within (.*[^:])$/ do |step_name, parent|
36
+ with_scope(parent) { step step_name }
37
37
  end
38
38
 
39
39
  # Multi-line step scoper
40
- When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
41
- with_scope(parent) { When "#{step}:", table_or_string }
40
+ When /^(.*) within (.*[^:]):$/ do |step_name, parent, table_or_string|
41
+ with_scope(parent) { step "#{step_name}:", table_or_string }
42
42
  end
43
43
 
44
44
  Given /^(?:|I )am on (.+)$/ do |page_name|
@@ -1,5 +1,4 @@
1
1
  require "active_admin/arbre/builder"
2
- require "active_admin/arbre/core_extensions"
3
2
  require "active_admin/arbre/context"
4
3
  require "active_admin/arbre/html/element"
5
4
  require "active_admin/arbre/html/attributes"
@@ -65,7 +65,7 @@ module Arbre
65
65
  # Render the blocks contents
66
66
  if block_given?
67
67
  with_current_dom_context tag do
68
- insert_text_node_if_string(yield)
68
+ append_return_block(yield)
69
69
  end
70
70
  end
71
71
  end
@@ -98,10 +98,13 @@ module Arbre
98
98
  end
99
99
  alias_method :within, :with_current_dom_context
100
100
 
101
- # Inserts a text node if the tag is a string
102
- def insert_text_node_if_string(tag)
103
- if tag.is_a?(String)
104
- current_dom_context << Arbre::HTML::TextNode.from_string(tag)
101
+ # Appends the value to the current DOM element if there are no
102
+ # existing DOM Children and it responds to #to_s
103
+ def append_return_block(tag)
104
+ return nil if current_dom_context.children.any?
105
+
106
+ if !tag.is_a?(Arbre::HTML::Element) && tag.respond_to?(:to_s)
107
+ current_dom_context << Arbre::HTML::TextNode.from_string(tag.to_s)
105
108
  end
106
109
  end
107
110
  end
@@ -35,7 +35,7 @@ module Arbre
35
35
  if defined?(@cached_html)
36
36
  @cached_html
37
37
  else
38
- html = to_html
38
+ html = to_s
39
39
  @cached_html = html if html.length > 0
40
40
  html
41
41
  end
@@ -3,7 +3,7 @@ module Arbre
3
3
 
4
4
  class Attributes < Hash
5
5
 
6
- def to_html
6
+ def to_s
7
7
  self.collect do |name, value|
8
8
  "#{html_escape(name)}=\"#{html_escape(value)}\""
9
9
  end.join(" ")
@@ -15,10 +15,6 @@ module Arbre
15
15
  alias :<< :add
16
16
 
17
17
  def to_s
18
- to_html
19
- end
20
-
21
- def to_html
22
18
  to_a.join(" ")
23
19
  end
24
20
 
@@ -16,9 +16,9 @@ module Arbre
16
16
  self.class.new(super)
17
17
  end
18
18
 
19
- def to_html
19
+ def to_s
20
20
  self.collect do |element|
21
- element.to_html
21
+ element.to_s
22
22
  end.join.html_safe
23
23
  end
24
24
  end
@@ -21,7 +21,7 @@ module Arbre
21
21
  '<!DOCTYPE html>'.html_safe
22
22
  end
23
23
 
24
- def to_html
24
+ def to_s
25
25
  doctype + super
26
26
  end
27
27
 
@@ -35,7 +35,7 @@ module Arbre
35
35
 
36
36
  def build(*args, &block)
37
37
  # Render the block passing ourselves in
38
- insert_text_node_if_string(block.call(self)) if block
38
+ append_return_block(block.call(self)) if block
39
39
  end
40
40
 
41
41
  def add_child(child)
@@ -108,11 +108,11 @@ module Arbre
108
108
  alias_method :find_by_class, :get_elements_by_class_name
109
109
 
110
110
  def content
111
- children.to_html
111
+ children.to_s
112
112
  end
113
113
 
114
114
  def html_safe
115
- to_html
115
+ to_s
116
116
  end
117
117
 
118
118
  def indent_level
@@ -120,18 +120,14 @@ module Arbre
120
120
  end
121
121
 
122
122
  def each(&block)
123
- [to_html].each(&block)
124
- end
125
-
126
- def to_s
127
- to_html
123
+ [to_s].each(&block)
128
124
  end
129
125
 
130
126
  def to_str
131
127
  to_s
132
128
  end
133
129
 
134
- def to_html
130
+ def to_s
135
131
  content
136
132
  end
137
133