Class: Georgia::MediaLibraryPresenter
- Inherits:
-
Object
- Object
- Georgia::MediaLibraryPresenter
- Defined in:
- app/presenters/georgia/media_library_presenter.rb
Instance Attribute Summary collapse
-
#view_context ⇒ Object
Returns the value of attribute view_context.
Instance Method Summary collapse
- #choose_image_button_tag ⇒ Object
- #image ⇒ Object
- #image_id ⇒ Object
- #image_input_tag ⇒ Object
-
#initialize(view_context, imageable, args = {}) ⇒ MediaLibraryPresenter
constructor
A new instance of MediaLibraryPresenter.
- #media_featured_tag ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(view_context, imageable, args = {}) ⇒ MediaLibraryPresenter
Returns a new instance of MediaLibraryPresenter.
8 9 10 11 12 13 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 8 def initialize view_context, imageable, args={} @view_context = view_context @imageable = imageable @target = args.fetch(:target, 'media_library_image') @input = args.fetch(:input, image_input_tag) end |
Instance Attribute Details
#view_context ⇒ Object
Returns the value of attribute view_context.
4 5 6 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 4 def view_context @view_context end |
Instance Method Details
#choose_image_button_tag ⇒ Object
21 22 23 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 21 def link_to("#{icon_tag('picture-o')} Choose Image".html_safe, '#', class: 'btn btn-primary js-media-library', data: {media: "##{@target}", toggle: 'modal', target: '#media_library'}) end |
#image ⇒ Object
35 36 37 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 35 def image @imageable.image end |
#image_id ⇒ Object
39 40 41 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 39 def image_id @imageable.image_id end |
#image_input_tag ⇒ Object
31 32 33 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 31 def image_input_tag hidden_field_tag(:image, image_id) end |
#media_featured_tag ⇒ Object
25 26 27 28 29 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 25 def media_featured_tag content_tag :div, class: 'media-featured js-media-image' do picture_tag(image, format: :thumb) end end |
#to_s ⇒ Object
15 16 17 18 19 |
# File 'app/presenters/georgia/media_library_presenter.rb', line 15 def to_s content_tag(:div, class: 'media-library-image', id: @target) do media_featured_tag + + @input end end |