activeadmin 0.5.0 → 0.5.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/.travis.yml +1 -1
- data/CHANGELOG.md +92 -1
- data/CONTRIBUTING.md +3 -3
- data/Gemfile +6 -5
- data/README.rdoc +6 -1
- data/Rakefile +2 -2
- data/app/assets/stylesheets/active_admin/_forms.css.scss +13 -2
- data/app/assets/stylesheets/active_admin/components/_comments.css.scss +1 -0
- data/app/assets/stylesheets/active_admin/components/_table_tools.css.scss +2 -1
- data/app/views/active_admin/resource/index.csv.erb +4 -1
- data/app/views/layouts/active_admin_logged_out.html.erb +3 -3
- data/docs/0-installation.md +0 -7
- data/docs/1-general-configuration.md +37 -0
- data/docs/11-decorators.md +48 -0
- data/docs/12-arbre-components.md +145 -0
- data/docs/2-resource-customization.md +23 -6
- data/docs/3-index-pages.md +5 -0
- data/docs/4-csv-format.md +11 -2
- data/docs/8-custom-actions.md +2 -2
- data/features/breadcrumb.feature +27 -0
- data/features/decorators.feature +41 -0
- data/features/i18n.feature +7 -0
- data/features/index/format_as_csv.feature +40 -3
- data/features/index/index_as_table.feature +6 -6
- data/features/step_definitions/format_steps.rb +6 -1
- data/lib/active_admin.rb +1 -1
- data/lib/active_admin/application.rb +15 -7
- data/lib/active_admin/comments/comment.rb +4 -2
- data/lib/active_admin/csv_builder.rb +2 -1
- data/lib/active_admin/devise.rb +1 -0
- data/lib/active_admin/dsl.rb +25 -0
- data/lib/active_admin/filters/dsl.rb +9 -0
- data/lib/active_admin/filters/forms.rb +2 -0
- data/lib/active_admin/filters/resource_extension.rb +32 -2
- data/lib/active_admin/form_builder.rb +29 -12
- data/lib/active_admin/inputs.rb +1 -0
- data/lib/active_admin/inputs/filter_boolean_input.rb +40 -0
- data/lib/active_admin/inputs/filter_select_input.rb +5 -1
- data/lib/active_admin/locales/bg.yml +1 -0
- data/lib/active_admin/locales/ca.yml +1 -0
- data/lib/active_admin/locales/cs.yml +9 -1
- data/lib/active_admin/locales/da.yml +1 -0
- data/lib/active_admin/locales/de.yml +16 -3
- data/lib/active_admin/locales/en.yml +1 -0
- data/lib/active_admin/locales/es.yml +1 -0
- data/lib/active_admin/locales/fr.yml +5 -1
- data/lib/active_admin/locales/he.yml +3 -2
- data/lib/active_admin/locales/hr.yml +1 -0
- data/lib/active_admin/locales/hu.yml +1 -0
- data/lib/active_admin/locales/it.yml +5 -4
- data/lib/active_admin/locales/ja.yml +12 -12
- data/lib/active_admin/locales/ko.yml +1 -0
- data/lib/active_admin/locales/lt.yml +81 -0
- data/lib/active_admin/locales/lv.yml +2 -1
- data/lib/active_admin/locales/nl.yml +1 -0
- data/lib/active_admin/locales/no-NB.yml +1 -0
- data/lib/active_admin/locales/pl.yml +1 -0
- data/lib/active_admin/locales/pt-BR.yml +3 -2
- data/lib/active_admin/locales/ro.yml +1 -0
- data/lib/active_admin/locales/ru.yml +7 -6
- data/lib/active_admin/locales/sv-SE.yml +1 -0
- data/lib/active_admin/locales/tr.yml +3 -2
- data/lib/active_admin/locales/vi.yml +1 -0
- data/lib/active_admin/locales/zh-CN.yml +1 -0
- data/lib/active_admin/locales/zh-TW.yml +1 -0
- data/lib/active_admin/menu_item.rb +6 -0
- data/lib/active_admin/page.rb +3 -0
- data/lib/active_admin/page_presenter.rb +2 -0
- data/lib/active_admin/resource.rb +12 -1
- data/lib/active_admin/resource/menu.rb +8 -1
- data/lib/active_admin/resource_controller.rb +3 -1
- data/lib/active_admin/resource_controller/collection.rb +1 -1
- data/lib/active_admin/resource_controller/decorators.rb +19 -0
- data/lib/active_admin/resource_dsl.rb +1 -1
- data/lib/active_admin/version.rb +1 -1
- data/lib/active_admin/view_helpers.rb +1 -0
- data/lib/active_admin/view_helpers/breadcrumb_helper.rb +1 -1
- data/lib/active_admin/view_helpers/download_format_links_helper.rb +50 -0
- data/lib/active_admin/view_helpers/fields_for.rb +4 -0
- data/lib/active_admin/view_helpers/flash_helper.rb +13 -0
- data/lib/active_admin/views/components/paginated_collection.rb +2 -11
- data/lib/active_admin/views/components/table_for.rb +21 -27
- data/lib/active_admin/views/footer.rb +3 -1
- data/lib/active_admin/views/index_as_block.rb +1 -1
- data/lib/active_admin/views/index_as_grid.rb +1 -1
- data/lib/active_admin/views/pages/base.rb +3 -3
- data/lib/active_admin/views/pages/index.rb +1 -7
- data/lib/active_admin/views/title_bar.rb +6 -3
- data/lib/generators/active_admin/devise/devise_generator.rb +1 -1
- data/lib/generators/active_admin/install/templates/active_admin.rb.erb +6 -3
- data/lib/generators/active_admin/install/templates/admin_user.rb.erb +1 -1
- data/lib/generators/active_admin/install/templates/dashboard.rb +2 -2
- data/lib/generators/active_admin/install/templates/migrations/2_move_admin_notes_to_comments.rb +2 -1
- data/spec/integration/memory_spec.rb +1 -1
- data/spec/support/rails_template.rb +41 -2
- data/spec/support/rails_template_with_data.rb +2 -1
- data/spec/support/templates/en.yml +2 -0
- data/spec/support/templates/post_decorator.rb +53 -0
- data/spec/unit/application_spec.rb +17 -4
- data/spec/unit/belongs_to_spec.rb +1 -1
- data/spec/unit/config_shared_examples.rb +15 -7
- data/spec/unit/controller_filters_spec.rb +8 -8
- data/spec/unit/csv_builder_spec.rb +10 -0
- data/spec/unit/devise_spec.rb +28 -7
- data/spec/unit/filters/filter_form_builder_spec.rb +24 -0
- data/spec/unit/filters/resource_spec.rb +15 -1
- data/spec/unit/form_builder_spec.rb +4 -0
- data/spec/unit/resource_controller_spec.rb +67 -3
- data/spec/unit/resource_spec.rb +17 -0
- data/spec/unit/view_helpers/download_format_links_helper_spec.rb +39 -0
- data/spec/unit/view_helpers/fields_for_spec.rb +5 -0
- data/spec/unit/views/components/table_for_spec.rb +31 -0
- data/spec/unit/views/pages/layout_spec.rb +1 -1
- data/spec/unit/views/pages/show_spec.rb +21 -0
- data/tasks/parallel_tests.rake +60 -0
- data/tasks/test.rake +2 -1
- metadata +44 -26
@@ -0,0 +1,81 @@
|
|
1
|
+
lt:
|
2
|
+
active_admin:
|
3
|
+
dashboard: Valdymo skydelis
|
4
|
+
dashboard_welcome:
|
5
|
+
welcome: "Sveiki atvykę į Active Admin. Tai yra numatytasis valdymo skydelis."
|
6
|
+
call_to_action: 'Norėdami pridėti skydelyje skyrius, žiūrėkite app/admin/dashboards.rb'
|
7
|
+
view: 'Žiūrėti'
|
8
|
+
edit: 'Redaguoti'
|
9
|
+
delete: 'Šalinti'
|
10
|
+
delete_confirmation: 'Ar jūs tikrai norite tai pašalinti?'
|
11
|
+
new_model: 'Naujas %{model}'
|
12
|
+
create_model: 'Naujas %{model}'
|
13
|
+
edit_model: 'Redaguoti %{model}'
|
14
|
+
update_model: 'Redaguoti %{model}'
|
15
|
+
delete_model: 'Pašalinti %{model}'
|
16
|
+
details: '%{model} Informacija'
|
17
|
+
cancel: 'Atšaukti'
|
18
|
+
empty: 'Tuščia'
|
19
|
+
previous: 'Atgal'
|
20
|
+
next: 'Toliau'
|
21
|
+
download: 'Atsisiųsti'
|
22
|
+
has_many_new: 'Pridėti naują %{model}'
|
23
|
+
has_many_delete: 'Šalinti'
|
24
|
+
filter: 'Filtras'
|
25
|
+
clear_filters: 'Išvalyti filtrus'
|
26
|
+
search_field: 'Paieškos %{field}'
|
27
|
+
equal_to: 'lygus'
|
28
|
+
greater_than: 'didesnis nei'
|
29
|
+
less_than: 'mažiau nei'
|
30
|
+
main_content: 'Prašome realizuoti %{model}#main_content turiniui vaizduoti.'
|
31
|
+
logout: 'Išeiti'
|
32
|
+
powered_by: "Powered by %{active_admin} %{version}"
|
33
|
+
sidebars:
|
34
|
+
filters: 'Filtrai'
|
35
|
+
pagination:
|
36
|
+
empty: '%{model} nerastas'
|
37
|
+
one: 'Rodoma <B> 1 </ b> %{model}'
|
38
|
+
one_page: 'Rodoma <b>visi %{n} </ b> %{model}'
|
39
|
+
multiple: 'Rodomi %{model} <b>%{iš} - %{to} </ b> iš<b>%{total} </ b> iš viso'
|
40
|
+
entry:
|
41
|
+
one: 'įrašas'
|
42
|
+
other: 'įrašai'
|
43
|
+
any: 'Bet kokia'
|
44
|
+
blank_slate:
|
45
|
+
content: 'Nėra %{resource_name}.'
|
46
|
+
link: 'Sukurti'
|
47
|
+
batch_actions:
|
48
|
+
button_label: 'Veiksmai su pažymėtais'
|
49
|
+
delete_confirmation: 'Ar jūs tikrai norite pašalinti šiuos %{plural_model}? Pašalinus negalėsite atstatyti?'
|
50
|
+
succesfully_destroyed:
|
51
|
+
one: 'Sėkmingai pašalintas 1 %{model}'
|
52
|
+
other: 'Sėkmingai pašalinti %{count} %{plural_model}'
|
53
|
+
selection_toggle_explanation: '(Žymėti)'
|
54
|
+
link: 'Sukurti'
|
55
|
+
action_label: '%{title} Pasirinkta'
|
56
|
+
labels:
|
57
|
+
destroy: 'Šalinti'
|
58
|
+
comments:
|
59
|
+
body: 'Kūno'
|
60
|
+
author: 'Autorius'
|
61
|
+
title: 'Komentaras'
|
62
|
+
add: 'Pridėti komentarą'
|
63
|
+
resource: 'Išteklių'
|
64
|
+
no_comments_yet: 'Dar nėra komentarų.'
|
65
|
+
title_content: 'Komentarai (%{count})'
|
66
|
+
errors:
|
67
|
+
empty_text: 'komentaras neišsaugotas, tekstas buvo tuščias.'
|
68
|
+
devise:
|
69
|
+
login:
|
70
|
+
title: 'Prisijungti'
|
71
|
+
remember_me: 'Prisimink mane'
|
72
|
+
submit: 'Prisijungti'
|
73
|
+
reset_password:
|
74
|
+
title: 'Pamiršote slaptažodį?'
|
75
|
+
submit: 'Vėl nustatykite savo slaptažodį'
|
76
|
+
change_password:
|
77
|
+
title: 'Keisti slaptažodį'
|
78
|
+
submit: 'Keisti slaptažodį'
|
79
|
+
links:
|
80
|
+
sign_in: 'Prisijungti'
|
81
|
+
forgot_your_password: 'Pamiršote slaptažodį?'
|
@@ -29,6 +29,7 @@ lv:
|
|
29
29
|
less_than: "Mazāks par"
|
30
30
|
main_content: "Lūdzu implementēt %{model}#main_content, lai rādītos saturs."
|
31
31
|
logout: "Iziet"
|
32
|
+
powered_by: "Powered by %{active_admin} %{version}"
|
32
33
|
sidebars:
|
33
34
|
filters: "Filtri"
|
34
35
|
pagination:
|
@@ -43,7 +44,7 @@ lv:
|
|
43
44
|
blank_slate:
|
44
45
|
content: "Sadaļā '%{resource_name}' nav neviena ieraksta."
|
45
46
|
link: "Izveidot jaunu"
|
46
|
-
comments:
|
47
|
+
comments:
|
47
48
|
body: "Saturs"
|
48
49
|
author: "Autors"
|
49
50
|
title: "Komentārs"
|
@@ -29,6 +29,7 @@
|
|
29
29
|
less_than: "Menor Que"
|
30
30
|
main_content: "Por favor implemente %{model}#main_content para exibir conteúdo."
|
31
31
|
logout: "Sair"
|
32
|
+
powered_by: "Powered by %{active_admin} %{version}"
|
32
33
|
sidebars:
|
33
34
|
filters: "Filtros"
|
34
35
|
pagination:
|
@@ -54,7 +55,7 @@
|
|
54
55
|
action_label: "%{title} Selecionado"
|
55
56
|
labels:
|
56
57
|
destroy: "Excluído"
|
57
|
-
comments:
|
58
|
+
comments:
|
58
59
|
body: "Conteúdo"
|
59
60
|
author: "Autor"
|
60
61
|
title: "Comentário"
|
@@ -77,4 +78,4 @@
|
|
77
78
|
submit: "Troque minha senha"
|
78
79
|
links:
|
79
80
|
sign_in: "Entrar"
|
80
|
-
forgot_your_password: "Esqueceu sua senha?"
|
81
|
+
forgot_your_password: "Esqueceu sua senha?"
|
@@ -8,12 +8,12 @@ ru:
|
|
8
8
|
edit: "Изменить"
|
9
9
|
delete: "Удалить"
|
10
10
|
delete_confirmation: "Вы уверены, что хотите удалить это?"
|
11
|
-
new_model: "Создать"
|
11
|
+
new_model: "Создать %{model}"
|
12
12
|
create_model: "Создать %{model}"
|
13
|
-
edit_model: "Изменить"
|
13
|
+
edit_model: "Изменить %{model}"
|
14
14
|
update_model: "Изменить %{model}"
|
15
|
-
delete_model: "Удалить"
|
16
|
-
details: "
|
15
|
+
delete_model: "Удалить %{model}"
|
16
|
+
details: "%{model} подробнее"
|
17
17
|
cancel: "Отмена"
|
18
18
|
empty: "Пусто"
|
19
19
|
previous: "Пред."
|
@@ -29,6 +29,7 @@ ru:
|
|
29
29
|
less_than: "меньше"
|
30
30
|
main_content: "Создайте %{model}#main_content для отображения содержимого."
|
31
31
|
logout: "Выйти"
|
32
|
+
powered_by: "Powered by %{active_admin} %{version}"
|
32
33
|
sidebars:
|
33
34
|
filters: "Фильтры"
|
34
35
|
pagination:
|
@@ -45,7 +46,7 @@ ru:
|
|
45
46
|
link: "Создать"
|
46
47
|
batch_actions:
|
47
48
|
button_label: "Групповые операции"
|
48
|
-
delete_confirmation: "Вы уверены, что хотите удалить
|
49
|
+
delete_confirmation: "Вы уверены, что хотите удалить %{plural_model}? Вы не сможете это отменить."
|
49
50
|
succesfully_destroyed:
|
50
51
|
one: "Успешно удалено: 1 %{model}"
|
51
52
|
other: "Успешно удалено: %{count} %{plural_model}"
|
@@ -54,7 +55,7 @@ ru:
|
|
54
55
|
action_label: "%{title} выбранное"
|
55
56
|
labels:
|
56
57
|
destroy: "Удалить"
|
57
|
-
comments:
|
58
|
+
comments:
|
58
59
|
body: "Текст"
|
59
60
|
author: "Автор"
|
60
61
|
title: "Комментарий"
|
@@ -29,6 +29,7 @@ tr:
|
|
29
29
|
less_than: "Küçükse"
|
30
30
|
main_content: "İçeriği görüntülemek için lütfen %{model}#main_content metodunu ekleyin."
|
31
31
|
logout: "Oturumu Sonlandır"
|
32
|
+
powered_by: "Powered by %{active_admin} %{version}"
|
32
33
|
sidebars:
|
33
34
|
filters: "Filtreler"
|
34
35
|
pagination:
|
@@ -45,10 +46,10 @@ tr:
|
|
45
46
|
link: "Bir tane oluşturun"
|
46
47
|
batch_actions:
|
47
48
|
button_label: "Toplu işlemler"
|
48
|
-
delete_confirmation: "%{
|
49
|
+
delete_confirmation: "%{plural_model} kayıtlarını silmek istediğinize emin misiniz? Dikkat bu işlemin geri dönüşü yoktur!"
|
49
50
|
succesfully_destroyed:
|
50
51
|
one: "1 %{model} kaydı başarıyla silindi."
|
51
|
-
other: "Toplam %{count} kayıt %{
|
52
|
+
other: "Toplam %{count} kayıt %{plural_model} modelinden silindi"
|
52
53
|
selection_toggle_explanation: "Seçimi Değiştir"
|
53
54
|
link: "Ekle"
|
54
55
|
action_label: "%{title} Seçildi"
|
@@ -28,12 +28,18 @@ module ActiveAdmin
|
|
28
28
|
# @option options [Proc] :if
|
29
29
|
# A block for the view to call to decide if this menu item should be displayed.
|
30
30
|
# The block should return true of false
|
31
|
+
#
|
32
|
+
# @option options [Proc] :parent
|
33
|
+
# The parent label to display for this menu item. Menu item will be nested
|
34
|
+
# under that label. It can either be a String or a Proc. If the option is Proc,
|
35
|
+
# it is called each time the label is requested.
|
31
36
|
def initialize(options = {})
|
32
37
|
@label = options[:label]
|
33
38
|
@id = MenuItem.generate_item_id(options[:id] || label)
|
34
39
|
@url = options[:url]
|
35
40
|
@priority = options[:priority] || 10
|
36
41
|
@children = Menu::ItemCollection.new
|
42
|
+
@parent = options[:parent]
|
37
43
|
|
38
44
|
@display_if_block = options[:if]
|
39
45
|
|
data/lib/active_admin/page.rb
CHANGED
@@ -46,10 +46,17 @@ module ActiveAdmin
|
|
46
46
|
|
47
47
|
# Set the configuration for the CSV
|
48
48
|
attr_writer :csv_builder
|
49
|
+
|
50
|
+
# Set breadcrumb builder
|
51
|
+
attr_accessor :breadcrumb
|
49
52
|
|
50
53
|
# Store a reference to the DSL so that we can dereference it during garbage collection.
|
51
54
|
attr_accessor :dsl
|
52
55
|
|
56
|
+
# The string identifying a class to decorate our resource with for the view.
|
57
|
+
# nil to not decorate.
|
58
|
+
attr_accessor :decorator_class_name
|
59
|
+
|
53
60
|
module Base
|
54
61
|
def initialize(namespace, resource_class, options = {})
|
55
62
|
@namespace = namespace
|
@@ -76,6 +83,10 @@ module ActiveAdmin
|
|
76
83
|
ActiveSupport::Dependencies.constantize(resource_class_name)
|
77
84
|
end
|
78
85
|
|
86
|
+
def decorator_class
|
87
|
+
ActiveSupport::Dependencies.constantize(decorator_class_name) if decorator_class_name
|
88
|
+
end
|
89
|
+
|
79
90
|
def resource_table_name
|
80
91
|
resource_class.quoted_table_name
|
81
92
|
end
|
@@ -163,6 +174,6 @@ module ActiveAdmin
|
|
163
174
|
def default_csv_builder
|
164
175
|
@default_csv_builder ||= CSVBuilder.default_for_resource(resource_class)
|
165
176
|
end
|
166
|
-
|
177
|
+
|
167
178
|
end # class Resource
|
168
179
|
end # module ActiveAdmin
|
@@ -9,7 +9,7 @@ module ActiveAdmin
|
|
9
9
|
@display_menu = false
|
10
10
|
else
|
11
11
|
options = default_menu_options.merge(options)
|
12
|
-
@parent_menu_item = options.delete(:parent)
|
12
|
+
@parent_menu_item = value_or_proc(options.delete(:parent))
|
13
13
|
@menu_item = MenuItem.new(default_menu_options.merge(options))
|
14
14
|
end
|
15
15
|
end
|
@@ -37,6 +37,13 @@ module ActiveAdmin
|
|
37
37
|
@display_menu != false
|
38
38
|
end
|
39
39
|
|
40
|
+
private
|
41
|
+
|
42
|
+
# Evaluates value if this is proc or return value if else
|
43
|
+
def value_or_proc(value)
|
44
|
+
return value.call if value.is_a? Proc
|
45
|
+
value
|
46
|
+
end
|
40
47
|
end
|
41
48
|
end
|
42
49
|
end
|
@@ -3,6 +3,7 @@ require 'active_admin/resource_controller/actions'
|
|
3
3
|
require 'active_admin/resource_controller/action_builder'
|
4
4
|
require 'active_admin/resource_controller/callbacks'
|
5
5
|
require 'active_admin/resource_controller/collection'
|
6
|
+
require 'active_admin/resource_controller/decorators'
|
6
7
|
require 'active_admin/resource_controller/scoping'
|
7
8
|
require 'active_admin/resource_controller/sidebars'
|
8
9
|
require 'active_admin/resource_controller/resource_class_methods'
|
@@ -22,6 +23,7 @@ module ActiveAdmin
|
|
22
23
|
include ActionBuilder
|
23
24
|
include Callbacks
|
24
25
|
include Collection
|
26
|
+
include Decorators
|
25
27
|
include Scoping
|
26
28
|
include Sidebars
|
27
29
|
extend ResourceClassMethods
|
@@ -35,7 +37,7 @@ module ActiveAdmin
|
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
|
-
# Inherited Resources uses the inherited(base) hook method to
|
40
|
+
# Inherited Resources uses the inherited(base) hook method to
|
39
41
|
# add in the Base.resource_class class method. To override it, we
|
40
42
|
# need to install our resource_class method each time we're inherited from.
|
41
43
|
def inherited(base)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ActiveAdmin
|
2
|
+
class ResourceController < BaseController
|
3
|
+
module Decorators
|
4
|
+
protected
|
5
|
+
|
6
|
+
def resource
|
7
|
+
decorator = active_admin_config.decorator_class
|
8
|
+
resource = super
|
9
|
+
decorator ? decorator.new(resource) : resource
|
10
|
+
end
|
11
|
+
|
12
|
+
def active_admin_collection
|
13
|
+
decorator = active_admin_config.decorator_class
|
14
|
+
collection = super
|
15
|
+
decorator ? decorator.decorate(collection) : collection
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/active_admin/version.rb
CHANGED