activeadmin 0.3.1 → 0.3.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 (34) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.md +45 -0
  3. data/Gemfile +1 -1
  4. data/README.rdoc +3 -2
  5. data/activeadmin.gemspec +1 -1
  6. data/app/assets/stylesheets/active_admin/_base.css.scss +28 -67
  7. data/app/assets/stylesheets/active_admin/_header.css.scss +10 -1
  8. data/app/assets/stylesheets/active_admin/components/_flash_messages.css.scss +3 -4
  9. data/app/assets/stylesheets/active_admin/components/_tables.css.scss +66 -0
  10. data/app/assets/stylesheets/active_admin/mixins/_all.css.scss +2 -0
  11. data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +17 -0
  12. data/docs/2-resource-customization.md +35 -0
  13. data/docs/6-show-screens.md +14 -0
  14. data/features/menu.feature +12 -1
  15. data/lib/active_admin/application.rb +3 -0
  16. data/lib/active_admin/arbre/context.rb +32 -3
  17. data/lib/active_admin/dependency_checker.rb +2 -0
  18. data/lib/active_admin/locales/bg.yml +40 -0
  19. data/lib/active_admin/locales/ja.yml +40 -0
  20. data/lib/active_admin/locales/sv-SE.yml +40 -0
  21. data/lib/active_admin/resource/naming.rb +6 -2
  22. data/lib/active_admin/version.rb +1 -1
  23. data/lib/active_admin/views/components/table_for.rb +1 -1
  24. data/lib/active_admin/views/header_renderer.rb +5 -1
  25. data/lib/active_admin/views/index_as_table.rb +1 -1
  26. data/lib/active_admin/views/pages/base.rb +12 -0
  27. data/lib/generators/active_admin/devise/devise_generator.rb +1 -1
  28. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +4 -1
  29. data/spec/integration/memory_spec.rb +38 -0
  30. data/spec/unit/application_spec.rb +9 -0
  31. data/spec/unit/arbre/context_spec.rb +18 -5
  32. data/spec/unit/resource/naming_spec.rb +11 -0
  33. data/tasks/test.rake +4 -2
  34. metadata +148 -91
data/.gitignore CHANGED
@@ -32,3 +32,4 @@ viewcumber
32
32
  test-rails*
33
33
  public
34
34
  .rvmrc
35
+ .rspec
@@ -2,6 +2,51 @@
2
2
 
3
3
  Nothing yet
4
4
 
5
+ ## 0.3.2
6
+
7
+ 45 commits by 15 contributors
8
+
9
+ ### Enhancements
10
+
11
+ * Site title can now be a link. Use config.site_title_link in
12
+ config/initializers/active_admin.rb
13
+ * i18n support for Japanese
14
+ * i18n support for Bulgarian
15
+ * i18n support for Swedish
16
+
17
+ ### Bug Fixes
18
+
19
+ * DeviseGenerator respects singular table names
20
+ * Active Admin no longer assumes sass-rails is installed
21
+ * Arbre::Context passes methods to the underlying html which fixes
22
+ issues on different types of servers (and on Heroku)
23
+ * #45: Fix for multibyte characters (@tricknotes)
24
+ * #505: Fix titlebar height when no breadcrumb (@mattvague)
25
+ * Fixed vertical align in dashboard
26
+ * Fixed i18n path's for multi-word model names
27
+
28
+ ### Dependencies
29
+
30
+ * Formtastic 2.0.0 breaks Active Admin. Locking to < 2.0.0
31
+
32
+ ### Contributors
33
+
34
+ * Amiel Martin
35
+ * Christian Hjalmarsson
36
+ * Edgars Beigarts
37
+ * Greg Bell
38
+ * Jan Dupal
39
+ * Joe Van
40
+ * Mark Roghelia
41
+ * Mathieu Martin
42
+ * Matt Vague
43
+ * Philippe Creux
44
+ * Ryunosuke SATO
45
+ * Sam Vincent
46
+ * Trace Wax
47
+ * Tsvetan Roustchev
48
+ * l4u
49
+
5
50
  ## 0.3.1
6
51
 
7
52
  * Only support InheritedResources up to 1.2.2
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.rc10"
7
+ rails_version = ENV['RAILS'] || detect_rails_version || "3.1.0"
8
8
  gem 'rails', rails_version
9
9
 
10
10
  case rails_version
@@ -4,6 +4,7 @@ Active Admin is a framework for creating administration style interfaces. It
4
4
  abstracts common business application patterns to make it simple for developers
5
5
  to implement beautiful and elegant interfaces with very little effort.
6
6
 
