activeadmin 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +8 -5
- data/CHANGELOG.md +151 -0
- data/Gemfile +16 -16
- data/LICENSE +1 -1
- data/activeadmin.gemspec +1 -0
- data/app/assets/images/active_admin/index_list_icons/block_icon.svg +10 -0
- data/app/assets/images/active_admin/index_list_icons/blog_icon.svg +4 -0
- data/app/assets/images/active_admin/index_list_icons/grid_icon.svg +13 -0
- data/app/assets/images/active_admin/index_list_icons/table_icon.svg +3 -0
- data/app/assets/javascripts/active_admin/components/jquery.aa.checkbox-toggler.js.coffee +17 -44
- data/app/assets/javascripts/active_admin/components/jquery.aa.dropdown-menu.js.coffee +2 -4
- data/app/assets/javascripts/active_admin/components/jquery.aa.popover.js.coffee +0 -3
- data/app/assets/javascripts/active_admin/components/jquery.aa.table-checkbox-toggler.js.coffee +10 -12
- data/app/assets/javascripts/active_admin/pages/application.js.coffee +13 -10
- data/app/assets/javascripts/active_admin/pages/batch_actions.js.coffee +3 -3
- data/app/assets/stylesheets/active_admin/_base.css.scss +1 -0
- data/app/assets/stylesheets/active_admin/_header.css.scss +5 -2
- data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +2 -2
- data/app/assets/stylesheets/active_admin/components/_index_list.scss +12 -0
- data/app/assets/stylesheets/active_admin/components/_popovers.css.scss +2 -2
- data/app/assets/stylesheets/active_admin/components/_table_tools.css.scss +2 -2
- data/app/assets/stylesheets/active_admin/mixins/_buttons.css.scss +4 -4
- data/app/assets/stylesheets/active_admin/mixins/_gradients.css.scss +5 -4
- data/app/assets/stylesheets/active_admin/mixins/_sections.css.scss +1 -1
- data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +1 -1
- data/app/assets/stylesheets/active_admin/print.css.scss +2 -2
- data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +1 -1
- data/app/views/active_admin/devise/unlocks/new.html.erb +14 -12
- data/docs/1-general-configuration.md +13 -0
- data/docs/10-custom-pages.md +40 -28
- data/docs/11-decorators.md +6 -4
- data/docs/12-arbre-components.md +1 -1
- data/docs/13-authorization-adapter.md +206 -0
- data/docs/2-resource-customization.md +129 -14
- data/docs/3-index-pages.md +65 -0
- data/docs/3-index-pages/create-an-index.md +29 -0
- data/docs/3-index-pages/index-as-table.md +35 -11
- data/docs/5-forms.md +2 -2
- data/features/authorization.feature +64 -0
- data/features/authorization_cancan.feature +52 -0
- data/features/belongs_to.feature +41 -5
- data/features/index/batch_actions.feature +27 -3
- data/features/index/formats.feature +27 -0
- data/features/index/index_as_table.feature +74 -2
- data/features/index/index_parameters.feature +69 -0
- data/features/index/index_scopes.feature +7 -11
- data/features/index/page_title.feature +18 -0
- data/features/index/switch_index_view.feature +73 -0
- data/features/menu.feature +27 -0
- data/features/registering_pages.feature +21 -0
- data/features/step_definitions/additional_web_steps.rb +4 -0
- data/features/step_definitions/batch_action_steps.rb +16 -6
- data/features/step_definitions/index_scope_steps.rb +3 -3
- data/features/step_definitions/index_views_steps.rb +3 -0
- data/features/step_definitions/menu_steps.rb +4 -0
- data/features/support/env.rb +4 -0
- data/features/support/paths.rb +3 -0
- data/lib/active_admin.rb +4 -0
- data/lib/active_admin/application.rb +43 -76
- data/lib/active_admin/authorization_adapter.rb +128 -0
- data/lib/active_admin/base_controller.rb +18 -1
- data/lib/active_admin/base_controller/authorization.rb +153 -0
- data/lib/active_admin/base_controller/menu.rb +8 -3
- data/lib/active_admin/batch_actions/resource_extension.rb +8 -7
- data/lib/active_admin/batch_actions/views/batch_action_form.rb +1 -1
- data/lib/active_admin/cancan_adapter.rb +40 -0
- data/lib/active_admin/dashboards.rb +4 -5
- data/lib/active_admin/dashboards/dashboard_controller.rb +1 -1
- data/lib/active_admin/devise.rb +22 -7
- data/lib/active_admin/dsl.rb +18 -5
- data/lib/active_admin/engine.rb +1 -1
- data/lib/active_admin/filters/dsl.rb +1 -1
- data/lib/active_admin/filters/forms.rb +9 -7
- data/lib/active_admin/filters/resource_extension.rb +20 -15
- data/lib/active_admin/form_builder.rb +44 -49
- data/lib/active_admin/helpers/optional_display.rb +4 -8
- data/lib/active_admin/inputs/filter_boolean_input.rb +1 -1
- data/lib/active_admin/inputs/filter_string_input.rb +5 -1
- data/lib/active_admin/locales/bg.yml +1 -1
- data/lib/active_admin/locales/ca.yml +1 -1
- data/lib/active_admin/locales/cs.yml +26 -25
- data/lib/active_admin/locales/da.yml +1 -1
- data/lib/active_admin/locales/de.yml +1 -1
- data/lib/active_admin/locales/en.yml +11 -1
- data/lib/active_admin/locales/es.yml +16 -16
- data/lib/active_admin/locales/fr.yml +1 -1
- data/lib/active_admin/locales/he.yml +1 -1
- data/lib/active_admin/locales/hr.yml +1 -1
- data/lib/active_admin/locales/hu.yml +1 -1
- data/lib/active_admin/locales/it.yml +1 -1
- data/lib/active_admin/locales/ja.yml +4 -1
- data/lib/active_admin/locales/ko.yml +1 -1
- data/lib/active_admin/locales/lt.yml +1 -1
- data/lib/active_admin/locales/lv.yml +12 -1
- data/lib/active_admin/locales/nl.yml +2 -2
- data/lib/active_admin/locales/no-NB.yml +22 -1
- data/lib/active_admin/locales/pl.yml +1 -1
- data/lib/active_admin/locales/pt-BR.yml +1 -1
- data/lib/active_admin/locales/pt-PT.yml +81 -0
- data/lib/active_admin/locales/ro.yml +1 -1
- data/lib/active_admin/locales/ru.yml +1 -1
- data/lib/active_admin/locales/sv-SE.yml +1 -1
- data/lib/active_admin/locales/tr.yml +1 -1
- data/lib/active_admin/locales/vi.yml +1 -1
- data/lib/active_admin/locales/zh-CN.yml +1 -1
- data/lib/active_admin/locales/zh-TW.yml +1 -1
- data/lib/active_admin/menu.rb +76 -38
- data/lib/active_admin/menu_collection.rb +96 -0
- data/lib/active_admin/menu_item.rb +61 -71
- data/lib/active_admin/namespace.rb +67 -5
- data/lib/active_admin/page.rb +6 -0
- data/lib/active_admin/page_controller.rb +13 -3
- data/lib/active_admin/resource.rb +11 -20
- data/lib/active_admin/resource/action_items.rb +3 -3
- data/lib/active_admin/resource/controllers.rb +0 -17
- data/lib/active_admin/resource/menu.rb +52 -24
- data/lib/active_admin/resource/naming.rb +6 -10
- data/lib/active_admin/resource/page_presenters.rb +57 -3
- data/lib/active_admin/resource/routes.rb +46 -0
- data/lib/active_admin/resource_controller.rb +2 -17
- data/lib/active_admin/resource_controller/data_access.rb +299 -0
- data/lib/active_admin/resource_controller/decorators.rb +2 -1
- data/lib/active_admin/resource_dsl.rb +12 -14
- data/lib/active_admin/router.rb +61 -56
- data/lib/active_admin/scope.rb +28 -18
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_factory.rb +0 -1
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +13 -19
- data/lib/active_admin/view_helpers/fields_for.rb +2 -0
- data/lib/active_admin/view_helpers/form_helper.rb +1 -1
- data/lib/active_admin/view_helpers/method_or_proc_helper.rb +66 -11
- data/lib/active_admin/views/components/attributes_table.rb +7 -4
- data/lib/active_admin/views/components/index_list.rb +68 -0
- data/lib/active_admin/views/components/paginated_collection.rb +13 -9
- data/lib/active_admin/views/components/scopes.rb +2 -8
- data/lib/active_admin/views/components/table_for.rb +1 -1
- data/lib/active_admin/views/footer.rb +1 -1
- data/lib/active_admin/views/header.rb +3 -2
- data/lib/active_admin/views/index_as_block.rb +4 -0
- data/lib/active_admin/views/index_as_blog.rb +4 -0
- data/lib/active_admin/views/index_as_grid.rb +4 -0
- data/lib/active_admin/views/index_as_table.rb +49 -7
- data/lib/active_admin/views/pages/index.rb +19 -4
- data/lib/active_admin/views/tabbed_navigation.rb +10 -54
- data/lib/generators/active_admin/install/install_generator.rb +5 -1
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +58 -0
- data/spec/integration/{default_namespace.rb → default_namespace_spec.rb} +0 -16
- data/spec/spec_helper.rb +3 -0
- data/spec/support/detect_rails_version.rb +10 -3
- data/spec/support/rails_template.rb +1 -1
- data/spec/support/templates/post_decorator.rb +6 -6
- data/spec/unit/application_spec.rb +5 -5
- data/spec/unit/authorization/authorization_adapter_spec.rb +61 -0
- data/spec/unit/authorization/controller_authorization_spec.rb +47 -0
- data/spec/unit/base_controller_spec.rb +0 -2
- data/spec/unit/batch_actions/resource_spec.rb +1 -1
- data/spec/unit/breadcrumbs_spec.rb +3 -3
- data/spec/unit/cancan_adapter_spec.rb +35 -0
- data/spec/unit/config_shared_examples.rb +9 -30
- data/spec/unit/devise_spec.rb +29 -0
- data/spec/unit/dsl_spec.rb +61 -0
- data/spec/unit/filters/filter_form_builder_spec.rb +58 -4
- data/spec/unit/filters/resource_spec.rb +17 -5
- data/spec/unit/form_builder_spec.rb +15 -0
- data/spec/unit/menu_collection_spec.rb +62 -0
- data/spec/unit/menu_item_spec.rb +51 -37
- data/spec/unit/menu_spec.rb +33 -29
- data/spec/unit/namespace/authorization_spec.rb +31 -0
- data/spec/unit/namespace/register_page_spec.rb +6 -28
- data/spec/unit/namespace/register_resource_spec.rb +11 -34
- data/spec/unit/namespace_spec.rb +63 -2
- data/spec/unit/page_controller_spec.rb +0 -3
- data/spec/unit/reloader_spec.rb +5 -5
- data/spec/unit/resource/menu_spec.rb +1 -13
- data/spec/unit/resource/naming_spec.rb +20 -2
- data/spec/unit/resource/page_presenters_spec.rb +14 -2
- data/spec/unit/resource_controller/{collection_spec.rb → data_access_spec.rb} +31 -13
- data/spec/unit/resource_controller_spec.rb +4 -5
- data/spec/unit/resource_spec.rb +33 -11
- data/spec/unit/routing_spec.rb +43 -0
- data/spec/unit/scope_spec.rb +13 -0
- data/spec/unit/view_factory_spec.rb +0 -1
- data/spec/unit/view_helpers/fields_for_spec.rb +4 -0
- data/spec/unit/view_helpers/form_helper_spec.rb +6 -2
- data/spec/unit/view_helpers/method_or_proc_helper_spec.rb +97 -0
- data/spec/unit/views/components/attributes_table_spec.rb +11 -0
- data/spec/unit/views/components/index_list_spec.rb +32 -0
- data/spec/unit/views/tabbed_navigation_spec.rb +42 -40
- data/tasks/test.rake +1 -1
- metadata +127 -40
- data/lib/active_admin/menu_builder.rb +0 -65
- data/lib/active_admin/resource_controller/callbacks.rb +0 -59
- data/lib/active_admin/resource_controller/collection.rb +0 -158
- data/lib/active_admin/views/utility_nav.rb +0 -41
- data/spec/unit/base_controller_shared_examples.rb +0 -25
- data/spec/unit/dsl_include_spec.rb +0 -20
data/app/assets/javascripts/active_admin/components/jquery.aa.table-checkbox-toggler.js.coffee
CHANGED
|
@@ -5,23 +5,21 @@ window.AA.TableCheckboxToggler = class AA.TableCheckboxToggler extends AA.Checkb
|
|
|
5
5
|
_bind: ->
|
|
6
6
|
super
|
|
7
7
|
|
|
8
|
-
@$container.find(
|
|
9
|
-
if e.target.type
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
@$container.find('tbody td').click (e)=>
|
|
9
|
+
@_didClickCell(e.target) if e.target.type isnt 'checkbox'
|
|
10
|
+
|
|
12
11
|
_didChangeCheckbox: (checkbox) ->
|
|
13
12
|
super
|
|
14
|
-
|
|
15
|
-
$row = $(checkbox).parents
|
|
13
|
+
|
|
14
|
+
$row = $(checkbox).parents 'tr'
|
|
16
15
|
|
|
17
16
|
if checkbox.checked
|
|
18
|
-
$row.addClass
|
|
17
|
+
$row.addClass 'selected'
|
|
19
18
|
else
|
|
20
|
-
$row.removeClass
|
|
19
|
+
$row.removeClass 'selected'
|
|
21
20
|
|
|
22
21
|
_didClickCell: (cell) ->
|
|
23
|
-
$(cell).parent(
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
$(cell).parent('tr').find(':checkbox').click()
|
|
23
|
+
|
|
24
|
+
jQuery ($)->
|
|
26
25
|
$.widget.bridge 'tableCheckboxToggler', AA.TableCheckboxToggler
|
|
27
|
-
)( jQuery )
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
#
|
|
1
|
+
# Initializers
|
|
2
|
+
$ ->
|
|
3
|
+
# jQuery datepickers (also evaluates dynamically added HTML)
|
|
4
|
+
$(document).on 'focus', '.datepicker:not(.hasDatepicker)', ->
|
|
5
|
+
$(@).datepicker dateFormat: 'yy-mm-dd'
|
|
4
6
|
|
|
7
|
+
# Clear Filters button
|
|
8
|
+
$('.clear_filters_btn').click ->
|
|
9
|
+
window.location.search = ''
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
$(".datepicker").datepicker dateFormat: "yy-mm-dd"
|
|
9
|
-
$(".clear_filters_btn").click ->
|
|
10
|
-
window.location.search = ""
|
|
11
|
-
false
|
|
11
|
+
# Batch Actions dropdown
|
|
12
|
+
$('.dropdown_button').popover()
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
# Filter form: don't send any inputs that are empty
|
|
15
|
+
$('#q_search').submit ->
|
|
16
|
+
$(@).find(':input').filter(-> @value is '').prop 'disabled', true
|
|
@@ -5,7 +5,7 @@ jQuery ($) ->
|
|
|
5
5
|
#
|
|
6
6
|
|
|
7
7
|
$(document).delegate "#batch_actions_selector li a", "click.rails", ->
|
|
8
|
-
$("#batch_action").val $(
|
|
8
|
+
$("#batch_action").val $(@).attr("data-action")
|
|
9
9
|
$("#collection_selection").submit()
|
|
10
10
|
|
|
11
11
|
#
|
|
@@ -14,8 +14,8 @@ jQuery ($) ->
|
|
|
14
14
|
|
|
15
15
|
if $("#batch_actions_selector").length && $(":checkbox.toggle_all").length
|
|
16
16
|
|
|
17
|
-
if $(".paginated_collection
|
|
18
|
-
$(".paginated_collection table").tableCheckboxToggler()
|
|
17
|
+
if $(".paginated_collection table.index_table").length
|
|
18
|
+
$(".paginated_collection table.index_table").tableCheckboxToggler()
|
|
19
19
|
else
|
|
20
20
|
$(".paginated_collection").checkboxToggler()
|
|
21
21
|
|
|
@@ -27,6 +27,7 @@ body.active_admin {
|
|
|
27
27
|
@import "active_admin/components/scopes";
|
|
28
28
|
@import "active_admin/components/status_tags";
|
|
29
29
|
@import "active_admin/components/table_tools";
|
|
30
|
+
@import "active_admin/components/index_list";
|
|
30
31
|
@import "active_admin/pages/dashboard";
|
|
31
32
|
@import "active_admin/pages/logged_out";
|
|
32
33
|
@import "active_admin/structure/footer";
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
height: 20px
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
ul
|
|
45
|
+
ul.tabs {
|
|
46
46
|
display: inline-block;
|
|
47
47
|
height: 100%;
|
|
48
48
|
margin: 0;
|
|
@@ -128,10 +128,13 @@
|
|
|
128
128
|
display: inline-block;
|
|
129
129
|
margin: 0;
|
|
130
130
|
padding: 0;
|
|
131
|
-
span, a { margin-left: 10px; }
|
|
132
131
|
|
|
133
132
|
a { text-decoration: none; }
|
|
134
133
|
a:hover { color: #fff; }
|
|
134
|
+
|
|
135
|
+
li {
|
|
136
|
+
display:inline;
|
|
137
|
+
}
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
}
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
position: absolute;
|
|
81
81
|
background-color: white;
|
|
82
82
|
padding: 2px;
|
|
83
|
-
|
|
83
|
+
box-shadow: rgba(0,0,0,0.4) 0 1px 3px, lighten($primary-color, 15%) 0px 1px 0px 0px inset;
|
|
84
84
|
background-color: $primary-color;
|
|
85
85
|
@include gradient(lighten($primary-color, 4%), darken($primary-color, 5%));
|
|
86
86
|
border: solid 1px darken($primary-color, 10%);
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
display: block;
|
|
94
94
|
background-color: #FFF;
|
|
95
95
|
border: solid 1px darken($primary-color, 10%);
|
|
96
|
-
|
|
96
|
+
box-shadow: lighten($primary-color, 5%) 0px 1px 0px 0px;
|
|
97
97
|
border-radius: 3px;
|
|
98
98
|
margin: 0;
|
|
99
99
|
overflow: hidden;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
position: absolute;
|
|
4
4
|
background-color: white;
|
|
5
5
|
padding: 2px;
|
|
6
|
-
|
|
6
|
+
box-shadow: rgba(0,0,0,0.4) 0 1px 3px, lighten($primary-color, 15%) 0px 1px 0px 0px inset;
|
|
7
7
|
background-color: $primary-color;
|
|
8
8
|
@include gradient(lighten($primary-color, 4%), darken($primary-color, 5%));
|
|
9
9
|
border: solid 1px darken($primary-color, 10%);
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
display: block;
|
|
60
60
|
background-color: #FFF;
|
|
61
61
|
border: solid 1px darken($primary-color, 10%);
|
|
62
|
-
|
|
62
|
+
box-shadow: lighten($primary-color, 5%) 0px 1px 0px 0px;
|
|
63
63
|
border-radius: 3px;
|
|
64
64
|
margin: 0;
|
|
65
65
|
overflow: hidden;
|
|
@@ -38,7 +38,7 @@ a.table_tools_button, .table_tools .dropdown_menu_button {
|
|
|
38
38
|
|
|
39
39
|
&:active {
|
|
40
40
|
@include border-colors(#d7d7d7, #c8c8c8, #c3c3c3);
|
|
41
|
-
|
|
41
|
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.17) inset;
|
|
42
42
|
@include gradient(#FFFFFF, #E8E8E8);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -81,7 +81,7 @@ a.table_tools_button, .table_tools .dropdown_menu_button {
|
|
|
81
81
|
|
|
82
82
|
a {
|
|
83
83
|
@include gradient(#F0F0F0, #FDFDFD);
|
|
84
|
-
|
|
84
|
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1) inset;
|
|
85
85
|
cursor: default;
|
|
86
86
|
|
|
87
87
|
&:hover {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
@include basic-button;
|
|
22
22
|
@include gradient(lighten($primary-color, 15%), darken($primary-color, 12%));
|
|
23
23
|
@include text-shadow(#000);
|
|
24
|
-
|
|
24
|
+
box-shadow: 0 1px 1px rgba(0,0,0,0.10), 0 1px 0 0px rgba(255,255,255, 0.2) inset;
|
|
25
25
|
border: solid 1px #484e53;
|
|
26
26
|
@include border-colors(#616a71, #484e53, #363b3f);
|
|
27
27
|
color: #efefef;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
&:active {
|
|
35
|
-
|
|
35
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.40) inset, 0 1px 0 0px #FFF;
|
|
36
36
|
@include gradient(lighten($primary-color, 8%), darken($primary-color, 17%));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
@mixin light-button {
|
|
42
42
|
@include basic-button;
|
|
43
43
|
@include gradient(#FFFFFF, #E7E7E7);
|
|
44
|
-
|
|
44
|
+
box-shadow: 0 1px 1px rgba(0,0,0,0.10), 0 1px 0 0 rgba(255,255,255, 0.8) inset;
|
|
45
45
|
border: solid 1px #c7c7c7;
|
|
46
46
|
@include border-colors(#d3d3d3, #c7c7c7, #c2c2c2);
|
|
47
47
|
@include text-shadow;
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
&:active {
|
|
56
|
-
|
|
56
|
+
box-shadow: 0 1px 2px rgba(0,0,0,0.22) inset, 0 1px 0 0px #EEE;
|
|
57
57
|
@include border-colors(#c2c2c2, #b9b9b9, #b7b7b7);
|
|
58
58
|
@include gradient(#F3F3F3, #D8D8D8);
|
|
59
59
|
}
|
|
@@ -3,12 +3,13 @@ $secondary-gradient-stop: #dfe1e2 !default;
|
|
|
3
3
|
|
|
4
4
|
@mixin gradient($start, $end){
|
|
5
5
|
background: $start;
|
|
6
|
-
background: -webkit-gradient(
|
|
7
|
-
background: -moz-linear-gradient(-90deg, $start, $end);
|
|
6
|
+
background: -webkit-linear-gradient(-90deg, $start, $end);
|
|
7
|
+
background: -moz-linear-gradient(-90deg, $start, $end);
|
|
8
|
+
background: linear-gradient(-90deg, $start, $end);
|
|
8
9
|
// IE 6 & 7
|
|
9
|
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$start}', endColorstr='#{$end}');
|
|
10
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($end)}');
|
|
10
11
|
// IE 8
|
|
11
|
-
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$start}', endColorstr='#{$end}');
|
|
12
|
+
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{ie-hex-str($start)}', endColorstr='#{ie-hex-str($end)}');
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
@mixin primary-gradient {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@include text-shadow;
|
|
4
4
|
border: solid 1px #cdcdcd;
|
|
5
5
|
@include border-colors(#e6e6e6, #d4d4d4, #cdcdcd);
|
|
6
|
-
|
|
6
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 1px #FFF inset;
|
|
7
7
|
|
|
8
8
|
font-size: 1.0em;
|
|
9
9
|
font-weight: bold;
|
|
@@ -40,7 +40,7 @@ h3 {
|
|
|
40
40
|
#header {
|
|
41
41
|
float: left;
|
|
42
42
|
|
|
43
|
-
#tabs, #utility_nav {
|
|
43
|
+
#tabs, .tabs, #utility_nav {
|
|
44
44
|
display: none;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -91,7 +91,7 @@ h3 {
|
|
|
91
91
|
padding: 0;
|
|
92
92
|
margin-bottom: 1em;
|
|
93
93
|
|
|
94
|
-
&.scope.selected {
|
|
94
|
+
&.scope.selected, &.index.selected {
|
|
95
95
|
display: block;
|
|
96
96
|
|
|
97
97
|
&:before {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<%=
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<div id="login">
|
|
2
|
+
<h2><%= title "#{render_or_call_method_or_proc_on(self, active_admin_application.site_title)} #{t('active_admin.devise.unlock.title')}" %></h2>
|
|
3
|
+
|
|
4
|
+
<%= active_admin_form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f|
|
|
5
|
+
f.inputs do
|
|
6
|
+
f.input :email
|
|
7
|
+
end
|
|
8
|
+
f.actions do
|
|
9
|
+
f.action :submit, :label => t('active_admin.devise.unlock.submit'), :button_html => { :value => t('active_admin.devise.unlock.submit') }
|
|
10
|
+
end
|
|
11
|
+
end %>
|
|
12
|
+
|
|
13
|
+
<%= render :partial => "active_admin/devise/shared/links" %>
|
|
14
|
+
</div>
|
|
@@ -114,3 +114,16 @@ You can also disable comments for a specific resource:
|
|
|
114
114
|
ActiveAdmin.register Post do
|
|
115
115
|
config.comments = false
|
|
116
116
|
end
|
|
117
|
+
|
|
118
|
+
## Utility Navigation
|
|
119
|
+
|
|
120
|
+
The "utility navigation" shown at the top right when logged in by default shows the current user email address and a link to "Log Out". However, the utility navigation is just like any other menu in the system, so you can provide your own menu to be rendered in place if you like.
|
|
121
|
+
|
|
122
|
+
ActiveAdmin.setup do |config|
|
|
123
|
+
config.namespace :admin do |admin|
|
|
124
|
+
admin.build_menu :utility_navigation do |menu|
|
|
125
|
+
menu.add label: "ActiveAdmin.info", url: "http://www.activeadmin.info", html_options: { target: :blank }
|
|
126
|
+
admin.add_logout_button_to_menu menu # can also pass priority & html_options for link_to to use
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
data/docs/10-custom-pages.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# Custom Pages
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
When you need a standalone page on your site, Custom Pages will be there with a familiar syntax to resource registration.
|
|
4
|
+
|
|
5
|
+
## Available Features
|
|
6
|
+
* main page content
|
|
7
|
+
* menu item
|
|
8
|
+
* sidebars
|
|
9
|
+
* action_items
|
|
10
|
+
* page_actions
|
|
6
11
|
|
|
7
12
|
## Create a new Page
|
|
8
13
|
|
|
@@ -15,8 +20,8 @@ Creating a page is a simple as calling the `register_page` method:
|
|
|
15
20
|
end
|
|
16
21
|
|
|
17
22
|
In the above example, a new page will be created at `/admin/my_page` with the
|
|
18
|
-
title "My Page" and the content of "Hello World". Anything rendered within
|
|
19
|
-
|
|
23
|
+
title "My Page" and the content of "Hello World". Anything rendered within
|
|
24
|
+
`content` will be the main content on the page.
|
|
20
25
|
|
|
21
26
|
## Page Title & I18n
|
|
22
27
|
|
|
@@ -24,22 +29,8 @@ Coming soon...
|
|
|
24
29
|
|
|
25
30
|
## Customize the Menu
|
|
26
31
|
|
|
27
|
-
The menu item is available to customize just like
|
|
28
|
-
Active Admin
|
|
29
|
-
|
|
30
|
-
ActiveAdmin.register_page "My Page" do
|
|
31
|
-
menu :label => "My Menu Item Label", :parent => "Dashboard"
|
|
32
|
-
|
|
33
|
-
content do
|
|
34
|
-
para "Hello World"
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
This configuration will add the page to the menu with the label "My Menu Item
|
|
39
|
-
Label" and will nest it underneath the "Dashboard" link.
|
|
40
|
-
|
|
41
|
-
To view the full list of available menu options visit ([Resource
|
|
42
|
-
Customization](2-resource-customization.md))
|
|
32
|
+
The menu item is available to customize just like
|
|
33
|
+
[any other resource](2-resource-customization.md#customize-the-menu) in Active Admin.
|
|
43
34
|
|
|
44
35
|
## Add a Sidebar Section
|
|
45
36
|
|
|
@@ -59,11 +50,8 @@ in Active Admin:
|
|
|
59
50
|
end
|
|
60
51
|
end
|
|
61
52
|
|
|
62
|
-
This
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
To view the full list of available sidebar section options visit
|
|
66
|
-
([Sidebars](7-sidebars.md))
|
|
53
|
+
This creates a sidebar section named "Help" containing an unordered list.
|
|
54
|
+
To view the full customization options, visit [Sidebars](7-sidebars.md).
|
|
67
55
|
|
|
68
56
|
## Add an Action Item
|
|
69
57
|
|
|
@@ -80,5 +68,29 @@ Just like other resources, you can add Action Item's to pages:
|
|
|
80
68
|
end
|
|
81
69
|
end
|
|
82
70
|
|
|
83
|
-
This
|
|
84
|
-
|
|
71
|
+
This adds an action item that links to the root URL of the application.
|
|
72
|
+
|
|
73
|
+
## Add a Page Action
|
|
74
|
+
|
|
75
|
+
`page_action` allows you to define controller actions specific to this page,
|
|
76
|
+
and is the functional equivalent of `collection_action`.
|
|
77
|
+
|
|
78
|
+
ActiveAdmin.register_page "My Page" do
|
|
79
|
+
|
|
80
|
+
page_action :ex, :method => :post do
|
|
81
|
+
# do stuff here
|
|
82
|
+
redirect_to admin_my_page_path, :notice => "You did stuff!"
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
action_item do
|
|
86
|
+
link_to "Do Stuff", admin_my_page_ex_path, :method => :post
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
content do
|
|
90
|
+
para "Hello World"
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
This defines the route `/admin/my_page/ex` which can handle HTTP POST requests.
|
|
95
|
+
|
|
96
|
+
Clicking on the `action_item` will reload page with the message "You did stuff!"
|
data/docs/11-decorators.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Decorators
|
|
2
2
|
|
|
3
3
|
Active Admin supports the use of decorators for resources. Resources will be
|
|
4
|
-
be decorated for the index and show blocks. The
|
|
5
|
-
gem is recommended but not required
|
|
4
|
+
be decorated for the index and show blocks. The
|
|
5
|
+
[draper](https://github.com/drapergem/draper) gem is recommended but not required
|
|
6
|
+
(more on requirements below). Note, that Active Admin works out of the box with
|
|
7
|
+
Draper `>= 1.0.0`.
|
|
6
8
|
|
|
7
9
|
## Configuration
|
|
8
10
|
|
|
@@ -12,10 +14,10 @@ gem is recommended but not required (more on requirements below).
|
|
|
12
14
|
|
|
13
15
|
## Example Usage
|
|
14
16
|
|
|
15
|
-
This example uses [draper](
|
|
17
|
+
This example uses [draper](https://github.com/drapergem/draper).
|
|
16
18
|
|
|
17
19
|
# Gemfile
|
|
18
|
-
gem 'draper'
|
|
20
|
+
gem 'draper', '>= 1.0.0'
|
|
19
21
|
|
|
20
22
|
Assuming a post and a post decorator
|
|
21
23
|
|