Skip to content

Commit

Permalink
removed name from headaer
Browse files Browse the repository at this point in the history
  • Loading branch information
tsonntag committed Mar 14, 2012
1 parent 1cb965e commit 0430a85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/gitter/column.rb
Expand Up @@ -23,10 +23,10 @@ def initialize grid, name, opts = {}, &block
content = header_opt
h_opts = {}
end
Header.new grid, name, content, h_opts.merge(:column => self)
Header.new grid, content, h_opts.merge(:column => self)
end
else
@headers = [Header.new(grid, name, nil, opts.merge(:column => self))]
@headers = [Header.new(grid, name, opts.merge(:column => self))]
end
end

Expand Down
11 changes: 8 additions & 3 deletions lib/gitter/header.rb
Expand Up @@ -5,20 +5,21 @@ def self.blank
new :blank, false
end

attr_reader :grid, :name, :content, :html_options, :column
attr_reader :grid, :content, :html_options, :column

def initialize grid, *args
opts = args.extract_options!
raise ArgumentError, 'too many arguments' if args.size > 1
@grid = grid
@name, @content = *args
@content = args.first
@column = opts.delete(:column){nil}
@html_options = opts
end

def label
@label ||= case content
when false then ''
when nil then grid.translate(:headers, name)
when Symbol then grid.translate(:headers, name)
else content
end
end
Expand All @@ -31,6 +32,10 @@ def link *args
end
end

def name
@name ||= Symbol === content ? content : 'n/a'
end

def to_s
"Header(#{name},html_options=#{html_options},#{column ? ',col':''},label=#{label})"
end
Expand Down

0 comments on commit 0430a85

Please sign in to comment.