activeadmin 0.3.0 → 0.3.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.

data/.yardopts CHANGED
@@ -4,5 +4,5 @@ lib/**/*.rb
4
4
  --asset docs/images:images
5
5
  -
6
6
  README.rdoc
7
- CHANGELOG.rdoc
7
+ CHANGELOG.md
8
8
  docs/**/*.md
@@ -2,6 +2,10 @@
2
2
 
3
3
  Nothing yet
4
4
 
5
+ ## 0.3.1
6
+
7
+ * Only support InheritedResources up to 1.2.2
8
+
5
9
  ## 0.3.0
6
10
 
7
11
  326 commits by 35 contributors
@@ -9,56 +13,56 @@ Nothing yet
9
13
  ### New Features
10
14
 
11
15
  * I18n! Now supported in 10 languages!
12
- * Customizeable CSV (@pcreux, @gregbell)
16
+ * Customizeable CSV ([@pcreux][], [@gregbell][])
13
17
  * Menus now support `if` and `priority` (Moritz Lawitschka)
14
18
  * Rails 3.1 support
15
- * Asset pipeline support (@gregbell)
16
- * `skip_before_filter` now supported in DSL (@shayfrendt)
17
- * Added a blank slate design (@mattvague)
18
- * Collection and Member actions use the Active Admin layout (@gregbell)
19
+ * Asset pipeline support ([@gregbell][])
20
+ * `skip_before_filter` now supported in DSL ([@shayfrendt][])
21
+ * Added a blank slate design ([@mattvague][])
22
+ * Collection and Member actions use the Active Admin layout ([@gregbell][])
19
23
 
20
24
  ### Enhancements
21
25
 
