Commit b49fa908dde6cfdb453296b5f62d6957001ba53b
Committed by
Rodrigo Souto
1 parent
bbcc0618
Exists in
master
and in
29 other branches
Adding bigger icons when displaying folders
Signed-off-by: Tallys Martins <tallysmartins@gmail.com> Signed-off-by: André Bernardes <andrebsguedes@gmail.com>
Showing
5 changed files
with
13 additions
and
10 deletions
Show diff stats
app/helpers/folder_helper.rb
@@ -42,15 +42,15 @@ module FolderHelper | @@ -42,15 +42,15 @@ module FolderHelper | ||
42 | 42 | ||
43 | def icon_for_article(article, size = 'icon') | 43 | def icon_for_article(article, size = 'icon') |
44 | article = FilePresenter.for article | 44 | article = FilePresenter.for article |
45 | - icon = article.respond_to?(:icon_name) ? | ||
46 | - article.icon_name : | ||
47 | - article.class.icon_name(article) | ||
48 | - if (icon =~ /\//) | ||
49 | - icon | 45 | + if article.respond_to?(:sized_icon) |
46 | + article.sized_icon(size) | ||
50 | else | 47 | else |
51 | - klasses = 'icon ' + [icon].flatten.map{|name| 'icon-'+name}.join(' ') | 48 | + icon = article.respond_to?(:icon_name) ? |
49 | + article.icon_name : | ||
50 | + article.class.icon_name(article) | ||
51 | + klasses = "#{size} " + [icon].flatten.map{|name| "#{size}-"+name}.join(' ') | ||
52 | if article.kind_of?(UploadedFile) || article.kind_of?(FilePresenter) | 52 | if article.kind_of?(UploadedFile) || article.kind_of?(FilePresenter) |
53 | - klasses += ' icon-upload-file' | 53 | + klasses += " #{size}-upload-file" |
54 | end | 54 | end |
55 | klasses | 55 | klasses |
56 | end | 56 | end |
app/presenters/image.rb
@@ -4,6 +4,10 @@ class FilePresenter::Image < FilePresenter | @@ -4,6 +4,10 @@ class FilePresenter::Image < FilePresenter | ||
4 | f.image? ? 10 : nil | 4 | f.image? ? 10 : nil |
5 | end | 5 | end |
6 | 6 | ||
7 | + def sized_icon(size) | ||
8 | + public_filename size | ||
9 | + end | ||
10 | + | ||
7 | def icon_name | 11 | def icon_name |
8 | public_filename :icon | 12 | public_filename :icon |
9 | end | 13 | end |
lib/short_filename.rb
@@ -9,7 +9,7 @@ module ShortFilename | @@ -9,7 +9,7 @@ module ShortFilename | ||
9 | def short_filename_upper_ext(filename, limit_chars = 43) | 9 | def short_filename_upper_ext(filename, limit_chars = 43) |
10 | extname = File.extname(filename) | 10 | extname = File.extname(filename) |
11 | display_name = shrink(File.basename(filename, extname), extname, limit_chars) | 11 | display_name = shrink(File.basename(filename, extname), extname, limit_chars) |
12 | - return display_name + " - " + extname.upcase.delete(".") if not extname.empty? else display_name | 12 | + return extname.present? ? (display_name + ' - ' + extname.upcase.delete(".")) : display_name |
13 | end | 13 | end |
14 | 14 | ||
15 | def shrink(filename, extname, limit_chars) | 15 | def shrink(filename, extname, limit_chars) |
3.24 KB
public/stylesheets/application.css
@@ -3910,7 +3910,6 @@ table.cms-articles .icon:hover { | @@ -3910,7 +3910,6 @@ table.cms-articles .icon:hover { | ||
3910 | 3910 | ||
3911 | div.folder-description { | 3911 | div.folder-description { |
3912 | padding-bottom: 15px; | 3912 | padding-bottom: 15px; |
3913 | - border-bottom: 1px solid #CCCCCC; | ||
3914 | } | 3913 | } |
3915 | 3914 | ||
3916 | .list-item h2{ | 3915 | .list-item h2{ |
@@ -3919,7 +3918,7 @@ div.folder-description { | @@ -3919,7 +3918,7 @@ div.folder-description { | ||
3919 | } | 3918 | } |
3920 | 3919 | ||
3921 | .item-info{ | 3920 | .item-info{ |
3922 | - border-bottom: 1px solid #ccc; | 3921 | + border-top: 1px solid #ccc; |
3923 | line-height: 25px; | 3922 | line-height: 25px; |
3924 | padding:25px 20px; | 3923 | padding:25px 20px; |
3925 | } | 3924 | } |