Web remembers max_upload_size submitted to update_web action (still is not used though)
This commit is contained in:
parent
9a5a195c47
commit
2ca286971c
3 changed files with 8 additions and 4 deletions
|
@ -58,7 +58,8 @@ class AdminController < ApplicationController
|
||||||
@params['published'] ? true : false,
|
@params['published'] ? true : false,
|
||||||
@params['brackets_only'] ? true : false,
|
@params['brackets_only'] ? true : false,
|
||||||
@params['count_pages'] ? 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'])
|
redirect_show('HomePage', @params['address'])
|
||||||
else
|
else
|
||||||
|
|
|
@ -76,7 +76,7 @@ module AbstractWikiService
|
||||||
|
|
||||||
def update_web(old_address, new_address, name, markup, color, additional_style, safe_mode = false,
|
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,
|
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
|
if old_address != new_address
|
||||||
@webs[new_address] = @webs[old_address]
|
@webs[new_address] = @webs[old_address]
|
||||||
@webs.delete(old_address)
|
@webs.delete(old_address)
|
||||||
|
@ -89,8 +89,9 @@ module AbstractWikiService
|
||||||
web.name, web.markup, web.color, web.additional_style, web.safe_mode =
|
web.name, web.markup, web.color, web.additional_style, web.safe_mode =
|
||||||
name, markup, color, additional_style, 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
|
password, published, brackets_only, count_pages, allow_uploads
|
||||||
|
web.allow_uploads, web.max_upload_size = allow_uploads, max_upload_size.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_page(web_address, page_name, content, written_on, author)
|
def write_page(web_address, page_name, content, written_on, author)
|
||||||
|
|
|
@ -119,7 +119,8 @@ class AdminControllerTest < Test::Unit::TestCase
|
||||||
'web' => 'wiki1', 'address' => 'renamed_wiki1', 'name' => 'Renamed Wiki1',
|
'web' => 'wiki1', 'address' => 'renamed_wiki1', 'name' => 'Renamed Wiki1',
|
||||||
'markup' => 'markdown', 'color' => 'blue', 'additional_style' => 'whatever',
|
'markup' => 'markdown', 'color' => 'blue', 'additional_style' => 'whatever',
|
||||||
'safe_mode' => 'on', 'password' => 'new_password', 'published' => 'on',
|
'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_redirected_to :web => 'renamed_wiki1', :action => 'show', :id => 'HomePage'
|
||||||
assert_equal 'renamed_wiki1', @web.address
|
assert_equal 'renamed_wiki1', @web.address
|
||||||
|
@ -132,6 +133,7 @@ class AdminControllerTest < Test::Unit::TestCase
|
||||||
assert @web.brackets_only
|
assert @web.brackets_only
|
||||||
assert @web.count_pages
|
assert @web.count_pages
|
||||||
assert @web.allow_uploads
|
assert @web.allow_uploads
|
||||||
|
assert_equal 300, @web.max_upload_size
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_update_web_opposite_values
|
def test_update_web_opposite_values
|
||||||
|
|
Loading…
Reference in a new issue