Sha256: 848a6127ac0483362ffaf189ce0703c1581c10ba1429c233544221c723aa284d

Contents?: true

Size: 1.65 KB

Versions: 11

Compression:

Stored size: 1.65 KB

Contents

##
# Provides specific helper methods to render content blocks and connectors.
# Split off from Cms::ApplicationController so it can be included in Cms::Acts::ContentPage
#
module Cms
  module RenderingHelper
    def render_connector_and_connectable(connector, connectable)
      if logged_in? && @mode == "edit" && current_user.able_to_edit?(connector.page)
        render :partial => 'cms/pages/edit_connector',
               :locals => { :connector => connector, :connectable => connectable}
      else
        render_connectable(connectable)
      end
    end

    def render_connectable(content_block)
      if content_block
        if content_block.class.renderable?
          logger.info "..... Rendering connectable #{content_block.class} ##{content_block.id} #{"v#{content_block.version}" if content_block.respond_to?(:version)}"
          content_block.perform_render(@controller)
        else
          logger.warn "Connectable #{content_block.class} ##{content_block.id} is not renderable"
        end
      else
        logger.warn "Connectable is null"
      end
    rescue Exception => e
      logger.error "Error occurred while rendering #{content_block.class}##{content_block.id}: #{e.message}\n#{e.backtrace.join("\n")}"
      "ERROR: #{e.message}"
    end

    ##
    # Renders the toolbar for the CMS. All page templates need to include this or they won't be editable.
    # Typically rendered as an iframe to avoid CSS/JS conflicts.
    #
    # @param [Symbol] tab Which tab of the dashboard to highlight. Defaults to :dashboard.
    #
    def render_cms_toolbar(tab=:dashboard)
      render :partial => 'layouts/cms_toolbar', :locals => {:tab => tab}
    end
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
browsercms-3.1.5 app/helpers/cms/rendering_helper.rb
browsercms-3.1.4 app/helpers/cms/rendering_helper.rb
browsercms-3.1.3 app/helpers/cms/rendering_helper.rb
drujensen-browsercms-3.2.0 app/helpers/cms/rendering_helper.rb
browsercmsi-3.1.2 app/helpers/cms/rendering_helper.rb
browsercms-3.1.2 app/helpers/cms/rendering_helper.rb
browsercms-3.1.1 app/helpers/cms/rendering_helper.rb
browsercmsi-3.1.1 app/helpers/cms/rendering_helper.rb
browsercmsi-3.1.0 app/helpers/cms/rendering_helper.rb
browsercms-3.1.0 app/helpers/cms/rendering_helper.rb
we5-browsercms-3.1.0 app/helpers/cms/rendering_helper.rb