diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 13da21e..aab52fe 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -527,9 +527,18 @@ li .domain { } li .byline { + margin-bottom: -5px; color: #888; font-size: 8.5pt; } +li .byline img.avatar { + border-radius: 8px; + height: 16px; + margin-bottom: 2px; + margin-right: 2px; + vertical-align: middle; + width: 16px; +} li.story .byline { margin-top: 1px; } diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index ab4fc32..ff0faba 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -81,7 +81,7 @@ private :username, :email, :password, :password_confirmation, :about, :email_replies, :email_messages, :email_mentions, :pushover_replies, :pushover_messages, :pushover_mentions, - :mailing_list_mode + :mailing_list_mode, :show_avatars ) end end diff --git a/app/models/user.rb b/app/models/user.rb index 344b3f2..fcb08fd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -83,9 +83,9 @@ class User < ActiveRecord::Base h end - def avatar_url + def avatar_url(size = 100) "https://secure.gravatar.com/avatar/" + - Digest::MD5.hexdigest(self.email.strip.downcase) + "?r=pg&d=mm&s=100" + Digest::MD5.hexdigest(self.email.strip.downcase) + "?r=pg&d=mm&s=#{size}" end def average_karma diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 31b7207..80fb2cb 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -30,6 +30,10 @@ class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ? <% end %> + <% if @user && @user.show_avatars? %> + + <% end %> + class="inactive_user" diff --git a/app/views/settings/index.html.erb b/app/views/settings/index.html.erb index 9bb0f70..13b44c6 100644 --- a/app/views/settings/index.html.erb +++ b/app/views/settings/index.html.erb @@ -170,6 +170,17 @@ +
+ +
+ Miscellaneous Settings +
+ +
+ <%= f.label :show_avatars, "Show User Avatars:", :class => "required" %> + <%= f.check_box :show_avatars %> +
+
<%= f.submit "Save All Settings" %> diff --git a/app/views/stories/_listdetail.html.erb b/app/views/stories/_listdetail.html.erb index 0eb4f89..406db77 100644 --- a/app/views/stories/_listdetail.html.erb +++ b/app/views/stories/_listdetail.html.erb @@ -54,7 +54,11 @@ class="story <%= story.vote && story.vote[:vote] == 1 ? "upvoted" : "" %> ms.domain %>
<% end %> - by + + <% end %> + class="new_user" <% end %>><%= ms.user.username %> @@ -67,10 +71,18 @@ class="story <%= story.vote && story.vote[:vote] == 1 ? "upvoted" : "" %> <% end %>
<% if story.previewing %> - by <%= story.user.username %> + by + <% if @user && @user.show_avatars? %> + + <% end %> + <%= story.user.username %> just now <% else %> - by + + <% end %> + by + class="new_user" <% end %>><%= story.user.username %> diff --git a/db/migrate/20150313040930_add_user_avatar_pref.rb b/db/migrate/20150313040930_add_user_avatar_pref.rb new file mode 100644 index 0000000..daac114 --- /dev/null +++ b/db/migrate/20150313040930_add_user_avatar_pref.rb @@ -0,0 +1,5 @@ +class AddUserAvatarPref < ActiveRecord::Migration + def change + add_column :users, :show_avatars, :boolean, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 544a8e0..c3a4880 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150211170052) do +ActiveRecord::Schema.define(version: 20150313040930) do create_table "comments", force: true do |t| t.datetime "created_at", null: false @@ -186,6 +186,7 @@ ActiveRecord::Schema.define(version: 20150211170052) do t.integer "banned_by_user_id" t.string "banned_reason", limit: 200 t.datetime "deleted_at" + t.boolean "show_avatars", default: false end add_index "users", ["mailing_list_mode"], name: "mailing_list_enabled", using: :btree