aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/admin_user
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/admin_user')
-rw-r--r--app/views/admin_user/_form.rhtml77
-rw-r--r--app/views/admin_user/_user_table.rhtml63
-rw-r--r--app/views/admin_user/edit.rhtml24
-rw-r--r--app/views/admin_user/list.rhtml12
-rw-r--r--app/views/admin_user/list_banned.rhtml2
-rw-r--r--app/views/admin_user/show.rhtml94
6 files changed, 172 insertions, 100 deletions
diff --git a/app/views/admin_user/_form.rhtml b/app/views/admin_user/_form.rhtml
index be69d9a80..e7175d09c 100644
--- a/app/views/admin_user/_form.rhtml
+++ b/app/views/admin_user/_form.rhtml
@@ -2,26 +2,65 @@
<!--[form:admin_user]-->
-<p><label for="admin_user_name">Name</label> (will change URL name and break URLs; unlike authorities, there is no history; you will need to rebuild the search index afterwards)<br/>
-<%= text_field 'admin_user', 'name', :size => 60 %></p>
+<div class="control-group">
+ <label for="admin_user_name" class="control-label">Name</label>
+ <div class="controls">
+ <%= text_field 'admin_user', 'name', :class => "span3" %>
+ <div class="help-block">
+ will change URL name and break URLs; unlike authorities, there is no history; you will need to rebuild the search index afterwards
+ </div>
+ </div>
+</div>
-<p><label for="admin_user_email">Email</label> (<strong>you must</strong> first validate this)<br/>
-<%= text_field 'admin_user', 'email', :size => 60 %></p>
+<div class="control-group">
+ <label for="admin_user_email" class="control-label">Email</label>
+ <div class="controls">
+ <%= text_field 'admin_user', 'email', :class => "span3" %>
+ <div class="help-block">
+ <strong>you must</strong> first validate this
+ </div>
+ </div>
+</div>
-<p><label for="admin_user_admin_level">Admin level</label> (<strong>none</strong> or <strong>super</strong>; this is for admin features and links which are in the site proper)<br/>
-<%= text_field 'admin_user', 'admin_level', :size => 60 %></p>
+<div class="control-group">
+ <label for="admin_level" class="control-label">Admin level</label>
+ <div class="controls">
+ <%= text_field 'admin_user', 'admin_level', :class => "span3" %>
+ <div class="help-block">
+ <strong>none</strong> or <strong>super</strong>; this is for admin features and links which are in the site proper
+ </div>
+ </div>
+</div>
-<p><label for="admin_user_ban_text">Ban text</label> <small>(if not blank will stop the
- user from filing new requests, making annotations or messaging other users;
- the text is shown in public on the user's page and when they try to do a
- forbidden action; write in the second person (you); see
- <%= link_to 'banned users', '../banned' %> for examples</small>)<br/>
-
-<%= text_area 'admin_user', 'ban_text', :cols => 60, :rows => 3 %></p>
-
-<p><label for="admin_user_about_me">About me</label> (user's own text on their profile, format like comments):<br/>
-<%= text_area 'admin_user', 'about_me', :cols => 60, :rows => 3 %></p>
-
-<p><%= check_box 'admin_user', 'no_limit' %>
-<label for="admin_user_no_limit">No rate limit</label> (disable the limit on daily requests)</p>
+<div class="control-group">
+ <label for="ban_text" class="control-label">Ban text</label>
+ <div class="controls">
+ <%= text_area 'admin_user', 'ban_text', :class => "span6", :rows => 3 %>
+ <div class="help-block">
+ if not blank will stop the
+ user from filing new requests, making annotations or messaging other users;
+ the text is shown in public on the user's page and when they try to do a
+ forbidden action; write in the second person (you); see
+ <%= link_to 'banned users', admin_user_list_banned_path %> for examples</small>
+ </div>
+ </div>
+</div>
+<div class="control-group">
+ <label for="about_me" class="control-label">About me</label>
+ <div class="controls">
+ <%= text_area 'admin_user', 'about_me', :class => "span6", :rows => 3 %>
+ <div class="help-block">
+ user's own text on their profile, format like comments
+ </div>
+ </div>
+</div>
+<div class="control-group">
+ <label for="admin_user_no_limit" class="control-label">No rate limit</label>
+ <div class="controls">
+ <%= check_box 'admin_user', 'no_limit' %>
+ <div class="help-block">
+ disable the limit on daily requests
+ </div>
+ </div>
+</div>
diff --git a/app/views/admin_user/_user_table.rhtml b/app/views/admin_user/_user_table.rhtml
index d35c78594..57066bf3f 100644
--- a/app/views/admin_user/_user_table.rhtml
+++ b/app/views/admin_user/_user_table.rhtml
@@ -1,22 +1,47 @@
-<table>
- <tr>
- <th>Id</th>
- <% for column in ['Name', 'Email', 'Created at', 'Updated at', 'Email confirmed', 'Admin'] + (banned_column ? ['Ban text'] : []) %>
- <th><%= column %></th>
+<div class="accordion" id="users">
+ <% for user in users %>
+ <div class="accordion-group">
+ <div class="accordion-heading accordion-toggle">
+ <span class="item-title">
+ <a href="#user_<%=user.id%>" data-toggle="collapse" data-parent="requests"><%= chevron_right %></a>
+ <% 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.email)})", "mailto:#{h(user.email)}")%>
+ </span>
+ <span class="item-metadata">
+ updated <%=I18n.l(user.updated_at, :format => "%e %B %Y %H:%M:%S")%>
+ </span>
+ </div>
+ <div id="user_<%=user.id%>" class="accordion-body collapse">
+ <table class="table table-striped table-condensed">
+ <tbody>
+ <% if banned_column %>
+ <tr>
+ <td><b>Ban text</b></td>
+ <td><%= h user.ban_text %></td>
+ </tr>
+ <% end %>
+ <% user.for_admin_column do |name, value, type|%>
+ <tr>
+ <td><b><%=h name%></b></td>
+ <td>
+ <% if type == 'datetime' %>
+ <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %>
+ (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>)
+ <% else %>
+ <%= h value %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+ </div>
<% end %>
- </tr>
-
-<% for user in users %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td><%= user.id.to_s %></td>
- <td><%= user_both_links(user) %></td>
- <td><a href="mailto:<%=h user.email %>"><%=h user.email%></a></td>
- <% for column in ['created_at', 'updated_at', 'email_confirmed', 'admin_level'] + (banned_column ? ['ban_text'] : []) %>
- <td><%=h user.send(column) %></td>
- <% end %>
- </tr>
-<% end %>
-</table>
+</div>
-<%= will_paginate(users) %>
+<%= will_paginate(users, :class => "paginator") %>
diff --git a/app/views/admin_user/edit.rhtml b/app/views/admin_user/edit.rhtml
index 06ddc57d3..3333a1e48 100644
--- a/app/views/admin_user/edit.rhtml
+++ b/app/views/admin_user/edit.rhtml
@@ -1,23 +1,11 @@
-
-
<h1><%=@title%></h1>
-<% form_tag '../update/' + @admin_user.id.to_s do %>
+<% form_tag admin_user_update_path(@admin_user), :class => "form form-horizontal" do %>
<%= render :partial => 'form' %>
- <p><%= submit_tag 'Save', :accesskey => 's' %></p>
-<% end %>
-
-<p>
-<%= link_to 'Show', '../show/' + @admin_user.id.to_s %> |
-<%= link_to 'List all', '../list' %>
-</p>
-
-<% if false #@admin_user.info_requests.size == 0 %>
- <% form_tag('../destroy/' + @admin_user.id.to_s) do %>
- <p>
- <%= hidden_field_tag(:admin_user_id, { :value => @admin_user.id } ) %>
- <%= submit_tag "Destroy " + @admin_user.name %> (this is permanent!)
- </p>
- <% end %>
+ <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" %>
diff --git a/app/views/admin_user/list.rhtml b/app/views/admin_user/list.rhtml
index 9de381ecc..23f75c159 100644
--- a/app/views/admin_user/list.rhtml
+++ b/app/views/admin_user/list.rhtml
@@ -1,13 +1,11 @@
-<% @title = 'Listing users' %>
+<% @title = _('Listing users') %>
<h1><%=@title%></h1>
-<% form_tag("", :method => "get") do %>
- <p>
- <%= text_field_tag 'query', params[:query], { :size => 30 } %>
- <%= submit_tag "Search" %> (substring search, names and emails)
- <%= link_to 'Banned users', 'banned' %>
- </p>
+<% form_tag({}, :method => "get", :class => "form form-search") do %>
+ <%= text_field_tag 'query', params[:query], { :size => 30, :class => "input-large search-query"} %>
+ <%= submit_tag "Search", :class => "btn" %> (substring search, names and emails)
+ <%= link_to 'Banned users', admin_user_list_banned_path, :class => "btn btn-info" %>
<% end %>
<%= render :partial => 'user_table', :locals => { :users => @admin_users, :banned_column => false } %>
diff --git a/app/views/admin_user/list_banned.rhtml b/app/views/admin_user/list_banned.rhtml
index be2d45399..e535415e6 100644
--- a/app/views/admin_user/list_banned.rhtml
+++ b/app/views/admin_user/list_banned.rhtml
@@ -2,7 +2,7 @@
<h1><%=@title%></h1>
-<p><%= link_to 'List all', 'list' %></p>
+<p><%= link_to 'List all', admin_user_list_path %></p>
<%= render :partial => 'user_table', :locals => { :users => @banned_users, :banned_column => true } %>
diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml
index 4af79e45a..279758f03 100644
--- a/app/views/admin_user/show.rhtml
+++ b/app/views/admin_user/show.rhtml
@@ -1,63 +1,81 @@
-<% @title = "User - " + h(@admin_user.name) %>
+<% @title = _("User – {{name}}", :name => h(@admin_user.name)) %>
<h1><%=@title%></h1>
<% if @admin_user.profile_photo %>
- <div class="user_photo_on_admin">
- <% form_tag '../clear_profile_photo/' + @admin_user.id.to_s, :multipart => true do %>
- <img src="<%= main_url(get_profile_photo_url(:url_name => @admin_user.url_name, :only_path => true)) %>">
- <br>
- <%= submit_tag "Clear photo" %>
- <% end %>
- </div>
+ <div class="user_photo_on_admin">
+ <% form_tag admin_clear_profile_photo_path(@admin_user), :multipart => true, :class => "form" do %>
+ <img src="<%= get_profile_photo_url(:url_name => @admin_user.url_name) %>">
+ <br>
+ <%= submit_tag "Clear photo", :class => "btn btn-info" %>
+ <% end %>
+ </div>
<% end %>
-
-<div>
-<strong>Id:</strong> <%= @admin_user.id%> <br>
-<% for column in User.content_columns %>
- <strong><%= column.human_name %>:</strong>
- <% if column.name == 'email' %>
- <a href="mailto:<%=h @admin_user.email %>"><%=h @admin_user.email%></a>
- <% elsif column.name == 'email_bounce_message' %>
- <% if !@admin_user.email_bounce_message.empty? %>
- <a href="../show_bounce_message/<%= @admin_user.id.to_s %>">See bounce message</a>
- <% end %>
- <% else %>
- <%=h @admin_user.send(column.name) %>
+<table class="table table-striped table-condensed">
+ <tbody>
+ <tr>
+ <td>
+ <b><%=_("Id")%></b>
+ </td>
+ <td>
+ <%=@admin_user.id%>
+ </td>
+ </tr>
+ <% @admin_user.for_admin_column(:complete => true) do |name, value, type, column_name| %>
+ <tr>
+ <td>
+ <b><%=_(name)%></b>
+ </td>
+ <td>
+ <% if column_name == 'email' %>
+ <%=link_to @admin_user.email, "mailto:#{h @admin_user.email}"%>
+ <% elsif column_name == 'email_bounce_message' %>
+ <% unless @admin_user.email_bounce_message.empty? %>
+ <%= link_to _("See bounce message"), admin_user_show_bounce(@admin_user.id) %>
+ <% end %>
+ <% else %>
+ <%=h admin_value(value)%>
+ <% end %>
+ <% if column_name == 'email_bounced_at' && !@admin_user.email_bounced_at.nil? %>
+ <% form_tag admin_user_clear_bounce_path(@admin_user), :class => "form form-inline" do %>
+ <input type="submit" name="action" value="Clear bounce" class="btn btn-info">
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
<% end %>
- <% if column.name == 'email_bounced_at' && !@admin_user.email_bounced_at.nil? %>
- <form action="../clear_bounce/<%= @admin_user.id.to_s %>" style="display: inline;"><input type="submit" name="action" value="Clear bounce"></form>
- <% end %>
- <br>
-<% end %>
-</div>
+ </tbody>
+</table>
-<p>
- <%= link_to 'Public page', main_url(user_url(@admin_user)) %>
- | <%= link_to 'Edit', '../edit/' + @admin_user.id.to_s %>
- | <%= link_to 'Log in as this user', '../login_as/' + @admin_user.id.to_s %> (also confirms their email)
-</p>
+
+<%= link_to 'Edit', admin_user_edit_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" %>
+
+<hr>
<h2>Track things</h2>
-<%= render :partial => 'admin_track/some_tracks', :locals => { :track_things => @admin_user.track_things } %>
+<%= render :partial => 'admin_track/some_tracks', :locals => { :track_things => @admin_user.track_things, :include_destroy => true } %>
+
+<hr>
<h2>Post redirects</h2>
-<table>
+<table class="table table-condensed table-striped">
<tr>
<th>Id</th>
<% for column in PostRedirect.content_columns %>
<th><%= column.human_name %></th>
<% end %>
</tr>
-
+
<% for post_redirect in @admin_user.post_redirects.find(:all, :order => 'created_at desc') %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%=h post_redirect.id %></td>
<% for column in PostRedirect.content_columns.map { |c| c.name } %>
<% if column == 'email_token' %>
- <td><%=link_to post_redirect.send(column), main_url(confirm_url(:email_token => post_redirect.send(column), :only_path => true)) %></td>
+ <td><%=link_to post_redirect.send(column), confirm_path(:email_token => post_redirect.send(column)) %></td>
<% else %>
<td><%=h post_redirect.send(column) %></td>
<% end %>
@@ -66,9 +84,13 @@
<% end %>
</table>
+<hr>
+
<h2>Requests</h2>
<%= render :partial => 'admin_request/some_requests', :locals => { :info_requests => @admin_user.info_requests } %>
+<hr>
+
<h2>Censor rules</h2>
<%= render :partial => 'admin_censor_rule/show', :locals => { :censor_rules => @admin_user.censor_rules, :user => @admin_user } %>