add option to show user avatars on stories and comments
just because
This commit is contained in:
parent
6734436e8c
commit
d286eab325
|
@ -527,9 +527,18 @@ li .domain {
|
||||||
}
|
}
|
||||||
|
|
||||||
li .byline {
|
li .byline {
|
||||||
|
margin-bottom: -5px;
|
||||||
color: #888;
|
color: #888;
|
||||||
font-size: 8.5pt;
|
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 {
|
li.story .byline {
|
||||||
margin-top: 1px;
|
margin-top: 1px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ private
|
||||||
:username, :email, :password, :password_confirmation, :about,
|
:username, :email, :password, :password_confirmation, :about,
|
||||||
:email_replies, :email_messages, :email_mentions,
|
:email_replies, :email_messages, :email_mentions,
|
||||||
:pushover_replies, :pushover_messages, :pushover_mentions,
|
:pushover_replies, :pushover_messages, :pushover_mentions,
|
||||||
:mailing_list_mode
|
:mailing_list_mode, :show_avatars
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -83,9 +83,9 @@ class User < ActiveRecord::Base
|
||||||
h
|
h
|
||||||
end
|
end
|
||||||
|
|
||||||
def avatar_url
|
def avatar_url(size = 100)
|
||||||
"https://secure.gravatar.com/avatar/" +
|
"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
|
end
|
||||||
|
|
||||||
def average_karma
|
def average_karma
|
||||||
|
|
|
@ -30,6 +30,10 @@ class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?
|
||||||
<span class="merge"></span>
|
<span class="merge"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if @user && @user.show_avatars? %>
|
||||||
|
<img src="<%= comment.user.avatar_url(16) %>" class="avatar">
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<a href="/u/<%= comment.user.username %>"
|
<a href="/u/<%= comment.user.username %>"
|
||||||
<% if !comment.user.is_active? %>
|
<% if !comment.user.is_active? %>
|
||||||
class="inactive_user"
|
class="inactive_user"
|
||||||
|
|
|
@ -170,6 +170,17 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="legend">
|
||||||
|
Miscellaneous Settings
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="boxline">
|
||||||
|
<%= f.label :show_avatars, "Show User Avatars:", :class => "required" %>
|
||||||
|
<%= f.check_box :show_avatars %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<%= f.submit "Save All Settings" %>
|
<%= f.submit "Save All Settings" %>
|
||||||
|
|
|
@ -54,7 +54,11 @@ class="story <%= story.vote && story.vote[:vote] == 1 ? "upvoted" : "" %>
|
||||||
ms.domain %></a>
|
ms.domain %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="byline">
|
<span class="byline">
|
||||||
by <a href="/u/<%= ms.user.username %>"
|
by
|
||||||
|
<% if @user && @user.show_avatars? %>
|
||||||
|
<img src="<%= ms.user.avatar_url(16) %>" class="avatar">
|
||||||
|
<% end %>
|
||||||
|
<a href="/u/<%= ms.user.username %>"
|
||||||
<% if ms.user.is_new? %>
|
<% if ms.user.is_new? %>
|
||||||
class="new_user"
|
class="new_user"
|
||||||
<% end %>><%= ms.user.username %></a>
|
<% end %>><%= ms.user.username %></a>
|
||||||
|
@ -67,10 +71,18 @@ class="story <%= story.vote && story.vote[:vote] == 1 ? "upvoted" : "" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="byline">
|
<div class="byline">
|
||||||
<% if story.previewing %>
|
<% if story.previewing %>
|
||||||
by <a><%= story.user.username %></a>
|
by
|
||||||
|
<% if @user && @user.show_avatars? %>
|
||||||
|
<img src="<%= story.user.avatar_url(16) %>" class="avatar">
|
||||||
|
<% end %>
|
||||||
|
<a><%= story.user.username %></a>
|
||||||
just now
|
just now
|
||||||
<% else %>
|
<% else %>
|
||||||
by <a href="/u/<%= story.user.username %>"
|
<% if @user && @user.show_avatars? %>
|
||||||
|
<img src="<%= story.user.avatar_url(16) %>" class="avatar">
|
||||||
|
<% end %>
|
||||||
|
by
|
||||||
|
<a href="/u/<%= story.user.username %>"
|
||||||
<% if story.user.is_new? %>
|
<% if story.user.is_new? %>
|
||||||
class="new_user"
|
class="new_user"
|
||||||
<% end %>><%= story.user.username %></a>
|
<% end %>><%= story.user.username %></a>
|
||||||
|
|
5
db/migrate/20150313040930_add_user_avatar_pref.rb
Normal file
5
db/migrate/20150313040930_add_user_avatar_pref.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class AddUserAvatarPref < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :show_avatars, :boolean, :default => false
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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|
|
create_table "comments", force: true do |t|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
@ -186,6 +186,7 @@ ActiveRecord::Schema.define(version: 20150211170052) do
|
||||||
t.integer "banned_by_user_id"
|
t.integer "banned_by_user_id"
|
||||||
t.string "banned_reason", limit: 200
|
t.string "banned_reason", limit: 200
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
|
t.boolean "show_avatars", default: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["mailing_list_mode"], name: "mailing_list_enabled", using: :btree
|
add_index "users", ["mailing_list_mode"], name: "mailing_list_enabled", using: :btree
|
||||||
|
|
Loading…
Reference in a new issue