for admins, show some private info about users in user profiles
This commit is contained in:
parent
976eb522e8
commit
fd00205625
|
@ -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() */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Vote < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :story
|
||||
belongs_to :comment
|
||||
|
||||
COMMENT_REASONS = {
|
||||
"O" => "Off-topic",
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<% if @showing_user.is_active? %>
|
||||
<label class="required">About:</label>
|
||||
|
||||
<div id="user_about" class="shorten_first_p">
|
||||
<div class="d shorten_first_p">
|
||||
<% if @showing_user.about.present? %>
|
||||
<%= raw @showing_user.linkified_about %>
|
||||
<% else %>
|
||||
|
@ -117,4 +117,54 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @user && @user.is_admin? && !@showing_user.is_moderator? %>
|
||||
<div style="clear: both;"></div>
|
||||
<br>
|
||||
|
||||
<p>
|
||||
<div class="legend">
|
||||
Administrative Information
|
||||
</div>
|
||||
</p>
|
||||
|
||||
<label class="required">E-Mail:</label>
|
||||
<span class="d">
|
||||
<%= @showing_user.email %>
|
||||
</span>
|
||||
<br>
|
||||
|
||||
<label class="required">Recent Votes:</label>
|
||||
<div class="d shorten_first_p">
|
||||
<% @showing_user.votes_for_others.limit(10).each do |v| %>
|
||||
<p>
|
||||
<% 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 %>
|
||||
<a href="<%= v.comment.short_id_url %>">comment</a>
|
||||
by
|
||||
<a href="/u/<%= v.comment.user.try(:username) %>"><%=
|
||||
v.comment.user.try(:username) %></a>
|
||||
on
|
||||
<a href="<%= v.story.short_id_url %>"><%= v.story.title %></a>
|
||||
<% elsif v.story_id && !v.comment_id %>
|
||||
<a href="<%= v.story.short_id_url %>"><%= v.story.title %></a>
|
||||
by
|
||||
<a href="/u/<%= v.story.user.try(:username) %>"><%=
|
||||
v.story.user.try(:username) %></a>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<br>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue