diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_censor_rule_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/admin_user_controller.rb | 32 | ||||
-rw-r--r-- | app/helpers/admin_helper.rb | 2 | ||||
-rwxr-xr-x | app/helpers/link_to_helper.rb | 4 | ||||
-rw-r--r-- | app/views/admin_general/_admin_navbar.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_user/_user_table.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_user/edit.html.erb | 6 | ||||
-rw-r--r-- | app/views/admin_user/index.html.erb (renamed from app/views/admin_user/list.html.erb) | 0 | ||||
-rw-r--r-- | app/views/admin_user/list_banned.html.erb | 2 | ||||
-rw-r--r-- | app/views/admin_user/show.html.erb | 2 | ||||
-rw-r--r-- | app/views/user/show.html.erb | 2 |
11 files changed, 28 insertions, 32 deletions
diff --git a/app/controllers/admin_censor_rule_controller.rb b/app/controllers/admin_censor_rule_controller.rb index dd0af002d..01c0bf4b2 100644 --- a/app/controllers/admin_censor_rule_controller.rb +++ b/app/controllers/admin_censor_rule_controller.rb @@ -54,7 +54,7 @@ class AdminCensorRuleController < AdminController if !@censor_rule.info_request.nil? redirect_to admin_request_url(@censor_rule.info_request) elsif !@censor_rule.user.nil? - redirect_to admin_user_show_url(@censor_rule.user) + redirect_to admin_user_url(@censor_rule.user) else raise "internal error" end @@ -85,7 +85,7 @@ class AdminCensorRuleController < AdminController if !@censor_rule.info_request.nil? redirect_to admin_request_url(@censor_rule.info_request) elsif !@censor_rule.user.nil? - redirect_to admin_user_show_url(@censor_rule.user) + redirect_to admin_user_url(@censor_rule.user) else raise "internal error" end @@ -114,7 +114,7 @@ class AdminCensorRuleController < AdminController if !info_request.nil? redirect_to admin_request_url(info_request) elsif !user.nil? - redirect_to admin_user_show_url(user) + redirect_to admin_user_url(user) else raise "internal error" end diff --git a/app/controllers/admin_user_controller.rb b/app/controllers/admin_user_controller.rb index a6438e151..3379b9629 100644 --- a/app/controllers/admin_user_controller.rb +++ b/app/controllers/admin_user_controller.rb @@ -5,12 +5,8 @@ # Email: hello@mysociety.org; WWW: http://www.mysociety.org/ class AdminUserController < AdminController - def index - list - render :action => 'list' - end - def list + def index @query = params[:query] if @query users = User.where(["lower(name) like lower('%'||?||'%') or @@ -21,20 +17,11 @@ class AdminUserController < AdminController @admin_users = users.paginate :order => "name", :page => params[:page], :per_page => 100 end - def list_banned - @banned_users = User.paginate :order => "name", :page => params[:page], :per_page => 100, - :conditions => ["ban_text <> ''"] - end - def show # Don't use @user as that is any logged in user @admin_user = User.find(params[:id]) end - def show_bounce_message - @admin_user = User.find(params[:id]) - end - def edit @admin_user = User.find(params[:id]) end @@ -53,17 +40,26 @@ class AdminUserController < AdminController if @admin_user.valid? @admin_user.save! flash[:notice] = 'User successfully updated.' - redirect_to admin_user_show_url(@admin_user) + redirect_to admin_user_url(@admin_user) else render :action => 'edit' end end + def list_banned + @banned_users = User.paginate :order => "name", :page => params[:page], :per_page => 100, + :conditions => ["ban_text <> ''"] + end + + def show_bounce_message + @admin_user = User.find(params[:id]) + end + def destroy_track track_thing = TrackThing.find(params[:track_id].to_i) track_thing.destroy flash[:notice] = 'Track destroyed' - redirect_to admin_user_show_url(track_thing.tracking_user) + redirect_to admin_user_url(track_thing.tracking_user) end def clear_bounce @@ -71,7 +67,7 @@ class AdminUserController < AdminController user.email_bounced_at = nil user.email_bounce_message = "" user.save! - redirect_to admin_user_show_url(user) + redirect_to admin_user_url(user) end def login_as @@ -96,7 +92,7 @@ class AdminUserController < AdminController end flash[:notice] = "Profile photo cleared" - redirect_to admin_user_show_url(@admin_user) + redirect_to admin_user_url(@admin_user) end def modify_comment_visibility diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 38743b1fa..d13fea79b 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -31,7 +31,7 @@ module AdminHelper def user_both_links(user) link_to(eye, user_path(user), :title => "view user's page on public website") + " " + - link_to(h(user.name), admin_user_show_path(user), :title => "view full details") + link_to(h(user.name), admin_user_path(user), :title => "view full details") end def comment_visibility(comment) diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 3709469cf..44d6c6f5f 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -116,7 +116,7 @@ module LinkToHelper if request.is_external? external_text || (request.external_user_name || _("Anonymous user")) + " (external)" else - link_to(internal_text || request.user.name, admin_user_show_url(request.user)) + link_to(internal_text || request.user.name, admin_user_url(request.user)) end end @@ -178,7 +178,7 @@ module LinkToHelper end def user_admin_link(user, name="admin", cls=nil) - link_to name, admin_user_show_url(user), :class => cls + link_to name, admin_user_url(user), :class => cls end # Tracks. feed can be 'track' or 'feed' diff --git a/app/views/admin_general/_admin_navbar.html.erb b/app/views/admin_general/_admin_navbar.html.erb index b6196815a..5dab81e7d 100644 --- a/app/views/admin_general/_admin_navbar.html.erb +++ b/app/views/admin_general/_admin_navbar.html.erb @@ -12,7 +12,7 @@ <li><%= link_to 'Authorities', admin_bodies_path %></li> <li><%= link_to 'Categories', admin_categories_path %></li> <li><%= link_to 'Requests', admin_requests_path %></li> - <li><%= link_to 'Users', admin_user_list_path %></li> + <li><%= link_to 'Users', admin_users_path %></li> <li><%= link_to 'Tracks', admin_track_list_path %></li> <li><%= link_to 'Log out', signout_path %></li> </ul> diff --git a/app/views/admin_user/_user_table.html.erb b/app/views/admin_user/_user_table.html.erb index 57066bf3f..4fd90d5c6 100644 --- a/app/views/admin_user/_user_table.html.erb +++ b/app/views/admin_user/_user_table.html.erb @@ -7,7 +7,7 @@ <% if user.admin_level == "super" %> <span class="label">superuser</span> <% end %> - <%= link_to("#{h(user.name)}", admin_user_show_path(user))%> + <%= link_to("#{h(user.name)}", admin_user_path(user))%> <%= link_to("(#{h(user.email)})", "mailto:#{h(user.email)}")%> </span> <span class="item-metadata"> diff --git a/app/views/admin_user/edit.html.erb b/app/views/admin_user/edit.html.erb index e641a13d6..ed1fb6e08 100644 --- a/app/views/admin_user/edit.html.erb +++ b/app/views/admin_user/edit.html.erb @@ -1,11 +1,11 @@ <h1><%=@title%></h1> -<%= form_tag admin_user_update_path(@admin_user), :class => "form form-horizontal" do %> +<%= form_tag admin_user_path(@admin_user), :method => 'put', :class => "form form-horizontal" do %> <%= render :partial => 'form' %> <div class="form-actions"> <%= submit_tag 'Save', :accesskey => 's', :class => "btn btn-primary" %> </div> <% end %> -<%= link_to 'Show', admin_user_show_path(@admin_user), :class => "btn" %> -<%= link_to 'List all', admin_user_list_path, :class => "btn" %> +<%= link_to 'Show', admin_user_path(@admin_user), :class => "btn" %> +<%= link_to 'List all', admin_users_path, :class => "btn" %> diff --git a/app/views/admin_user/list.html.erb b/app/views/admin_user/index.html.erb index b1238f87a..b1238f87a 100644 --- a/app/views/admin_user/list.html.erb +++ b/app/views/admin_user/index.html.erb diff --git a/app/views/admin_user/list_banned.html.erb b/app/views/admin_user/list_banned.html.erb index e535415e6..ee17d9899 100644 --- a/app/views/admin_user/list_banned.html.erb +++ b/app/views/admin_user/list_banned.html.erb @@ -2,7 +2,7 @@ <h1><%=@title%></h1> -<p><%= link_to 'List all', admin_user_list_path %></p> +<p><%= link_to 'List all', admin_users_path %></p> <%= render :partial => 'user_table', :locals => { :users => @banned_users, :banned_column => true } %> diff --git a/app/views/admin_user/show.html.erb b/app/views/admin_user/show.html.erb index 6d12aeff5..2963a4100 100644 --- a/app/views/admin_user/show.html.erb +++ b/app/views/admin_user/show.html.erb @@ -49,7 +49,7 @@ </table> -<%= link_to 'Edit', admin_user_edit_path(@admin_user), :class => "btn btn-primary" %> +<%= link_to 'Edit', edit_admin_user_path(@admin_user), :class => "btn btn-primary" %> <%= link_to 'Public page', user_path(@admin_user), :class => "btn" %> <%= link_to "Log in as #{@admin_user.name} (also confirms their email)", admin_user_login_as_path(@admin_user), :class => "btn btn-info" %> diff --git a/app/views/user/show.html.erb b/app/views/user/show.html.erb index b23f74326..51882b8ef 100644 --- a/app/views/user/show.html.erb +++ b/app/views/user/show.html.erb @@ -66,7 +66,7 @@ <p class="subtitle"> <%= _('Joined {{site_name}} in', :site_name=>site_name) %> <%= @display_user.created_at.year %> <% if !@user.nil? && @user.admin_page_links? %> - (<%= link_to "admin", admin_user_show_path(@display_user) %>) + (<%= link_to "admin", admin_user_path(@display_user) %>) <% end %> </p> |