From: Jean-Philippe Lang Date: Mon, 28 Nov 2011 20:23:57 +0000 (+0000) Subject: Removed EnumerationsController#list action. X-Git-Tag: 1.3.0~39 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2dbbdafbc6c4d2b83565c16ea2c19a824ff3acbf;p=redmine.git Removed EnumerationsController#list action. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7973 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb index 73d39dd4d..c567b6ae6 100644 --- a/app/controllers/enumerations_controller.rb +++ b/app/controllers/enumerations_controller.rb @@ -24,16 +24,10 @@ class EnumerationsController < ApplicationController include CustomFieldsHelper def index - list - render :action => 'list' end - # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :post, :only => [ :destroy, :create, :update ], - :redirect_to => { :action => :list } - - def list - end + :redirect_to => { :action => :index } def new begin @@ -48,7 +42,7 @@ class EnumerationsController < ApplicationController @enumeration.type = params[:enumeration][:type] if @enumeration.save flash[:notice] = l(:notice_successful_create) - redirect_to :action => 'list', :type => @enumeration.type + redirect_to :action => 'index', :type => @enumeration.type else render :action => 'new' end @@ -63,7 +57,7 @@ class EnumerationsController < ApplicationController @enumeration.type = params[:enumeration][:type] if params[:enumeration][:type] if @enumeration.update_attributes(params[:enumeration]) flash[:notice] = l(:notice_successful_update) - redirect_to :action => 'list', :type => @enumeration.type + redirect_to :action => 'index', :type => @enumeration.type else render :action => 'edit' end diff --git a/app/views/enumerations/index.html.erb b/app/views/enumerations/index.html.erb new file mode 100644 index 000000000..80f7ef3dc --- /dev/null +++ b/app/views/enumerations/index.html.erb @@ -0,0 +1,37 @@ +

<%=l(:label_enumerations)%>

+ +<% Enumeration.get_subclasses.each do |klass| %> +

<%= l(klass::OptionName) %>

+ +<% enumerations = klass.shared %> +<% if enumerations.any? %> + + + + + + + + +<% enumerations.each do |enumeration| %> + + + + + + + +<% end %> +
<%= l(:field_name) %><%= l(:field_is_default) %><%= l(:field_active) %>
<%= link_to h(enumeration), :action => 'edit', :id => enumeration %><%= checked_image enumeration.is_default? %><%= checked_image enumeration.active? %><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %> + <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration }, + :method => :post, + :confirm => l(:text_are_you_sure), + :class => 'icon icon-del' %> +
+<% reset_cycle %> +<% end %> + +

<%= link_to l(:label_enumeration_new), { :action => 'new', :type => klass.name } %>

+<% end %> + +<% html_title(l(:label_enumerations)) -%> diff --git a/app/views/enumerations/list.html.erb b/app/views/enumerations/list.html.erb deleted file mode 100644 index 80f7ef3dc..000000000 --- a/app/views/enumerations/list.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -

<%=l(:label_enumerations)%>

- -<% Enumeration.get_subclasses.each do |klass| %> -

<%= l(klass::OptionName) %>

- -<% enumerations = klass.shared %> -<% if enumerations.any? %> - - - - - - - - -<% enumerations.each do |enumeration| %> - - - - - - - -<% end %> -
<%= l(:field_name) %><%= l(:field_is_default) %><%= l(:field_active) %>
<%= link_to h(enumeration), :action => 'edit', :id => enumeration %><%= checked_image enumeration.is_default? %><%= checked_image enumeration.active? %><%= reorder_links('enumeration', {:action => 'update', :id => enumeration}) %> - <%= link_to l(:button_delete), { :action => 'destroy', :id => enumeration }, - :method => :post, - :confirm => l(:text_are_you_sure), - :class => 'icon icon-del' %> -
-<% reset_cycle %> -<% end %> - -

<%= link_to l(:label_enumeration_new), { :action => 'new', :type => klass.name } %>

-<% end %> - -<% html_title(l(:label_enumerations)) -%> diff --git a/test/functional/enumerations_controller_test.rb b/test/functional/enumerations_controller_test.rb index 3ab40b5cf..d306ef926 100644 --- a/test/functional/enumerations_controller_test.rb +++ b/test/functional/enumerations_controller_test.rb @@ -34,7 +34,7 @@ class EnumerationsControllerTest < ActionController::TestCase def test_index get :index assert_response :success - assert_template 'list' + assert_template 'index' end def test_destroy_enumeration_not_in_use