Class: ProjectDecorator
- Inherits:
-
Draper::Decorator
- Object
- Draper::Decorator
- ProjectDecorator
- Includes:
- Draper::LazyHelpers
- Defined in:
- app/decorators/project_decorator.rb
Instance Method Summary collapse
- #display_expires_at ⇒ Object
- #display_goal ⇒ Object
- #display_image(version = 'project_thumb') ⇒ Object
- #display_pledged ⇒ Object
-
#display_progress ⇒ Object
Method for width of progress bars only.
- #display_status ⇒ Object
- #display_video_embed_url ⇒ Object
- #progress_bar ⇒ Object
- #remaining_days ⇒ Object
- #successful_flag ⇒ Object
Instance Method Details
#display_expires_at ⇒ Object
40 41 42 |
# File 'app/decorators/project_decorator.rb', line 40 def display_expires_at source.expires_at ? I18n.l(source.expires_at.to_date) : '' end |
#display_goal ⇒ Object
48 49 50 |
# File 'app/decorators/project_decorator.rb', line 48 def display_goal number_to_currency source.goal end |
#display_image(version = 'project_thumb') ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/decorators/project_decorator.rb', line 24 def display_image(version = 'project_thumb' ) if source.uploaded_image.present? source.uploaded_image.send(version).url elsif source.video_thumbnail.url.present? source.video_thumbnail.send(version).url elsif source.video source.video.thumbnail_large end end |
#display_pledged ⇒ Object
44 45 46 |
# File 'app/decorators/project_decorator.rb', line 44 def display_pledged number_to_currency source.pledged end |
#display_progress ⇒ Object
Method for width of progress bars only
18 19 20 21 22 |
# File 'app/decorators/project_decorator.rb', line 18 def display_progress return 100 if source.successful? || source.progress > 100 return 8 if source.progress > 0 and source.progress < 8 source.progress end |
#display_status ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/decorators/project_decorator.rb', line 9 def display_status if source.online? (source.reached_goal? ? 'reached_goal' : 'not_reached_goal') else source.state end end |
#display_video_embed_url ⇒ Object
34 35 36 37 38 |
# File 'app/decorators/project_decorator.rb', line 34 def if source. "#{source.}?title=0&byline=0&portrait=0&autoplay=0" end end |
#progress_bar ⇒ Object
52 53 54 55 56 57 |
# File 'app/decorators/project_decorator.rb', line 52 def width = source.progress > 100 ? 100 : source.progress content_tag(:div, id: :progress_wrapper) do content_tag(:div, nil, id: :progress, style: "width: #{width}%") end end |
#remaining_days ⇒ Object
5 6 7 |
# File 'app/decorators/project_decorator.rb', line 5 def remaining_days source.time_to_go[:time] end |
#successful_flag ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'app/decorators/project_decorator.rb', line 60 def successful_flag return nil unless source.successful? content_tag(:div, class: [:successful_flag]) do image_tag("channels/successful.png") end end |