diff options
Diffstat (limited to 'app/views/admin_user')
-rw-r--r-- | app/views/admin_user/_form.rhtml | 77 | ||||
-rw-r--r-- | app/views/admin_user/_user_table.rhtml | 63 | ||||
-rw-r--r-- | app/views/admin_user/edit.rhtml | 14 | ||||
-rw-r--r-- | app/views/admin_user/list.rhtml | 12 | ||||
-rw-r--r-- | app/views/admin_user/show.rhtml | 93 |
5 files changed, 171 insertions, 88 deletions
diff --git a/app/views/admin_user/_form.rhtml b/app/views/admin_user/_form.rhtml index be69d9a80..756806d2a 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', '../banned' %> 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..9c996b542 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"><i class="icon-chevron-right"></i></a> + <% if user.admin_level == "super" %> + <span class="label">superuser</span> + <% end %> + <%= link_to("#{h(user.name)}", user_admin_url(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..c3ee3012b 100644 --- a/app/views/admin_user/edit.rhtml +++ b/app/views/admin_user/edit.rhtml @@ -1,16 +1,14 @@ - - <h1><%=@title%></h1> -<% form_tag '../update/' + @admin_user.id.to_s do %> +<% form_tag "../update/#{@admin_user.id}", :class => "form form-horizontal" do %> <%= render :partial => 'form' %> - <p><%= submit_tag 'Save', :accesskey => 's' %></p> + <div class="form-actions"> + <%= submit_tag 'Save', :accesskey => 's', :class => "btn btn-primary" %> + </div> <% end %> -<p> -<%= link_to 'Show', '../show/' + @admin_user.id.to_s %> | -<%= link_to 'List all', '../list' %> -</p> +<%= link_to 'Show', "../show/#{@admin_user.id}", :class => "btn" %> +<%= link_to 'List all', '../list', :class => "btn" %> <% if false #@admin_user.info_requests.size == 0 %> <% form_tag('../destroy/' + @admin_user.id.to_s) do %> diff --git a/app/views/admin_user/list.rhtml b/app/views/admin_user/list.rhtml index 9de381ecc..df3a1b276 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', 'banned', :class => "btn btn-info" %> <% end %> <%= render :partial => 'user_table', :locals => { :users => @admin_users, :banned_column => false } %> diff --git a/app/views/admin_user/show.rhtml b/app/views/admin_user/show.rhtml index a9a1c1a4b..ab2872625 100644 --- a/app/views/admin_user/show.rhtml +++ b/app/views/admin_user/show.rhtml @@ -1,57 +1,76 @@ -<% @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="<%= get_profile_photo_url(:url_name => @admin_user.url_name) %>"> - <br> - <%= submit_tag "Clear photo" %> - <% end %> - </div> -<% end %> + <div class="user_photo_on_admin"> + <% form_tag "../clear_profile_photo/#{@admin_user.id}", :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"), "../show_bounce_message/#{@admin_user.id}"%> + <% end %> + <% else %> + <%=h admin_value(value)%> + <% end %> + <% if column_name == 'email_bounced_at' && !@admin_user.email_bounced_at.nil? %> + <% form_tag "../clear_bounce/#{@admin_user.id}", :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', user_path(@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', '../edit/' + @admin_user.id.to_s, :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)", "../login_as/#{@admin_user.id}", :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> @@ -66,9 +85,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 } %> |