activeadmin 0.1.1 → 0.2.0

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 (255) hide show
  1. data/CHANGELOG.rdoc +15 -1
  2. data/Gemfile +41 -11
  3. data/LICENSE +5 -0
  4. data/README.rdoc +202 -87
  5. data/Rakefile +51 -15
  6. data/activeadmin.gemspec +310 -131
  7. data/cucumber.yml +1 -0
  8. data/features/comments/commenting.feature +81 -0
  9. data/features/comments/viewing_index.feature +19 -0
  10. data/features/edit_page.feature +77 -0
  11. data/features/first_boot.feature +16 -0
  12. data/features/global_navigation.feature +30 -0
  13. data/features/index/formats.feature +10 -0
  14. data/features/index/index_as_block.feature +15 -0
  15. data/features/index/index_as_blog.feature +50 -0
  16. data/features/index/index_as_grid.feature +45 -0
  17. data/features/index/index_as_table.feature +79 -0
  18. data/features/index/index_scopes.feature +52 -0
  19. data/features/index/pagination.feature +23 -0
  20. data/features/new_page.feature +75 -0
  21. data/features/registering_assets.feature +35 -0
  22. data/features/registering_resources.feature +33 -0
  23. data/features/show/default_content.feature +43 -0
  24. data/features/show/page_title.feature +33 -0
  25. data/features/sidebar_sections.feature +128 -0
  26. data/features/specifying_actions.feature +16 -0
  27. data/features/step_definitions/action_item_steps.rb +7 -0
  28. data/features/step_definitions/additional_web_steps.rb +67 -0
  29. data/features/step_definitions/asset_steps.rb +7 -0
  30. data/features/step_definitions/attribute_steps.rb +15 -0
  31. data/features/step_definitions/comment_steps.rb +8 -0
  32. data/features/step_definitions/configuration_steps.rb +31 -0
  33. data/features/step_definitions/factory_steps.rb +28 -0
  34. data/features/step_definitions/flash_steps.rb +3 -0
  35. data/features/step_definitions/format_steps.rb +7 -0
  36. data/features/step_definitions/index_scope_steps.rb +20 -0
  37. data/features/step_definitions/pagination_steps.rb +8 -0
  38. data/features/step_definitions/sidebar_steps.rb +11 -0
  39. data/features/step_definitions/tab_steps.rb +3 -0
  40. data/features/step_definitions/user_steps.rb +20 -0
  41. data/features/step_definitions/web_steps.rb +219 -0
  42. data/features/support/env.rb +88 -0
  43. data/features/support/paths.rb +48 -0
  44. data/features/users/logging_in.feature +34 -0
  45. data/features/users/logging_out.feature +13 -0
  46. data/lib/active_admin.rb +155 -79
  47. data/lib/active_admin/abstract_view_factory.rb +95 -0
  48. data/lib/active_admin/action_items.rb +4 -15
  49. data/lib/active_admin/arbre.rb +23 -0
  50. data/lib/active_admin/arbre/attributes.rb +20 -0
  51. data/lib/active_admin/arbre/class_list.rb +28 -0
  52. data/lib/active_admin/arbre/collection.rb +27 -0
  53. data/lib/active_admin/arbre/context.rb +8 -0
  54. data/lib/active_admin/arbre/core_extensions.rb +5 -0
  55. data/lib/active_admin/arbre/document.rb +42 -0
  56. data/lib/active_admin/arbre/element.rb +151 -0
  57. data/lib/active_admin/arbre/html.rb +84 -0
  58. data/lib/active_admin/arbre/html5_elements.rb +47 -0
  59. data/lib/active_admin/arbre/tag.rb +129 -0
  60. data/lib/active_admin/arbre/text_node.rb +35 -0
  61. data/lib/active_admin/callbacks.rb +87 -0
  62. data/lib/active_admin/comments.rb +73 -0
  63. data/lib/active_admin/comments/comment.rb +15 -0
  64. data/lib/active_admin/comments/configuration.rb +16 -0
  65. data/lib/active_admin/comments/namespace_helper.rb +14 -0
  66. data/lib/active_admin/comments/resource_helper.rb +17 -0
  67. data/lib/active_admin/comments/show_page_helper.rb +23 -0
  68. data/lib/active_admin/comments/views.rb +3 -0
  69. data/lib/active_admin/comments/views/active_admin_comment.rb +0 -0
  70. data/lib/active_admin/comments/views/active_admin_comments.rb +82 -0
  71. data/lib/active_admin/component.rb +22 -0
  72. data/lib/active_admin/controller_action.rb +12 -0
  73. data/lib/active_admin/dashboards.rb +0 -2
  74. data/lib/active_admin/dashboards/dashboard_controller.rb +10 -5
  75. data/lib/active_admin/dashboards/section.rb +5 -14
  76. data/lib/active_admin/devise.rb +43 -0
  77. data/lib/active_admin/dsl.rb +202 -0
  78. data/lib/active_admin/event.rb +31 -0
  79. data/lib/active_admin/form_builder.rb +68 -50
  80. data/lib/active_admin/iconic.rb +51 -0
  81. data/lib/active_admin/iconic/icons.rb +142 -0
  82. data/lib/active_admin/namespace.rb +102 -16
  83. data/lib/active_admin/renderer.rb +18 -3
  84. data/lib/active_admin/resource.rb +110 -9
  85. data/lib/active_admin/resource/belongs_to.rb +31 -0
  86. data/lib/active_admin/resource_controller.rb +45 -260
  87. data/lib/active_admin/resource_controller/action_builder.rb +21 -0
  88. data/lib/active_admin/resource_controller/actions.rb +53 -0
  89. data/lib/active_admin/resource_controller/callbacks.rb +47 -0
  90. data/lib/active_admin/resource_controller/collection.rb +142 -0
  91. data/lib/active_admin/resource_controller/filters.rb +58 -0
  92. data/lib/active_admin/resource_controller/form.rb +42 -0
  93. data/lib/active_admin/resource_controller/menu.rb +29 -0
  94. data/lib/active_admin/resource_controller/page_configurations.rb +53 -0
  95. data/lib/active_admin/resource_controller/scoping.rb +36 -0
  96. data/lib/active_admin/resource_controller/sidebars.rb +38 -0
  97. data/lib/active_admin/scope.rb +17 -0
  98. data/lib/active_admin/sidebar.rb +8 -47
  99. data/lib/active_admin/stylesheets/active_admin.scss +418 -0
  100. data/lib/active_admin/stylesheets/active_admin/_comments.scss +40 -0
  101. data/lib/active_admin/stylesheets/active_admin/_flash_messages.scss +13 -0
  102. data/lib/active_admin/stylesheets/active_admin/_forms.scss +168 -0
  103. data/lib/active_admin/stylesheets/active_admin/_header.scss +108 -0
  104. data/lib/active_admin/stylesheets/active_admin/_typography.scss +100 -0
  105. data/lib/active_admin/stylesheets/active_admin/mixins/_all.scss +8 -0
  106. data/lib/active_admin/stylesheets/active_admin/mixins/_buttons.scss +27 -0
  107. data/lib/active_admin/stylesheets/active_admin/mixins/_gradients.scss +21 -0
  108. data/lib/active_admin/stylesheets/active_admin/mixins/_icons.scss +20 -0
  109. data/lib/active_admin/stylesheets/active_admin/mixins/_reset.scss +165 -0
  110. data/lib/active_admin/stylesheets/active_admin/mixins/_rounded.scss +43 -0
  111. data/lib/active_admin/stylesheets/active_admin/mixins/_sections.scss +27 -0
  112. data/lib/active_admin/stylesheets/active_admin/mixins/_shadows.scss +21 -0
  113. data/lib/active_admin/stylesheets/active_admin/mixins/_variables.scss +12 -0
  114. data/lib/active_admin/version.rb +1 -1
  115. data/lib/active_admin/view_factory.rb +21 -0
  116. data/lib/active_admin/view_helpers.rb +17 -100
  117. data/lib/active_admin/view_helpers/assigns_with_indifferent_access_helper.rb +7 -0
  118. data/lib/active_admin/view_helpers/auto_link_helper.rb +41 -0
  119. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +29 -0
  120. data/lib/active_admin/view_helpers/display_helper.rb +38 -0
  121. data/lib/active_admin/view_helpers/filter_form_helper.rb +174 -0
  122. data/lib/active_admin/view_helpers/form_helper.rb +12 -0
  123. data/lib/active_admin/view_helpers/icon_helper.rb +12 -0
  124. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +26 -0
  125. data/lib/active_admin/view_helpers/renderer_helper.rb +29 -0
  126. data/lib/active_admin/view_helpers/sidebar_helper.rb +15 -0
  127. data/lib/active_admin/view_helpers/status_tag_helper.rb +13 -0
  128. data/lib/active_admin/view_helpers/table_helper.rb +12 -0
  129. data/lib/active_admin/view_helpers/title_helper.rb +11 -0
  130. data/lib/active_admin/view_helpers/view_factory_helper.rb +11 -0
  131. data/lib/active_admin/views.rb +8 -0
  132. data/lib/active_admin/views/action_items.rb +17 -0
  133. data/lib/active_admin/views/components/attributes_table.rb +66 -0
  134. data/lib/active_admin/views/components/columns.rb +49 -0
  135. data/lib/active_admin/views/components/paginated_collection.rb +74 -0
  136. data/lib/active_admin/views/components/panel.rb +26 -0
  137. data/lib/active_admin/views/components/scopes.rb +64 -0
  138. data/lib/active_admin/views/components/sidebar_section.rb +30 -0
  139. data/lib/active_admin/views/components/table_for.rb +174 -0
  140. data/lib/active_admin/views/dashboard_section_renderer.rb +19 -0
  141. data/lib/active_admin/views/header_renderer.rb +37 -0
  142. data/lib/active_admin/views/index_as_block.rb +24 -0
  143. data/lib/active_admin/views/index_as_blog.rb +89 -0
  144. data/lib/active_admin/views/index_as_grid.rb +49 -0
  145. data/lib/active_admin/views/index_as_table.rb +73 -0
  146. data/lib/active_admin/views/pages/base.rb +138 -0
  147. data/lib/active_admin/views/pages/dashboard.rb +61 -0
  148. data/lib/active_admin/views/pages/edit.rb +27 -0
  149. data/lib/active_admin/views/pages/index.rb +64 -0
  150. data/lib/active_admin/views/pages/new.rb +27 -0
  151. data/lib/active_admin/views/pages/show.rb +56 -0
  152. data/lib/active_admin/views/tabs_renderer.rb +52 -0
  153. data/lib/active_admin/views/templates/active_admin/devise/mailer/reset_password_instructions.html.erb +8 -0
  154. data/lib/active_admin/views/templates/active_admin/devise/mailer/unlock_instructions.html.erb +7 -0
  155. data/lib/active_admin/views/templates/active_admin/devise/passwords/edit.html.erb +16 -0
  156. data/lib/active_admin/views/templates/active_admin/devise/passwords/new.html.erb +14 -0
  157. data/lib/active_admin/views/templates/active_admin/devise/sessions/new.html.erb +18 -0
  158. data/lib/active_admin/views/templates/active_admin/devise/shared/_links.erb +20 -0
  159. data/lib/active_admin/views/templates/active_admin/devise/unlocks/new.html.erb +12 -0
  160. data/lib/active_admin/views/templates/active_admin_dashboard/index.html.arb +1 -0
  161. data/lib/active_admin/views/templates/active_admin_default/edit.html.arb +1 -0
  162. data/lib/active_admin/views/{active_admin_default → templates/active_admin_default}/index.csv.erb +0 -0
  163. data/lib/active_admin/views/templates/active_admin_default/index.html.arb +1 -0
  164. data/lib/active_admin/views/templates/active_admin_default/new.html.arb +1 -0
  165. data/lib/active_admin/views/templates/active_admin_default/show.html.arb +1 -0
  166. data/lib/active_admin/views/{layouts → templates/layouts}/active_admin.html.erb +3 -4
  167. data/lib/active_admin/views/templates/layouts/active_admin_logged_out.html.erb +31 -0
  168. data/lib/generators/active_admin/devise/devise_generator.rb +45 -0
  169. data/lib/generators/active_admin/install/install_generator.rb +18 -3
  170. data/lib/generators/active_admin/install/templates/active_admin.js +41 -0
  171. data/lib/generators/active_admin/install/templates/{active_admin.rb → active_admin.rb.erb} +33 -3
  172. data/lib/generators/active_admin/install/templates/active_admin_vendor.js +1 -1
  173. data/lib/generators/active_admin/install/templates/dashboards.rb +3 -4
  174. data/lib/generators/active_admin/install/templates/images/admin_notes_icon.png +0 -0
  175. data/lib/generators/active_admin/install/templates/images/loading.gif +0 -0
  176. data/lib/generators/active_admin/install/templates/images/nested_menu_arrow.gif +0 -0
  177. data/lib/generators/active_admin/install/templates/images/nested_menu_arrow_dark.gif +0 -0
  178. data/lib/generators/active_admin/install/templates/images/orderable.png +0 -0
  179. data/lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb +16 -0
  180. data/lib/generators/active_admin/install/templates/migrations/2_move_admin_notes_to_comments.rb +25 -0
  181. data/spec/integration/belongs_to_spec.rb +42 -0
  182. data/spec/integration/index_as_table_spec.rb +0 -119
  183. data/spec/integration/layout_spec.rb +3 -37
  184. data/spec/spec_helper.rb +89 -50
  185. data/spec/support/integration_example_group.rb +37 -0
  186. data/spec/support/rails_template.rb +21 -9
  187. data/spec/support/rails_template_with_data.rb +32 -0
  188. data/spec/support/templates/cucumber.rb +28 -0
  189. data/spec/unit/abstract_view_factory_spec.rb +79 -0
  190. data/spec/unit/action_builder_spec.rb +19 -7
  191. data/spec/unit/action_items_spec.rb +16 -30
  192. data/spec/unit/active_admin_spec.rb +10 -22
  193. data/spec/unit/arbre/html/element_finder_methods_spec.rb +54 -0
  194. data/spec/unit/arbre/html/element_spec.rb +224 -0
  195. data/spec/unit/arbre/html/tag_attributes_spec.rb +61 -0
  196. data/spec/unit/arbre/html/tag_spec.rb +63 -0
  197. data/spec/unit/arbre/html_spec.rb +185 -0
  198. data/spec/unit/auto_link_spec.rb +38 -0
  199. data/spec/unit/belongs_to_spec.rb +44 -0
  200. data/spec/unit/breadcrumbs_spec.rb +110 -0
  201. data/spec/unit/comments_spec.rb +53 -0
  202. data/spec/unit/component_spec.rb +18 -0
  203. data/spec/unit/components/attributes_table_spec.rb +100 -0
  204. data/spec/unit/components/columns_spec.rb +75 -0
  205. data/spec/unit/components/panel_spec.rb +31 -0
  206. data/spec/unit/components/sidebar_section_spec.rb +37 -0
  207. data/spec/unit/components/table_for_spec.rb +130 -0
  208. data/spec/unit/dashboard_controller_spec.rb +26 -0
  209. data/spec/unit/dashboard_section_spec.rb +10 -17
  210. data/spec/unit/display_name_spec.rb +29 -0
  211. data/spec/unit/event_spec.rb +41 -0
  212. data/spec/unit/filter_form_builder_spec.rb +99 -77
  213. data/spec/unit/form_builder_spec.rb +69 -69
  214. data/spec/unit/namespace_spec.rb +61 -3
  215. data/spec/unit/pretty_format_spec.rb +35 -0
  216. data/spec/unit/registration_spec.rb +40 -1
  217. data/spec/unit/renderer_spec.rb +8 -0
  218. data/spec/unit/resource_controller_spec.rb +105 -6
  219. data/spec/unit/resource_spec.rb +78 -11
  220. data/spec/unit/routing_spec.rb +82 -6
  221. data/spec/unit/scope_spec.rb +31 -0
  222. data/spec/unit/tabs_renderer_spec.rb +24 -2
  223. data/spec/unit/view_factory_spec.rb +16 -0
  224. metadata +268 -82
  225. data/.gitignore +0 -25
  226. data/active_admin.gemspec +0 -22
  227. data/lib/active_admin/action_builder.rb +0 -60
  228. data/lib/active_admin/breadcrumbs.rb +0 -26
  229. data/lib/active_admin/dashboards/renderer.rb +0 -45
  230. data/lib/active_admin/dashboards/section_renderer.rb +0 -28
  231. data/lib/active_admin/filters.rb +0 -189
  232. data/lib/active_admin/pages.rb +0 -11
  233. data/lib/active_admin/pages/base.rb +0 -92
  234. data/lib/active_admin/pages/edit.rb +0 -21
  235. data/lib/active_admin/pages/index.rb +0 -58
  236. data/lib/active_admin/pages/index/blog.rb +0 -65
  237. data/lib/active_admin/pages/index/table.rb +0 -48
  238. data/lib/active_admin/pages/index/thumbnails.rb +0 -40
  239. data/lib/active_admin/pages/new.rb +0 -21
  240. data/lib/active_admin/pages/show.rb +0 -54
  241. data/lib/active_admin/table_builder.rb +0 -162
  242. data/lib/active_admin/tabs_renderer.rb +0 -39
  243. data/lib/active_admin/views/active_admin_dashboard/index.html.erb +0 -1
  244. data/lib/active_admin/views/active_admin_default/edit.html.erb +0 -1
  245. data/lib/active_admin/views/active_admin_default/index.html.erb +0 -1
  246. data/lib/active_admin/views/active_admin_default/new.html.erb +0 -1
  247. data/lib/active_admin/views/active_admin_default/show.html.erb +0 -1
  248. data/lib/generators/active_admin/install/templates/active_admin.css +0 -325
  249. data/lib/generators/active_admin/install/templates/images/orderable.gif +0 -0
  250. data/spec/integration/index_as_blog_spec.rb +0 -65
  251. data/spec/integration/index_as_thumbnails_spec.rb +0 -43
  252. data/spec/integration/new_view_spec.rb +0 -52
  253. data/spec/integration/show_view_spec.rb +0 -91
  254. data/spec/unit/sidebar_spec.rb +0 -96
  255. data/spec/unit/table_builder_spec.rb +0 -162
