Permalink
Browse files

Added option to hide avatars and extra post information

  • Loading branch information...
1 parent a733c4e commit d2db04b74fda1be5adeaf531a4d90fe89c17cbb4 @themichaellai themichaellai committed Jul 6, 2012
View
@@ -1,7 +1,7 @@
require 'digest/sha1'
class User < ActiveRecord::Base
- attr_accessible :login, :email, :password, :password_confirmation, :avatar, :signature, :bio, :time_zone, :ban_message, :banned_until, :stylesheet
+ attr_accessible :login, :email, :password, :password_confirmation, :avatar, :signature, :bio, :time_zone, :ban_message, :banned_until, :stylesheet, :show_avatar, :show_user_detail
attr_reader :password
has_many :articles, :dependent => :destroy, :order => 'created_at desc'
@@ -104,6 +104,8 @@ def self.encrypt(password)
def set_defaults
self.profile_updated_at = self.all_viewed_at = Time.now.utc
self.time_zone = Setting.find(:first).time_zone
+ self.show_avatar = true
+ self.show_user_detail = true
end
def make_admin_if_first_user
@@ -24,17 +24,22 @@
<tr>
<td class="profile">
<dl>
- <dt><%= link_to h(post.user), post.user %>
+ <dt>
+ <% if current_user.show_user_detail %>
+ <%= link_to h(post.user), post.user %>
+ <% else %>
+ <%= link_to h(post.user), post.user, {:title => "Posts: %s" % [post.user.posts_count]} %>
+ <% end %>
<% if !post.user.steamid.blank? %>
&nbsp;<%= link_to steam_icon, steam_for(post.user) %>
<% end %>
</dt>
<dd class="rank"><%= rank_for(post.user) %></dd>
<dd class="avatar">
- <%= link_to avatar_for(post.user), post.user unless post.user.avatar.nil? %>
+ <%= link_to avatar_for(post.user), post.user unless post.user.avatar.nil? or not current_user.show_avatar %>
</dd>
- <dd><%=t :registered %>: <%= I18n.l(post.user.created_at, :format => :ed_month) %></dd>
- <dd><%=t :posts %>: <%= post.user.posts_count %></dd>
+ <% if current_user.show_user_detail %><dd><%=t :registered %>: <%= I18n.l(post.user.created_at, :format => :ed_month) %></dd>
+ <dd><%=t :posts %>: <%= post.user.posts_count %></dd><% end %>
</dl>
</td>
<td class="body">
@@ -27,6 +27,8 @@
<p><%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %></p>
<p class="label"><label for="user_stylesheet">Stylesheet</label></p>
<p><%= f.select :stylesheet, {"El Dorado" => "application", "Classic by roflmaoer" => "roflmaoer", "drdonutman" => "drdonutman"} %></p>
+ <p><%= f.check_box :show_avatar %> <label for="show_avatar">Show Avatars</label></p>
+ <p><%= f.check_box :show_user_detail %> <label for="show_user_detail">Show User Detail On Posts</label></p>
<p>
<%= submit_tag I18n.t(:save_changes), :disable_with => I18n.t(:save_changes) %>&nbsp;
<%= link_to I18n.t(:delete), confirm_delete_user_path %> &nbsp;
@@ -0,0 +1,6 @@
+class AddPostDisplayOptionsToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :show_avatar, :boolean, :default => true
+ add_column :users, :show_user_detail, :boolean, :default => true
+ end
+end
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120531043037) do
+ActiveRecord::Schema.define(:version => 20120706014156) do
create_table "articles", :force => true do |t|
t.integer "user_id"
@@ -240,6 +240,8 @@
t.datetime "all_viewed_at"
t.string "steamid"
t.string "stylesheet", :default => "application"
+ t.boolean "show_avatar", :default => true
+ t.boolean "show_user_detail", :default => true
end
add_index "users", ["chatting_at"], :name => "index_users_on_chatting_at"

0 comments on commit d2db04b

Please sign in to comment.