From 2ca286971c565f6d3db9b3f44ecce28402a6192d Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Sun, 30 Jan 2005 06:18:57 +0000 Subject: [PATCH] Web remembers max_upload_size submitted to update_web action (still is not used though) --- app/controllers/admin_controller.rb | 3 ++- app/models/wiki_service.rb | 5 +++-- test/functional/admin_controller_test.rb | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 58b40177..61b3ec9e 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -58,7 +58,8 @@ class AdminController < ApplicationController @params['published'] ? true : false, @params['brackets_only'] ? true : false, @params['count_pages'] ? true : false, - @params['allow_uploads'] ? true : false + @params['allow_uploads'] ? true : false, + @params['max_upload_size'] ) redirect_show('HomePage', @params['address']) else diff --git a/app/models/wiki_service.rb b/app/models/wiki_service.rb index fa65fb6c..e8966988 100644 --- a/app/models/wiki_service.rb +++ b/app/models/wiki_service.rb @@ -76,7 +76,7 @@ module AbstractWikiService def update_web(old_address, new_address, name, markup, color, additional_style, safe_mode = false, password = nil, published = false, brackets_only = false, count_pages = false, - allow_uploads = true) + allow_uploads = true, max_upload_size = nil) if old_address != new_address @webs[new_address] = @webs[old_address] @webs.delete(old_address) @@ -89,8 +89,9 @@ module AbstractWikiService web.name, web.markup, web.color, web.additional_style, web.safe_mode = name, markup, color, additional_style, safe_mode - web.password, web.published, web.brackets_only, web.count_pages, web.allow_uploads = + web.password, web.published, web.brackets_only, web.count_pages = password, published, brackets_only, count_pages, allow_uploads + web.allow_uploads, web.max_upload_size = allow_uploads, max_upload_size.to_i end def write_page(web_address, page_name, content, written_on, author) diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb index 97fb6152..1ee654ba 100644 --- a/test/functional/admin_controller_test.rb +++ b/test/functional/admin_controller_test.rb @@ -119,7 +119,8 @@ class AdminControllerTest < Test::Unit::TestCase 'web' => 'wiki1', 'address' => 'renamed_wiki1', 'name' => 'Renamed Wiki1', 'markup' => 'markdown', 'color' => 'blue', 'additional_style' => 'whatever', 'safe_mode' => 'on', 'password' => 'new_password', 'published' => 'on', - 'brackets_only' => 'on', 'count_pages' => 'on', 'allow_uploads' => 'on') + 'brackets_only' => 'on', 'count_pages' => 'on', 'allow_uploads' => 'on', + 'max_upload_size' => '300') assert_redirected_to :web => 'renamed_wiki1', :action => 'show', :id => 'HomePage' assert_equal 'renamed_wiki1', @web.address @@ -132,6 +133,7 @@ class AdminControllerTest < Test::Unit::TestCase assert @web.brackets_only assert @web.count_pages assert @web.allow_uploads + assert_equal 300, @web.max_upload_size end def test_update_web_opposite_values