Commit
5cf344ebad5fa578e5e77abd5a58751f54802a2f
Exists in
master
and in
29 other branches
add_member_task_reject_details, admin_visible_profile, article-list-template, community_notifications, contact_admin_translation, event_fixes, fix_comments_pagination, fix_rails4_organization_ratings, fix_sign_up_form, follow_step_fix, forum_topic_creation, mirror_block_improvements, multi_env_on_remote_user, new_security, noosfero_spb_ci, organization_ratings_improvements, organization_ratings_link_to_profile_stable-spb-1.3, organization_ratings_translations_fix, profile_api_improvements, ratings_minor_fixes, remote_user_fix, send_email_to_admins, stable-spb-1.3, stable-spb-1.3-fixes, stable-spb-1.4, stable-spb-1.5, suggest_rejected_value, web_steps_improvements, xss_terminate_custom_options
Moving presenters to app/presenters folder
|
| @@ -0,0 +1,11 @@ |
| @@ -0,0 +1,11 @@ |
|
| |
1
| +# Made to encapsulate any UploadedFile |
|
| |
2
| +class FilePresenter::Generic < FilePresenter |
|
| |
3
| + def initialize(f) |
|
| |
4
| + @file = f |
|
| |
5
| + end |
|
| |
6
| + |
|
| |
7
| + # if returns low priority, because it is generic. |
|
| |
8
| + def self.accepts?(f) |
|
| |
9
| + 1 if f.is_a? UploadedFile |
|
| |
10
| + end |
|
| |
11
| +end |
|
| @@ -0,0 +1,18 @@ |
| @@ -0,0 +1,18 @@ |
|
| |
1
| +class FilePresenter::Image < FilePresenter |
|
| |
2
| + def initialize(f) |
|
| |
3
| + @file = f |
|
| |
4
| + end |
|
| |
5
| + |
|
| |
6
| + def self.accepts?(f) |
|
| |
7
| + return nil unless f.respond_to? :image? |
|
| |
8
| + f.image? ? 10 : nil |
|
| |
9
| + end |
|
| |
10
| + |
|
| |
11
| + def icon_name |
|
| |
12
| + public_filename :icon |
|
| |
13
| + end |
|
| |
14
| + |
|
| |
15
| + def short_description |
|
| |
16
| + _('Image (%s)') % content_type.split('/')[1].upcase |
|
| |
17
| + end |
|
| |
18
| +end |
|
| @@ -1,11 +0,0 @@ |
| @@ -1,11 +0,0 @@ |
|
1
| -# Made to encapsulate any UploadedFile |
| |
|
2
| -class FilePresenter::Generic < FilePresenter |
| |
|
3
| - def initialize(f) |
| |
|
4
| - @file = f |
| |
|
5
| - end |
| |
|
6
| - |
| |
|
7
| - # if returns low priority, because it is generic. |
| |
|
8
| - def self.accepts?(f) |
| |
|
9
| - 1 if f.is_a? UploadedFile |
| |
|
10
| - end |
| |
|
11
| -end |
| |
|
| @@ -1,18 +0,0 @@ |
| @@ -1,18 +0,0 @@ |
|
1
| -class FilePresenter::Image < FilePresenter |
| |
|
2
| - def initialize(f) |
| |
|
3
| - @file = f |
| |
|
4
| - end |
| |
|
5
| - |
| |
|
6
| - def self.accepts?(f) |
| |
|
7
| - return nil unless f.respond_to? :image? |
| |
|
8
| - f.image? ? 10 : nil |
| |
|
9
| - end |
| |
|
10
| - |
| |
|
11
| - def icon_name |
| |
|
12
| - public_filename :icon |
| |
|
13
| - end |
| |
|
14
| - |
| |
|
15
| - def short_description |
| |
|
16
| - _('Image (%s)') % content_type.split('/')[1].upcase |
| |
|
17
| - end |
| |
|
18
| -end |
| |