bootstrap_helper 3.2.2.1 → 4.2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +0 -2
- data/Gemfile +1 -1
- data/README.md +5 -2
- data/bootstrap_helper.gemspec +3 -4
- data/lib/bootstrap_helper/helper.rb +43 -61
- data/lib/bootstrap_helper/version.rb +1 -1
- metadata +12 -28
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -9,12 +9,15 @@ bootstrap_helper auto generates Bootstrap HTML codes.
|
|
9
9
|
include Bootstrap Helper in Gemfile;
|
10
10
|
|
11
11
|
``` ruby
|
12
|
-
gem 'bootstrap_helper'
|
12
|
+
gem 'bootstrap_helper', '3.2.2.0'
|
13
13
|
```
|
14
|
+
|
15
|
+
## Rails 4.0+
|
16
|
+
|
14
17
|
or you can install from latest build;
|
15
18
|
|
16
19
|
``` ruby
|
17
|
-
gem 'bootstrap_helper',
|
20
|
+
gem 'bootstrap_helper', '4.2.2.0'
|
18
21
|
```
|
19
22
|
|
20
23
|
## USAGE
|
data/bootstrap_helper.gemspec
CHANGED
@@ -15,14 +15,13 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = BootstrapHelper::Rails::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "railties", "
|
18
|
+
gem.add_dependency "railties", "4.0.0.beta1"
|
19
19
|
gem.add_dependency "thor", "~> 0.14"
|
20
|
-
gem.add_dependency "simple_form", "~> 2.0.2"
|
21
20
|
gem.add_dependency "will_paginate", '>= 3.0.3'
|
22
21
|
gem.add_development_dependency("rspec-rails")
|
23
22
|
gem.add_development_dependency("capybara", ">= 0.4.0")
|
24
23
|
gem.add_development_dependency("sqlite3")
|
25
|
-
gem.add_development_dependency "bundler", ">= 1.
|
26
|
-
gem.add_development_dependency "rails", "
|
24
|
+
gem.add_development_dependency "bundler", ">= 1.3.0"
|
25
|
+
gem.add_development_dependency "rails", "4.0.0.beta1"
|
27
26
|
end
|
28
27
|
|
@@ -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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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,24 +42,6 @@ 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
|
-
|
63
45
|
def render_table(rows, renderrers, table_options = {})
|
64
46
|
table_options = {
|
65
47
|
:has_header => true,
|
@@ -68,57 +50,57 @@ module BootstrapHelper
|
|
68
50
|
:id => nil,
|
69
51
|
:class_name => "auto",
|
70
52
|
:blank_message => "No results available."
|
71
|
-
|
53
|
+
}.merge(table_options)
|
72
54
|
|
73
|
-
|
55
|
+
table_tag_options = table_options[:id] ? { :id => table_options[:id], :class => table_options[:class_name] } : { :class => table_options[:class_name] }
|
74
56
|
|
75
|
-
|
57
|
+
table = TagNode.new('table', table_tag_options)
|
76
58
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
59
|
+
if !table_options[:caption].blank?
|
60
|
+
table << caption = TagNode.new(:caption)
|
61
|
+
caption << table_options[:caption]
|
62
|
+
end
|
81
63
|
|
82
|
-
|
83
|
-
|
84
|
-
|
64
|
+
if table_options[:has_header] == true
|
65
|
+
table << thead = TagNode.new(:thead)
|
66
|
+
thead << tr = TagNode.new(:tr, :class => 'odd')
|
85
67
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
68
|
+
renderrers.each do |renderrer|
|
69
|
+
tr << th = TagNode.new(:th)
|
70
|
+
th << renderrer[0]
|
90
71
|
end
|
72
|
+
end
|
91
73
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
else
|
105
|
-
td << renderrer[1].call(row)
|
106
|
-
end
|
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)
|
107
86
|
else
|
108
|
-
td << renderrer[1]
|
87
|
+
td << renderrer[1].call(row)
|
109
88
|
end
|
89
|
+
else
|
90
|
+
td << renderrer[1]
|
110
91
|
end
|
111
92
|
end
|
93
|
+
end
|
112
94
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
end
|
118
|
-
|
119
|
-
return table.to_s
|
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]
|
120
99
|
end
|
121
100
|
|
101
|
+
return table.to_s
|
102
|
+
end
|
103
|
+
|
122
104
|
# .current will be added to current action, but if you want to add .current to another link, you can set @current = ['/other_link']
|
123
105
|
# TODO: hot about render_list( *args )
|
124
106
|
def render_list(list=[], options={})
|
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
|
+
version: 4.2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 4.0.0.beta1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.0.0.beta1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: thor
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,22 +43,6 @@ dependencies:
|
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0.14'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: simple_form
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 2.0.2
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 2.0.2
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
47
|
name: will_paginate
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,7 +114,7 @@ dependencies:
|
|
130
114
|
requirements:
|
131
115
|
- - ! '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
|
-
version: 1.
|
117
|
+
version: 1.3.0
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -138,23 +122,23 @@ dependencies:
|
|
138
122
|
requirements:
|
139
123
|
- - ! '>='
|
140
124
|
- !ruby/object:Gem::Version
|
141
|
-
version: 1.
|
125
|
+
version: 1.3.0
|
142
126
|
- !ruby/object:Gem::Dependency
|
143
127
|
name: rails
|
144
128
|
requirement: !ruby/object:Gem::Requirement
|
145
129
|
none: false
|
146
130
|
requirements:
|
147
|
-
- -
|
131
|
+
- - '='
|
148
132
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
133
|
+
version: 4.0.0.beta1
|
150
134
|
type: :development
|
151
135
|
prerelease: false
|
152
136
|
version_requirements: !ruby/object:Gem::Requirement
|
153
137
|
none: false
|
154
138
|
requirements:
|
155
|
-
- -
|
139
|
+
- - '='
|
156
140
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
141
|
+
version: 4.0.0.beta1
|
158
142
|
description: Twitter Bootstrap HTML Helper
|
159
143
|
email:
|
160
144
|
- xuite.joke@gmail.com
|