diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 5588314..13da21e 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -337,10 +337,6 @@ div#footer a { /* other specifics */ -div#user_about { - margin-left: 12em; -} - div#gravatar { border: 2px solid #fff; border-radius: 100% 100%; @@ -945,8 +941,7 @@ table.data td p:last-child { .box label, .box span, .box select, -.box br, -.box div.d { +.box br { line-height: 2em; } .box br { @@ -971,6 +966,9 @@ table.data td p:last-child { line-height: 2em; vertical-align: middle; } +.box div.d { + margin-left: 7em; +} .box input.normal, .box label.normal { @@ -981,7 +979,8 @@ table.data td p:last-child { .box span.d label, .box td label, -.box .legend label { +.box .legend label, +.box div.d label { display: inline; float: none; vertical-align: baseline; @@ -1016,7 +1015,9 @@ table.data td p:last-child { .box.wide .hintblock { margin-left: 12em; } - +.box.wide div.d { + margin-left: 12em; +} /* for flash_notices() and flash_errors() */ diff --git a/app/models/user.rb b/app/models/user.rb index e1fe79a..344b3f2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -262,4 +262,11 @@ class User < ActiveRecord::Base Message.where("recipient_user_id = ? AND (has_been_read = ? AND " << "deleted_by_recipient = ?)", self.id, false, false).count) end + + def votes_for_others + self.votes.joins(:story, :comment). + where("comments.user_id <> votes.user_id AND " << + "stories.user_id <> votes.user_id"). + order("id DESC") + end end diff --git a/app/models/vote.rb b/app/models/vote.rb index 9ee1a60..4e78e74 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -1,6 +1,7 @@ class Vote < ActiveRecord::Base belongs_to :user belongs_to :story + belongs_to :comment COMMENT_REASONS = { "O" => "Off-topic", diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index e15d5d8..732ae43 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -109,7 +109,7 @@ <% if @showing_user.is_active? %> -
+
<% if @showing_user.about.present? %> <%= raw @showing_user.linkified_about %> <% else %> @@ -117,4 +117,54 @@ <% end %>
<% end %> + + <% if @user && @user.is_admin? && !@showing_user.is_moderator? %> +
+
+ +

+

+ Administrative Information +
+

+ + + + <%= @showing_user.email %> + +
+ + +
+ <% @showing_user.votes_for_others.limit(10).each do |v| %> +

+ <% if v.vote == 1 %> + +1 + <% else %> + <%= v.vote %> + <% if v.comment_id %> + (<%= Vote::COMMENT_REASONS[v.reason] %>) + <% else %> + (<%= Vote::STORY_REASONS[v.reason] %>) + <% end %> + <% end %> + on + <% if v.comment_id %> + comment + by + <%= + v.comment.user.try(:username) %> + on + <%= v.story.title %> + <% elsif v.story_id && !v.comment_id %> + <%= v.story.title %> + by + <%= + v.story.user.try(:username) %> + <% end %> +

+ <% end %> +
+
+ <% end %>