Module | Cms::RenderingHelper |
In: |
app/helpers/cms/rendering_helper.rb
|
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.
# File app/helpers/cms/rendering_helper.rb, line 38 38: def render_cms_toolbar(tab=:dashboard) 39: render :partial => 'layouts/cms_toolbar', :locals => {:tab => tab} 40: end
# File app/helpers/cms/rendering_helper.rb, line 16 16: def render_connectable(content_block) 17: if content_block 18: if content_block.class.renderable? 19: logger.info "..... Rendering connectable #{content_block.class} ##{content_block.id} #{"v#{content_block.version}" if content_block.respond_to?(:version)}" 20: content_block.perform_render(@controller) 21: else 22: logger.warn "Connectable #{content_block.class} ##{content_block.id} is not renderable" 23: end 24: else 25: logger.warn "Connectable is null" 26: end 27: rescue Exception => e 28: logger.error "Error occurred while rendering #{content_block.class}##{content_block.id}: #{e.message}\n#{e.backtrace.join("\n")}" 29: "ERROR: #{e.message}" 30: end
# File app/helpers/cms/rendering_helper.rb, line 7 7: def render_connector_and_connectable(connector, connectable) 8: if logged_in? && @mode == "edit" && current_user.able_to_edit?(connector.page) 9: render :partial => 'cms/pages/edit_connector', 10: :locals => { :connector => connector, :connectable => connectable} 11: else 12: render_connectable(connectable) 13: end 14: end