Sha256: bca57fa954ba964d5e829a8452586ef6a08f567387774657b2d8451ad5e913d1

Contents?: true

Size: 940 Bytes

Versions: 1

Compression:

Stored size: 940 Bytes

Contents

module RailsConnector

class WidgetRenderer < AbstractController::Base
  include AbstractController::Rendering
  include AbstractController::Helpers

  helper :cms, "rails_connector/widget"

  self.view_paths = [File.join('app', 'widgets')]

  def initialize(request)
    @_request = request
  end

  def show(widget, obj, widget_field_name, container)
    @widget = widget
    @obj = obj
    @widget_field_name = widget_field_name
    @container = container

    render_to_string "#{widget.obj_class.underscore}/views/show"
  end

  def thumbnail(widget_dir)
    begin
      render_to_string "#{widget_dir}/views/thumbnail"
    rescue ActionView::MissingTemplate => e
      view_context.widget_thumbnail(
        widget_dir.titleize,
        'thumbnail.html.erb does not existing. Please provide one.',
        view_context.image_tag('180x120.gif')
      )
    end
  end

  def request
    @_request
  end
end

end # module RailsConnector

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.9.1.3.22208381 lib/rails_connector/widget_renderer.rb