diff --git a/app/models/user.rb b/app/models/user.rb index 9635eaa4..abf476a2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index cad7c048..fcd17ca1 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -24,17 +24,22 @@
-
<%= link_to h(post.user), post.user %> +
+ <% 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? %>  <%= link_to steam_icon, steam_for(post.user) %> <% end %>
<%= rank_for(post.user) %>
- <%= 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 %>
-
<%=t :registered %>: <%= I18n.l(post.user.created_at, :format => :ed_month) %>
-
<%=t :posts %>: <%= post.user.posts_count %>
+ <% if current_user.show_user_detail %>
<%=t :registered %>: <%= I18n.l(post.user.created_at, :format => :ed_month) %>
+
<%=t :posts %>: <%= post.user.posts_count %>
<% end %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 8da2c36c..d9757d19 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -27,6 +27,8 @@

<%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones %>

<%= f.select :stylesheet, {"El Dorado" => "application", "Classic by roflmaoer" => "roflmaoer", "drdonutman" => "drdonutman"} %>

+

<%= f.check_box :show_avatar %>

+

<%= f.check_box :show_user_detail %>

<%= submit_tag I18n.t(:save_changes), :disable_with => I18n.t(:save_changes) %>  <%= link_to I18n.t(:delete), confirm_delete_user_path %>   diff --git a/db/migrate/20120706014156_add_post_display_options_to_users.rb b/db/migrate/20120706014156_add_post_display_options_to_users.rb new file mode 100644 index 00000000..9f68c7bf --- /dev/null +++ b/db/migrate/20120706014156_add_post_display_options_to_users.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index b9baee43..47024d03 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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"