22
- * Better I18n config file loading (@fabiokr)
23
- * `TableFor` now supports I18n headers (@fabiokr)
24
- * `AttributesTable` now supports I18n attributes (@fabiokr)
25
- * Member actions all use CSS class `member_link` (@doug316)
26
- * Made `status_tag` an Arbre component (@pcreux)
27
- * CSV downloads have sexy names such as "articles-2011-06-21.csv" (@pcreux)
28
- * Created `ActiveAdmin::Setting` to easily create settings (@gregbell)
29
- * New datepicker styles (@mattvague)
30
- * Set `@page_title` in member action to render a custom title (@gregbell)
31
- * #248: Settable logout link options in initializer (@gregbell)
32
- * Added a DependencyChecker that warns if dependencies aren't met (@pcreux)
26
+ * Better I18n config file loading ([@fabiokr][])
27
+ * `TableFor` now supports I18n headers ([@fabiokr][])
28
+ * `AttributesTable` now supports I18n attributes ([@fabiokr][])
29
+ * Member actions all use CSS class `member_link` ([@doug316][])
30
+ * Made `status_tag` an Arbre component ([@pcreux][])
31
+ * CSV downloads have sexy names such as "articles-2011-06-21.csv" ([@pcreux][])
32
+ * Created `ActiveAdmin::Setting` to easily create settings ([@gregbell][])
33
+ * New datepicker styles ([@mattvague][])
34
+ * Set `[@page_title][]` in member action to render a custom title ([@gregbell][])
35
+ * [#248][]: Settable logout link options in initializer ([@gregbell][])
36
+ * Added a DependencyChecker that warns if dependencies aren't met ([@pcreux][])
33
37
 
34
38
  ### Bug Fixes
35
39
 
36
- * #52: Fix update action with STI models (@gregbell)
37
- * #122: Fix sortable columns on nested resources (@knoopx)
38
- * Fix so that Dashboard Sections can appear in root namespace (@knoopx)
39
- * #131: Fixed `status_tag` with nil content (@pcreux)
40
- * #110: Fixed dropdown menu floats in Firefox (@mattvague)
41
- * Use quoted table names (@krug)
42
- * Fixed CSS float of `.paginated_collection_contents` bug in Firefox (@mattvague)
43
- * Removed unwanted gradient in IE in attribute table headers (@emzeq)
44
- * #222: Added `Arbre::Context#length` for Rack servers (@gregbell)
45
- * #255: Fixed problem with dropdown menus in IE8 and IE9 (@mattvague)
46
- * #235: Default sort order should use primary_key (@gregbell)
47
- * #197: Fixed issues with #form params disappearing (@rolfb)
48
- * #186: Fixes for when `default_namespace = false` (@gregbell)
49
- * #135: Comments on STI classes redirect correctly (@gregbell)
50
- * #77: Fixed performance issue where ActiveRecord::Base.all was being called (@pcreux)
51
- * #332: Fixed Devise redirection when in false namespace (@gregbell)
52
- * #171: Fixed issue where class names would clash with HTML object names (@gregbell)
53
- * #381: Fixed issues with Devise < 1.2 (@pcreux)
54
- * #369: Added support for pluralized model names such as News (@gregbell)
55
- * #42: Default forms work with polymorphic associations (@mattvague)
40
+ * [#52][]: Fix update action with STI models ([@gregbell][])
41
+ * [#122][]: Fix sortable columns on nested resources ([@knoopx][])
42
+ * Fix so that Dashboard Sections can appear in root namespace ([@knoopx][])
43
+ * [#131][]: Fixed `status_tag` with nil content ([@pcreux][])
44
+ * [#110][]: Fixed dropdown menu floats in Firefox ([@mattvague][])
45
+ * Use quoted table names ([@krug][])
46
+ * Fixed CSS float of `.paginated_collection_contents` bug in Firefox ([@mattvague][])
47
+ * Removed unwanted gradient in IE in attribute table headers ([@emzeq][])
48
+ * [#222][]: Added `Arbre::Context#length` for Rack servers ([@gregbell][])
49
+ * [#255][]: Fixed problem with dropdown menus in IE8 and IE9 ([@mattvague][])
50
+ * [#235][]: Default sort order should use primary_key ([@gregbell][])
51
+ * [#197][]: Fixed issues with #form params disappearing ([@rolfb][])
52
+ * [#186][]: Fixes for when `default_namespace = false` ([@gregbell][])
53
+ * [#135][]: Comments on STI classes redirect correctly ([@gregbell][])
54
+ * [#77][]: Fixed performance issue where ActiveRecord::Base.all was being called ([@pcreux][])
55
+ * [#332][]: Fixed Devise redirection when in false namespace ([@gregbell][])
56
+ * [#171][]: Fixed issue where class names would clash with HTML object names ([@gregbell][])
57
+ * [#381][]: Fixed issues with Devise < 1.2 ([@pcreux][])
58
+ * [#369][]: Added support for pluralized model names such as News ([@gregbell][])
59
+ * [#42][]: Default forms work with polymorphic associations ([@mattvague][])
56
60
 
57
61
  ### Dependencies
58
62
 
59
- * Switched from will_paginate to Kaminari for pagination (@mwindwer)
60
- * Removed dependency on InheritedViews (@gregbell)
61
- * Removed Jeweler. Using Bundler and a gemspec (@gregbell)
63
+ * Switched from will_paginate to Kaminari for pagination ([@mwindwer][])
64
+ * Removed dependency on InheritedViews ([@gregbell][])
65
+ * Removed Jeweler. Using Bundler and a gemspec ([@gregbell][])
62
66
 
63
67
  ### Contributors
64
68
 
@@ -105,29 +109,29 @@ Nothing yet
105
109
 
106
110
  ### Features & Enhancements
107
111
 
108
- * Arbre includes self closing tags (#100)
109
- * Controller class & action added to body as CSS classes (#99)
110
- * HAML is not required by default (#92)
111
- * Devise login now respects Devise.authentication_keys (#69)
112
- * Active Admin no longer uses <tt>ActiveRecord::Base#search</tt> (#28)
113
- * Resource's can now override the label in the menu (#48)
112
+ * Arbre includes self closing tags ([#100][])
113
+ * Controller class & action added to body as CSS classes ([#99][])
114
+ * HAML is not required by default ([#92][])
115
+ * Devise login now respects Devise.authentication_keys ([#69][])
116
+ * Active Admin no longer uses <tt>ActiveRecord::Base#search</tt> ([#28][])
117
+ * Resource's can now override the label in the menu ([#48][])
114
118
  * Subdirectories are now loaded in the Active Admin load path
115
119
 
116
120
  ### Bug Fixes
117
121
 
118
- * Sort order now includes table name (#38)
119
- * Fixed table_for 'odd', 'even' row classes (#96)
120
- * Fixed Devise installation if AdminUser already exists (#95)
121
- * Fixed issues when ActiveAdmin.default_namespaces is false (#32)
122
- * Added styles for missing HTML 5 inputs (#31)
123
- * Fixed issue if adding empty Active Admin Comment (#21)
124
- * Fixed layout issues in FF 4 (#22)
125
- * Use Sass::Plugin.options[:css_location] instead of Rails.root (#55)
122
+ * Sort order now includes table name ([#38][])
123
+ * Fixed table_for 'odd', 'even' row classes ([#96][])
124
+ * Fixed Devise installation if AdminUser already exists ([#95][])
125
+ * Fixed issues when ActiveAdmin.default_namespaces is false ([#32][])
126
+ * Added styles for missing HTML 5 inputs ([#31][])
127
+ * Fixed issue if adding empty Active Admin Comment ([#21][])
128
+ * Fixed layout issues in FF 4 ([#22][])
129
+ * Use Sass::Plugin.options[:css_location] instead of Rails.root ([#55][])
126
130
 
127
131
  ### Test Suite
128
132
 
129
- * Update RSpec to latest & fix specs (Thanks Ben Marini & Jeremt Ruppel!) (#100)
130
- * Added tests for STI models (#52)
133
+ * Update RSpec to latest & fix specs (Thanks Ben Marini & Jeremt Ruppel!) ([#100][])
134
+ * Added tests for STI models ([#52][])
131
135
 
132
136
  ### Contributors
133
137
 
@@ -174,4 +178,49 @@ of the highlights. 250 commits. Enough said.
174
178
 
175
179
  ## 0.1.0
176
180
 
177
- e Initial release
181
+ * Initial release
182
+
183
+ <!--- The following link definition list is generated by PimpMyChangelog --->
184
+ [#21]: https://github.com/gregbell/active_admin/issues/21
185
+ [#22]: https://github.com/gregbell/active_admin/issues/22
186
+ [#28]: https://github.com/gregbell/active_admin/issues/28
187
+ [#31]: https://github.com/gregbell/active_admin/issues/31
188
+ [#32]: https://github.com/gregbell/active_admin/issues/32
189
+ [#38]: https://github.com/gregbell/active_admin/issues/38
190
+ [#42]: https://github.com/gregbell/active_admin/issues/42
191
+ [#48]: https://github.com/gregbell/active_admin/issues/48
192
+ [#52]: https://github.com/gregbell/active_admin/issues/52
193
+ [#55]: https://github.com/gregbell/active_admin/issues/55
194
+ [#69]: https://github.com/gregbell/active_admin/issues/69
195
+ [#77]: https://github.com/gregbell/active_admin/issues/77
196
+ [#92]: https://github.com/gregbell/active_admin/issues/92
197
+ [#95]: https://github.com/gregbell/active_admin/issues/95
198
+ [#96]: https://github.com/gregbell/active_admin/issues/96
199
+ [#99]: https://github.com/gregbell/active_admin/issues/99
200
+ [#100]: https://github.com/gregbell/active_admin/issues/100
201
+ [#110]: https://github.com/gregbell/active_admin/issues/110
202
+ [#122]: https://github.com/gregbell/active_admin/issues/122
203
+ [#131]: https://github.com/gregbell/active_admin/issues/131
204
+ [#135]: https://github.com/gregbell/active_admin/issues/135
205
+ [#171]: https://github.com/gregbell/active_admin/issues/171
206
+ [#186]: https://github.com/gregbell/active_admin/issues/186
207
+ [#197]: https://github.com/gregbell/active_admin/issues/197
208
+ [#222]: https://github.com/gregbell/active_admin/issues/222
209
+ [#235]: https://github.com/gregbell/active_admin/issues/235
210
+ [#248]: https://github.com/gregbell/active_admin/issues/248
211
+ [#255]: https://github.com/gregbell/active_admin/issues/255
212
+ [#332]: https://github.com/gregbell/active_admin/issues/332
213
+ [#369]: https://github.com/gregbell/active_admin/issues/369
214
+ [#381]: https://github.com/gregbell/active_admin/issues/381
215
+ [@doug316]: https://github.com/doug316
216
+ [@emzeq]: https://github.com/emzeq
217
+ [@fabiokr]: https://github.com/fabiokr
218
+ [@gregbell]: https://github.com/gregbell
219
+ [@knoopx]: https://github.com/knoopx
220
+ [@krug]: https://github.com/krug
221
+ [@mattvague]: https://github.com/mattvague
222
+ [@mwindwer]: https://github.com/mwindwer
223
+ [@page_title]: https://github.com/page_title
224
+ [@pcreux]: https://github.com/pcreux
225
+ [@rolfb]: https://github.com/rolfb
226
+ [@shayfrendt]: https://github.com/shayfrendt
data/Gemfile CHANGED
@@ -9,10 +9,11 @@ gem 'rails', rails_version
9
9
 
10
10
  case rails_version
11
11
  when /^3\.0/
12
- gem "meta_search", '~> 1.0.0'
12
+ # Do nothing, bundler should figure it out
13
13
  when /^3\.1/
14
- gem "meta_search", '>= 1.1.0.pre'
15
- gem 'sass-rails', "~> 3.1.0.rc"
14
+ # These are the gems you have to have for Rails 3.1 to be happy
15
+ gem 'sass-rails'
16
+ gem 'uglifier'
16
17
  else
17
18
  raise "Rails #{rails_version} is not supported yet"
18
19
  end
@@ -4,11 +4,13 @@ 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
+
7
8
  == Help / Support / Demo
9
+
10
+ * Documentation & Guides: http://activeadmin.info/documentation.html
8
11
  * Mailing list: http://groups.google.com/group/activeadmin
9
12
  * Bug reports: https://github.com/gregbell/active_admin/issues
10
13
  * RDoc: http://rubydoc.info/github/gregbell/active_admin/master/frames
11
- * Guides: http://activeadmin.info/documentation.html
12
14
  * Live demo: http://demo.activeadmin.info/admin
13
15
  * Website: http://www.activeadmin.info
14
16
 
@@ -27,8 +29,14 @@ to implement beautiful and elegant interfaces with very little effort.
27
29
  Active Admin is released as a Ruby Gem. The gem is to be installed within a Ruby
28
30
  on Rails 3 application. To install, simply add the following to your Gemfile:
29
31
 
30
- # Gemfile
32
+ # Gemfile in Rails <= 3.1
33
+ gem 'activeadmin'
34
+
35
+ If you are using Rails >= 3.1, you must also include a beta version of MetaSearch and sass-rails:
36
+
37
+ # Gemfile in Rails >= 3.1
31
38
  gem 'activeadmin'
39
+ gem 'sass-rails'
32
40
 
33
41
  After updating your bundle, run the installer
34
42
 
@@ -56,387 +64,15 @@ To register your first model, run:
56
64
  This creates a file at <tt>app/admin/my_model_names.rb</tt> for configuring the resource.
57
65
  Refresh your web browser to see the interface.
58
66
 
59
- To learn how to further configure your admin section, keep on reading!
60
-
61
- == General Configuration
62
-
63
- === Admin Users
64
-
65
- By default Active Admin will include Devise and create a new model called
66
- AdminUser. If you would like to use another name, you can pass it in to the
67
- installer through the user option:
68
-
69
- $> rails generate active_admin:install UserClassName
70
-
71
- If you don't want the generator to create any user classes:
72
-
73
- $> rails generate active_admin:install --skip-users
74
-
75
- === Authentication
76
-
77
- Active Admin requires two settings to authenticate and use the current user
78
- within your application. Both are set in
79
- <tt>config/initializers/active_admin.rb</tt>. By default they are setup for use
80
- with Devise and a model named AdminUser. If you chose a different model name,
81
- you will need to update these settings.
82
-
83
- Set the method that controllers should call to authenticate the current user
84
- with:
85
-
86
- # config/initializers/active_admin.rb
87
- config.authentication_method = :authenticate_admin_user!
88
-
89
- Set the method to call within the view to access the current admin user
90
-
91
- # config/initializers/active_admin.rb
92
- config.current_user_method = :current_admin_user
93
-
94
- Both of these settings can be set to false to turn off authentication.
95
-
96
- # Turn off authentication all together
97
- config.authentication_method = false
98
- config.current_user_method = false
99
-
100
- === Site Title
101
-
102
- You can update the title used for the site in the initializer also. By default
103
- it is set to the name of your Rails.application class name.
104
-
105
- # config/initializers/active_admin.rb
106
- config.site_title = "My Admin Site"
107
-
108
- == Customize The Resource
109
-
110
- === Rename the Resource
111
-
112
- By default, any references to the resource (menu, routes, buttons, etc) in the
113
- interface will use the name of the class. You can rename the resource by using
114
- the <tt>:as</tt> option.
115
-
116
- ActiveAdmin.register Post, :as => "Article"
117
-
118
- The resource will then be available as /admin/articles
119
-
120
- === Customize the Navigation
121
-
122
- The resource will be displayed in the global navigation by default.
123
-
124
- To disable the resource from being displayed in the global navigation:
125
-
126
- ActiveAdmin.register Post do
127
- menu false
128
- end
129
-
130
- To change the name of the label in the menu:
131
-
132
- ActiveAdmin.register Post do
133
- menu :label => "My Posts"
134
- end
135
-
136
- To add the menu as a child of another menu:
137
-
138
- ActiveAdmin.register Post do
139
- menu :parent => "Blog"
140
- end
141
-
142
- This will create the menu item if it doesn't exist yet.
143
-
144
- == Customizing the Index Page
145
-
146
- Filtering and listing resources is one of the most important tasks for
147
- administering a web application. Active Admin provides many different tools for
148
- you to build a compelling interface into your data for the admin staff.
149
-
150
- Built in, Active Admin has the following index renderers:
151
-
152
- * *Table*: A table drawn with each row being a resource
153
- * *Grid*: A set of rows and columns each cell being a resource
154
- * *Blocks*: A set of rows (not tabular) each row being a resource
155
- * *Blog*: A title and body content, similar to a blog index
156
-
157
- All index pages also support scopes, filters, pagination, action items, and
158
- sidebar sections.
159
-
160
- === Index as a Table
161
-
162
- By default, the index page is a table with each of the models content columns and links to
163
- show, edit and delete the object. There are many ways to customize what gets
164
- displayed.
165
-
166
- ==== Defining Columns
167
-
168
- To display an attribute or a method on a resource, simply pass a symbol into the
169
- column method:
170
-
171
- index do
172
- column :title
173
- end
174
-
175
- If the default title does not work for you, pass it as the first argument:
176
-
177
- index do
178
- column "My Custom Title", :title
179
- end
180
-
181
- Sometimes calling methods just isn't enough and you need to write some view
182
- specific code. For example, say we wanted a colum called Title which holds a
183
- link to the posts admin screen.
184
-
185
- The column method accepts a block as an argument which will then be rendered
186
- within the context of the view for each of the objects in the collection.
187
-
188
- index do
189
- column "Title" do |post|
190
- link_to post.title, admin_post_path(post)
191
- end
192
- end
193
-
194
- The block gets called once for each resource in the collection. The resource gets passed into
195
- the block as an argument.
196
-
197
-
198
- ==== Sorting
199
-
200
- When a column is generated from an Active Record attribute, the table is
201
- sortable by default. If you are creating a custom column, you may need to give
202
- Active Admin a hint for how to sort the table.
203
-
204
- If a column is defined using a block, you must pass the key to turn on sorting. The key
205
- is the attribute which gets used to sort objects using Active Record.
206
-
207
- index do
208
- column "Title", :sortable => :title do |post|
209
- link_to post.title, admin_post_path(post)
210
- end
211
- end
212
-
213
- You can turn off sorting on any column by passing false:
214
-
215
- index do
216
- column :title, :sortable => false
217
- end
218
-
219
- ==== Showing and Hiding Columns
220
-
221
- The entire index block is rendered within the context of the view, so you can
222
- easily do things that show or hide columns based on the current context.
223
-
224
- For example, if you were using CanCan:
225
-
226
- index do
227
- column :title, :sortable => false
228
- if can? :manage, Post
229
- column :some_secret_data
230
- end
231
- end
232
67
 
233
- === Index as a Grid
68
+ == Next Steps
234
69
 
235
- Sometimes you want to display the index screen for a set of resources as a grid
236
- (possibly a grid of thumbnail images). To do so, use the :grid option for the
237
- index block.
70
+ The best place to get documentation is at http://activeadmin.info/documentation.html.
238
71
 
239
- index :as => :grid do |product|
240
- link_to(image_tag(product.image_path), admin_product_path(product))
241
- end
72
+ To view a sample Active Admin application, checkout http://demo.activeadmin.info
242
73
 
243
- The block is rendered within a cell in the grid once for each resource in the
244
- collection. The resource is passed into the block for you to use in the view.
74
+ If you have any questions, please email the mailing list at http://groups.google.com/group/activeadmin
245
75
 
246
- You can customize the number of colums that are rendered using the columns
247
- option:
248
-
249
- index :as => :grid, :columns => 5 do |product|
250
- link_to(image_tag(product.image_path), admin_product_path(product))
251
- end
252
-
253
-
254
- === Index as a Block
255
-
256
- If you want to fully customize the display of your resources on the index
257
- screen, Index as a Block allows you to render a block of content for each
258
- resource.
259
-
260
- index :as => :block do |product|
261
- div :for => product do
262
- h2 auto_link(product.title)
263
- div do
264
- simple_format product.description
265
- end
266
- end
267
- end
268
-
269
- === Index Filters
270
-
271
- By default the index screen includes a "Filters" sidebar on the right hand side
272
- with a filter for each attribute of the registered model. You can customize the
273
- filters that are displayed as well as the type of widgets they use.
274
-
275
- To display a filter for an attribute, use the filter method
276
-
277
- ActiveAdmin.register Post do
278
- filter :title
279
- end
280
-
281
- Out of the box, Active Admin supports the following filter types:
282
-
283
- * *:string* - A search field
284
- * *:date_range* - A start and end date field with calendar inputs
285
- * *:numeric* - A drop down for selecting "Equal To", "Greater Than" or "Less
286
- Than" and an input for a value.
287
- * *:select* - A drop down which filters based on a selected item in a collection
288
- or all.
289
- * *:check_boxes* - A list of check boxes users can turn on and off to filter
290
-
291
- By default, Active Admin will pick the most relevant filter based on the
292
- attribute type. You can force the type by passing the :as option.
293
-
294
- filter :author, :as => :check_boxes
295
-
296
- The :check_boxes and :select types accept options for the collection. By default
297
- it attempts to create a collection based on an association. But you can pass in
298
- the collection as a proc to be called at render time.
299
-
300
- # Will call available
301
- filter :author, :as => :check_boxes, :collection => proc { Author.all }
302
-
303
- You can change the filter label by passing a label option:
304
-
305
- filter :author, :label => 'Author'
306
-
307
- By default, Active Admin will try to use ActiveModel I18n to determine the label.
308
-
309
- == Customizing the CSV format
310
-
311
- Customizing the CSV format is as simple as customizing the index page.
312
-
313
- csv do
314
- column :name
315
- column("Author") { |post| post.author.full_name }
316
- end
317
-
318
- == Customizing the Form
319
-
320
- Active Admin gives complete control over the output of the form by creating a thin DSL on top of
321
- the fabulous DSL created by Formtastic (http://github.com/justinfrench/formtastic).
322
-
323
- ActiveAdmin.register Post do
324
-
325
- form do |f|
326
- f.inputs "Details" do
327
- f.input :title
328
- f.input :published_at, :label => "Publish Post At"
329
- f.input :category
330
- end
331
- f.inputs "Content" do
332
- f.input :body
333
- end
334
- f.buttons
335
- end
336
-
337
- end
338
-
339
- Please view the documentation for Formtastic to see all the wonderful things you can do:
340
- http://github.com/justinfrench/formtastic
341
-
342
- If you require a more custom form than can be provided through the DSL, you can pass
343
- a partial in to render the form yourself.
344
-
345
- For example:
346
-
347
- ActiveAdmin.register Post do
348
- form :partial => "form"
349
- end
350
-
351
- Then implement app/views/admin/posts/_form.html.erb:
352
-
353
- <%= semantic_form_for [:admin, @post] do |f| %>
354
- <%= f.inputs :title, :body %>
355
- <%= f.buttons :commit %>
356
- <% end %>
357
-
358
-
359
- == Customizing the Show Screen
360
-
361
- Customizing the show screen is as simple as implementing the show block:
362
-
363
- ActiveAdmin.register Post do
364
- show do
365
- h3 post.title
366
- div do
367
- simple_format post.body
368
- end
369
- end
370
- end
371
-
372
- The show block is rendered within the context of the view and uses the Arbre HTML DSL. You
373
- can also render a partial at any point.
374
-
375
- ActiveAdmin.register Post do
376
- show do
377
- # renders app/views/admin/posts/_some_partial.html.erb
378
- render "some_partial"
379
- end
380
- end
381
-
382
-
383
- == Sidebar Sections
384
-
385
- To add a sidebar section to all the screen within a section, use the sidebar method:
386
-
387
- sidebar :help do
388
- "Need help? Email us at help@example.com"
389
- end
390
-
391
- This will generate a sidebar section on each screen of the resource. With the block as
392
- the contents of the section. The first argument is the section title.
393
-
394
- You can also use Arbre syntax to define the content.
395
-
396
- sidebar :help do
397
- ul do
398
- li "Second List First Item"
399
- li "Second List Second Item"
400
- end
401
- end
402
-
403
- Sidebar sections can be rendered on a specific action by using the :only or :except
404
- options.
405
-
406
- sidebar :help, :only => :index do
407
- "Need help? Email us at help@example.com"
408
- end
409
-
410
- If you only pass a symbol, Active Admin will attempt to locate a partial to render.
411
-
412
- # Will render app/views/admin/posts/_help_sidebar.html.erb
413
- sidebar :help
414
-
415
- Or you can pass your own custom partial to render.
416
-
417
- sidebar :help, :partial => "custom_help_partial"
418
-
419
- == Add collection and member actions
420
-
421
- To add a collection action, use the collection_action method:
422
-
423
- collection_action :import_csv do
424
- # do csv import
425
- redirect_to :action => :index, :notice => "CSV imported successfully!"
426
- end
427
-
428
- To add a member action, use the member_action method:
429
-
430
- member_action :lock, :method => :post do
431
- resource.lock!
432
- redirect_to :action => :show, :notice => "Locked!"
433
- end
434
-
435
- == Internationalization (I18n)
436
-
437
- To internationalize Active Admin or to change default strings, you can copy
438
- lib/active_admin/locales/en.yml to your application config/locales directory and
439
- change its content. You can contribute to the project with your translations to!
440
76
 
441
77
  == Tools Being Used
442
78
 
@@ -446,8 +82,6 @@ other open source projects:
446
82
  InheritedResources::
447
83
  Inherited Resources speeds up development by making your controllers inherit all restful
448
84
  actions so you just have to focus on what is important.
449
- InheritedViews::
450
- Inherited Views is a thin addition to Inherited Resources which adds in html views to the mix
451
85
  Formtastic::
452
86
  A DSL for semantically building amazing forms.
453
87
  Devise::
@@ -458,29 +92,20 @@ Iconic Icons::
458
92
  Excellent SVG icon set designed by P.J. Onori: http://somerandomdude.com/projects/iconic
459
93
 
460
94
 
461
- == Contributors
462
-
463
- * Greg Bell http://github.com/gregbell
464
- * Philippe Creux http://github.com/pcreux
465
- * Sam Vincent http://github.com/samvincent
466
- * Matt Vague http://github.com/mattvague
467
- * Dan Kubb http://github.com/dkubb
468
- * Sam Reh http://github.com/samuelreh
469
-
470
-
471
95
  == Roadmap & Issue Tracking
472
96
 
473
- We are using the awesome Github issues!
97
+ We are using the awesome Github issues! Please submit bugs or features to
98
+ https://github.com/gregbell/active_admin/issues
99
+
474
100
 
475
101
  == Note on Patches/Pull Requests
476
102
 
477
103
  * Fork the project.
478
- * Make your feature addition or bug fix on a new topic branch
104
+ * Make a NEW TOPIC BRANCH, then make your feature addition or bug fix
479
105
  * Add specs and cukes for it. This is important so I don't break it in a
480
106
  future version unintentionally.
481
107
  * Commit, do not mess with rakefile, version, or history.
482
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
483
- * Send me a pull request.
108
+ * Send a pull request.
484
109
 
485
110
  == Copyright
486
111
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency("meta_search", ">= 0.9.2")
22
22
  s.add_dependency("devise", ">= 1.1.2")
23
23
  s.add_dependency("formtastic", ">= 1.1.0")
24
- s.add_dependency("inherited_resources", ">= 0")
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")
27
27
  s.add_dependency("fastercsv", ">= 0")
@@ -40,4 +40,4 @@ it is set to the name of your Rails.application class name.
40
40
 
41
41
  To internationalize Active Admin or to change default strings, you can copy
42
42
  lib/active_admin/locales/en.yml to your application config/locales directory and
43
- change its content. You can contribute to the project with your translations to!
43
+ change its content. You can contribute to the project with your translations too!
@@ -10,26 +10,70 @@ the <tt>:as</tt> option.
10
10
 
11
11
  The resource will then be available as /admin/articles
12
12
 
13
- ## Customize the Navigation
13
+ ## Customize the Menu
14
14
 
15
- The resource will be displayed in the global navigation by default.
16
-
17
- To disable the resource from being displayed in the global navigation:
15
+ The resource will be displayed in the global navigation by default. To disable
16
+ the resource from being displayed in the global navigation, pass `false` to the
17
+ `menu` method:
18
18
 
19
19
  ActiveAdmin.register Post do
20
20
  menu false
21
21
  end
22
22
 
23
+ The menu method accepts a hash with the following options:
24
+
25
+ * `:label` - The string label to display in the menu
26
+ * `:parent` - The string label of the parent to set for this menu
27
+ * `:if` - A block or a symbol of a method to call to decide if the menu item
28
+ should be displayed
29
+ * `:priority` - The integer value of the priority. Defaults to 10
30
+
31
+ ### Labels
32
+
23
33
  To change the name of the label in the menu:
24
34
 
25
35
  ActiveAdmin.register Post do
26
36
  menu :label => "My Posts"
27
37
  end
28
38
 
39
+ By default the menu uses a pluralized version of your resource name.
40
+
41
+ ### Drop Down Menus
42
+
43
+ In many cases, a single level navigation will not be enough for the
44
+ administration of a production application. In that case, you can categorize
45
+ your resources and creating drop down menus to access them.
46
+
29
47
  To add the menu as a child of another menu:
30
48
 
31
49
  ActiveAdmin.register Post do
32
50
  menu :parent => "Blog"
33
51
  end
34
52
 
35
- This will create the menu item if it doesn't exist yet.
53
+ Note, the "Blog" menu does not even have to exist yet. It will be generated on
54
+ the fly as a drop down list for you.
55
+
56
+ ### Menu Priority
57
+
58
+ By default Active Admin sorts menus alphabetically. Some times you want specific
59
+ resources to show up at the beginning or the end of your menu.
60
+
61
+ Each menu item is given an integer priority value (default 10). You can set it
62
+ to edit the location of the menu item.
63
+
64
+ ActiveAdmin.register Post do
65
+ menu :priority => 1
66
+ end
67
+
68
+ This would ensure that the Post menu item, is at the beginning of the menu.
69
+
70
+ ### Conditionally Showing / Hiding Menu Items
71
+
72
+ Menu items can be shown or hidden at runtime using the `:if` option.
73
+
74
+ ActiveAdmin.register Post do
75
+ menu :if => proc{ current_admin_user.can_edit_posts? }
76
+ end
77
+
78
+ The `proc` will be called in the context of the view, so you have access to all
79
+ your helpers and current user session information.
@@ -8,7 +8,7 @@ Built in, Active Admin has the following index renderers:
8
8
 
9
9
  * *Table*: A table drawn with each row being a resource ([View Table Docs](3-index-pages/index-as-table.md))
10
10
  * *Grid*: A set of rows and columns each cell being a resource ([View Grid Docs](3-index-pages/index-as-grid.md))
11
- * *Blocks*: A set of rows (not tabular) each row being a resource ([View Blocks Docs](3-index-pages/index-as-blocks.md))
11
+ * *Blocks*: A set of rows (not tabular) each row being a resource ([View Blocks Docs](3-index-pages/index-as-block.md))
12
12
  * *Blog*: A title and body content, similar to a blog index ([View Blog Docs](3-index-pages/index-as-blog.md))
13
13
 
14
14
  All index pages also support scopes, filters, pagination, action items, and
@@ -5,10 +5,10 @@
5
5
  Render your index page as a set of posts. The post has two main options:
6
6
  title and body.
7
7
 
8
- index :as => :blog do
9
- title :my_title # Calls #my_title on each resource
10
- body :my_body # Calls #my_body on each resource
11
- end
8
+ index :as => :blog do
9
+ title :my_title # Calls #my_title on each resource
10
+ body :my_body # Calls #my_body on each resource
11
+ end
12
12
 
13
13
  ## Post Title
14
14
 
@@ -1,5 +1,6 @@
1
1
  it:
2
2
  active_admin:
3
+ dashboard: Dashboard
3
4
  dashboard_welcome:
4
5
  welcome: "Benvenuti in Active Admin. Questa è la pagina dashboard di default."
5
6
  call_to_action: "Per aggiungere sezioni alla dashboard controlla il file 'app/admin/dashboards.rb'"
@@ -1,3 +1,3 @@
1
1
  module ActiveAdmin
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -82,7 +82,7 @@ module ActiveAdmin
82
82
  :onchange => "document.getElementById('#{method}_numeric').name = 'q[' + this.value + ']';"
83
83
  filter_input = text_field current_filter, :size => 10, :id => "#{method}_numeric"
84
84
 
85
- [ label(method),
85
+ [ label(method, options[:label]),
86
86
  filter_select,
87
87
  " ",
88
88
  filter_input
@@ -6,10 +6,10 @@ module ActiveAdmin
6
6
  # Render your index page as a set of posts. The post has two main options:
7
7
  # title and body.
8
8
  #
9
- # index :as => :blog do
10
- # title :my_title # Calls #my_title on each resource
11
- # body :my_body # Calls #my_body on each resource
12
- # end
9
+ # index :as => :blog do
10
+ # title :my_title # Calls #my_title on each resource
11
+ # body :my_body # Calls #my_body on each resource
12
+ # end
13
13
  #
14
14
  # == Post Title
15
15
  #
@@ -9,7 +9,7 @@ namespace :test do
9
9
  desc "Run against the important versions of rails"
10
10
  task :major_rails_versions do
11
11
  current_version = detect_rails_version if File.exists?("Gemfile.lock")
12
- ["3.0.10", "3.1.0.rc6"].each do |version|
12
+ ["3.0.10", "3.1.0"].each do |version|
13
13
  puts
14
14
  puts
15
15
  puts "== Using Rails #{version}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-25 00:00:00.000000000Z
12
+ date: 2011-09-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70119273208180 !ruby/object:Gem::Requirement
16
+ requirement: &70245214115280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70119273208180
24
+ version_requirements: *70245214115280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: meta_search
27
- requirement: &70119273207680 !ruby/object:Gem::Requirement
27
+ requirement: &70245214709900 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70119273207680
35
+ version_requirements: *70245214709900
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: devise
38
- requirement: &70119273207220 !ruby/object:Gem::Requirement
38
+ requirement: &70245215132620 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.1.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70119273207220
46
+ version_requirements: *70245215132620
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: formtastic
49
- requirement: &70119273206760 !ruby/object:Gem::Requirement
49
+ requirement: &70245215318320 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,21 +54,21 @@ dependencies:
54
54
  version: 1.1.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70119273206760
57
+ version_requirements: *70245215318320
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: inherited_resources
60
- requirement: &70119273206300 !ruby/object:Gem::Requirement
60
+ requirement: &70245215317700 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
- - - ! '>='
63
+ - - <
64
64
  - !ruby/object:Gem::Version
65
- version: '0'
65
+ version: 1.3.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70119273206300
68
+ version_requirements: *70245215317700
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: kaminari
71
- requirement: &70119273205840 !ruby/object:Gem::Requirement
71
+ requirement: &70245215297560 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.12.4
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70119273205840
79
+ version_requirements: *70245215297560
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sass
82
- requirement: &70119273205360 !ruby/object:Gem::Requirement
82
+ requirement: &70245215296960 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 3.1.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70119273205360
90
+ version_requirements: *70245215296960
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: fastercsv
93
- requirement: &70119273204900 !ruby/object:Gem::Requirement
93
+ requirement: &70245215296300 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70119273204900
101
+ version_requirements: *70245215296300
102
102
  description: The administration framework for Ruby on Rails.
103
103
  email:
104
104
  - gregdbell@gmail.com
@@ -451,7 +451,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
451
451
  version: '0'
452
452
  segments:
453
453
  - 0
454
- hash: 2396832735345360600
454
+ hash: -256188017324891804
455
455
  required_rubygems_version: !ruby/object:Gem::Requirement
456
456
  none: false
457
457
  requirements:
@@ -460,7 +460,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
460
460
  version: '0'
461
461
  segments:
462
462
  - 0
463
- hash: 2396832735345360600
463
+ hash: -256188017324891804
464
464
  requirements: []
465
465
  rubyforge_project:
466
466
  rubygems_version: 1.8.6