typus 1.0.0.pre8 → 1.0.0.pre9
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/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
data/CHANGELOG
CHANGED
|
@@ -68,6 +68,10 @@
|
|
|
68
68
|
[X] Search fields now support exact match, beginning of the field and
|
|
69
69
|
full-text match which is the default.
|
|
70
70
|
[X] Do not depend on Rdiscount when rendering content on resources#show.
|
|
71
|
+
[X] Decide where to put the search box.
|
|
72
|
+
[X] Pagination doesn't work properly when having multiple paginators on edit page
|
|
73
|
+
[X] Generator to copy views to `app/views/admin`.
|
|
74
|
+
[X] Clicking on h1 should open website (root_path) when available.
|
|
71
75
|
|
|
72
76
|
[-] Move html code from helpers to partials.
|
|
73
77
|
[ ] Add `has_many` through relationships.
|
|
@@ -79,16 +83,13 @@
|
|
|
79
83
|
[ ] Show auto_generated, read_only on string fields. (_string.html.erb)
|
|
80
84
|
[ ] Pass options hash to form fields.
|
|
81
85
|
[ ] Fix css to display correctly "select" fields in relationships.
|
|
82
|
-
[ ] Ajax pagination. (?)
|
|
83
86
|
[ ] Add test for `typus_table_selector`.
|
|
84
87
|
[ ] Forever loop when schema has not been migrated.
|
|
85
|
-
[ ] Pagination doesn't work properly when having multiple paginators on edit page
|
|
86
88
|
[ ] Add support for `has_one` relationships.
|
|
87
89
|
[ ] Remove all crappy rescues.
|
|
88
90
|
[ ] Search in multiple models.
|
|
89
91
|
[ ] Nested models.
|
|
90
92
|
[ ] Contextual content depending on the logged user.
|
|
91
|
-
[ ] Include dashboard#sidebar in the generator so use can easily overwrite it.
|
|
92
93
|
[ ] Verify generator is working properly.
|
|
93
94
|
[ ] Test generator?
|
|
94
95
|
[ ] Added comment on all FIXME tests. Try to fix them first.
|
|
@@ -97,8 +98,5 @@
|
|
|
97
98
|
[ ] Convert plugin to engine.
|
|
98
99
|
[ ] Verify lightbox is working as expected.
|
|
99
100
|
[ ] Fix footer to the bottom.
|
|
100
|
-
[ ] Show sort arrow on hover.
|
|
101
|
-
[ ] Clicking on h1 should open website (root_path) when available.
|
|
102
101
|
[ ] `Typus.applications` should become `Typus.groups`.
|
|
103
|
-
[ ] Decide where to put the search box.
|
|
104
102
|
[ ] Removing an item should redirect to back without the page params.
|
data/Gemfile
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
source 'http://rubygems.org'
|
|
2
2
|
|
|
3
|
-
# gemspec
|
|
4
|
-
|
|
5
|
-
gem "rails", "3.0.0"
|
|
6
|
-
gem "fastercsv", "1.5.3"
|
|
7
|
-
|
|
8
|
-
gem "sqlite3-ruby"
|
|
9
|
-
gem "mysql"
|
|
10
|
-
gem "pg"
|
|
11
|
-
gem "factory_girl"
|
|
12
|
-
gem "acts_as_tree"
|
|
13
3
|
gem "acts_as_list"
|
|
4
|
+
gem "acts_as_tree"
|
|
14
5
|
gem "paperclip"
|
|
15
|
-
gem "
|
|
16
|
-
gem "
|
|
17
|
-
|
|
6
|
+
gem "fastercsv", "1.5.3" unless RUBY_VERSION >= '1.9'
|
|
7
|
+
gem "paginator", "1.1.1"
|
|
8
|
+
|
|
9
|
+
group :test do
|
|
10
|
+
gem "capybara"
|
|
11
|
+
gem "factory_girl"
|
|
12
|
+
gem "mysql"
|
|
13
|
+
gem "paperclip"
|
|
14
|
+
gem "pg"
|
|
15
|
+
gem "rails", "3.0.0"
|
|
16
|
+
gem "shoulda"
|
|
17
|
+
gem "sqlite3-ruby"
|
|
18
|
+
|
|
19
|
+
gem "mocha"
|
|
20
|
+
end
|
data/Gemfile.lock
CHANGED
|
@@ -33,12 +33,25 @@ GEM
|
|
|
33
33
|
arel (1.0.1)
|
|
34
34
|
activesupport (~> 3.0.0)
|
|
35
35
|
builder (2.1.2)
|
|
36
|
+
capybara (0.3.9)
|
|
37
|
+
culerity (>= 0.2.4)
|
|
38
|
+
mime-types (>= 1.16)
|
|
39
|
+
nokogiri (>= 1.3.3)
|
|
40
|
+
rack (>= 1.0.0)
|
|
41
|
+
rack-test (>= 0.5.4)
|
|
42
|
+
selenium-webdriver (>= 0.0.3)
|
|
43
|
+
culerity (0.2.12)
|
|
36
44
|
erubis (2.6.6)
|
|
37
45
|
abstract (>= 1.0.0)
|
|
38
46
|
factory_girl (1.3.2)
|
|
39
47
|
fastercsv (1.5.3)
|
|
48
|
+
ffi (0.6.3)
|
|
49
|
+
rake (>= 0.8.7)
|
|
50
|
+
hoe (2.6.2)
|
|
51
|
+
rake (>= 0.8.7)
|
|
52
|
+
rubyforge (>= 2.0.4)
|
|
40
53
|
i18n (0.4.1)
|
|
41
|
-
|
|
54
|
+
json_pure (1.4.6)
|
|
42
55
|
mail (2.2.5)
|
|
43
56
|
activesupport (>= 2.3.6)
|
|
44
57
|
mime-types
|
|
@@ -47,6 +60,9 @@ GEM
|
|
|
47
60
|
mocha (0.9.8)
|
|
48
61
|
rake
|
|
49
62
|
mysql (2.8.1)
|
|
63
|
+
nokogiri (1.4.3.1)
|
|
64
|
+
paginator (1.1.1)
|
|
65
|
+
hoe (>= 1.6.0)
|
|
50
66
|
paperclip (2.3.3)
|
|
51
67
|
activerecord
|
|
52
68
|
activesupport
|
|
@@ -71,6 +87,13 @@ GEM
|
|
|
71
87
|
rake (>= 0.8.4)
|
|
72
88
|
thor (~> 0.14.0)
|
|
73
89
|
rake (0.8.7)
|
|
90
|
+
rubyforge (2.0.4)
|
|
91
|
+
json_pure (>= 1.1.7)
|
|
92
|
+
rubyzip (0.9.4)
|
|
93
|
+
selenium-webdriver (0.0.28)
|
|
94
|
+
ffi (>= 0.6.1)
|
|
95
|
+
json_pure
|
|
96
|
+
rubyzip
|
|
74
97
|
shoulda (2.11.3)
|
|
75
98
|
sqlite3-ruby (1.3.1)
|
|
76
99
|
thor (0.14.0)
|
|
@@ -84,11 +107,12 @@ PLATFORMS
|
|
|
84
107
|
DEPENDENCIES
|
|
85
108
|
acts_as_list
|
|
86
109
|
acts_as_tree
|
|
110
|
+
capybara
|
|
87
111
|
factory_girl
|
|
88
112
|
fastercsv (= 1.5.3)
|
|
89
|
-
leftright
|
|
90
113
|
mocha
|
|
91
114
|
mysql
|
|
115
|
+
paginator (= 1.1.1)
|
|
92
116
|
paperclip
|
|
93
117
|
pg
|
|
94
118
|
rails (= 3.0.0)
|
data/Rakefile
CHANGED
|
@@ -36,10 +36,9 @@ task :release => :build do
|
|
|
36
36
|
|
|
37
37
|
system "git commit -m 'Bump version to #{Typus::VERSION}' lib/typus/version.rb"
|
|
38
38
|
system "git tag v#{version}"
|
|
39
|
-
system "git push"
|
|
40
|
-
system "git push --tags"
|
|
39
|
+
system "git push && git push --tags"
|
|
41
40
|
|
|
42
41
|
system "gem push typus-#{version}.gem"
|
|
43
42
|
|
|
44
|
-
system "git clean -fd"
|
|
43
|
+
system "git clean -fd && rm -f typus-#{version}.gem"
|
|
45
44
|
end
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
require "typus/authentication"
|
|
2
|
-
|
|
3
1
|
class Admin::BaseController < ActionController::Base
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
include Typus::Authentication::const_get(Typus.authentication.to_s.classify)
|
|
6
4
|
|
|
7
5
|
before_filter :reload_config_and_roles
|
|
8
6
|
before_filter :authenticate
|
|
9
7
|
|
|
8
|
+
helper_method :current_user
|
|
9
|
+
|
|
10
10
|
protected
|
|
11
11
|
|
|
12
12
|
def reload_config_and_roles
|
|
13
13
|
Typus.reload! unless Rails.env.production?
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
include Typus::Authentication
|
|
17
|
-
|
|
18
16
|
def set_path
|
|
19
17
|
@back_to || request.referer || admin_dashboard_path
|
|
20
18
|
end
|
|
@@ -26,11 +26,10 @@ class Admin::ResourcesController < Admin::BaseController
|
|
|
26
26
|
:only => [ :index, :new, :edit, :create, :update, :show ]
|
|
27
27
|
|
|
28
28
|
##
|
|
29
|
-
# This is the main index of the model. With filters, conditions
|
|
30
|
-
# and more.
|
|
29
|
+
# This is the main index of the model. With filters, conditions and more.
|
|
31
30
|
#
|
|
32
|
-
# By default application can respond_to html, csv and xml, but you
|
|
33
|
-
#
|
|
31
|
+
# By default application can respond_to html, csv and xml, but you can add
|
|
32
|
+
# your formats.
|
|
34
33
|
#
|
|
35
34
|
def index
|
|
36
35
|
@conditions, @joins = @resource.build_conditions(params)
|
|
@@ -55,9 +54,9 @@ class Admin::ResourcesController < Admin::BaseController
|
|
|
55
54
|
end
|
|
56
55
|
|
|
57
56
|
##
|
|
58
|
-
# Create new items. There's an special case when we create an
|
|
59
|
-
#
|
|
60
|
-
#
|
|
57
|
+
# Create new items. There's an special case when we create an item from
|
|
58
|
+
# another item. In this case, after the item is created we also create the
|
|
59
|
+
# relationship between these items.
|
|
61
60
|
#
|
|
62
61
|
def create
|
|
63
62
|
@item = @resource.new(params[@object_name])
|
|
@@ -110,13 +109,12 @@ class Admin::ResourcesController < Admin::BaseController
|
|
|
110
109
|
end
|
|
111
110
|
|
|
112
111
|
##
|
|
113
|
-
# Change item position. This only works if acts_as_list is
|
|
114
|
-
#
|
|
112
|
+
# Change item position. This only works if acts_as_list is installed. We can
|
|
113
|
+
# then move items:
|
|
115
114
|
#
|
|
116
115
|
# params[:go] = 'move_to_top'
|
|
117
116
|
#
|
|
118
|
-
# Available positions are move_to_top, move_higher, move_lower,
|
|
119
|
-
# move_to_bottom.
|
|
117
|
+
# Available positions are move_to_top, move_higher, move_lower, move_to_bottom.
|
|
120
118
|
#
|
|
121
119
|
def position
|
|
122
120
|
@item.send(params[:go])
|
|
@@ -156,20 +154,24 @@ class Admin::ResourcesController < Admin::BaseController
|
|
|
156
154
|
|
|
157
155
|
# We consider that we are unrelating a has_many or has_and_belongs_to_many
|
|
158
156
|
|
|
159
|
-
|
|
157
|
+
reflection = @resource.reflect_on_association(resource_class.table_name.to_sym)
|
|
158
|
+
macro = reflection.try(:macro)
|
|
159
|
+
options = reflection.try(:options)
|
|
160
160
|
|
|
161
161
|
case macro
|
|
162
162
|
# when :has_one
|
|
163
163
|
# attribute = resource_tableized.singularize
|
|
164
164
|
# saved_succesfully = @item.update_attribute attribute, nil
|
|
165
165
|
when :has_many
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
if options.has_key?(:as) # We are in a polymorphic relationship
|
|
167
|
+
interface = options[:as]
|
|
168
|
+
saved_succesfully = resource.update_attributes("#{interface}_type" => nil, "#{interface}_id" => nil)
|
|
169
|
+
else
|
|
170
|
+
# We have to verify we can unrelate. For example: A Category which has
|
|
171
|
+
# many posts and Post validates_presence_of Category should not be removed.
|
|
172
|
+
attribute = @resource.table_name.singularize
|
|
173
|
+
saved_succesfully = resource.update_attributes(attribute => nil)
|
|
174
|
+
end
|
|
173
175
|
when :has_and_belongs_to_many
|
|
174
176
|
attribute = resource_tableized
|
|
175
177
|
saved_succesfully = @item.send(attribute).delete(resource)
|
|
@@ -214,10 +216,6 @@ class Admin::ResourcesController < Admin::BaseController
|
|
|
214
216
|
@object_name = ActiveModel::Naming.singular(@resource)
|
|
215
217
|
end
|
|
216
218
|
|
|
217
|
-
##
|
|
218
|
-
# Find model when performing an edit, update, destroy, relate,
|
|
219
|
-
# unrelate ...
|
|
220
|
-
#
|
|
221
219
|
def get_object
|
|
222
220
|
@item = @resource.find(params[:id])
|
|
223
221
|
end
|
|
@@ -299,9 +297,9 @@ class Admin::ResourcesController < Admin::BaseController
|
|
|
299
297
|
|
|
300
298
|
end
|
|
301
299
|
|
|
302
|
-
def select_template(
|
|
303
|
-
folder =
|
|
304
|
-
render "admin/#{folder}/#{
|
|
300
|
+
def select_template(action = params[:action], resource = @resource.to_resource)
|
|
301
|
+
folder = File.exist?("app/views/admin/#{resource}/#{action}.html.erb") ? resource : 'resources'
|
|
302
|
+
render "admin/#{folder}/#{action}"
|
|
305
303
|
end
|
|
306
304
|
|
|
307
305
|
end
|
|
@@ -2,22 +2,14 @@ module Admin
|
|
|
2
2
|
|
|
3
3
|
module BaseHelper
|
|
4
4
|
|
|
5
|
-
def
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
File.basename(file, ".html.erb")
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
path = if partials.include?("_#{partial}") then partials_path
|
|
17
|
-
elsif resources_partials.include?(partial) then resources_partials_path
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
render "#{path}/#{partial}" if path
|
|
5
|
+
def typus_render(*args)
|
|
6
|
+
options = args.extract_options!
|
|
7
|
+
options[:resource] ||= @resource.to_resource
|
|
8
|
+
|
|
9
|
+
template_file = Rails.root.join("app", "views", "admin", options[:resource], "_#{options[:partial]}.html.erb")
|
|
10
|
+
resource = File.exists?(template_file) ? options[:resource] : "resources"
|
|
11
|
+
|
|
12
|
+
render "admin/#{resource}/#{options[:partial]}", :options => options
|
|
21
13
|
end
|
|
22
14
|
|
|
23
15
|
def title(page_title)
|
|
@@ -32,19 +24,19 @@ module Admin
|
|
|
32
24
|
render "admin/helpers/apps"
|
|
33
25
|
end
|
|
34
26
|
|
|
35
|
-
def login_info
|
|
36
|
-
return if
|
|
27
|
+
def login_info
|
|
28
|
+
return if [:none, :http_basic].include?(Typus.authentication)
|
|
37
29
|
|
|
38
30
|
admin_edit_typus_user_path = { :controller => "/admin/#{Typus.user_class.to_resource}",
|
|
39
31
|
:action => 'edit',
|
|
40
|
-
:id =>
|
|
32
|
+
:id => current_user.id }
|
|
41
33
|
|
|
42
34
|
message = _t("Are you sure you want to sign out and end your session?")
|
|
43
35
|
|
|
44
|
-
user_details = if
|
|
45
|
-
link_to
|
|
36
|
+
user_details = if current_user.can?('edit', Typus.user_class_name)
|
|
37
|
+
link_to current_user.name, admin_edit_typus_user_path
|
|
46
38
|
else
|
|
47
|
-
|
|
39
|
+
current_user.name
|
|
48
40
|
end
|
|
49
41
|
|
|
50
42
|
render "admin/helpers/login_info", :message => message, :user_details => user_details
|
|
@@ -6,13 +6,10 @@ module Admin
|
|
|
6
6
|
render File.join(path, "applications")
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def resources
|
|
9
|
+
def resources(current_user)
|
|
10
10
|
available = Typus.resources.map do |resource|
|
|
11
|
-
resource if
|
|
11
|
+
resource if current_user.resources.include?(resource)
|
|
12
12
|
end.compact
|
|
13
|
-
|
|
14
|
-
return if available.empty?
|
|
15
|
-
|
|
16
13
|
render File.join(path, "resources"), :resources => available
|
|
17
14
|
end
|
|
18
15
|
|
|
@@ -3,8 +3,8 @@ module Admin
|
|
|
3
3
|
module FiltersHelper
|
|
4
4
|
|
|
5
5
|
def build_filters(resource = @resource)
|
|
6
|
-
|
|
7
6
|
typus_filters = resource.typus_filters
|
|
7
|
+
|
|
8
8
|
return if typus_filters.empty?
|
|
9
9
|
|
|
10
10
|
current_request = request.env['QUERY_STRING'] || []
|
|
@@ -23,8 +23,10 @@ module Admin
|
|
|
23
23
|
string_filter(current_request, key)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
items = items.to_a
|
|
27
|
+
items.insert(0, [message, ""])
|
|
27
28
|
|
|
29
|
+
{ :filter => filter, :items => items }
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
render "admin/helpers/filters/filters", :filters => filters
|
|
@@ -40,10 +42,7 @@ module Admin
|
|
|
40
42
|
%w(controller action page).each { |p| params_without_filter.delete(p) }
|
|
41
43
|
params_without_filter.delete(related_fk)
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
values_labelized = values.map { |v| v.to_label }
|
|
45
|
-
items = values.map(&:id).to_hash_with(values_labelized)
|
|
46
|
-
|
|
45
|
+
items = model.all(:order => model.typus_order_by).collect{|v| [v.to_label, v.id] }
|
|
47
46
|
message = _t("View all %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase.pluralize)
|
|
48
47
|
|
|
49
48
|
return related_fk, items, message
|
|
@@ -51,8 +50,7 @@ module Admin
|
|
|
51
50
|
|
|
52
51
|
def date_filter(request, filter)
|
|
53
52
|
values = %w(today last_few_days last_7_days last_30_days)
|
|
54
|
-
|
|
55
|
-
items = values.to_hash_with(values_humanized)
|
|
53
|
+
items = values.collect {|v| [_t(v.humanize), v ] }
|
|
56
54
|
message = _t("Show all dates")
|
|
57
55
|
return filter, items, message
|
|
58
56
|
end
|
|
@@ -28,14 +28,6 @@ module Admin
|
|
|
28
28
|
return html
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def form_partial
|
|
32
|
-
resource = @resource.to_resource
|
|
33
|
-
template_file = Rails.root.join("app/views/admin/#{resource}/_form.html.erb")
|
|
34
|
-
partial = File.exists?(template_file) ? resource : "resources"
|
|
35
|
-
|
|
36
|
-
return "admin/#{partial}/form"
|
|
37
|
-
end
|
|
38
|
-
|
|
39
31
|
def typus_tree_field(attribute, form)
|
|
40
32
|
render "admin/templates/tree",
|
|
41
33
|
:attribute => attribute,
|
|
@@ -55,7 +47,7 @@ module Admin
|
|
|
55
47
|
|
|
56
48
|
association = @resource.reflect_on_association(relationship.to_sym)
|
|
57
49
|
|
|
58
|
-
next if
|
|
50
|
+
next if current_user.cannot?('read', association.class_name.constantize)
|
|
59
51
|
|
|
60
52
|
case association.macro
|
|
61
53
|
when :has_and_belongs_to_many
|
|
@@ -95,6 +87,8 @@ module Admin
|
|
|
95
87
|
end
|
|
96
88
|
|
|
97
89
|
=begin
|
|
90
|
+
|
|
91
|
+
# TODO: Take `attribute_disabled?(attribute)` back.
|
|
98
92
|
def attribute_disabled?(attribute)
|
|
99
93
|
accessible = @resource.accessible_attributes
|
|
100
94
|
return accessible.nil? ? false : !accessible.include?(attribute)
|
|
@@ -14,13 +14,11 @@ module Admin
|
|
|
14
14
|
return link
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
has_file_preview = item.send(attribute).styles.member?(file[:preview])
|
|
20
|
-
has_file_thumbnail = item.send(attribute).styles.member?(file[:thumbnail])
|
|
17
|
+
has_file_preview = item.send(attribute).styles.member?(Typus.file_preview)
|
|
18
|
+
has_file_thumbnail = item.send(attribute).styles.member?(Typus.file_thumbnail)
|
|
21
19
|
|
|
22
20
|
href = if has_file_preview && file_preview_is_image
|
|
23
|
-
url = item.send(attribute).url(
|
|
21
|
+
url = item.send(attribute).url(Typus.file_preview)
|
|
24
22
|
# FIXME: This has changed on Rails3.
|
|
25
23
|
# ActionController::Base.relative_url_root + url
|
|
26
24
|
else
|
|
@@ -28,7 +26,7 @@ module Admin
|
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
content = if has_file_thumbnail && file_preview_is_image
|
|
31
|
-
image_tag item.send(attribute).url(
|
|
29
|
+
image_tag item.send(attribute).url(Typus.file_thumbnail)
|
|
32
30
|
else
|
|
33
31
|
item.send(attribute)
|
|
34
32
|
end
|