ManageIQ/manageiq-ui-classic

View on GitHub
app/presenters/tree_node/custom_button_set.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
90%
module TreeNode
  class CustomButtonSet < Node
    set_attribute(:text) do
      case @tree
      when TreeBuilderCatalogItems, TreeBuilderGenericObjectDefinition
        _("%{button_group_name} (Group)") % {:button_group_name => @object.name.split("|").first}
      else
        @object.name.split("|").first
      end
    end

    set_attribute(:tooltip) do
      if @object.description
        _("Button Group: %{button_group_description}") % {:button_group_description => @object.description}
      else
        @object.name.split("|").first
      end
    end

    set_attribute(:color) { @object.set_data.try(:[], :button_color) }
  end
end