Commit 927c6c1b0b71849257f0113534cecbc9aba53483
1 parent
31d7ff73
Exists in
master
and in
29 other branches
ActionItem0: fixing bugs
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@144 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
10 changed files
with
34 additions
and
24 deletions
Show diff stats
app/controllers/account_controller.rb
1 | class AccountController < ApplicationController | 1 | class AccountController < ApplicationController |
2 | + | ||
3 | + | ||
4 | + | ||
5 | + uses_flexible_template :owner => 'owner' | ||
6 | + | ||
2 | # Be sure to include AuthenticationSystem in Application Controller instead | 7 | # Be sure to include AuthenticationSystem in Application Controller instead |
3 | include AuthenticatedSystem | 8 | include AuthenticatedSystem |
4 | # If you want "remember me" functionality, add this before_filter to Application Controller | 9 | # If you want "remember me" functionality, add this before_filter to Application Controller |
app/controllers/edit_template_controller.rb
1 | class EditTemplateController < ApplicationController | 1 | class EditTemplateController < ApplicationController |
2 | 2 | ||
3 | - uses_flexible_template(:edit => true, :owner => 'owner') | 3 | + uses_flexible_template :edit => true, :owner => 'owner' |
4 | 4 | ||
5 | def flexible_template_owner | 5 | def flexible_template_owner |
6 | Profile.find(1) | 6 | Profile.find(1) |
app/controllers/features_controller.rb
app/controllers/manage_tags_controller.rb
@@ -2,6 +2,10 @@ require 'extended_tag.rb' | @@ -2,6 +2,10 @@ require 'extended_tag.rb' | ||
2 | 2 | ||
3 | # Manage tags stored by the acts-as_taggable_on_steroids plugin by providing an interface to create, destroy, update and list them | 3 | # Manage tags stored by the acts-as_taggable_on_steroids plugin by providing an interface to create, destroy, update and list them |
4 | class ManageTagsController < ApplicationController | 4 | class ManageTagsController < ApplicationController |
5 | + | ||
6 | + uses_flexible_template :owner => 'owner' | ||
7 | + | ||
8 | + | ||
5 | # Index redirects to list action without modifing the url | 9 | # Index redirects to list action without modifing the url |
6 | def index | 10 | def index |
7 | redirect_to :action => 'list' | 11 | redirect_to :action => 'list' |
app/views/layouts/account.rhtml
1 | <html> | 1 | <html> |
2 | <head> | 2 | <head> |
3 | <%= javascript_include_tag :defaults %> | 3 | <%= javascript_include_tag :defaults %> |
4 | - <%= javascript_include_tag_template @chosen_template %> | ||
5 | - <%= stylesheet_link_tag_template @chosen_template %> | 4 | + <%= javascript_include_tag_template %> |
5 | + <%= stylesheet_link_tag_template %> | ||
6 | 6 | ||
7 | </head> | 7 | </head> |
8 | <body> | 8 | <body> |
app/views/layouts/virtual_community_admin.rhtml
1 | <html> | 1 | <html> |
2 | <head> | 2 | <head> |
3 | <%= javascript_include_tag :defaults %> | 3 | <%= javascript_include_tag :defaults %> |
4 | - <%= javascript_include_tag_template @chosen_template %> | ||
5 | - <%= stylesheet_link_tag_template @chosen_template %> | 4 | + <%= javascript_include_tag_template %> |
5 | + <%= stylesheet_link_tag_template %> | ||
6 | 6 | ||
7 | </head> | 7 | </head> |
8 | <body> | 8 | <body> |
lib/extended_tag.rb
@@ -13,7 +13,7 @@ class Tag | @@ -13,7 +13,7 @@ class Tag | ||
13 | end | 13 | end |
14 | end | 14 | end |
15 | 15 | ||
16 | - acts_as_ferret :fields => [:name] | 16 | +# acts_as_ferret :fields => [:name] |
17 | 17 | ||
18 | 18 | ||
19 | # Return all the tags that were suggested but not yet approved | 19 | # Return all the tags that were suggested but not yet approved |
test/functional/application_controller_test.rb
@@ -24,20 +24,6 @@ class ApplicationControllerTest < Test::Unit::TestCase | @@ -24,20 +24,6 @@ class ApplicationControllerTest < Test::Unit::TestCase | ||
24 | assert_tag :tag => 'span', :content => 'post_only' | 24 | assert_tag :tag => 'span', :content => 'post_only' |
25 | end | 25 | end |
26 | 26 | ||
27 | - | ||
28 | - def test_load_template_default | ||
29 | - get :index | ||
30 | - assert_equal assigns(:chosen_template), 'default' | ||
31 | - end | ||
32 | - | ||
33 | - def test_load_template_other | ||
34 | - p = Profile.find(1) | ||
35 | - p.template = "other" | ||
36 | - p.save | ||
37 | - get :index | ||
38 | - assert_equal assigns(:chosen_template), 'other' | ||
39 | - end | ||
40 | - | ||
41 | def test_exist_owner | 27 | def test_exist_owner |
42 | get :index | 28 | get :index |
43 | assert_not_nil assigns(:owner) | 29 | assert_not_nil assigns(:owner) |
@@ -45,12 +31,16 @@ class ApplicationControllerTest < Test::Unit::TestCase | @@ -45,12 +31,16 @@ class ApplicationControllerTest < Test::Unit::TestCase | ||
45 | 31 | ||
46 | def test_exist_chosen_theme | 32 | def test_exist_chosen_theme |
47 | get :index | 33 | get :index |
48 | - assert_not_nil assigns(:chosen_theme) | 34 | + assert_not_nil assigns(:ft_config) |
35 | + conf = assigns(:ft_config) | ||
36 | + assert_not_nil conf[:theme] | ||
49 | end | 37 | end |
50 | 38 | ||
51 | def test_exist_chosen_icons_theme | 39 | def test_exist_chosen_icons_theme |
52 | get :index | 40 | get :index |
53 | - assert_not_nil assigns(:chosen_icons_theme) | 41 | + assert_not_nil assigns(:ft_config) |
42 | + conf = assigns(:ft_config) | ||
43 | + assert_not_nil conf[:icons_theme] | ||
54 | end | 44 | end |
55 | 45 | ||
56 | def test_should_generate_help_box_when_passing_string | 46 | def test_should_generate_help_box_when_passing_string |
test/functional/edit_template_controller_test.rb
@@ -5,15 +5,19 @@ require 'edit_template_controller' | @@ -5,15 +5,19 @@ require 'edit_template_controller' | ||
5 | class EditTemplateController; def rescue_action(e) raise e end; end | 5 | class EditTemplateController; def rescue_action(e) raise e end; end |
6 | 6 | ||
7 | class EditTemplateControllerTest < Test::Unit::TestCase | 7 | class EditTemplateControllerTest < Test::Unit::TestCase |
8 | + | ||
8 | def setup | 9 | def setup |
9 | @controller = EditTemplateController.new | 10 | @controller = EditTemplateController.new |
10 | @request = ActionController::TestRequest.new | 11 | @request = ActionController::TestRequest.new |
11 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
13 | + @rejected_dirs = ['.', '..', '.svn'] | ||
14 | + @theme_dir_path = "#{RAILS_ROOT}/public/themes" | ||
15 | + @icons_dir_path = "#{RAILS_ROOT}/public/icons" | ||
12 | end | 16 | end |
13 | 17 | ||
14 | def test_select_theme_html | 18 | def test_select_theme_html |
15 | get :index | 19 | get :index |
16 | - available_themes = Dir.new(ApplicationHelper::THEME_DIR_PATH).to_a - ApplicationHelper::REJECTED_DIRS | 20 | + available_themes = Dir.new(@theme_dir_path).to_a - @rejected_dirs |
17 | available_themes.collect do |t| | 21 | available_themes.collect do |t| |
18 | assert_tag :tag => 'select', :attributes => {:id => 'theme_name', :name => 'theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}} | 22 | assert_tag :tag => 'select', :attributes => {:id => 'theme_name', :name => 'theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}} |
19 | end | 23 | end |
@@ -22,7 +26,7 @@ class EditTemplateControllerTest < Test::Unit::TestCase | @@ -22,7 +26,7 @@ class EditTemplateControllerTest < Test::Unit::TestCase | ||
22 | 26 | ||
23 | def test_select_icons_theme_html | 27 | def test_select_icons_theme_html |
24 | get :index | 28 | get :index |
25 | - available_icons = Dir.new(ApplicationHelper::ICONS_DIR_PATH).to_a - ApplicationHelper::REJECTED_DIRS | 29 | + available_icons = Dir.new(@icons_dir_path).to_a - @rejected_dirs |
26 | available_icons.collect do |t| | 30 | available_icons.collect do |t| |
27 | assert_tag :tag => 'select', :attributes => {:id => 'icons_theme_name', :name => 'icons_theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}} | 31 | assert_tag :tag => 'select', :attributes => {:id => 'icons_theme_name', :name => 'icons_theme_name'}, :child => {:tag =>"option", :attributes => {:value => t}} |
28 | end | 32 | end |
test/mocks/test/test_controller.rb