Skip to content

Commit ab9153c

Browse files
committed
bordered & striped table
1 parent 5cd7cf2 commit ab9153c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/bootstrap-helper/builders/table.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def render(options, &proc)
1818
end
1919

2020
def wrapper(options ,buffer)
21-
content_tag :table,buffer,class: 'table'
21+
table_class = ['table']
22+
table_class << "table-striped" if options[:striped]
23+
table_class << "table-bordered" if options[:border]
24+
content_tag :table, buffer, class: table_class
2225
end
2326

2427
def ths(*heads)

lib/bootstrap-helper/helpers/table.rb

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ def bt_table(collection , options = {},&proc)
66
::BootstrapHelper::Builders::Table.new(self,collection,options,&proc)
77
end
88

9+
def bt_bordered_table(collection , options = {},&proc)
10+
bt_table(collection , options.merge(border:true),&proc)
11+
end
12+
13+
def bt_bordered_striped_table(collection , options = {},&proc)
14+
bt_table(collection , options.merge(border:true,striped: true),&proc)
15+
end
916
end
1017
end
1118
end

0 commit comments

Comments
 (0)