diff --git a/app/controllers/wiki_extensions_settings_controller.rb b/app/controllers/wiki_extensions_settings_controller.rb index f41df49..7c7a77f 100644 --- a/app/controllers/wiki_extensions_settings_controller.rb +++ b/app/controllers/wiki_extensions_settings_controller.rb @@ -29,6 +29,7 @@ def update setting.transaction do menus.each_pair {|menu_no, menu| menu_setting = WikiExtensionsMenu.find_or_create(@project.id, menu[:menu_no].to_i) + menu_setting.enabled = false menu_setting.attributes = menu.permit(:enabled, :menu_no, :title, :page_name) menu_setting.save! } diff --git a/init.rb b/init.rb index d1ebfb7..9cd163f 100644 --- a/init.rb +++ b/init.rb @@ -36,7 +36,7 @@ author_url 'http://twitter.com/haru_iida' description 'This is a Wiki Extensions plugin for Redmine' url 'http://www.r-labs.org/projects/r-labs/wiki/Wiki_Extensions_en' - version '0.9.1' + version '0.9.2' requires_redmine :version_or_higher => '4.0.0' project_module :wiki_extensions do diff --git a/test/functional/wiki_extensions_settings_controller_test.rb b/test/functional/wiki_extensions_settings_controller_test.rb index 97b8578..de1c479 100644 --- a/test/functional/wiki_extensions_settings_controller_test.rb +++ b/test/functional/wiki_extensions_settings_controller_test.rb @@ -54,6 +54,18 @@ def setup assert(menus[1].enabled) assert_equal('my_title2', menus[1].title) assert_equal('my_page_name2', menus[1].page_name) + + menus = {} + menus[0] = {:enabled => 'true',:menu_no => 1, :title => 'my_title', :page_name => 'my_page_name'} + menus[1] = {:menu_no => 2} + post :update, :params => { + :menus => menus, :id => @project} + assert_response :redirect + setting = WikiExtensionsSetting.find_or_create @project.id + menus = setting.menus + assert(menus[0].enabled) + assert(!menus[1].enabled) + end end