Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

user_avatar_tag add timestamp option #639

Merged
merged 2 commits into from
May 12, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def user_avatar_tag(user, size = :normal, opts = {})

img =
if user.avatar?
image_tag(user.avatar.url(user_avatar_size_name_for_2x(size)), class: img_class)
image_url = user.avatar.url(user_avatar_size_name_for_2x(size))
image_url += "?t=#{user.updated_at.to_i}" if opts[:timestamp]
image_tag(image_url, class: img_class)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要测试

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

else
image_tag(user.letter_avatar_url(width * 2), class: img_class)
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/account/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<div class="sidebar col-md-3">
<div class="panel panel-default" style="text-align:center;">
<div class="panel-body">
<%= user_avatar_tag(@user, :large, link: false) %>
<%= user_avatar_tag(@user, :large, link: false, timestamp: true) %>
</div>
</div>
<div class="panel panel-default">
Expand Down