Sha256: fd1cf0619ed0166190520f13ae03afeaba0109a16fea86269cdf44aa45bbeb7f

Contents?: true

Size: 436 Bytes

Versions: 7

Compression:

Stored size: 436 Bytes

Contents

module Trestle
  class Tab
    include ActionView::Helpers::TagHelper

    attr_reader :name, :options

    def initialize(name, options={})
      @name, @options = name, options
    end

    def label
      safe_join([options[:label] || I18n.t("admin.tabs.#{name}", default: name.to_s.titleize), badge].compact, " ")
    end

    def badge
      content_tag(:span, options[:badge], class: "badge") if options[:badge]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trestle-0.8.7 lib/trestle/tab.rb
trestle-0.8.6 lib/trestle/tab.rb
trestle-0.8.5 lib/trestle/tab.rb
trestle-0.8.4 lib/trestle/tab.rb
trestle-0.8.3 lib/trestle/tab.rb
trestle-0.8.2 lib/trestle/tab.rb
trestle-0.8.0 lib/trestle/tab.rb