typus 1.0.0.pre8 → 1.0.0.pre9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -6
- data/Gemfile +16 -13
- data/Gemfile.lock +26 -2
- data/Rakefile +2 -3
- data/app/controllers/admin/base_controller.rb +3 -5
- data/app/controllers/admin/resources_controller.rb +24 -26
- data/app/helpers/admin/base_helper.rb +14 -22
- data/app/helpers/admin/dashboard_helper.rb +2 -5
- data/app/helpers/admin/filters_helper.rb +6 -8
- data/app/helpers/admin/form_helper.rb +3 -9
- data/app/helpers/admin/preview_helper.rb +4 -6
- data/app/helpers/admin/relationships_helper.rb +9 -11
- data/app/helpers/admin/resources_helper.rb +6 -24
- data/app/helpers/admin/search_helper.rb +1 -1
- data/app/helpers/admin/sidebar_helper.rb +12 -15
- data/app/helpers/admin/table_helper.rb +13 -13
- data/app/views/admin/dashboard/show.html.erb +1 -1
- data/app/views/admin/helpers/_apps.html.erb +4 -3
- data/app/views/admin/helpers/_header.html.erb +2 -2
- data/app/views/admin/helpers/dashboard/_applications.html.erb +3 -3
- data/app/views/admin/helpers/dashboard/_resources.html.erb +17 -13
- data/app/views/admin/helpers/filters/_filters.html.erb +9 -27
- data/app/views/admin/helpers/resources/_pagination.html.erb +8 -9
- data/app/views/admin/helpers/search/_search.html.erb +1 -1
- data/app/views/admin/mailer/reset_password_link.text.erb +3 -0
- data/app/views/admin/resources/_form.html.erb +4 -4
- data/app/views/admin/resources/edit.html.erb +2 -3
- data/app/views/admin/resources/index.html.erb +15 -13
- data/app/views/admin/resources/new.html.erb +2 -2
- data/app/views/admin/resources/show.html.erb +1 -2
- data/app/views/admin/templates/_boolean.html.erb +1 -1
- data/app/views/admin/templates/_has_many.html.erb +2 -4
- data/app/views/admin/templates/_has_n.html.erb +1 -1
- data/app/views/admin/templates/_selector.html.erb +0 -1
- data/app/views/admin/templates/_string.html.erb +1 -1
- data/app/views/layouts/admin/session.html.erb +1 -1
- data/config/available_locales/ca.yml +3 -5
- data/config/available_locales/de.yml +2 -4
- data/config/available_locales/es.yml +2 -4
- data/config/available_locales/fr.yml +40 -39
- data/config/available_locales/fr_models.yml +2 -2
- data/config/available_locales/hu.yml +3 -5
- data/config/available_locales/it.yml +0 -4
- data/config/available_locales/language.yml.template +2 -4
- data/config/available_locales/pt-BR.yml +2 -4
- data/config/available_locales/ru.yml +2 -4
- data/config/routes.rb +1 -0
- data/lib/generators/templates/config/initializers/typus.rb +5 -5
- data/lib/generators/templates/config/initializers/typus_authentication.rb +5 -5
- data/lib/generators/templates/config/initializers/typus_resources.rb +7 -7
- data/lib/generators/templates/config/typus/README +11 -13
- data/lib/generators/templates/controller.rb +0 -2
- data/lib/generators/templates/functional_test.rb +4 -15
- data/lib/generators/typus/migration_generator.rb +0 -1
- data/lib/support/active_record.rb +18 -9
- data/lib/support/fake_user.rb +42 -0
- data/lib/support/object.rb +1 -0
- data/lib/support/string.rb +0 -32
- data/lib/tasks/typus.rake +0 -8
- data/lib/typus.rb +34 -18
- data/lib/typus/authentication/base.rb +26 -0
- data/lib/typus/authentication/http_basic.rb +22 -0
- data/lib/typus/authentication/none.rb +19 -0
- data/lib/typus/authentication/session.rb +190 -0
- data/lib/typus/format.rb +12 -19
- data/lib/typus/orm/active_record.rb +13 -51
- data/lib/typus/resources.rb +0 -9
- data/lib/typus/version.rb +1 -1
- data/test/factories.rb +43 -0
- data/test/fixtures/rails_app/app/controllers/application_controller.rb +0 -1
- data/test/fixtures/rails_app/app/models/page.rb +0 -4
- data/test/fixtures/rails_app/config/application.rb +6 -3
- data/test/fixtures/rails_app/config/database.yml +12 -20
- data/test/fixtures/rails_app/config/typus/application.yml +4 -8
- data/test/fixtures/rails_app/db/test.sqlite3 +0 -0
- data/test/fixtures/rails_app/log/test.log +227115 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012213057.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012213132.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012213234.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012213506.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215057.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215217.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215415.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215443.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215509.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215528.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215551.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215615.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215640.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215714.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215744.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215814.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215836.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012215906.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012220659.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012221043.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012221258.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012222558.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012222752.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012222848.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012223433.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012223535.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012224003.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012224052.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012224109.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012224139.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012224205.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012224243.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101012225119.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063215.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063300.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063352.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063427.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063448.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063530.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063559.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063646.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063737.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063822.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063837.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063919.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063939.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013063952.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064220.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064253.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064318.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064404.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064452.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064536.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064652.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013064845.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013065023.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013065137.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013065713.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013065954.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070057.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070116.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070156.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070349.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070429.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070448.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070514.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070709.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070745.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070809.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070905.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013070955.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013071116.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013071209.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013071335.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013071632.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013071643.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013071735.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013071749.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013072030.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013072050.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013072108.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013072713.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013072751.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013072912.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101013074546.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101018180512.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101018183359.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101018183608.csv +2 -0
- data/test/fixtures/rails_app/tmp/export-posts-20101018183759.csv +2 -0
- data/test/functional/admin/account_controller_test.rb +1 -1
- data/test/functional/admin/{resources_controller_assets_relationships.rb → assets_controller_test.rb} +12 -16
- data/test/functional/admin/categories_controller_test.rb +62 -0
- data/test/functional/admin/{resources_controller_comments_toggle_test.rb → comments_controller_test.rb} +0 -0
- data/test/functional/admin/dashboard_controller_test.rb +34 -2
- data/test/functional/admin/posts_controller_test.rb +548 -0
- data/test/functional/admin/session_controller_test.rb +2 -2
- data/test/functional/admin/{resources_controller_tableless_resource_test.rb → status_controller_test.rb} +0 -0
- data/test/functional/admin/{resources_controller_typus_users_test.rb → typus_users_controller_test.rb} +2 -2
- data/test/helpers/admin/base_helper_test.rb +35 -37
- data/test/helpers/admin/dashboard_helper_test.rb +4 -8
- data/test/helpers/admin/form_helper_test.rb +9 -34
- data/test/helpers/admin/resources_helper_test.rb +28 -16
- data/test/helpers/admin/sidebar_helper_test.rb +14 -27
- data/test/helpers/admin/table_helper_test.rb +24 -68
- data/test/integration/login_test.rb +13 -0
- data/test/integration_test_helper.rb +21 -0
- data/test/lib/support/active_record_test.rb +72 -21
- data/test/lib/support/array_test.rb +2 -6
- data/test/lib/support/string_test.rb +21 -30
- data/test/lib/typus/active_record_test.rb +162 -100
- data/test/lib/typus/resource_test.rb +2 -3
- data/test/lib/typus_test.rb +25 -22
- data/test/test_helper.rb +4 -17
- data/test/unit/admin/mailer_test.rb +2 -2
- data/test/unit/typus_user_roles_test.rb +23 -23
- data/test/unit/typus_user_test.rb +30 -24
- data/typus.gemspec +0 -1
- metadata +111 -60
- data/app/models/admin/fake_user.rb +0 -46
- data/lib/generators/templates/model.yml +0 -10
- data/lib/typus/authentication.rb +0 -241
- data/lib/vendor/paginator.rb +0 -143
- data/test/factories/assets.rb +0 -5
- data/test/factories/categories.rb +0 -3
- data/test/factories/comments.rb +0 -6
- data/test/factories/pages.rb +0 -5
- data/test/factories/pictures.rb +0 -7
- data/test/factories/posts.rb +0 -6
- data/test/factories/typus_users.rb +0 -8
- data/test/fixtures/rails_app/README +0 -244
- data/test/fixtures/rails_app/app/helpers/application_helper.rb +0 -2
- data/test/fixtures/rails_app/app/views/layouts/application.html.erb +0 -14
- data/test/fixtures/rails_app/config/environments/development.rb +0 -19
- data/test/fixtures/rails_app/config/environments/production.rb +0 -42
- data/test/fixtures/rails_app/config/initializers/acts_as_list.rb +0 -258
- data/test/fixtures/rails_app/config/initializers/acts_as_tree.rb +0 -98
- data/test/fixtures/rails_app/config/initializers/backtrace_silencers.rb +0 -7
- data/test/fixtures/rails_app/config/initializers/inflections.rb +0 -10
- data/test/fixtures/rails_app/config/initializers/mime_types.rb +0 -5
- data/test/fixtures/rails_app/config/locales/en.yml +0 -5
- data/test/fixtures/rails_app/db/seeds.rb +0 -7
- data/test/fixtures/rails_app/public/404.html +0 -26
- data/test/fixtures/rails_app/public/422.html +0 -26
- data/test/fixtures/rails_app/public/500.html +0 -26
- data/test/fixtures/rails_app/public/favicon.ico +0 -0
- data/test/fixtures/rails_app/public/images/rails.png +0 -0
- data/test/fixtures/rails_app/public/index.html +0 -279
- data/test/fixtures/rails_app/public/javascripts/application.js +0 -2
- data/test/fixtures/rails_app/public/javascripts/controls.js +0 -965
- data/test/fixtures/rails_app/public/javascripts/dragdrop.js +0 -974
- data/test/fixtures/rails_app/public/javascripts/effects.js +0 -1123
- data/test/fixtures/rails_app/public/javascripts/prototype.js +0 -4874
- data/test/fixtures/rails_app/public/javascripts/rails.js +0 -118
- data/test/fixtures/rails_app/public/robots.txt +0 -5
- data/test/fixtures/rails_app/script/rails +0 -9
- data/test/functional/admin/dashboard_controller_http_basic_test.rb +0 -24
- data/test/functional/admin/dashboard_controller_none_test.rb +0 -18
- data/test/functional/admin/resources_controller_categories_before_test.rb +0 -10
- data/test/functional/admin/resources_controller_categories_lists_test.rb +0 -44
- data/test/functional/admin/resources_controller_categories_views_test.rb +0 -10
- data/test/functional/admin/resources_controller_posts_before_test.rb +0 -10
- data/test/functional/admin/resources_controller_posts_crud_custom_test.rb +0 -27
- data/test/functional/admin/resources_controller_posts_crud_test.rb +0 -44
- data/test/functional/admin/resources_controller_posts_formats_test.rb +0 -39
- data/test/functional/admin/resources_controller_posts_forms_test.rb +0 -58
- data/test/functional/admin/resources_controller_posts_permissions_test.rb +0 -100
- data/test/functional/admin/resources_controller_posts_relationships_test.rb +0 -91
- data/test/functional/admin/resources_controller_posts_roles.rb +0 -52
- data/test/functional/admin/resources_controller_posts_views_test.rb +0 -143
- data/test/lib/vendor/paginator_test.rb +0 -141
- data/typus-1.0.0.pre7.gem +0 -0
@@ -9,8 +9,6 @@ it:
|
|
9
9
|
"Are you sure you want to leave this page?": "Sei sicuro di volere lasciare questa pagina?"
|
10
10
|
"Are you sure you want to sign out and end your session?": "Sei sicuro che vuoi disconnetterti dal sistema?"
|
11
11
|
"As you're not the admin or the owner of this record you cannot edit it": "Non puoi modificare questo elemento poichè non sei un amministratore o il proprietario dello stesso"
|
12
|
-
|
13
|
-
"Back to list": "Torna alla lista"
|
14
12
|
|
15
13
|
"Cancel and go back": "Annulla e torna indietro"
|
16
14
|
"Change %{attribute}?": "Vuoi cambiare %{attribute}?"
|
@@ -23,7 +21,6 @@ it:
|
|
23
21
|
"Dashboard": "Panoramica"
|
24
22
|
"Developed by": "Realizzato da"
|
25
23
|
"Do you want to cancel it?": "Vuoi annullare e tornare indietro?"
|
26
|
-
"Documentation": "Documentazione"
|
27
24
|
"Down": "Giù"
|
28
25
|
|
29
26
|
"Edit": "Modifica"
|
@@ -47,7 +44,6 @@ it:
|
|
47
44
|
"Last few days": "Ultimi giorni"
|
48
45
|
"Last 30 days": "Ultimi 30 giorni"
|
49
46
|
"Last 7 days": "Ultimi 7 giorni"
|
50
|
-
"License": "Licenza"
|
51
47
|
"List": "Lista"
|
52
48
|
"Loading": "Caricamento"
|
53
49
|
"Logged as": "Loggato come"
|
@@ -14,8 +14,6 @@
|
|
14
14
|
"Are you sure you want to sign out and end your session?":
|
15
15
|
"As you're not the admin or the owner of this record you cannot edit it":
|
16
16
|
|
17
|
-
"Back to list":
|
18
|
-
|
19
17
|
"Change %{attribute}?":
|
20
18
|
"Change password":
|
21
19
|
"Checked if active":
|
@@ -25,7 +23,6 @@
|
|
25
23
|
|
26
24
|
"Dashboard":
|
27
25
|
"Do you want to cancel it?":
|
28
|
-
"Documentation":
|
29
26
|
"Down":
|
30
27
|
|
31
28
|
"Edit":
|
@@ -46,7 +43,7 @@
|
|
46
43
|
"Last few days":
|
47
44
|
"Last 30 days":
|
48
45
|
"Last 7 days":
|
49
|
-
"
|
46
|
+
"List":
|
50
47
|
"Logged as":
|
51
48
|
"Login":
|
52
49
|
|
@@ -92,6 +89,7 @@
|
|
92
89
|
"Unrelate %{unrelate_model} from %{unrelate_model_from}?":
|
93
90
|
"Up":
|
94
91
|
|
92
|
+
"View all %{attribute}":
|
95
93
|
"View site":
|
96
94
|
|
97
95
|
"You're adding a new %{resource_from}":
|
@@ -14,8 +14,6 @@ pt-BR:
|
|
14
14
|
"Are you sure you want to sign out and end your session?": "Tem certeza que quer sair e encerrar sua sessão?"
|
15
15
|
"As you're not the admin or the owner of this record you cannot edit it": "Como você não é o dono desse registro ou o admin, você não pode editá-lo."
|
16
16
|
|
17
|
-
"Back to list": "Voltar à lista"
|
18
|
-
|
19
17
|
"Cancel and go back":
|
20
18
|
"Change password": "Trocar senha"
|
21
19
|
"Change %{attribute}?": "Mudar %{attribute}?"
|
@@ -26,7 +24,6 @@ pt-BR:
|
|
26
24
|
|
27
25
|
"Dashboard": "Painel"
|
28
26
|
"Do you want to cancel it?": "Quer cancelar?"
|
29
|
-
"Documentation":
|
30
27
|
"Down": "Descer"
|
31
28
|
|
32
29
|
"Edit": "Editar"
|
@@ -48,7 +45,7 @@ pt-BR:
|
|
48
45
|
"Last few days": "Últimos dias"
|
49
46
|
"Last 30 days": "Últimos 30 dias"
|
50
47
|
"Last 7 days": "Últimos 7 dias"
|
51
|
-
"
|
48
|
+
"List":
|
52
49
|
"Logged as": "Logado como"
|
53
50
|
"Login": "Login"
|
54
51
|
|
@@ -94,6 +91,7 @@ pt-BR:
|
|
94
91
|
"Unrelate %{unrelate_model} from %{unrelate_model_from}?": "Desvincular %{unrelate_model} de %{unrelate_model_from}?"
|
95
92
|
"Up": "Subir"
|
96
93
|
|
94
|
+
"View all %{attribute}":
|
97
95
|
"View site": "Ver site"
|
98
96
|
|
99
97
|
"You're adding a new %{resource_from} to %{resource_to}": "Você está adicionando um novo %{resource_from} a %{resource_to}."
|
@@ -14,8 +14,6 @@ ru:
|
|
14
14
|
"Are you sure you want to sign out and end your session?":
|
15
15
|
"As you're not the admin or the owner of this record you cannot edit it": "Вы не администратор и не владелец записи и не можете ее редактировать"
|
16
16
|
|
17
|
-
"Back to list": "Назад к списку"
|
18
|
-
|
19
17
|
"Cancel and go back":
|
20
18
|
"Change password": "Сменить пароль"
|
21
19
|
"Change %{attribute}?": "Изменить %{attribute}?"
|
@@ -26,7 +24,6 @@ ru:
|
|
26
24
|
|
27
25
|
"Dashboard": "Обзор"
|
28
26
|
"Do you want to cancel it?": "Вы хотите отменить это?"
|
29
|
-
"Documentation":
|
30
27
|
"Down": "Вниз"
|
31
28
|
|
32
29
|
"Edit": "Изменить"
|
@@ -48,7 +45,7 @@ ru:
|
|
48
45
|
"Last few days": "Последние дней"
|
49
46
|
"Last 7 days": "Последние 7 дней"
|
50
47
|
"Last 30 days": "Последние 30 дней"
|
51
|
-
"
|
48
|
+
"List":
|
52
49
|
"Logged as": "Вы вошли как"
|
53
50
|
"Login": "Редактировать"
|
54
51
|
|
@@ -94,6 +91,7 @@ ru:
|
|
94
91
|
"Unrelate %{unrelate_model} from %{unrelate_model_from}?": "Отсоединить %{unrelate_model} от %{unrelate_model_from}?"
|
95
92
|
"Up": "Вверх"
|
96
93
|
|
94
|
+
"View all %{attribute}":
|
97
95
|
"View site": "Перейти к сайту"
|
98
96
|
|
99
97
|
"You can update your password at": "Вы можете установить свой пароль на"
|
data/config/routes.rb
CHANGED
@@ -4,19 +4,19 @@ Typus.setup do |config|
|
|
4
4
|
config.admin_title = "<%= options[:admin_title] %>"
|
5
5
|
# config.admin_sub_title = ""
|
6
6
|
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# lost passwords.
|
7
|
+
# When mailer_sender is set, password recover is enabled. This email
|
8
|
+
# address will be used in Admin::Mailer.
|
10
9
|
# config.mailer_sender = "admin@example.com"
|
11
10
|
|
12
11
|
# Define file attachment settings.
|
13
12
|
# config.file_preview = :typus_preview
|
14
13
|
# config.file_thumbnail = :typus_thumbnail
|
15
14
|
|
16
|
-
# Authentication:
|
15
|
+
# Authentication: +:none+, +:http_basic+
|
16
|
+
# Run `rails g typus:migration` if you need an advanced authentication system.
|
17
17
|
# config.authentication = :none
|
18
18
|
|
19
|
-
# Define username and password for
|
19
|
+
# Define username and password for +:http_basic+ authentication
|
20
20
|
# config.username = "admin"
|
21
21
|
# config.password = "columbia"
|
22
22
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
Typus.setup do |config|
|
2
2
|
|
3
|
-
#
|
3
|
+
# Define authentication: +:none+, +:http_basic+, +:session+
|
4
4
|
config.authentication = :session
|
5
5
|
|
6
|
-
# Define
|
6
|
+
# Define master_role.
|
7
7
|
# config.master_role = "admin"
|
8
8
|
|
9
|
-
# Define relationship
|
9
|
+
# Define relationship.
|
10
10
|
# config.relationship = "typus_users"
|
11
11
|
|
12
|
-
# Define user_class_name
|
12
|
+
# Define user_class_name.
|
13
13
|
config.user_class_name = "<%= options[:user_class_name] %>"
|
14
14
|
|
15
|
-
# Define
|
15
|
+
# Define user_fk.
|
16
16
|
config.user_fk = "<%= options[:user_fk] %>"
|
17
17
|
|
18
18
|
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
Typus::Resources.setup do |config|
|
2
2
|
|
3
|
-
# Defines
|
3
|
+
# Defines default_action_on_item.
|
4
4
|
# config.default_action_on_item = "edit"
|
5
5
|
|
6
|
-
# Defines
|
6
|
+
# Defines end_year.
|
7
7
|
# config.end_year = nil
|
8
8
|
|
9
|
-
# Defines
|
9
|
+
# Defines form_rows.
|
10
10
|
# config.form_rows = 15
|
11
11
|
|
12
|
-
# Defines
|
12
|
+
# Defines action_after_save.
|
13
13
|
# config.action_after_save = "edit"
|
14
14
|
|
15
|
-
# Defines
|
15
|
+
# Defines minute_step.
|
16
16
|
# config.minute_step = 5
|
17
17
|
|
18
18
|
# Defines nil.
|
@@ -21,10 +21,10 @@ Typus::Resources.setup do |config|
|
|
21
21
|
# Defines only_user_items.
|
22
22
|
# config.only_user_items = false
|
23
23
|
|
24
|
-
# Defines per_page
|
24
|
+
# Defines per_page.
|
25
25
|
# config.per_page = 15
|
26
26
|
|
27
|
-
# Defines
|
27
|
+
# Defines start_year.
|
28
28
|
# config.start_year = nil
|
29
29
|
|
30
30
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# Models
|
2
2
|
|
3
|
-
This is an example of a **Typus** enabled model with all available
|
4
|
-
|
5
|
-
|
3
|
+
This is an example of a **Typus** enabled model with all available options. You
|
4
|
+
can use this example to customize your YAML files which only have set the most
|
5
|
+
common settings.
|
6
6
|
|
7
7
|
Post:
|
8
8
|
fields:
|
@@ -26,7 +26,7 @@ only have set the most common settings.
|
|
26
26
|
index: cleanup
|
27
27
|
edit: send_as_newsletter
|
28
28
|
show: rebuild
|
29
|
-
export: csv, xml
|
29
|
+
export: csv, xml
|
30
30
|
order_by: created_at
|
31
31
|
relationships:
|
32
32
|
filters: is_published?, created_at, category_id
|
@@ -34,10 +34,10 @@ only have set the most common settings.
|
|
34
34
|
application: Application
|
35
35
|
description: Some text to describe the model
|
36
36
|
options:
|
37
|
+
action_after_save: :index
|
37
38
|
default_action_on_item: show
|
38
39
|
end_year: 2015
|
39
40
|
form_rows: 25
|
40
|
-
action_after_save: :index
|
41
41
|
minute_step: 15
|
42
42
|
nil: 'nil'
|
43
43
|
only_user_items: true
|
@@ -48,9 +48,9 @@ Note: To define namespace models use :: as a separator. (i.e. Delayed::Job)
|
|
48
48
|
|
49
49
|
# Roles
|
50
50
|
|
51
|
-
In this file you can configure the actions available for each of
|
52
|
-
|
53
|
-
|
51
|
+
In this file you can configure the actions available for each of your models on
|
52
|
+
the application. You can also use the 'all' shortcut to allow the user the
|
53
|
+
access to all actions.
|
54
54
|
|
55
55
|
admin:
|
56
56
|
Post: create, read, update, delete
|
@@ -61,10 +61,8 @@ to allow the user the access to all actions.
|
|
61
61
|
Post: create, read, update
|
62
62
|
Category: read, update
|
63
63
|
|
64
|
-
You can also define `resources` which are not related to a model,
|
65
|
-
|
66
|
-
statistics.
|
64
|
+
You can also define `resources` which are not related to a model, for example
|
65
|
+
to control `Redis`.
|
67
66
|
|
68
67
|
admin:
|
69
|
-
|
70
|
-
MemCached: index, cleanup
|
68
|
+
Redis: index, flush_all
|
@@ -1,21 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'test_helper'
|
2
2
|
|
3
|
-
# ControllerTest generated by Typus, use it to test the extended admin functionality.
|
4
3
|
class Admin::<%= resource %>ControllerTest < ActionController::TestCase
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
test "should render index" do
|
12
|
-
get :index
|
13
|
-
assert_template :index
|
14
|
-
end
|
15
|
-
|
16
|
-
test "should render new" do
|
17
|
-
get :new
|
18
|
-
assert_template :new
|
5
|
+
# Replace this with your real tests.
|
6
|
+
test "the truth" do
|
7
|
+
assert true
|
19
8
|
end
|
20
9
|
|
21
10
|
end
|
@@ -46,7 +46,6 @@ Examples:
|
|
46
46
|
template "config/typus/typus.yml", "config/typus/typus.yml"
|
47
47
|
template "config/typus/typus_roles.yml", "config/typus/typus_roles.yml"
|
48
48
|
template "model.rb", "app/models/#{options[:user_class_name].underscore}.rb"
|
49
|
-
template "model.yml", "test/fixtures/#{options[:user_class_name].underscore.pluralize}.yml"
|
50
49
|
end
|
51
50
|
|
52
51
|
def generate_controllers
|
@@ -11,12 +11,11 @@ class ActiveRecord::Base
|
|
11
11
|
end
|
12
12
|
|
13
13
|
#--
|
14
|
-
# TODO: This has been copied from Rails 2 because has been removed
|
15
|
-
#
|
16
|
-
#
|
14
|
+
# TODO: This has been copied from Rails 2 because has been removed from
|
15
|
+
# Rails 3. Once the "build_conditions" has been refactored to use Arel
|
16
|
+
# this can be removed.
|
17
17
|
#++
|
18
18
|
def self.merge_conditions(*conditions)
|
19
|
-
|
20
19
|
segments = []
|
21
20
|
|
22
21
|
conditions.each do |condition|
|
@@ -27,16 +26,15 @@ class ActiveRecord::Base
|
|
27
26
|
end
|
28
27
|
|
29
28
|
"(#{segments.join(') AND (')})" unless segments.empty?
|
30
|
-
|
31
29
|
end
|
32
30
|
|
33
31
|
#--
|
34
32
|
# On a model:
|
35
33
|
#
|
36
34
|
# class Post < ActiveRecord::Base
|
37
|
-
# STATUS = {
|
38
|
-
#
|
39
|
-
#
|
35
|
+
# STATUS = { t("Published") => "published",
|
36
|
+
# t("Pending") => "pending",
|
37
|
+
# t("Draft") => "draft" }
|
40
38
|
# end
|
41
39
|
#
|
42
40
|
# >> Post.first.status
|
@@ -50,7 +48,18 @@ class ActiveRecord::Base
|
|
50
48
|
#++
|
51
49
|
def mapping(attribute)
|
52
50
|
values = self.class::const_get(attribute.to_s.upcase)
|
53
|
-
|
51
|
+
|
52
|
+
if values.kind_of?(Array)
|
53
|
+
case values.first
|
54
|
+
when Array
|
55
|
+
array_keys, array_values = values.transpose
|
56
|
+
else
|
57
|
+
array_keys = array_values = values
|
58
|
+
end
|
59
|
+
values = array_keys.to_hash_with(array_values)
|
60
|
+
end
|
61
|
+
|
62
|
+
values.invert[send(attribute)]
|
54
63
|
end
|
55
64
|
|
56
65
|
def to_label
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class FakeUser
|
2
|
+
|
3
|
+
def id
|
4
|
+
0
|
5
|
+
end
|
6
|
+
|
7
|
+
def can?(*args)
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
11
|
+
def cannot?(*args)
|
12
|
+
!can?(*args)
|
13
|
+
end
|
14
|
+
|
15
|
+
def is_root?
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def is_not_root?
|
20
|
+
!is_root?
|
21
|
+
end
|
22
|
+
|
23
|
+
def resources
|
24
|
+
Typus::Configuration.roles[role].compact
|
25
|
+
end
|
26
|
+
|
27
|
+
def applications
|
28
|
+
Typus.applications
|
29
|
+
end
|
30
|
+
|
31
|
+
def application(name)
|
32
|
+
Typus.application(name)
|
33
|
+
end
|
34
|
+
|
35
|
+
def role
|
36
|
+
Typus.master_role
|
37
|
+
end
|
38
|
+
|
39
|
+
def name
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
data/lib/support/object.rb
CHANGED
data/lib/support/string.rb
CHANGED
@@ -8,40 +8,8 @@ class String
|
|
8
8
|
partition(prefix).last
|
9
9
|
end
|
10
10
|
|
11
|
-
def extract_resource
|
12
|
-
remove_prefix
|
13
|
-
end
|
14
|
-
|
15
11
|
def extract_class
|
16
12
|
remove_prefix.camelize.classify.constantize
|
17
13
|
end
|
18
14
|
|
19
|
-
def extract_human_name
|
20
|
-
extract_class.model_name.human.gsub('/', ' ')
|
21
|
-
end
|
22
|
-
|
23
|
-
#--
|
24
|
-
# OPTIMIZE: Find a way to remove the rescue.
|
25
|
-
#++
|
26
|
-
def typus_actions_on(filter)
|
27
|
-
if settings = Typus::Configuration.config[self]['actions'][filter.to_s]
|
28
|
-
settings.extract_settings
|
29
|
-
else
|
30
|
-
[]
|
31
|
-
end
|
32
|
-
rescue
|
33
|
-
[]
|
34
|
-
end
|
35
|
-
|
36
|
-
#--
|
37
|
-
# OPTIMIZE: Find a way to remove the rescue.
|
38
|
-
#++
|
39
|
-
def typus_defaults_for(filter)
|
40
|
-
if settings = Typus::Configuration.config[self][filter.to_s]
|
41
|
-
settings.extract_settings
|
42
|
-
else
|
43
|
-
[]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
15
|
end
|