bootstrap_helper 4.2.2.1 → 4.2.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ * add ibutton feature
2
+ * Releaase 3.2.2.0 & 4.2.2.0
1
3
  * 2.1.2.1 add if defined?(SimpleForm)
2
4
  * 2.1.2 fix breadcurm should be plaintext item
3
5
  * 2.1.1 fix simple_form decrappted warning
@@ -17,12 +17,12 @@ module BootstrapHelper
17
17
  id_attribute = (@body_id)? " id=\"#{@body_id}-page\"" : ""
18
18
 
19
19
  raw(%Q|<!--[if lt IE 7 ]>
20
- <body class="#{class_attribute} ie6"><![endif]-->
21
- <!--[if gte IE 7 ]>
22
- <body class="#{class_attribute} ie"><![endif]-->
23
- <!--[if !IE]>-->
24
- <body#{id_attribute} class="#{class_attribute}">
25
- <!--<![endif]-->|)
20
+ <body class="#{class_attribute} ie6"><![endif]-->
21
+ <!--[if gte IE 7 ]>
22
+ <body class="#{class_attribute} ie"><![endif]-->
23
+ <!--[if !IE]>-->
24
+ <body#{id_attribute} class="#{class_attribute}">
25
+ <!--<![endif]-->|)
26
26
 
27
27
  end
28
28
 
@@ -42,6 +42,24 @@ module BootstrapHelper
42
42
  sanitize( html, :tags => %w(table thead tbody tr td th ol ul li div span font img sup sub br hr a pre p h1 h2 h3 h4 h5 h6), :attributes => %w(style src href size color) )
43
43
  end
44
44
 
45
+
46
+ def ibutton(text, path, options = {})
47
+
48
+ color_btn_class = ["btn-primary", "btn-danger", "btn-info" , "btn-warning", "btn-success", "btn-inverse"]
49
+
50
+ class_name = (options[:class].present?)? options[:class] : ""
51
+ icon_class = ""
52
+
53
+ if options[:iclass].present?
54
+ icon_class = options[:iclass]
55
+ icon_class << " icon-white" if !(color_btn_class & class_name.split(" ")).empty?
56
+ options.delete(:iclass)
57
+ end
58
+ link_to path, options do
59
+ content_tag(:i, "", :class => icon_class) + content_tag(:span, " #{text}" )
60
+ end
61
+ end
62
+
45
63
  def render_table(rows, renderrers, table_options = {})
46
64
  table_options = {
47
65
  :has_header => true,
@@ -50,56 +68,56 @@ module BootstrapHelper
50
68
  :id => nil,
51
69
  :class_name => "auto",
52
70
  :blank_message => "No results available."
53
- }.merge(table_options)
71
+ }.merge(table_options)
54
72
 
55
- table_tag_options = table_options[:id] ? { :id => table_options[:id], :class => table_options[:class_name] } : { :class => table_options[:class_name] }
73
+ table_tag_options = table_options[:id] ? { :id => table_options[:id], :class => table_options[:class_name] } : { :class => table_options[:class_name] }
56
74
 
57
- table = TagNode.new('table', table_tag_options)
75
+ table = TagNode.new('table', table_tag_options)
58
76
 
59
- if !table_options[:caption].blank?
60
- table << caption = TagNode.new(:caption)
61
- caption << table_options[:caption]
62
- end
77
+ if !table_options[:caption].blank?
78
+ table << caption = TagNode.new(:caption)
79
+ caption << table_options[:caption]
80
+ end
63
81
 
64
- if table_options[:has_header] == true
65
- table << thead = TagNode.new(:thead)
66
- thead << tr = TagNode.new(:tr, :class => 'odd')
82
+ if table_options[:has_header] == true
83
+ table << thead = TagNode.new(:thead)
84
+ thead << tr = TagNode.new(:tr, :class => 'odd')
67
85
 
68
- renderrers.each do |renderrer|
69
- tr << th = TagNode.new(:th)
70
- th << renderrer[0]
86
+ renderrers.each do |renderrer|
87
+ tr << th = TagNode.new(:th)
88
+ th << renderrer[0]
89
+ end
71
90
  end
72
- end
73
91
 
74
- table << tbody = TagNode.new('tbody')
75
- row_info = {}
76
- row_info[:total] = rows.length
77
- rows.each_with_index do |row,i|
78
- row_info[:current] = i
79
- tbody << tr = TagNode.new('tr', :class => cycle("","odd") )
80
- renderrers.each do |renderrer|
81
- tr << td = TagNode.new('td')
82
-
83
- if renderrer[1].class == Proc
84
- if table_options[:has_row_info] == true
85
- td << renderrer[1].call(row, row_info)
92
+ table << tbody = TagNode.new('tbody')
93
+ row_info = {}
94
+ row_info[:total] = rows.length
95
+ rows.each_with_index do |row,i|
96
+ row_info[:current] = i
97
+ tbody << tr = TagNode.new('tr', :class => cycle("","odd") )
98
+ renderrers.each do |renderrer|
99
+ tr << td = TagNode.new('td')
100
+
101
+ if renderrer[1].class == Proc
102
+ if table_options[:has_row_info] == true
103
+ td << renderrer[1].call(row, row_info)
104
+ else
105
+ td << renderrer[1].call(row)
106
+ end
86
107
  else
87
- td << renderrer[1].call(row)
108
+ td << renderrer[1]
88
109
  end
89
- else
90
- td << renderrer[1]
91
110
  end
92
111
  end
93
- end
94
112
 
95
- if rows.length <= 0 && table_options[:blank_message] != false
96
- tbody << tr = TagNode.new('tr', :class => "no-record" )
97
- tr << td = TagNode.new('td', :colspan => renderrers.length)
98
- td << table_options[:blank_message]
99
- end
113
+ if rows.length <= 0 && table_options[:blank_message] != false
114
+ tbody << tr = TagNode.new('tr', :class => "no-record" )
115
+ tr << td = TagNode.new('td', :colspan => renderrers.length)
116
+ td << table_options[:blank_message]
117
+ end
100
118
 
101
- return table.to_s
102
- end
119
+ return table.to_s
120
+ end
103
121
 
104
122
  # .current will be added to current action, but if you want to add .current to another link, you can set @current = ['/other_link']
105
123
  # TODO: hot about render_list( *args )
@@ -1,5 +1,5 @@
1
1
  module BootstrapHelper
2
2
  module Rails
3
- VERSION = "4.2.2.1"
3
+ VERSION = "4.2.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2.1
4
+ version: 4.2.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-02 00:00:00.000000000 Z
12
+ date: 2013-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -215,18 +215,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
215
  - - ! '>='
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
- segments:
219
- - 0
220
- hash: 1963512162171040679
221
218
  required_rubygems_version: !ruby/object:Gem::Requirement
222
219
  none: false
223
220
  requirements:
224
221
  - - ! '>='
225
222
  - !ruby/object:Gem::Version
226
223
  version: '0'
227
- segments:
228
- - 0
229
- hash: 1963512162171040679
230
224
  requirements: []
231
225
  rubyforge_project:
232
226
  rubygems_version: 1.8.25
@@ -275,3 +269,4 @@ test_files:
275
269
  - spec/helpers/application_helper_spec.rb
276
270
  - spec/integration/view_homepage_spec.rb
277
271
  - spec/spec_helper.rb
272
+ has_rdoc: