From: Eric Davis Date: Mon, 15 Feb 2010 16:41:16 +0000 (+0000) Subject: Refactor: Merged RolesController#list and #index X-Git-Tag: 1.0.0~347 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=038a88e970aa7d0512258a903614b99e5f7e98ae;p=redmine.git Refactor: Merged RolesController#list and #index git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3435 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index c701cac74..00902735c 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -21,16 +21,11 @@ class RolesController < ApplicationController before_filter :require_admin verify :method => :post, :only => [ :destroy, :move ], - :redirect_to => { :action => :list } + :redirect_to => { :action => :index } def index - list - render :action => 'list' unless request.xhr? - end - - def list @role_pages, @roles = paginate :roles, :per_page => 25, :order => 'builtin, position' - render :action => "list", :layout => false if request.xhr? + render :action => "index", :layout => false if request.xhr? end def new diff --git a/app/views/roles/index.html.erb b/app/views/roles/index.html.erb new file mode 100644 index 000000000..41878146b --- /dev/null +++ b/app/views/roles/index.html.erb @@ -0,0 +1,37 @@ +
+<%= link_to l(:label_role_new), {:action => 'new'}, :class => 'icon icon-add' %> +
+ +

<%=l(:label_role_plural)%>

+ + + + + + + + +<% for role in @roles %> + "> + + + + +<% end %> + +
<%=l(:label_role)%><%=l(:button_sort)%>
<%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, :action => 'edit', :id => role)) %> + <% unless role.builtin? %> + <%= reorder_links('role', {:action => 'edit', :id => role}) %> + <% end %> + + <%= link_to(l(:button_delete), { :action => 'destroy', :id => role }, + :method => :post, + :confirm => l(:text_are_you_sure), + :class => 'icon icon-del') unless role.builtin? %> +
+ +

<%= pagination_links_full @role_pages %>

+ +

<%= link_to l(:label_permissions_report), :action => 'report' %>

+ +<% html_title(l(:label_role_plural)) -%> diff --git a/app/views/roles/list.rhtml b/app/views/roles/list.rhtml deleted file mode 100644 index 41878146b..000000000 --- a/app/views/roles/list.rhtml +++ /dev/null @@ -1,37 +0,0 @@ -
-<%= link_to l(:label_role_new), {:action => 'new'}, :class => 'icon icon-add' %> -
- -

<%=l(:label_role_plural)%>

- - - - - - - - -<% for role in @roles %> - "> - - - - -<% end %> - -
<%=l(:label_role)%><%=l(:button_sort)%>
<%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, :action => 'edit', :id => role)) %> - <% unless role.builtin? %> - <%= reorder_links('role', {:action => 'edit', :id => role}) %> - <% end %> - - <%= link_to(l(:button_delete), { :action => 'destroy', :id => role }, - :method => :post, - :confirm => l(:text_are_you_sure), - :class => 'icon icon-del') unless role.builtin? %> -
- -

<%= pagination_links_full @role_pages %>

- -

<%= link_to l(:label_permissions_report), :action => 'report' %>

- -<% html_title(l(:label_role_plural)) -%> diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb index 200408837..9159742c9 100644 --- a/test/functional/roles_controller_test.rb +++ b/test/functional/roles_controller_test.rb @@ -35,7 +35,7 @@ class RolesControllerTest < ActionController::TestCase def test_get_index get :index assert_response :success - assert_template 'list' + assert_template 'index' assert_not_nil assigns(:roles) assert_equal Role.find(:all, :order => 'builtin, position'), assigns(:roles)