diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-05 11:33:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-05 11:33:49 +0000 |
commit | c9fd7513edd0f594227fc681dcd654e41bd118e6 (patch) | |
tree | 90f582a920c1bc017d2342b53f23ea91230bd586 /app | |
parent | 8d9b04865bac785d12b0aac43fe0c62488c39fec (diff) | |
download | redmine-c9fd7513edd0f594227fc681dcd654e41bd118e6.tar.gz redmine-c9fd7513edd0f594227fc681dcd654e41bd118e6.zip |
Default configuration data can now be loaded from the administration screen.
A message is automatically displayed on this screen if roles, trackers,... have not been configured yet.
The rake task is still available and the data loading code is wrapped in a transaction.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1040 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_controller.rb | 17 | ||||
-rw-r--r-- | app/views/admin/_no_data.rhtml | 8 | ||||
-rw-r--r-- | app/views/admin/index.rhtml | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 0f8eb32a5..9e6a22822 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -22,7 +22,8 @@ class AdminController < ApplicationController helper :sort include SortHelper - def index + def index + @no_configuration_data = Redmine::DefaultData::Loader::no_data? end def projects @@ -56,6 +57,20 @@ class AdminController < ApplicationController end end + # Loads the default configuration + # (roles, trackers, statuses, workflow, enumerations) + def default_configuration + if request.post? + begin + Redmine::DefaultData::Loader::load(params[:lang]) + flash[:notice] = l(:notice_default_data_loaded) + rescue Exception => e + flash[:error] = l(:error_can_t_load_default_data, e.message) + end + end + redirect_to :action => 'index' + end + def test_email raise_delivery_errors = ActionMailer::Base.raise_delivery_errors # Force ActionMailer to raise delivery errors so we can catch it diff --git a/app/views/admin/_no_data.rhtml b/app/views/admin/_no_data.rhtml new file mode 100644 index 000000000..5d52dc059 --- /dev/null +++ b/app/views/admin/_no_data.rhtml @@ -0,0 +1,8 @@ +<div class="nodata"> +<% form_tag({:action => 'default_configuration'}) do %> + <%= simple_format(l(:text_no_configuration_data)) %> + <p><%= l(:field_language) %>: + <%= select_tag 'lang', options_for_select(lang_options_for_select(false), current_language.to_s) %> + <%= submit_tag l(:text_load_default_configuration) %></p> +<% end %> +</div> diff --git a/app/views/admin/index.rhtml b/app/views/admin/index.rhtml index 1c6cbdee5..2291c5415 100644 --- a/app/views/admin/index.rhtml +++ b/app/views/admin/index.rhtml @@ -1,5 +1,7 @@ <h2><%=l(:label_administration)%></h2> +<%= render :partial => 'no_data' if @no_configuration_data %> + <p class="icon22 icon22-projects"> <%= link_to l(:label_project_plural), :controller => 'admin', :action => 'projects' %> | <%= link_to l(:label_new), :controller => 'projects', :action => 'add' %> |