lib/active_admin/views/title_bar.rb in activeadmin-0.6.6 vs lib/active_admin/views/title_bar.rb in activeadmin-1.0.0.pre1

- old
+ new

@@ -1,48 +1,50 @@ module ActiveAdmin module Views class TitleBar < Component def build(title, action_items) - super(:id => "title_bar") + super(id: "title_bar") @title = title @action_items = action_items build_titlebar_left build_titlebar_right end private def build_titlebar_left - div :id => "titlebar_left" do + div id: "titlebar_left" do build_breadcrumb build_title_tag end end def build_titlebar_right - div :id => "titlebar_right" do + div id: "titlebar_right" do build_action_items end end def build_breadcrumb(separator = "/") - links = if active_admin_config && active_admin_config.breadcrumb.present? + breadcrumb_config = active_admin_config && active_admin_config.breadcrumb + + links = if breadcrumb_config.is_a?(Proc) instance_exec(controller, &active_admin_config.breadcrumb) - else + elsif breadcrumb_config.present? breadcrumb_links end return unless links.present? && links.is_a?(::Array) - span :class => "breadcrumb" do + span class: "breadcrumb" do links.each do |link| text_node link - span(separator, :class => "breadcrumb_sep") + span(separator, class: "breadcrumb_sep") end end end def build_title_tag - h2(@title, :id => 'page_title') + h2(@title, id: 'page_title') end def build_action_items insert_tag(view_factory.action_items, @action_items) if @action_items.any? end