Sha256: 8db23197ccb5f638822c1935a6f968a687e529663b38d250dd1366958c8dd047

Contents?: true

Size: 725 Bytes

Versions: 7

Compression:

Stored size: 725 Bytes

Contents

module TypeStation
  class ContentPresenter < BasePresenter
    presents :content

    def tag(default, options = {})
      css_class = options.delete(:class) if options.include?(:class)
      cl_image_tag((value.present? ? value['identifier'] : default), options.merge({class: ['ts-editable-image-tag', css_class], data: options}))
    end

    def link(default, html_options = nil, &block)
      css_class = html_options.delete(:class) if html_options.include?(:class)
      content_tag(:a, nil, html_options.merge({class: ['ts-editable-link-tag', css_class], href: (value.present? ? cloudinary_url(value['identifier'], format: value['format']) : default)}), &block)
    end

    def value
      content
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
type_station-0.3.2 app/presenters/type_station/content_presenter.rb
type_station-0.3.1 app/presenters/type_station/content_presenter.rb
type_station-0.3.0 app/presenters/type_station/content_presenter.rb
type_station-0.2.3 app/presenters/type_station/content_presenter.rb
type_station-0.2.2 app/presenters/type_station/content_presenter.rb
type_station-0.2.1 app/presenters/type_station/content_presenter.rb
type_station-0.2.0 app/presenters/type_station/content_presenter.rb