tw_bootstrap_helper 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/lib/tw_bootstrap_helper/railtie.rb +13 -0
- data/lib/tw_bootstrap_helper/view_helper.rb +246 -0
- data/lib/tw_bootstrap_helper.rb +1 -0
- metadata +130 -0
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Agência Orangeweb
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= tw_bootstrap_helper
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to tw_bootstrap_helper
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Agência Orangeweb. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
@@ -0,0 +1,246 @@
|
|
1
|
+
# Helpers para auxiliar o uso do 960.gs com Rails
|
2
|
+
#
|
3
|
+
# Author:: Luiz Eduardo de Oliveira Fomseca - Agência Orangeweb (mailto:atendimento@orangeweb.com.br)
|
4
|
+
# Copyright:: Copyright (c) 2011 Agência Orangeweb, MEI
|
5
|
+
# License:: MIT
|
6
|
+
|
7
|
+
require 'tw_bootstrap_helper/railtie.rb'
|
8
|
+
|
9
|
+
# GEM Rails960gs
|
10
|
+
module TwBootsrapHelper
|
11
|
+
|
12
|
+
# Extende os Helpers da Aplicação
|
13
|
+
module ViewHelper
|
14
|
+
|
15
|
+
def bootstrap_link_to title, path, type, options={}
|
16
|
+
|
17
|
+
options[:class] = "" unless options.has_key?(:class)
|
18
|
+
options[:class].insert(0, " btn " + type.to_s)
|
19
|
+
|
20
|
+
if options.has_key?(:small) then
|
21
|
+
if options[:small] == true then
|
22
|
+
options[:class].insert(-1, " small ")
|
23
|
+
end
|
24
|
+
options.delete(:small)
|
25
|
+
end
|
26
|
+
|
27
|
+
options[:class].to_s.strip!
|
28
|
+
link_to title, path, options
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
# Default Options from Links with Bootstraper
|
33
|
+
|
34
|
+
def default_link_to title, path, options={}
|
35
|
+
bootstrap_link_to title, path, :default, options
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def primary_link_to title, path, options={}
|
40
|
+
bootstrap_link_to title, path, :primary, options
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def info_link_to title, path, options={}
|
45
|
+
bootstrap_link_to title, path, :info, options
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def success_link_to title, path, options={}
|
50
|
+
bootstrap_link_to title, path, :success, options
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def danger_link_to title, path, options={}
|
55
|
+
bootstrap_link_to title, path, :danger, options
|
56
|
+
end
|
57
|
+
|
58
|
+
# Commom Alias from Links
|
59
|
+
|
60
|
+
def pill_link_to title, path, options={}
|
61
|
+
link_to title, path, options
|
62
|
+
end
|
63
|
+
|
64
|
+
def new_link_to title, path, options={}
|
65
|
+
success_link_to title, path, options
|
66
|
+
end
|
67
|
+
|
68
|
+
def cancel_link_to title, path, options={}
|
69
|
+
default_link_to title, path, options
|
70
|
+
end
|
71
|
+
|
72
|
+
def edit_link_to title, path, options={}
|
73
|
+
info_link_to title, path, options
|
74
|
+
end
|
75
|
+
|
76
|
+
def delete_link_to title, path, options={}
|
77
|
+
options[:confirm] = 'Tem certeza que deseja apagar este item?'
|
78
|
+
options[:method] = :delete
|
79
|
+
danger_link_to title, path, options
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
# Show a Toolbar
|
85
|
+
def toolbar(&block)
|
86
|
+
content = capture(&block)
|
87
|
+
content_tag(:div, content_tag(:ul, content), :class => "toolbar corner border gradient")
|
88
|
+
end
|
89
|
+
|
90
|
+
# Show a Toolbar
|
91
|
+
def toolbar_item(&block)
|
92
|
+
content = capture(&block)
|
93
|
+
content_tag(:li, content, :class => "toolbar-item")
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
# Show a Pill Toolbar
|
99
|
+
def pill(&block)
|
100
|
+
content = capture(&block)
|
101
|
+
content_tag(:div, content_tag(:ul, content, :class => "pills border corner h-padding"))
|
102
|
+
end
|
103
|
+
|
104
|
+
# Show a Pill Toolbar Item
|
105
|
+
def pill_item(&block)
|
106
|
+
content = capture(&block)
|
107
|
+
content_tag(:li, content, :class => "pill-item")
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
def bootstrap_label title, type, options={}
|
112
|
+
options[:class] = "" unless options.has_key?(:class)
|
113
|
+
options[:class].insert(0, " label " + type.to_s)
|
114
|
+
raw content_tag :span, " #{title} ", options
|
115
|
+
end
|
116
|
+
|
117
|
+
def label_default title, options={}
|
118
|
+
bootstrap_label title, :default, options={}
|
119
|
+
end
|
120
|
+
|
121
|
+
def label_success title, options={}
|
122
|
+
bootstrap_label title, :success, options={}
|
123
|
+
end
|
124
|
+
|
125
|
+
def label_warning title, options={}
|
126
|
+
bootstrap_label title, :warning, options={}
|
127
|
+
end
|
128
|
+
|
129
|
+
def label_important title, options={}
|
130
|
+
bootstrap_label title, :important, options={}
|
131
|
+
end
|
132
|
+
|
133
|
+
def label_notice title, options={}
|
134
|
+
bootstrap_label title, :notice, options={}
|
135
|
+
end
|
136
|
+
|
137
|
+
# Commom Alias from Labels
|
138
|
+
|
139
|
+
def label_new title="Novo"
|
140
|
+
label_success title
|
141
|
+
end
|
142
|
+
|
143
|
+
def label_error title="Erro"
|
144
|
+
label_important title
|
145
|
+
end
|
146
|
+
|
147
|
+
def label_incomplete title="Incompleto"
|
148
|
+
label_warning title
|
149
|
+
end
|
150
|
+
|
151
|
+
def label_details title="+ Detalhes"
|
152
|
+
label_notice title
|
153
|
+
end
|
154
|
+
|
155
|
+
def label_back title="<< Voltar"
|
156
|
+
label_default title
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
# Grids
|
161
|
+
|
162
|
+
# Bootstrap Row Grid
|
163
|
+
def grid_row(&block)
|
164
|
+
content = capture(&block)
|
165
|
+
raw content_tag(:div, content, :class => "grid row")
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
# Bootstrap Col Grid
|
170
|
+
def grid_col(cols, center=true,&block)
|
171
|
+
content = capture(&block)
|
172
|
+
cl = "span#{cols} border corner h-padding opaque "
|
173
|
+
|
174
|
+
cl += " center " if center
|
175
|
+
|
176
|
+
content_tag(:div, content, :class => cl)
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
# Bootstrap Row Grid
|
181
|
+
def nav_icon(title, link)
|
182
|
+
raw content_tag(:div, link + content_tag(:span, title), :class => "nav-icon-item corner h-margin v-margin")
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
#============ HTML HELPERS ================
|
187
|
+
|
188
|
+
def table(opts={}, &block)
|
189
|
+
content = capture(&block)
|
190
|
+
|
191
|
+
opts[:class] = "border zebra-striped corner"
|
192
|
+
|
193
|
+
content_tag(:table, content, opts)
|
194
|
+
end
|
195
|
+
|
196
|
+
|
197
|
+
def table_head(&block)
|
198
|
+
content = capture(&block)
|
199
|
+
content_tag(:thead, content_tag(:tr, content))
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
def table_th_block(options={}, &block)
|
204
|
+
content = capture(&block)
|
205
|
+
content_tag(:th, content)
|
206
|
+
end
|
207
|
+
|
208
|
+
def table_th(value="", options={})
|
209
|
+
content_tag(:th, value)
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
def table_body(&block)
|
214
|
+
content = capture(&block)
|
215
|
+
content_tag(:tbody, content)
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
def table_tr(&block)
|
220
|
+
content = capture(&block)
|
221
|
+
content_tag(:tr, content)
|
222
|
+
end
|
223
|
+
|
224
|
+
|
225
|
+
def table_td_block(options={}, &block)
|
226
|
+
content = capture(&block)
|
227
|
+
content_tag(:td, content, options)
|
228
|
+
end
|
229
|
+
|
230
|
+
def table_td(value="", options={})
|
231
|
+
content_tag(:td, value, options)
|
232
|
+
end
|
233
|
+
|
234
|
+
def lorem_ipsum_text
|
235
|
+
<<-eos
|
236
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris fermentum tempor arcu in mollis.
|
237
|
+
Aliquam erat volutpat. Sed malesuada lacinia nibh, eget posuere turpis accumsan vitae. Aliquam lacus massa, pellentesque auctor volutpat eu, luctus ac enim.
|
238
|
+
Nullam venenatis tellus nec tortor dictum rutrum. Proin sed magna eu mauris posuere vulputate vel quis nunc. Donec at elit sapien, vitae mattis arcu. Maecenas sollicitudin auctor volutpat. Vivamus tincidunt interdum placerat.
|
239
|
+
In mattis, metus vel pellentesque accumsan, neque nisi ornare lectus, et interdum lectus ipsum sed augue. Nullam sollicitudin placerat enim a lobortis.
|
240
|
+
Curabitur id lorem turpis, sit amet euismod elit.
|
241
|
+
eos
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'tw_bootstrap_helper/railtie' if defined?(Rails)
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tw_bootstrap_helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Agencia Orangeweb
|
14
|
+
- Luiz Eduardo de Oliveira Fonseca
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-12-07 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :development
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
version_requirements: *id001
|
33
|
+
name: shoulda
|
34
|
+
prerelease: false
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
type: :development
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 23
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
version: 1.0.0
|
48
|
+
version_requirements: *id002
|
49
|
+
name: bundler
|
50
|
+
prerelease: false
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
type: :development
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 7
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 6
|
62
|
+
- 4
|
63
|
+
version: 1.6.4
|
64
|
+
version_requirements: *id003
|
65
|
+
name: jeweler
|
66
|
+
prerelease: false
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
type: :development
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
version_requirements: *id004
|
79
|
+
name: rcov
|
80
|
+
prerelease: false
|
81
|
+
description: Make easy use of Twitter Bootstrap on Rails App
|
82
|
+
email: apps@orangeweb.com.br
|
83
|
+
executables: []
|
84
|
+
|
85
|
+
extensions: []
|
86
|
+
|
87
|
+
extra_rdoc_files:
|
88
|
+
- LICENSE.txt
|
89
|
+
- README.rdoc
|
90
|
+
files:
|
91
|
+
- lib/tw_bootstrap_helper.rb
|
92
|
+
- lib/tw_bootstrap_helper/railtie.rb
|
93
|
+
- lib/tw_bootstrap_helper/view_helper.rb
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.rdoc
|
96
|
+
homepage: http://github.com/orangeweb/tw_bootstrap_helper
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
version: "0"
|
122
|
+
requirements: []
|
123
|
+
|
124
|
+
rubyforge_project:
|
125
|
+
rubygems_version: 1.8.12
|
126
|
+
signing_key:
|
127
|
+
specification_version: 3
|
128
|
+
summary: Make easy use of Twitter Bootstrap on Rails App
|
129
|
+
test_files: []
|
130
|
+
|