Commit 966b65004e85a47af52f76c29866782eccd68ed5
1 parent
801b04e3
Exists in
master
and in
28 other branches
Allow themes to override profile default images
(ActionItem1627)
Showing
29 changed files
with
17 additions
and
6 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -406,14 +406,20 @@ module ApplicationHelper | @@ -406,14 +406,20 @@ module ApplicationHelper | ||
| 406 | if profile.image | 406 | if profile.image |
| 407 | profile.image.public_filename( size ) | 407 | profile.image.public_filename( size ) |
| 408 | else | 408 | else |
| 409 | - if profile.organization? | ||
| 410 | - if profile.kind_of?(Community) | ||
| 411 | - '/images/icons-app/users_size-'+ size.to_s() +'.png' | 409 | + icon = |
| 410 | + if profile.organization? | ||
| 411 | + if profile.kind_of?(Community) | ||
| 412 | + '/images/icons-app/community-'+ size.to_s() +'.png' | ||
| 413 | + else | ||
| 414 | + '/images/icons-app/enterprise-'+ size.to_s() +'.png' | ||
| 415 | + end | ||
| 412 | else | 416 | else |
| 413 | - '/images/icons-app/enterprise-default-pic-'+ size.to_s() +'.png' | 417 | + '/images/icons-app/person-'+ size.to_s() +'.png' |
| 414 | end | 418 | end |
| 419 | + if File.exists?(File.join(Rails.root, 'public', theme_path, icon)) | ||
| 420 | + theme_path + icon | ||
| 415 | else | 421 | else |
| 416 | - '/images/icons-app/user_icon_size-'+ size.to_s() +'.png' | 422 | + icon |
| 417 | end | 423 | end |
| 418 | end | 424 | end |
| 419 | 425 |
app/models/comment.rb
| @@ -44,7 +44,7 @@ class Comment < ActiveRecord::Base | @@ -44,7 +44,7 @@ class Comment < ActiveRecord::Base | ||
| 44 | end | 44 | end |
| 45 | 45 | ||
| 46 | def removed_user_image | 46 | def removed_user_image |
| 47 | - '/images/icons-app/user_icon_size-minor.png' | 47 | + '/images/icons-app/person-minor.png' |
| 48 | end | 48 | end |
| 49 | 49 | ||
| 50 | def anchor | 50 | def anchor |
15.2 KB
3.9 KB
5.47 KB
10 KB
24.5 KB
public/images/icons-app/enterprise-default-pic-big.png
24.5 KB
public/images/icons-app/enterprise-default-pic-minor.png
5.19 KB
public/images/icons-app/enterprise-default-pic-portrait.png
7.56 KB
public/images/icons-app/enterprise-default-pic-thumb.png
14 KB
5.19 KB
7.56 KB
14 KB
9.65 KB
979 Bytes
2.5 KB
3.68 KB
5.91 KB
public/images/icons-app/user_icon_size-big.png
9.65 KB
public/images/icons-app/user_icon_size-icon.png
979 Bytes
public/images/icons-app/user_icon_size-minor.png
2.5 KB
public/images/icons-app/user_icon_size-portrait.png
3.68 KB
public/images/icons-app/user_icon_size-thumb.png
5.91 KB
public/images/icons-app/users_size-big.png
15.2 KB
public/images/icons-app/users_size-minor.png
3.9 KB
public/images/icons-app/users_size-portrait.png
5.47 KB
public/images/icons-app/users_size-thumb.png
10 KB
test/unit/comment_test.rb
| @@ -209,4 +209,9 @@ class CommentTest < Test::Unit::TestCase | @@ -209,4 +209,9 @@ class CommentTest < Test::Unit::TestCase | ||
| 209 | assert_no_match /[<>]/, comment.name | 209 | assert_no_match /[<>]/, comment.name |
| 210 | end | 210 | end |
| 211 | 211 | ||
| 212 | + should 'use an existing image for deleted comments' do | ||
| 213 | + image = Comment.new.removed_user_image | ||
| 214 | + assert File.exists?(File.join(Rails.root, 'public', image)), "#{image} does not exist." | ||
| 215 | + end | ||
| 216 | + | ||
| 212 | end | 217 | end |