@@ -1,39 +0,0 @@
1
- module ActiveAdmin
2
-
3
- # Renders out a horizontal list of tabs.
4
- class TabsRenderer < Renderer
5
-
6
- # Pass in an ActiveAdmin::Menu and it will display the first level
7
- # of navigation as a horizontal list of tabs
8
- def to_html(menu, options = {})
9
- @options = default_options.merge(options)
10
- render_menu(menu)
11
- end
12
-
13
- protected
14
-
15
- def render_menu(menu)
16
- content_tag :ul, :id => @options[:id] do
17
- menu.items.collect do |item|
18
- render_item(item)
19
- end.join
20
- end
21
- end
22
-
23
- def render_item(item)
24
- content_tag :li, :id => item.dom_id, :class => ("current" if current?(item)) do
25
- link_to item.name, item.url
26
- end
27
- end
28
-
29
- # Returns true if the menu item name is @current_tab
30
- def current?(menu_item)
31
- menu_item.name == @current_tab
32
- end
33
-
34
- def default_options
35
- { :id => "tabs" }
36
- end
37
-
38
- end
39
- end
@@ -1 +0,0 @@
1
- <%= ActiveAdmin::Dashboards::Renderer.new(self).to_html %>
@@ -1 +0,0 @@
1
- <%= renderer_for(:edit).new(self).to_html %>
@@ -1 +0,0 @@
1
- <%= renderer_for(:index).new(self).to_html %>
@@ -1 +0,0 @@
1
- <%= renderer_for(:new).new(self).to_html %>
@@ -1 +0,0 @@
1
- <%= renderer_for(:show).new(self).to_html %>
@@ -1,325 +0,0 @@
1
- /*
2
- Active Admin CSS
3
- */
4
-
5
- /* -------------------------------------- General */
6
- body {
7
- font-family: Helvetica, Arial, sans-serif;
8
- line-height: 140%;
9
- font-size: 78%;
10
- background: #fff;
11
- margin: 0;
12
- padding: 0;
13
- }
14
-
15
- #header { background-color: #4b4a48; padding: 9px 30px; text-shadow: #222 1px 1px 0; }
16
- #header h1 { display: inline; margin-right: 20px; font-size: 1.1em; color: #94999a; font-weight: normal; text-transform: uppercase; }
17
- #header ul#tabs { margin: 0; padding: 0; display: inline; }
18
- #header ul#tabs li { display: inline; margin-right: 4px; font-size: 1.0em; }
19
- #header ul#tabs li a { text-decoration: none; color: #bbb; padding: 4px 10px; }
20
- #header ul#tabs li.current a { -webkit-border-radius: 8px; color: #dfdfdf; background: #777; }
21
-
22
- #content { margin: 0; padding: 25px 30px; }
23
- #main_content_wrapper{ float: left; width: 100%; }
24
- #main_content{ margin-right: 300px; }
25
- #content.without_sidebar #main_content{ margin-right: 0; }
26
- #sidebar{ float: left; width: 270px; margin-left: -270px; padding-top: 1.3em; }
27
-
28
- #title_bar { position: relative; background: #e4e3e3; background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#dddbdb)); margin: 0; padding: 10px 30px; color: #535353; text-shadow: #fff 1px 1px 0;}
29
- #title_bar .action_items { position: absolute; right: 30px; top: 28px; }
30
- #title_bar .breadcrumb a { color: #777; }
31
- #title_bar .breadcrumb .breadcrumb_sep { color: #aaa; margin: 0 2px; }
32
- #title_bar h2 { margin: 12px 0 5px 0; padding: 0; font-size: 2.2em;}
33
-
34
- #index_footer { padding-top: 5px; text-align: right; font-size: 0.85em; }
35
- .clear { clear: both; }
36
-
37
- #footer { padding: 30px 30px; font-size: 0.8em; font-style: italic; color: #bbb; clear: both; }
38
- #footer p { border-top: 1px solid #eee; padding-top: 10px}
39
- #footer a { color: #bbb; }
40
-
41
- /* -------------------------------------- Links */
42
- a { color: #27637D; }
43
- a:link, a:visited { }
44
- a:hover {}
45
- a { color: #27637D; }
46
-
47
- /* -------------------------------------- Buttons */
48
- a.button, input[type=submit], .action_items a {
49
- background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#dddbdb));
50
- -webkit-box-shadow: 0px 1px 1px #bbb;
51
- -webkit-border-radius: 200px;
52
- text-shadow: #fff 1px 1px 1px;
53
- padding: 10px 15px 8px 15px !important;
54
- border: 1px solid #f8f8f8;
55
- color: #777;
56
- text-decoration: none;
57
- font-weight: bold;
58
- cursor: pointer;
59
- }
60
- a.button:active, input[type=submit]:active, .action_items a:active{
61
- background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#dddbdb));
62
- -webkit-box-shadow: inset 0px 1px 2px #bbb;
63
- -webkit-border-radius: 200px;
64
- text-shadow: #fff 1px 1px 1px;
65
- border: 1px solid #f8f8f8;
66
- color: #666666;
67
- }
68
-
69
- a.button.small {
70
- font-size: 0.9em;
71
- padding: 6px 12px 4px 12px;
72
- }
73
-
74
- /* -------------------------------------- Action Items */
75
- /*.action_items a {
76
- background: #DDD;
77
- color: #333;
78
- font-weight: bold;
79
- text-decoration: none;
80
- padding: 4px 6px 3px 6px;
81
- margin-left: 10px;
82
- -moz-border-radius: 2px;
83
- -webkit-border-radius: 2px;
84
- }
85
- .action_items a:hover { background: #333; color: #ddd; } */
86
-
87
- /* -------------------------------------- Tables */
88
- table { width: 100%; margin-bottom: 10px; }
89
- table tr th { padding: 5px 10px; text-align: left; background-color: #555; color: #eee; }
90
- table tr th a, table tr th a:link, table tr th a:visited, table tr th a:hover { color: #eee; text-decoration: none; }
91
- table tr td { padding: 8px 10px; border-bottom: 1px solid #e0e0e0; }
92
- table > tbody > tr:hover > td, table > tbody > tr.odd:hover > td { background-color: #ddd}
93
- table tr.odd td { background-color: #eee }
94
-
95
- /* -------------------------------------- Sortable Tables */
96
- th.sortable a { background: url('/images/active_admin/orderable.gif') no-repeat 0 4px; padding-left: 13px; display: block; }
97
- th.sortable.sorted-asc a { background-position: 0 -27px; }
98
- th.sortable.sorted-desc a { background-position: 0 -56px; }
99
-
100
- /* -------------------------------------- Typography */
101
- h2 { font-size: 2em; }
102
-
103
- /* -------------------------------------- Sidebar */
104
- .sidebar_section { background: #eee; padding: 5px 15px 10px 15px; border-bottom: 1px solid #e0e0e0; }
105
- .sidebar_section h3 { padding: 5px 15px; background: #555; color: #fff; margin: -5px -15px 10px -15px; }
106
-
107
- /* -------------------------------------- Filters Sidebar */
108
- #filters_sidebar_section label { display: block; text-shadow: #fff 1px 1px 0; text-transform: uppercase; font-size: 0.8em; }
109
- #filters_sidebar_section .filter-form-field { margin-bottom: 6px; }
110
-
111
- /* -------------------------------------- Pagination */
112
- .pagination_information { float: right }
113
- .pagination { display: inline; font-size: 0.9; margin-left: 10px; }
114
- .pagination a, .pagination em { padding: 4px 6px 3px 6px; margin-right: 4px; }
115
- .pagination a { background: #ddd; color: #333; text-decoration: none;}
116
- .pagination em {background: #333; color: #ddd; font-style: none;}
117
- .pagination .previous_page, .pagination .next_page { display:none; }
118
-
119
- /* -------------------------------------- Resource Attribute Tables */
120
- table.resource_attributes {
121
- font-size: 0.9em;
122
- }
123
- table.resource_attributes th, table.resource_attributes td {
124
- padding: 5px 10px;
125
- }
126
- table.resource_attributes th {
127
- width: 150px;
128
- color: #777;
129
- background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));
130
- background: -moz-linear-gradient(top, #eee, #ddd);
131
- vertical-align: top;
132
- }
133
- table.resource_attributes tr:hover td{
134
- background: #fff;
135
- }
136
-
137
- /* -------------------------------------- Dashboard */
138
- table.dashboard > tbody > tr > td { vertical-align: top; border-bottom: none; }
139
- table.dashboard > tbody > tr:hover > td,
140
- table.dashboard > tbody > tr.odd:hover > td
141
- { background: none;}
142
- table.dashboard .dashboard_section{ border: 1px solid #eee; padding: 0; -webkit-border-radius: 5px; }
143
- table.dashboard .dashboard_section_content { padding: 0 15px 5px 15px; }
144
- table.dashboard h3 {
145
- margin-top: 0;
146
- background: #eee;
147
- -webkit-border-top-left-radius: 5px;
148
- -webkit-border-top-right-radius: 5px;
149
- background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#dddbdb));
150
- padding: 5px;
151
- color: #535353;
152
- font-size: 1.1em;
153
- text-shadow: #fff 1px 1px 0;
154
- }
155
-
156
- /* -------------------------------------- Status Labels */
157
- span.status {
158
- text-transform: uppercase;
159
- font-size: 0.75em;
160
- padding: 2px 5px;
161
- color: #fff;
162
- background-color: #aaa;
163
- }
164
-
165
- /* -------------------------------------- Datepicker */
166
- .ui-datepicker {
167
- color: #fff;
168
- background: #333;
169
- padding: 5px 5px 0 5px;
170
- display: none;
171
- }
172
- .ui-datepicker table th, .ui-datepicker table td, .ui-datepicker table tr:hover td{
173
- background: #333;
174
- border: 0;
175
- padding: 1px 3px;
176
- }
177
- .ui-datepicker table a {
178
- color: #fff;
179
- text-decoration: none;
180
- text-shadow: none;
181
- }
182
-
183
-
184
- /* -------------------------------------- Formtastic */
185
- /* -------------------------------------------------------------------------------------------------
186
-
187
- It's *strongly* suggested that you don't modify this file. Instead, load a new stylesheet after
188
- this one in your layouts (eg formtastic_changes.css) and override the styles to suit your needs.
189
- This will allow you to update formtastic.css with new releases without clobbering your own changes.
190
-
191
- This stylesheet forms part of the Formtastic Rails Plugin
192
- (c) 2008 Justin French
193
-
194
- --------------------------------------------------------------------------------------------------*/
195
-
196
-
197
- form.formtastic, form.formtastic ul, form.formtastic ol, form.formtastic li, form.formtastic fieldset, form.formtastic legend, form.formtastic input, form.formtastic textarea, form.formtastic select, form.formtastic p { margin:0; padding:0; }
198
- form.formtastic fieldset { border:0; }
199
- form.formtastic em, form.formtastic strong { font-style:normal; font-weight:normal; }
200
- form.formtastic ol, form.formtastic ul { list-style:none; }
201
- form.formtastic abbr, form.formtastic acronym { border:0; font-variant:normal; }
202
- form.formtastic input, form.formtastic textarea, form.formtastic select { font-family:inherit; font-size:inherit; font-weight:inherit; }
203
- form.formtastic input, form.formtastic textarea, form.formtastic select { font-size:100%; }
204
- form.formtastic legend { white-space:normal; color:#000; }
205
-
206
- /* SEMANTIC ERRORS
207
- --------------------------------------------------------------------------------------------------*/
208
- form.formtastic ul.errors { color:#cc0000; margin:0.5em 0 1.5em 20%; list-style:square; }
209
- form.formtastic ul.errors li { padding:0; border:none; display:list-item; }
210
-
211
-
212
- /* FIELDSETS & LISTS
213
- --------------------------------------------------------------------------------------------------*/
214
- form.formtastic fieldset.buttons { padding-left:20%; }
215
- form.formtastic fieldset.buttons li { float:left; padding-right:0.5em; }
216
-
217
- /* clearfixing the fieldsets */
218
- form.formtastic fieldset { display: block; }
219
- form.formtastic fieldset:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
220
- html[xmlns] form.formtastic fieldset { display: block; }
221
- * html form.formtastic fieldset { height: 1%; }
222
-
223
-
224
- /* INPUT LIs
225
- --------------------------------------------------------------------------------------------------*/
226
- form.formtastic fieldset > ol > li { margin-bottom:1.5em; }
227
-
228
- /* clearfixing the li's */
229
- form.formtastic fieldset > ol > li { display: block; }
230
- form.formtastic fieldset > ol > li:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
231
- html[xmlns] form.formtastic fieldset > ol > li { display: block; }
232
- * html form.formtastic fieldset > ol > li { height: 1%; }
233
-
234
- form.formtastic fieldset > ol > li.required { }
235
- form.formtastic fieldset > ol > li.optional { }
236
- form.formtastic fieldset > ol > li.error { }
237
- form.formtastic fieldset > ol > li.error input[type=text],
238
- form.formtastic fieldset > ol > li.error input[type=password],
239
- form.formtastic fieldset > ol > li.error textarea
240
- { border: 1px solid red; }
241
-
242
-
243
- /* LABELS
244
- --------------------------------------------------------------------------------------------------*/
245
- form.formtastic fieldset > ol > li label { display:block; width:20%; float:left; padding-top:.2em; }
246
- form.formtastic fieldset > ol > li > li label { line-height:100%; padding-top:0; }
247
- form.formtastic fieldset > ol > li > li label input { line-height:100%; vertical-align:middle; margin-top:-0.1em;}
248
-
249
-
250
- /* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets)
251
- --------------------------------------------------------------------------------------------------*/
252
- form.formtastic fieldset > ol > li fieldset { position:relative; }
253
- form.formtastic fieldset > ol > li fieldset legend { position:absolute; width:95%; padding-top:0.1em; left: 0px; }
254
- form.formtastic fieldset > ol > li fieldset legend span { position:absolute; }
255
- form.formtastic fieldset > ol > li fieldset legend.label label { position:absolute; }
256
- form.formtastic fieldset > ol > li fieldset ol { float:left; width:74%; margin:0; padding:0 0 0 20%; }
257
- form.formtastic fieldset > ol > li fieldset ol li { padding:0; border:0; }
258
-
259
-
260
- /* INLINE HINTS
261
- --------------------------------------------------------------------------------------------------*/
262
- form.formtastic fieldset > ol > li p.inline-hints { color:#666; margin:0.5em 0 0 20%; }
263
-
264
-
265
- /* INLINE ERRORS
266
- --------------------------------------------------------------------------------------------------*/
267
- form.formtastic fieldset > ol > li p.inline-errors { color:#cc0000; margin:0.5em 0 0 20%; }
268
- form.formtastic fieldset > ol > li ul.errors { color:#cc0000; margin:0.5em 0 0 20%; list-style:square; }
269
- form.formtastic fieldset > ol > li ul.errors li { padding:0; border:none; display:list-item; }
270
-
271
-
272
- /* HIDDEN OVERRIDES
273
- the dual declarations are required because of our clearfix display hack on the LIs, which is more
274
- specific than the more general rule below. TODO: Revist the clearing hack and this rule.
275
- --------------------------------------------------------------------------------------------------*/
276
- form.formtastic fieldset ol li.hidden,
277
- html[xmlns] form.formtastic fieldset ol li.hidden { display:none; }
278
-
279
- /* BOOLEAN OVERRIDES
280
- --------------------------------------------------------------------------------------------------*/
281
- form.formtastic fieldset > ol > li.boolean label { padding-left:20%; width:auto; padding-right: 10px; text-transform: none !important;}
282
- form.formtastic fieldset > ol > li.boolean label input { margin:0 0.5em 0 0.2em; }
283
-
284
-
285
- /* RADIO OVERRIDES
286
- --------------------------------------------------------------------------------------------------*/
287
- form.formtastic fieldset > ol > li.radio { }
288
- form.formtastic fieldset > ol > li.radio fieldset ol { margin-bottom:-0.6em; }
289
- form.formtastic fieldset > ol > li.radio fieldset ol li { margin:0.1em 0 0 0; }
290
- form.formtastic fieldset > ol > li.radio fieldset ol li label { float:none; width:100%; }
291
- form.formtastic fieldset > ol > li.radio fieldset ol li label input { margin-right:0.2em; }
292
-
293
-
294
- /* CHECK BOXES (COLLECTION) OVERRIDES
295
- --------------------------------------------------------------------------------------------------*/
296
- form.formtastic fieldset > ol > li.check_boxes { }
297
- form.formtastic fieldset > ol > li.check_boxes fieldset ol { margin-bottom:-0.6em; }
298
- form.formtastic fieldset > ol > li.check_boxes fieldset ol li { margin:0.1em 0 0.5em 0; }
299
- form.formtastic fieldset > ol > li.check_boxes fieldset ol li label { float:none; width:100%; }
300
- form.formtastic fieldset > ol > li.check_boxes fieldset ol li label input { margin-right:0.2em; }
301
-
302
-
303
-
304
- /* DATE & TIME OVERRIDES
305
- --------------------------------------------------------------------------------------------------*/
306
- form.formtastic fieldset > ol > li.date fieldset ol li,
307
- form.formtastic fieldset > ol > li.time fieldset ol li,
308
- form.formtastic fieldset > ol > li.datetime fieldset ol li { float:left; width:auto; margin:0 .3em 0 0; }
309
-
310
- form.formtastic fieldset > ol > li.date fieldset ol li label,
311
- form.formtastic fieldset > ol > li.time fieldset ol li label,
312
- form.formtastic fieldset > ol > li.datetime fieldset ol li label { display:none; }
313
-
314
- form.formtastic fieldset > ol > li.date fieldset ol li label input,
315
- form.formtastic fieldset > ol > li.time fieldset ol li label input,
316
- form.formtastic fieldset > ol > li.datetime fieldset ol li label input { display:inline; margin:0; padding:0; }
317
-
318
- /* -------------------------------------- Formtastic Specific Forms */
319
- form.formtastic li { margin-bottom: 10px; }
320
- form.formtastic label { color: #666; text-transform: uppercase; }
321
- form.formtastic input[type=text], form.formtastic input[type=password], form.formtastic textarea { width: 76%; }
322
-
323
- /* -------------------------------------- Form */
324
- input[type=text], input[type=password], textarea { border: 1px solid #ccc; font-size: 0.8em; padding: 8px 10px !important; outline: none; }
325
- input[type=text]:focus, input[type=password]:focus, textarea:focus { border: 1px solid #aaa; }
@@ -1,65 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe_with_render "Index as Blog" do
4
-
5
- before :all do
6
- load_defaults!
7
- reload_routes!
8
- end
9
-
10
- before do
11
- Admin::PostsController.reset_index_config!
12
- @post = Post.create(:title => "Hello World", :body => "This is the hello world post")
13
- end
14
-
15
- describe "displaying the index as posts" do
16
-
17
- context "when no configuration block given" do
18
- before do
19
- Admin::PostsController.index :as => :blog
20
- get :index
21
- end
22
-
23
- it "should have an h3 as the title" do
24
- response.should have_tag("h3", "Post #{@post.id}")
25
- end
26
- it "should generate a title link" do
27
- response.should have_tag("a", "Post #{@post.id}", :attributes => {
28
- :href => "/admin/posts/#{@post.id}" })
29
- end
30
- end
31
-
32
- context "when a simple config given" do
33
- before do
34
- Admin::PostsController.index :as => :blog do |i|
35
- i.title :title
36
- i.content :body
37
- end
38
- get :index
39
- end
40
- it "should render the title" do
41
- response.should have_tag("h3", "Hello World")
42
- end
43
- it "should render the body as the content" do
44
- response.should have_tag("div", @post.body, :attributes => { :class => 'content' } )
45
- end
46
- end
47
-
48
- context "when blocks given as config" do
49
- before do
50
- Admin::PostsController.index :as => :blog do |i|
51
- i.title {|post| post.title }
52
- i.content {|post| simple_format post.body }
53
- end
54
- get :index
55
- end
56
- it "should render the title" do
57
- response.should have_tag("h3", "Hello World")
58
- end
59
- it "should render the body as the content" do
60
- response.should have_tag("div", @post.body, :attributes => { :class => 'content' } )
61
- end
62
- end
63
-
64
- end
65
- end
@@ -1,43 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe_with_render "Index as Thumbnails" do
4
-
5
- before :all do
6
- load_defaults!
7
- reload_routes!
8
- end
9
-
10
- before do
11
- Admin::PostsController.reset_index_config!
12
- @post = Post.create(:title => "Hello World", :body => "This is the hello world post")
13
-
14
- # Create a method for a fake thumbnail url
15
- class Post < ActiveRecord::Base
16
- def thumbnail_url
17
- title.downcase.gsub(' ', '-') + ".jpg"
18
- end
19
- end
20
- end
21
-
22
- describe "displaying the index as thumbnails" do
23
-
24
- context "when only setting the image path" do
25
- before do
26
- Admin::PostsController.index :as => :thumbnails do |i|
27
- i.image :thumbnail_url
28
- end
29
- get :index
30
- end
31
- it "should generate an image" do
32
- response.should have_tag("img", :attributes => {
33
- :src => "hello-world.jpg",
34
- :width => "200", :height => "200"})
35
- end
36
- it "should create a link to the resource" do
37
- response.should have_tag("a", :attributes => {
38
- :href => "/admin/posts/#{@post.id}" })
39
- end
40
- end
41
-
42
- end
43
- end