7
+ {<img src="http://travis-ci.org/gregbell/active_admin.png" />}[http://travis-ci.org/gregbell/active_admin]
7
8
 
8
9
  == Help / Support / Demo
9
10
 
@@ -29,10 +30,10 @@ to implement beautiful and elegant interfaces with very little effort.
29
30
  Active Admin is released as a Ruby Gem. The gem is to be installed within a Ruby
30
31
  on Rails 3 application. To install, simply add the following to your Gemfile:
31
32
 
32
- # Gemfile in Rails <= 3.1
33
+ # Gemfile in Rails < 3.1
33
34
  gem 'activeadmin'
34
35
 
35
- If you are using Rails >= 3.1, you must also include a beta version of MetaSearch and sass-rails:
36
+ If you are using Rails >= 3.1, you must also have sass-rails in your Gemfile:
36
37
 
37
38
  # Gemfile in Rails >= 3.1
38
39
  gem 'activeadmin'
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency("rails", ">= 3.0.0")
21
21
  s.add_dependency("meta_search", ">= 0.9.2")
22
22
  s.add_dependency("devise", ">= 1.1.2")
23
- s.add_dependency("formtastic", ">= 1.1.0")
23
+ s.add_dependency("formtastic", "< 2.0.0")
24
24
  s.add_dependency("inherited_resources", "< 1.3.0")
25
25
  s.add_dependency("kaminari", ">= 0.12.4")
26
26
  s.add_dependency("sass", ">= 3.1.0")
@@ -11,6 +11,7 @@
11
11
  @import "active_admin/components/comments";
12
12
  @import "active_admin/components/flash_messages";
13
13
  @import "active_admin/components/date_picker";
14
+ @import "active_admin/components/tables";
14
15
 
15
16
  body {
16
17
  font-family: Helvetica, Arial, sans-serif;
@@ -25,36 +26,52 @@ body {
25
26
  // ----------------------------------- Page Title Bar
26
27
  #title_bar {
27
28
  @include section-header;
29
+ @include clearfix;
30
+ @include box-sizing(border-box);
31
+ display: table;
32
+ width: 100%;
28
33
  position: relative;
29
34
  margin: 0;
30
35
  padding: 10px $horizontal-page-margin;
31
36
 
37
+ #titlebar_left, #titlebar_right {
38
+ height: 50px;
39
+ vertical-align: middle;
40
+ display: table-cell;
41
+ }
42
+
43
+ #titlebar_right {
44
+ text-align: right;
45
+ }
46
+
32
47
  h2 {
33
- margin: 12px 0 5px 0;
48
+ margin: 0;
34
49
  padding: 0;
35
50
  font-size: 2.6em;
36
51
  font-weight: bold;
37
52
  }
38
53
 
39
54
  .action_items {
40
- position: absolute;
41
- right: $horizontal-page-margin;
42
- top: 28px;
43
-
44
55
  a {
45
56
  @include light-button;
46
57
  @include icon(#777, 0.8em);
47
58
  @include gradient(#f9f9f9, #dddbdb);
59
+ display: inline-block;
48
60
  padding: .8em 1.5em .7em 1.5em;
49
61
  border: 1px solid #f8f8f8;
50
62
  span.icon { vertical-align: bottom; margin-right: 4px;}
51
63
  &:hover{ @include icon-color(#000); }
52
- &:active { border: inherit; }
53
64
  }
54
65
  }
55
66
  }
56
67
 
57
- // ----------------------------------- Main Structure
68
+ // ----------------------------------- Main Structure
69
+
70
+ #wrapper {
71
+ display: table;
72
+ width: 100%;
73
+ }
74
+
58
75
  #active_admin_content {
59
76
  margin: 0;
60
77
  padding: 25px $horizontal-page-margin;
@@ -111,9 +128,12 @@ a.button, input[type=submit] { @include dark-button; }
111
128
 
112
129
  // ----------------------------------- Breadcrumbs
113
130
  .breadcrumb {
114
- text-transform: uppercase;
131
+ display: block;
115
132
  font-size: 0.9em;
116
133
  font-weight: normal;
134
+ line-height: 1.0em;
135
+ margin-bottom: 12px;
136
+ text-transform: uppercase;
117
137
 
118
138
  a, a:link {
119
139
  color: #8a949e ;
@@ -166,65 +186,6 @@ a.button, input[type=submit] { @include dark-button; }
166
186
  margin-top: 80px;
167
187
  }
168
188
 
169
- // ----------------------------------- Tables
170
- table.index_table {
171
- width: 100%;
172
- margin-bottom: 10px;
173
- border: 0;
174
- border-spacing: 0;
175
-
176
-
177
- th {
178
- @include section-header;
179
- text-align: left;
180
- padding-left: $cell-horizontal-padding;
181
- padding-right: $cell-horizontal-padding;
182
-
183
- a, a:link, a:visited {
184
- color: $section-header-text-color;
185
- text-decoration: none;
186
- display: block;
187
- }
188
-
189
- &.sortable a {
190
- background: url(active_admin_image_path('orderable.png')) no-repeat 0 4px; padding-left: 13px;
191
- }
192
-
193
- &.sorted-asc a { background-position: 0 -27px; }
194
- &.sorted-desc a { background-position: 0 -56px;}
195
-
196
- &.sorted-asc, &.sorted-desc {
197
- @include gradient(darken($secondary-gradient-start, 5%), darken($secondary-gradient-stop, 5%));
198
- border-bottom: 1px solid $secondary-gradient-stop;
199
- }
200
- }
201
-
202
- tr.even td { background: $table-stripe-color; }
203
-
204
- td {
205
- padding: 10px $cell-horizontal-padding 8px $cell-horizontal-padding;
206
- border-bottom: 1px solid #e8e8e8;
207
- vertical-align: top;
208
- }
209
- }
210
-
211
- // ----------------------------------- Tables inside Panels
212
-
213
- .panel_contents table {
214
- margin-top: 5px;
215
- th {
216
- padding-top: 10px;
217
- background: none;
218
- color: $primary-color;
219
- @include no-shadow;
220
- @include text-shadow;
221
- text-transform: uppercase;
222
- border-bottom: 1px solid #ccc;
223
- }
224
- tr.odd td { background: darken($table-stripe-color, 3%); }
225
- tr.even td { background: $table-stripe-color; }
226
- }
227
-
228
189
  // ----------------------------------- Sidebar Sections
229
190
  .sidebar_section { @include section; }
230
191
 
@@ -13,7 +13,16 @@
13
13
  margin-right: 20px;
14
14
  margin-bottom: 0px;
15
15
  font-size: 1.3em;
16
- font-weight: normal;
16
+ font-weight: normal;
17
+
18
+ a {
19
+ text-decoration: none;
20
+
21
+ &:hover {
22
+ color: #fff;
23
+ }
24
+
25
+ }
17
26
  }
18
27
 
19
28
  a, a:link { color: #cdcdcd; }
@@ -1,10 +1,9 @@
1
1
  body.logged_in {
2
2
  .flash {
3
- @include primary-gradient;
3
+ @include gradient(#f7f1d3, #f5edc5);
4
4
  @include text-shadow(#fafafa);
5
- background-color: #a24a42;
6
- border: none;
7
- color: #fff;
5
+ border-bottom: 1px solid #eee098;
6
+ color: #cb9810;
8
7
  font-weight: bold;
9
8
  font-size: 1.1em;
10
9
  line-height: 1.0em;
@@ -0,0 +1,66 @@
1
+ // ----------------------------------- Tables
2
+
3
+ table tr {
4
+ td {
5
+ vertical-align: top;
6
+ }
7
+ }
8
+
9
+ // --------- Index Tables
10
+
11
+ table.index_table {
12
+ width: 100%;
13
+ margin-bottom: 10px;
14
+ border: 0;
15
+ border-spacing: 0;
16
+
17
+ th {
18
+ @include section-header;
19
+ text-align: left;
20
+ padding-left: $cell-horizontal-padding;
21
+ padding-right: $cell-horizontal-padding;
22
+
23
+ a, a:link, a:visited {
24
+ color: $section-header-text-color;
25
+ text-decoration: none;
26
+ display: block;
27
+ }
28
+
29
+ &.sortable a {
30
+ background: url(active_admin_image_path('orderable.png')) no-repeat 0 4px; padding-left: 13px;
31
+ }
32
+
33
+ &.sorted-asc a { background-position: 0 -27px; }
34
+ &.sorted-desc a { background-position: 0 -56px;}
35
+
36
+ &.sorted-asc, &.sorted-desc {
37
+ @include gradient(darken($secondary-gradient-start, 5%), darken($secondary-gradient-stop, 5%));
38
+ border-bottom: 1px solid $secondary-gradient-stop;
39
+ }
40
+ }
41
+
42
+ tr.even td { background: $table-stripe-color; }
43
+
44
+ td {
45
+ padding: 10px $cell-horizontal-padding 8px $cell-horizontal-padding;
46
+ border-bottom: 1px solid #e8e8e8;
47
+ vertical-align: top;
48
+ }
49
+ }
50
+
51
+ // --------- Tables inside Panels
52
+
53
+ .panel_contents table {
54
+ margin-top: 5px;
55
+ th {
56
+ padding-top: 10px;
57
+ background: none;
58
+ color: $primary-color;
59
+ @include no-shadow;
60
+ @include text-shadow;
61
+ text-transform: uppercase;
62
+ border-bottom: 1px solid #ccc;
63
+ }
64
+ tr.odd td { background: darken($table-stripe-color, 3%); }
65
+ tr.even td { background: $table-stripe-color; }
66
+ }
@@ -6,3 +6,5 @@
6
6
  @import "active_admin/mixins/rounded";
7
7
  @import "active_admin/mixins/buttons";
8
8
  @import "active_admin/mixins/sections";
9
+ @import "active_admin/mixins/utilities";
10
+
@@ -0,0 +1,17 @@
1
+ @mixin clearfix {
2
+ &:after {
3
+ visibility: hidden;
4
+ display: block;
5
+ content: "";
6
+ clear: both;
7
+ height: 0;
8
+ }
9
+ }
10
+
11
+ @mixin box-sizing($value: border-box) {
12
+ -moz-box-sizing: $value;
13
+ -webkit-box-sizing: $value;
14
+ -o-box-sizing: $value;
15
+ -ms-box-sizing: $value;
16
+ box-sizing: $value;
17
+ }
@@ -77,3 +77,38 @@ Menu items can be shown or hidden at runtime using the `:if` option.
77
77
 
78
78
  The `proc` will be called in the context of the view, so you have access to all
79
79
  your helpers and current user session information.
80
+
81
+ ## Scoping the queries
82
+
83
+ If your administrators have different access levels, you may sometimes want to
84
+ scope what they have access to. Assuming your User model has the proper
85
+ has_many relationships, you can simply scope the listings and finders like so:
86
+
87
+ ActiveAdmin.register Post do
88
+ scope_to :current_user
89
+
90
+ # or if the association doesn't have the default name.
91
+ # scope_to :current_user, :association_method => :blog_posts
92
+ end
93
+
94
+ That approach limits the posts an admin can access to ```current_user.posts```.
95
+
96
+ If you want to do something fancier, for example override a default scope, you can
97
+ also use :association_method parameter with a normal method on your User model.
98
+ The only requirement is that your method returns an instance of ActiveRecord::Relation.
99
+
100
+ class Ad < ActiveRecord::Base
101
+ default_scope lambda { where :published => true }
102
+ end
103
+
104
+ class User < ActiveRecord::Base
105
+ def managed_ads
106
+ # Overrides Ad's default_scope
107
+ Ad.unscoped
108
+ end
109
+ end
110
+
111
+ ActiveAdmin.register Ad do
112
+ scope_to :current_user, :association_method => :managed_ads
113
+ end
114
+
@@ -20,3 +20,17 @@ can also render a partial at any point.
20
20
  render "some_partial"
21
21
  end
22
22
  end
23
+
24
+ If you'd like to keep the default active_admin look, you can also use "attributes_table":
25
+
26
+ ActiveAdmin.register Ad do
27
+ show do |ad|
28
+ attributes_table do
29
+ row :title
30
+ row :image do
31
+ image_tag(ad.image.url)
32
+ end
33
+ end
34
+ active_admin_comments
35
+ end
36
+ end
@@ -13,7 +13,6 @@ Feature: Menu
13
13
  When I am on the dashboard
14
14
  Then I should not see a menu item for "Posts"
15
15
 
16
- @wip
17
16
  Scenario: Set the menu item label
18
17
  Given a configuration of:
19
18
  """
@@ -24,3 +23,15 @@ Feature: Menu
24
23
  When I am on the dashboard
25
24
  Then I should see a menu item for "Articles"
26
25
  And I should not see a menu item for "Posts"
26
+
27
+ Scenario: Set the site title and site title link
28
+ Given a configuration of:
29
+ """
30
+ ActiveAdmin.application.site_title = "My Great Site"
31
+ ActiveAdmin.application.site_title_link = "http://www.google.com/"
32
+ """
33
+ When I am on the dashboard
34
+ And I should see "My Great Site"
35
+ When I follow "My Great Site"
36
+ Then I should see "Ruby on Rails: Welcome aboard"
37
+ # Why won't it take me to the Googles??? It takes me to / instead. Oh well
@@ -20,6 +20,9 @@ module ActiveAdmin
20
20
 
21
21
  # The title which gets displayed in the main layout
22
22
  setting :site_title, ""
23
+
24
+ # Set the site title link href (defaults to AA dashboard)
25
+ setting :site_title_link, ""
23
26
 
24
27
  # Load paths for admin configurations. Add folders to this load path
25
28
  # to load up other resources for administration. External gems can
@@ -7,10 +7,39 @@ module Arbre
7
7
  super - 1
8
8
  end
9
9
 
10
- def length
11
- to_html.length
10
+ def bytesize
11
+ cached_html.bytesize
12
+ end
13
+ alias :length :bytesize
14
+
15
+ def respond_to?(method)
16
+ super || cached_html.respond_to?(method)
17
+ end
18
+
19
+ # Webservers treat Arbre::Context as a string. We override
20
+ # method_missing to delegate to the string representation
21
+ # of the html.
22
+ def method_missing(method, *args, &block)
23
+ if cached_html.respond_to? method
24
+ cached_html.send method, *args, &block
25
+ else
26
+ super
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ # Caches the rendered HTML so that we don't re-render just to
33
+ # get the content lenght or to delegate a method to the HTML
34
+ def cached_html
35
+ if defined?(@cached_html)
36
+ @cached_html
37
+ else
38
+ html = to_html
39
+ @cached_html = html if html.length > 0
40
+ html
41
+ end
12
42
  end
13
- alias :bytesize :length
14
43
 
15
44
  end
16
45
  end
@@ -22,6 +22,8 @@ module ActiveAdmin
22
22
  def sass_rails_3_1?
23
23
  require 'sass/rails/version'
24
24
  Sass::Rails::VERSION >= "3.1"
25
+ rescue LoadError
26
+ false
25
27
  end
26
28
  end
27
29
  end
@@ -0,0 +1,40 @@
1
+ bg:
2
+ active_admin:
3
+ dashboard: Табло
4
+ dashboard_welcome:
5
+ welcome: "Добре дошли в Active Admin. Това е таблото по подразбиране."
6
+ call_to_action: "За да добавите секции, проверете 'app/admin/dashboards.rb'"
7
+ view: "Преглед"
8
+ edit: "Редакция"
9
+ delete: "Изтриване"
10
+ delete_confirmation: "Сигурни ли сте, че искате да изтриете това?"
11
+ new_model: "Създай %{model}"
12
+ edit_model: "Редактирай %{model}"
13
+ delete_model: "Изтрий %{model}"
14
+ details: "%{model} Детайли"
15
+ cancel: "Отказ"
16
+ empty: "Празни"
17
+ previous: "Назад"
18
+ next: "Напред"
19
+ download: "Свали:"
20
+ has_many_new: "Добави нов %{model}"
21
+ has_many_delete: "Изтрий"
22
+ filter: "Филтър"
23
+ clear_filters: "Изчисти филтрите"
24
+ search_field: "Търси %{field}"
25
+ equal_to: "Съответства на"
26
+ greater_than: "По-голямо от"
27
+ less_than: "По-малко от"
28
+ main_content: "Моля, приложи %{model}#main_content за визуализация на съдържанието."
29
+ logout: "Изход"
30
+ sidebars:
31
+ filters: "Филтри"
32
+ pagination:
33
+ empty: "%{model} не е открит"
34
+ one: "Показване на <b>1</b> %{model}"
35
+ one_page: "Показване на <b>всички %{n}</b> %{model}"
36
+ multiple: "Показване на %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> от <b>%{total}</b> общо"
37
+ any: "Всеки"
38
+ blank_slate:
39
+ content: "Няма %{resource_name} все още."
40
+ link: "Създай връзка"
@@ -0,0 +1,40 @@
1
+ ja:
2
+ active_admin:
3
+ dashboard: "ダッシュボード"
4
+ dashboard_welcome:
5
+ welcome: "Active Admin へようこそ。ダッシュボードの初期ページを表示しています。"
6
+ call_to_action: "ダッシュボードに項目を追加するために 'app/admin/dashboards.rb' を編集してください。"
7
+ view: "閲覧"
8
+ edit: "編集"
9
+ delete: "削除"
10
+ delete_confirmation: "本当に削除しますか?"
11
+ new_model: "%{model} を作成する"
12
+ edit_model: "%{model} を編集する"
13
+ delete_model: "%{model} を削除する"
14
+ details: "%{model} の詳細"
15
+ cancel: "取り消す"
16
+ empty: "空"
17
+ previous: "前"
18
+ next: "次"
19
+ download: "ダウンロード:"
20
+ has_many_new: "新規に %{model} を追加する"
21
+ has_many_delete: "削除する"
22
+ filter: "絞り込む"
23
+ clear_filters: "条件を削除する"
24
+ search_field: "%{field} で絞り込む"
25
+ equal_to: "等しい"
26
+ greater_than: "より大きい"
27
+ less_than: "より小さい"
28
+ main_content: "内容を表示するために %{model}#main_content を実装してください。"
29
+ logout: "ログアウト"
30
+ sidebars:
31
+ filters: "検索条件"
32
+ pagination:
33
+ empty: "%{model} は見つかりませんでした"
34
+ one: "<b>1</b> 件の %{model} を表示しています"
35
+ one_page: "<b>全 %{n}</b> 件の %{model} を表示しています"
36
+ multiple: "全 <b>%{total}</b> 件中 <b>%{from}&nbsp;-&nbsp;%{to}</b> 件の %{model} を表示しています"
37
+ any: "任意"
38
+ blank_slate:
39
+ content: "%{resource_name} はまだありません。"
40
+ link: "作成する"
@@ -0,0 +1,40 @@
1
+ "sv-SE":
2
+ active_admin:
3
+ dashboard: Skrivbord
4
+ dashboard_welcome:
5
+ welcome: "Välkommen till Active Admin. Detta är ditt standardskrivbord."
6
+ call_to_action: "För att lägga till sektioner, gör en checkout på 'app/admin/dashboards.rb'"
7
+ view: "Visa"
8
+ edit: "Editera"
9
+ delete: "Ta bort"
10
+ delete_confirmation: "Är du säker att du vill ta bort denna?"
11
+ new_model: "Ny %{model}"
12
+ edit_model: "Editera %{model}"
13
+ delete_model: "Ta bort %{model}"
14
+ details: "Detaljvy för %{model}"
15
+ cancel: "Avbryt"
16
+ empty: "Tom"
17
+ previous: "Föregående"
18
+ next: "Nästa"
19
+ download: "Ladda ner:"
20
+ has_many_new: "Skapa en ny %{model}"
21
+ has_many_delete: "Ta bort"
22
+ filter: "Filter"
23
+ clear_filters: "Töm dina filters"
24
+ search_field: "Sök %{field}"
25
+ equal_to: "Lika med"
26
+ greater_than: "Större än"
27
+ less_than: "Mindre än"
28
+ main_content: "Implementera %{model}#main_content för att kunna visa något."
29
+ logout: "Logga ut"
30
+ sidebars:
31
+ filters: "Filter"
32
+ pagination:
33
+ empty: "Ingen %{model} funnen"
34
+ one: "Visar <b>1</b> utav %{model}"
35
+ one_page: "Visar <b>alla %{n}</b> utav %{model}"
36
+ multiple: "Visar %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> av <b>%{total}</b> totalt"
37
+ any: "Någon"
38
+ blank_slate:
39
+ content: "Finns ingen %{resource_name} än."
40
+ link: "Skapa en"
@@ -33,14 +33,18 @@ module ActiveAdmin
33
33
  else
34
34
  # Check if we have a translation available otherwise pluralize
35
35
  begin
36
- I18n.translate!("activerecord.models.#{resource.model_name.downcase}")
36
+ I18n.translate!("activerecord.models.#{resource.model_name.underscore}")
37
37
  resource.model_name.human(:count => 3)
38
38
  rescue I18n::MissingTranslationData
39
39
  resource_name.pluralize
40
40
  end
41
41
  end
42
42
  end
43
-
43
+
44
+ # Returns the plural and underscored version of this resource. Useful for element id's.
45
+ def plural_underscored_resource_name
46
+ plural_resource_name.underscore.gsub(/\s/, '_')
47
+ end
44
48
  end
45
49
  end
46
50
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -81,7 +81,7 @@ module ActiveAdmin
81
81
  def build_table_body
82
82
  @tbody = tbody do
83
83
  # Build enough rows for our collection
84
- @collection.each{|_| tr(:class => cycle('odd', 'even')) }
84
+ @collection.each{|_| tr(:class => cycle('odd', 'even'), :id => dom_id(_)) }
85
85
  end
86
86
  end
87
87
 
@@ -12,7 +12,11 @@ module ActiveAdmin
12
12
  protected
13
13
 
14
14
  def title
15
- content_tag 'h1', active_admin_application.site_title, :id => 'site_title'
15
+ if !active_admin_application.site_title_link || active_admin_application.site_title_link == ""
16
+ content_tag 'h1', active_admin_application.site_title, :id => 'site_title'
17
+ else
18
+ content_tag 'h1', link_to(active_admin_application.site_title, active_admin_application.site_title_link), :id => 'site_title'
19
+ end
16
20
  end
17
21
 
18
22
  # Renders the global navigation returned by
@@ -94,7 +94,7 @@ module ActiveAdmin
94
94
 
95
95
  def build(page_config, collection)
96
96
  table_options = {
97
- :id => active_admin_config.plural_resource_name.underscore,
97
+ :id => active_admin_config.plural_underscored_resource_name,
98
98
  :sortable => true,
99
99
  :class => "index_table",
100
100
  :i18n => active_admin_config.resource
@@ -52,8 +52,20 @@ module ActiveAdmin
52
52
 
53
53
  def build_title_bar
54
54
  div :id => "title_bar" do
55
+ build_titlebar_left
56
+ build_titlebar_right
57
+ end
58
+ end
59
+
60
+ def build_titlebar_left
61
+ div :id => "titlebar_left" do
55
62
  build_breadcrumb
56
63
  build_title_tag
64
+ end
65
+ end
66
+
67
+ def build_titlebar_right
68
+ div :id => "titlebar_right" do
57
69
  build_action_items
58
70
  end
59
71
  end
@@ -31,7 +31,7 @@ module ActiveAdmin
31
31
 
32
32
  def set_namespace_for_path
33
33
  routes_file = File.join(destination_root, "config", "routes.rb")
34
- gsub_file routes_file, /devise_for :#{table_name}/, "devise_for :#{table_name}, ActiveAdmin::Devise.config"
34
+ gsub_file routes_file, /devise_for :#{plural_table_name}/, "devise_for :#{plural_table_name}, ActiveAdmin::Devise.config"
35
35
  end
36
36
 
37
37
  def add_default_user_to_migration
@@ -7,6 +7,10 @@ ActiveAdmin.setup do |config|
7
7
  #
8
8
  config.site_title = "<%= Rails.application.class.name.split("::").first.titlecase %>"
9
9
 
10
+ # Set the link url for the title. For example, to take
11
+ # users to your main site. Defaults to no link.
12
+ #
13
+ # config.site_title_link = "/"
10
14
 
11
15
  # == Default Namespace
12
16
  #
@@ -25,7 +29,6 @@ ActiveAdmin.setup do |config|
25
29
  # Default:
26
30
  # config.default_namespace = :admin
27
31
 
28
-
29
32
  # == User Authentication
30
33
  #
31
34
  # Active Admin will automatically call an authentication
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ # These tests show the memory leak that is currently in Active Admin. They
4
+ # are all marked as pending until they pass. To work on them, comment out the
5
+ # pending method call in #it_should_not_leak
6
+ describe "Memory Leak" do
7
+
8
+ def count_instances_of(klass)
9
+ count = 0
10
+
11
+ ObjectSpace.each_object do |o|
12
+ if o.class == klass
13
+ count += 1
14
+ end
15
+ end
16
+
17
+ count
18
+ end
19
+
20
+ def self.it_should_not_leak(klass)
21
+ it "should not leak #{klass}" do
22
+ pending
23
+
24
+ GC.start
25
+
26
+ count = count_instances_of(klass)
27
+
28
+ load_defaults!
29
+ GC.start
30
+
31
+ count_instances_of(klass).should == count
32
+ end
33
+ end
34
+
35
+ it_should_not_leak ActiveAdmin::Namespace
36
+ it_should_not_leak ActiveAdmin::Resource
37
+
38
+ end
@@ -30,6 +30,15 @@ describe ActiveAdmin::Application do
30
30
  application.site_title = "New Title"
31
31
  application.site_title.should == "New Title"
32
32
  end
33
+
34
+ it "should store the site's title link" do
35
+ application.site_title_link.should == ""
36
+ end
37
+
38
+ it "should set the site's title link" do
39
+ application.site_title_link = "http://www.mygreatsite.com"
40
+ application.site_title_link.should == "http://www.mygreatsite.com"
41
+ end
33
42
 
34
43
  it "should have a view factory" do
35
44
  application.view_factory.should be_an_instance_of(ActiveAdmin::ViewFactory)
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Arbre::Context do
@@ -5,18 +6,30 @@ describe Arbre::Context do
5
6
  setup_arbre_context!
6
7
 
7
8
  before do
8
- h1 # Add some HTML to the context
9
+ h1 "札幌市北区" # Add some HTML to the context
10
+ end
11
+
12
+ it "should not increment the indent_level" do
13
+ current_dom_context.indent_level.should == -1
9
14
  end
10
15
 
11
16
  it "should return a bytesize" do
12
- current_dom_context.bytesize.should == 10
17
+ current_dom_context.bytesize.should == 25
13
18
  end
14
19
 
15
20
  it "should return a length" do
16
- current_dom_context.length.should == 10
21
+ current_dom_context.length.should == 25
17
22
  end
18
23
 
19
- it "should not increment the indent_level" do
20
- current_dom_context.indent_level.should == -1
24
+ it "should delegate missing methods to the html string" do
25
+ current_dom_context.should respond_to(:index)
26
+ current_dom_context.index('<').should == 0
27
+ end
28
+
29
+ it "should use a cached version of the HTML for method delegation" do
30
+ current_dom_context.should_receive(:to_html).once.and_return("<h1>札幌市北区</h1>")
31
+ current_dom_context.index('<').should == 0
32
+ current_dom_context.index('<').should == 0
21
33
  end
34
+
22
35
  end
@@ -37,6 +37,17 @@ module ActiveAdmin
37
37
  config(:as => "Blog Categories").camelized_resource_name.should == "BlogCategory"
38
38
  end
39
39
  end
40
+
41
+ describe "plural underscored resource name" do
42
+ before(:all) do
43
+ class ::CandyCane; end
44
+ @config = Resource.new(namespace, CandyCane, {})
45
+ end
46
+
47
+ it "should return an underscored and pluralized resource name" do
48
+ config.plural_underscored_resource_name.should == "candy_canes"
49
+ end
50
+ end
40
51
 
41
52
  describe "resource name" do
42
53
  it "should return a pretty name" do
@@ -14,7 +14,8 @@ namespace :test do
14
14
  puts
15
15
  puts "== Using Rails #{version}"
16
16
  cmd "./script/use_rails #{version}"
17
- cmd "bundle exec rspec spec"
17
+ cmd "bundle exec rspec spec/unit"
18
+ cmd "bundle exec rspec spec/integration"
18
19
  cmd "bundle exec cucumber features"
19
20
  end
20
21
  cmd "./script/use_rails #{current_version}" if current_version
@@ -24,7 +25,8 @@ end
24
25
 
25
26
  # Run specs and cukes
26
27
  task :test do
27
- cmd "bundle exec rspec spec"
28
+ cmd "bundle exec rspec spec/unit"
29
+ cmd "bundle exec rspec spec/integration"
28
30
  cmd "bundle exec cucumber features"
29
31
  end
30
32
 
metadata CHANGED
@@ -1,111 +1,158 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: activeadmin
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 2
10
+ version: 0.3.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Greg Bell
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-09-02 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: &70245214115280 !ruby/object:Gem::Requirement
17
+
18
+ date: 2011-09-23 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ type: :runtime
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ - 0
21
33
  version: 3.0.0
22
- type: :runtime
34
+ name: rails
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
23
37
  prerelease: false
24
- version_requirements: *70245214115280
25
- - !ruby/object:Gem::Dependency
26
- name: meta_search
27
- requirement: &70245214709900 !ruby/object:Gem::Requirement
38
+ type: :runtime
39
+ requirement: &id002 !ruby/object:Gem::Requirement
28
40
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 63
45
+ segments:
46
+ - 0
47
+ - 9
48
+ - 2
32
49
  version: 0.9.2
33
- type: :runtime
50
+ name: meta_search
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
34
53
  prerelease: false
35
- version_requirements: *70245214709900
36
- - !ruby/object:Gem::Dependency
37
- name: devise
38
- requirement: &70245215132620 !ruby/object:Gem::Requirement
54
+ type: :runtime
55
+ requirement: &id003 !ruby/object:Gem::Requirement
39
56
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 23
61
+ segments:
62
+ - 1
63
+ - 1
64
+ - 2
43
65
  version: 1.1.2
44
- type: :runtime
66
+ name: devise
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
45
69
  prerelease: false
46
- version_requirements: *70245215132620
47
- - !ruby/object:Gem::Dependency
48
- name: formtastic
49
- requirement: &70245215318320 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: 1.1.0
55
70
  type: :runtime
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - <
75
+ - !ruby/object:Gem::Version
76
+ hash: 15
77
+ segments:
78
+ - 2
79
+ - 0
80
+ - 0
81
+ version: 2.0.0
82
+ name: formtastic
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
56
85
  prerelease: false
57
- version_requirements: *70245215318320
58
- - !ruby/object:Gem::Dependency
59
- name: inherited_resources
60
- requirement: &70245215317700 !ruby/object:Gem::Requirement
86
+ type: :runtime
87
+ requirement: &id005 !ruby/object:Gem::Requirement
61
88
  none: false
62
- requirements:
89
+ requirements:
63
90
  - - <
64
- - !ruby/object:Gem::Version
91
+ - !ruby/object:Gem::Version
92
+ hash: 27
93
+ segments:
94
+ - 1
95
+ - 3
96
+ - 0
65
97
  version: 1.3.0
66
- type: :runtime
98
+ name: inherited_resources
99
+ version_requirements: *id005
100
+ - !ruby/object:Gem::Dependency
67
101
  prerelease: false
68
- version_requirements: *70245215317700
69
- - !ruby/object:Gem::Dependency
70
- name: kaminari
71
- requirement: &70245215297560 !ruby/object:Gem::Requirement
102
+ type: :runtime
103
+ requirement: &id006 !ruby/object:Gem::Requirement
72
104
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 39
109
+ segments:
110
+ - 0
111
+ - 12
112
+ - 4
76
113
  version: 0.12.4
77
- type: :runtime
114
+ name: kaminari
115
+ version_requirements: *id006
116
+ - !ruby/object:Gem::Dependency
78
117
  prerelease: false
79
- version_requirements: *70245215297560
80
- - !ruby/object:Gem::Dependency
81
- name: sass
82
- requirement: &70245215296960 !ruby/object:Gem::Requirement
118
+ type: :runtime
119
+ requirement: &id007 !ruby/object:Gem::Requirement
83
120
  none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 3
127
+ - 1
128
+ - 0
87
129
  version: 3.1.0
88
- type: :runtime
130
+ name: sass
131
+ version_requirements: *id007
132
+ - !ruby/object:Gem::Dependency
89
133
  prerelease: false
90
- version_requirements: *70245215296960
91
- - !ruby/object:Gem::Dependency
92
- name: fastercsv
93
- requirement: &70245215296300 !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
99
134
  type: :runtime
100
- prerelease: false
101
- version_requirements: *70245215296300
135
+ requirement: &id008 !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ hash: 3
141
+ segments:
142
+ - 0
143
+ version: "0"
144
+ name: fastercsv
145
+ version_requirements: *id008
102
146
  description: The administration framework for Ruby on Rails.
103
- email:
147
+ email:
104
148
  - gregdbell@gmail.com
105
149
  executables: []
150
+
106
151
  extensions: []
152
+
107
153
  extra_rdoc_files: []
108
- files:
154
+
155
+ files:
109
156
  - .document
110
157
  - .gitignore
111
158
  - .travis.yml
@@ -137,6 +184,7 @@ files:
137
184
  - app/assets/stylesheets/active_admin/components/_comments.css.scss
138
185
  - app/assets/stylesheets/active_admin/components/_date_picker.css.scss
139
186
  - app/assets/stylesheets/active_admin/components/_flash_messages.css.scss
187
+ - app/assets/stylesheets/active_admin/components/_tables.css.scss
140
188
  - app/assets/stylesheets/active_admin/mixins/_all.css.scss
141
189
  - app/assets/stylesheets/active_admin/mixins/_buttons.css.scss
142
190
  - app/assets/stylesheets/active_admin/mixins/_gradients.css.scss
@@ -145,6 +193,7 @@ files:
145
193
  - app/assets/stylesheets/active_admin/mixins/_rounded.css.scss
146
194
  - app/assets/stylesheets/active_admin/mixins/_sections.css.scss
147
195
  - app/assets/stylesheets/active_admin/mixins/_shadows.css.scss
196
+ - app/assets/stylesheets/active_admin/mixins/_utilities.scss
148
197
  - app/assets/stylesheets/active_admin/mixins/_variables.css.scss
149
198
  - app/views/active_admin/dashboard/index.html.arb
150
199
  - app/views/active_admin/devise/mailer/reset_password_instructions.html.erb
@@ -267,15 +316,18 @@ files:
267
316
  - lib/active_admin/helpers/settings.rb
268
317
  - lib/active_admin/iconic.rb
269
318
  - lib/active_admin/iconic/icons.rb
319
+ - lib/active_admin/locales/bg.yml
270
320
  - lib/active_admin/locales/cs.yml
271
321
  - lib/active_admin/locales/da.yml
272
322
  - lib/active_admin/locales/en.yml
273
323
  - lib/active_admin/locales/es.yml
274
324
  - lib/active_admin/locales/fr.yml
275
325
  - lib/active_admin/locales/it.yml
326
+ - lib/active_admin/locales/ja.yml
276
327
  - lib/active_admin/locales/pl.yml
277
328
  - lib/active_admin/locales/pt-BR.yml
278
329
  - lib/active_admin/locales/ru.yml
330
+ - lib/active_admin/locales/sv-SE.yml
279
331
  - lib/active_admin/locales/zh_cn.yml
280
332
  - lib/active_admin/menu.rb
281
333
  - lib/active_admin/menu_item.rb
@@ -368,6 +420,7 @@ files:
368
420
  - spec/integration/belongs_to_spec.rb
369
421
  - spec/integration/default_namespace.rb
370
422
  - spec/integration/javascript_spec.rb
423
+ - spec/integration/memory_spec.rb
371
424
  - spec/integration/stylesheets_spec.rb
372
425
  - spec/spec_helper.rb
373
426
  - spec/support/detect_rails_version.rb
@@ -439,35 +492,38 @@ files:
439
492
  - tasks/yard.rake
440
493
  homepage: http://activeadmin.info
441
494
  licenses: []
495
+
442
496
  post_install_message:
443
497
  rdoc_options: []
444
- require_paths:
498
+
499
+ require_paths:
445
500
  - lib
446
- required_ruby_version: !ruby/object:Gem::Requirement
501
+ required_ruby_version: !ruby/object:Gem::Requirement
447
502
  none: false
448
- requirements:
449
- - - ! '>='
450
- - !ruby/object:Gem::Version
451
- version: '0'
452
- segments:
503
+ requirements:
504
+ - - ">="
505
+ - !ruby/object:Gem::Version
506
+ hash: 3
507
+ segments:
453
508
  - 0
454
- hash: -256188017324891804
455
- required_rubygems_version: !ruby/object:Gem::Requirement
509
+ version: "0"
510
+ required_rubygems_version: !ruby/object:Gem::Requirement
456
511
  none: false
457
- requirements:
458
- - - ! '>='
459
- - !ruby/object:Gem::Version
460
- version: '0'
461
- segments:
512
+ requirements:
513
+ - - ">="
514
+ - !ruby/object:Gem::Version
515
+ hash: 3
516
+ segments:
462
517
  - 0
463
- hash: -256188017324891804
518
+ version: "0"
464
519
  requirements: []
520
+
465
521
  rubyforge_project:
466
- rubygems_version: 1.8.6
522
+ rubygems_version: 1.8.10
467
523
  signing_key:
468
524
  specification_version: 3
469
525
  summary: The administration framework for Ruby on Rails.
470
- test_files:
526
+ test_files:
471
527
  - features/comments/commenting.feature
472
528
  - features/comments/viewing_index.feature
473
529
  - features/dashboard.feature
@@ -519,6 +575,7 @@ test_files:
519
575
  - spec/integration/belongs_to_spec.rb
520
576
  - spec/integration/default_namespace.rb
521
577
  - spec/integration/javascript_spec.rb
578
+ - spec/integration/memory_spec.rb
522
579
  - spec/integration/stylesheets_spec.rb
523
580
  - spec/spec_helper.rb
524
581
  - spec/support/detect_rails_version.rb