orangeweb_bootstrap_helper 0.0.8 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module OrangewebBootstrapHelper
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -1,16 +1,16 @@
1
1
  # -*- encoding : utf-8 -*-
2
- # Helpers para auxiliar o uso do Twitter Bootstrap em Rails Apps
3
- #
4
- # Author:: Luiz Eduardo de Oliveira Fomseca - Agência Orangeweb (mailto:apps@orangeweb.com.br)
5
- # Copyright:: Copyright (c) 2011 Agência Orangeweb, MEI
6
- # License:: MIT
2
+ # The **orangeweb_bootstrap_helper** gives you a lot of ERB Helpers that make the work with Twitter Bootstrap more DRY, Fast and Easy.
3
+ #
4
+ # Author:: Luiz Eduardo de Oliveira Fomseca (luizeof@gmail.com)
5
+ # Copyright:: Copyright (c) 2011-2012 Agência Orangeweb (atendimento@orangeweb.com.br)
6
+ # License:: GPL
7
7
 
8
8
  require 'orangeweb_bootstrap_helper/railtie.rb'
9
9
 
10
- # GEM tw_bootstrap_helper
10
+ # GEM orangeweb_bootstrap_helper
11
11
  module OrangewebBootStrapHelper
12
12
 
13
- # Extende os Helpers da Aplicação
13
+ # Extends Application Helpers
14
14
  module ViewHelper
15
15
 
16
16
  def show_notifications val
@@ -23,23 +23,14 @@ module ViewHelper
23
23
 
24
24
  raw out
25
25
  end
26
-
27
-
28
-
29
- ## TWITTER BOOTSTRAP ICONS
30
-
26
+
31
27
  def icon(ico, color = :black)
32
28
  ico = ico.to_s
33
29
  color = color.to_s
34
30
  ico.gsub!(/_/, "-")
35
31
  raw(content_tag :i, "", :class => "icon icon-#{ico} icon-#{color}")
36
32
  end
37
-
38
-
39
- ## TWITTER BOOTSTRAP BADGES ************
40
-
41
-
42
- # Gera o Badge DRY
33
+
43
34
  def bootstrap_badge value, type
44
35
  raw(content_tag :span, value, :class => "badge badge-#{type.to_s}")
45
36
  end
@@ -68,11 +59,6 @@ module ViewHelper
68
59
  bootstrap_badge value, :inverse
69
60
  end
70
61
 
71
-
72
- ## TWITTER BOOTSTRAP LABELS ************
73
-
74
-
75
- # Gera o Badge DRY
76
62
  def bootstrap_label value, type
77
63
  raw(content_tag :span, value, :class => "label label-#{type.to_s}")
78
64
  end
@@ -101,87 +87,60 @@ module ViewHelper
101
87
  bootstrap_label value, :inverse
102
88
  end
103
89
 
104
- # Cria o Pop-over
105
-
106
90
  def popover title, content, options={}
107
91
  options[:rel] = "popover"
108
92
  options[:data] = { :content => content, "original-title" => title }
109
93
  link_to icon(:info_sign), "#", options
110
94
  end
111
95
 
112
-
113
- # links and buttons
114
-
115
-
116
96
  def tooltip_link title, link, tooltip, opts={}
117
97
  opts[:rel] = "tooltip"
118
98
  opts[:tooltip] = tooltip
119
99
  link_to title, link, opts
120
100
  end
121
-
122
-
123
- # Cria um botao base para operações crud
101
+
124
102
  def link_to_icon title, link, ico, opts={}
125
103
  link_to raw( icon(ico.to_sym) + " " + title ).to_s, link, opts
126
104
  end
127
105
 
128
-
129
- # Cria um link simples pra si mesmo
130
106
  def link_to_self link, opts={}
131
107
  link_to link, link.to_s.delete('http://').insert(0, 'http://'), opts
132
108
  end
133
109
 
134
-
135
- # Cria um link simples pra si mesmo, e abre em uma nova janela
136
110
  def link_to_self_blank link
137
111
  link_to_blank link, link
138
112
  end
139
113
 
140
-
141
- # Cria um link abrindo uma nova janela, e associa um icone ao final do texto ancora
114
+
142
115
  def link_to_blank title, link, opts={}
143
116
  opts[:target] = :blank
144
117
  link_to raw(title + " " + icon(:share_alt)).to_s, link.to_s.delete('http://').insert(0, 'http://'), opts
145
118
  end
146
-
147
-
148
- # Cria um link basa para as opeções crud
119
+
149
120
  def link_to_crud title, link, ico, opts={}
150
121
  link_to raw( icon(ico.to_sym) + " " + title ).to_s, link, opts
151
122
  end
152
123
 
153
-
154
- # Cria um link para editar registros
155
124
  def link_to_edit title, link, opts={}
156
125
  link_to_crud title, link, :pencil, opts
157
126
  end
158
127
 
159
-
160
- # Cria um link para cancelar edição de registros
161
128
  def link_to_cancel title, link, opts={}
162
129
  link_to_crud title, link, :arrow_left, opts
163
130
  end
164
-
165
-
166
- # Cria um link para voltar
131
+
167
132
  def link_to_back title, link, opts={}
168
133
  link_to_cancel title, link, opts
169
134
  end
170
135
 
171
-
172
- # Cria um link para novos registros
173
136
  def link_to_new title, link, opts={}
174
137
  link_to_crud title, link, :plus, opts
175
138
  end
176
139
 
177
-
178
- # Cria um link para apagar registros
179
140
  def link_to_delete title, link, opts={}
180
141
  link_to_crud title, link, :trash, method: :delete, data: { confirm: 'Tem certeza que deseja apagar este registro?' }
181
142
  end
182
143
 
183
-
184
- # Cria um botao base para operações crud
185
144
  def button_to_crud title, link, ico, color, opts={}
186
145
  opts[:class] += " btn "
187
146
  unless opts[:small].nil? then
@@ -195,22 +154,16 @@ module ViewHelper
195
154
  link_to raw( icon(ico.to_sym, color.to_sym) + " " + title ).to_s, link, opts
196
155
  end
197
156
 
198
-
199
- # Cria um botao para novos registros
200
157
  def button_to_edit title, link, opts={}
201
158
  opts[:class] = "btn-warning"
202
159
  button_to_crud title, link, :pencil, :white, opts
203
160
  end
204
161
 
205
-
206
- # Cria um botao para novos registros
207
162
  def button_to_cancel title, link, opts={}
208
163
  opts[:class] = "btn-default"
209
164
  button_to_crud title, link, :arrow_left, :black, opts
210
165
  end
211
166
 
212
-
213
- # Cria um botao para novos registros
214
167
  def button_to_new title, link, opts={}
215
168
  opts[:class] = "btn-primary"
216
169
  button_to_crud title, link, :plus, :white, opts
@@ -227,11 +180,6 @@ module ViewHelper
227
180
  button_to_crud title, link, :trash, :white, opts
228
181
  end
229
182
 
230
-
231
- ## TEXT HELPERS
232
-
233
-
234
- # Exibe o texto 'Sim' ou 'Não' para um valor booleano em um Label
235
183
  def yes_no_label val
236
184
  if val then
237
185
  label_success "Sim"
@@ -240,8 +188,6 @@ module ViewHelper
240
188
  end
241
189
  end
242
190
 
243
-
244
- # Exibe o texto 'Sim' ou 'Não' para um valor booleano em um Label
245
191
  def active_inactive_label val
246
192
  if val then
247
193
  label_success "Ativo"
@@ -250,17 +196,12 @@ module ViewHelper
250
196
  end
251
197
  end
252
198
 
253
-
254
- # Toolbars
255
199
  def toolbar &block
256
200
  raw '<div class="well">' +
257
201
  capture(&block) +
258
202
  "</div>"
259
203
  end
260
204
 
261
-
262
-
263
- # alert_block
264
205
  def alert_block title, alert_context = :alert, &block
265
206
  raw '<div class="alert alert-block alert-' + alert_context.to_s + '" >' +
266
207
  ' <a class="close" data-dismiss="alert" href="#">×</a>' +
@@ -269,9 +210,6 @@ module ViewHelper
269
210
  '</div>'
270
211
  end
271
212
 
272
-
273
-
274
- # alert_inline
275
213
  def alert_inline title, alert_context = :alert, &block
276
214
  raw '<div class="alert alert-' + alert_context.to_s + '" >' +
277
215
  ' <a class="close" data-dismiss="alert" href="#">×</a>' +
@@ -280,57 +218,38 @@ module ViewHelper
280
218
  '</div>'
281
219
  end
282
220
 
283
-
284
-
285
- # Exibe os Flash Notice
286
221
  def show_notice
287
222
  unless notice.nil? then
288
223
  raw(content_tag :div, (alert_inline "Notificação: ", :info do content_tag(:span, notice) end), :id => "notice")
289
224
  end
290
225
  end
291
226
 
292
-
293
- # SimpleForm + Bootstrap Form Helpers
294
-
295
- # Fieldset + Legend
296
227
  def fieldset title, &block
297
228
  raw '<div class="form-inputs"><fieldset><legend>' + title + "</legend>" +
298
229
  capture(&block) +
299
230
  "</fieldset></div>"
300
231
  end
301
-
302
-
303
- # Form Actins
232
+
304
233
  def form_actions_block &block
305
234
  content_tag(:div, capture(&block), :class => "form-actions" )
306
235
  end
307
-
308
- # Common Form Actions = Submit Button + Cancel Link
236
+
309
237
  def form_actions form, back_url, submit_title = "Gravar", cancel_title = "Cancelar"
310
238
  form_actions_block do
311
239
  (form.button :submit, submit_title) + " " + (link_to cancel_title, back_url)
312
240
  end
313
241
  end
314
242
 
315
-
316
-
317
-
318
- # CSS Grid
319
-
320
-
321
- # Bootstrap Grid Row Fixed
322
243
  def row options = { :class => "" }, &block
323
244
  options[:class].insert(-1, " row")
324
245
  content_tag(:div, capture(&block), options)
325
246
  end
326
247
 
327
- # Bootstrap Grid Row Fluid
328
248
  def row_fluid options = { :class => "" }, &block
329
249
  options[:class].insert(-1, " row-fluid")
330
250
  content_tag(:div, capture(&block), options)
331
251
  end
332
-
333
- # Bootstrap Grid Row Fixed
252
+
334
253
  def span cols, options={}, &block
335
254
  offset = ""
336
255
 
@@ -344,38 +263,6 @@ module ViewHelper
344
263
  content_tag(:div, capture(&block), options)
345
264
  end
346
265
 
347
-
348
- # Bootstrap Extras
349
-
350
-
351
- #Star Rating
352
- def star_rating val=0
353
-
354
- rating = case val
355
- when 0 then 0
356
- when 01..05 then 05
357
- when 06..10 then 10
358
- when 11..15 then 15
359
- when 16..20 then 20
360
- when 21..25 then 25
361
- when 26..30 then 30
362
- when 31..35 then 35
363
- when 36..40 then 40
364
- when 41..45 then 45
365
- when 46..50 then 50
366
- else -1
367
- end
368
-
369
- if rating.to_i >= 0 then
370
- content_tag :span, "", :class => "star-rating rating-#{rating}", :rel => "tooltip", :title => "#{rating} estrelas"
371
- else
372
- content_tag :span, "!!! Entre com um valor entre 0 e 50 (#{rating}) !!!",
373
- end
374
-
375
- end
376
-
377
-
378
-
379
266
  def page_section_fluid title, options = {}
380
267
  if options[:class].nil? then options[:class] = "" end
381
268
  options[:class].insert(-1, " row-fluid")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orangeweb_bootstrap_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
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: 2012-07-23 00:00:00.000000000 Z
12
+ date: 2012-08-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Helpers that makes easier the use of Twitter Bootstrap with Ruby on Rails
15
15
  email:
@@ -20,7 +20,6 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - .gitignore
22
22
  - Gemfile
23
- - Gemfile~
24
23
  - LICENSE
25
24
  - README.md
26
25
  - Rakefile
@@ -30,20 +29,15 @@ files:
30
29
  - app/assets/stylesheets/bootstrap.css
31
30
  - lib/generators/orangeweb_bootstrap/USAGE
32
31
  - lib/generators/orangeweb_bootstrap/orangeweb_bootstrap_generator.rb
33
- - lib/generators/orangeweb_bootstrap/orangeweb_bootstrap_generator.rb~
34
32
  - lib/generators/orangeweb_bootstrap/templates/app/assets/images/glyphicons-halflings-white.png
35
33
  - lib/generators/orangeweb_bootstrap/templates/app/assets/images/glyphicons-halflings.png
36
34
  - lib/generators/orangeweb_bootstrap/templates/app/assets/javascripts/bootstrap.js
37
35
  - lib/generators/orangeweb_bootstrap/templates/app/assets/stylesheets/bootstrap.css
38
36
  - lib/orangeweb_bootstrap_helper.rb
39
- - lib/orangeweb_bootstrap_helper.rb~
40
37
  - lib/orangeweb_bootstrap_helper/railtie.rb
41
38
  - lib/orangeweb_bootstrap_helper/version.rb
42
- - lib/orangeweb_bootstrap_helper/version.rb~
43
39
  - lib/orangeweb_bootstrap_helper/view_helper.rb
44
- - lib/orangeweb_bootstrap_helper/view_helper.rb~
45
40
  - orangeweb_bootstrap_helper.gemspec
46
- - orangeweb_bootstrap_helper.gemspec~
47
41
  homepage: http://orangeweb.github.com/orangeweb_bootstrap_helpers/
48
42
  licenses: []
49
43
  post_install_message:
data/Gemfile~ DELETED
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in orangeweb_bootstrap_helper.gemspec
4
- gemspec
5
-
@@ -1,14 +0,0 @@
1
- class OrangewebBootstrapGenerator < Rails::Generators::NamedBase
2
- source_root File.expand_path('../templates', __FILE__)
3
-
4
- def init
5
- # copy twitter bootstrap javascript files
6
- copy_file "/app/assets/javascripts/bootstrap.js", "app/assets/javascripts/bootstrap.js"
7
- # copy twitter bootstrap stylesheets files
8
- copy_file "/app/assets/stylesheets/bootstrap.css", "app/assets/stylesheets/bootstrap.css"
9
- # copy twitter bootstrap image sprite files
10
- copy_file "/app/assets/images/glyphicons-halflings.png", "app/assets/images/glyphicons-halflings.png"
11
- copy_file "/app/assets/images/glyphicons-halflings-white.png", "app/assets/images/glyphicons-halflings-white.png"
12
- end
13
-
14
- end
@@ -1 +0,0 @@
1
- require 'orangeweb_bootstrap_helper/railtie' if defined?(Rails)
@@ -1,3 +0,0 @@
1
- module OrangewebBootstrapHelper
2
- VERSION = "0.0.7"
3
- end
@@ -1,392 +0,0 @@
1
- # -*- encoding : utf-8 -*-
2
- # Helpers para auxiliar o uso do Twitter Bootstrap em Rails Apps
3
- #
4
- # Author:: Luiz Eduardo de Oliveira Fomseca - Agência Orangeweb (mailto:apps@orangeweb.com.br)
5
- # Copyright:: Copyright (c) 2011 Agência Orangeweb, MEI
6
- # License:: MIT
7
-
8
- require 'orangeweb_bootstrap_helper/railtie.rb'
9
-
10
- # GEM tw_bootstrap_helper
11
- module OrangewebBootStrapHelper
12
-
13
- # Extende os Helpers da Aplicação
14
- module ViewHelper
15
-
16
- def show_notifications val
17
-
18
- out =
19
- "<div class=\alert\">" <<
20
- "<button class=\"close\" data-dismiss=\"alert\">×</button>" <<
21
- "<strong>Warning!</strong> #{val}." <<
22
- "</div>"
23
-
24
- raw out
25
- end
26
-
27
-
28
-
29
- ## TWITTER BOOTSTRAP ICONS
30
-
31
- def icon(ico, color = :black)
32
- ico = ico.to_s
33
- color = color.to_s
34
- ico.gsub!(/_/, "-")
35
- raw(content_tag :i, "", :class => "icon icon-#{ico} icon-#{color}")
36
- end
37
-
38
-
39
- ## TWITTER BOOTSTRAP BADGES ************
40
-
41
-
42
- # Gera o Badge DRY
43
- def bootstrap_badge value, type
44
- raw(content_tag :span, value, :class => "badge badge-#{type.to_s}")
45
- end
46
-
47
- def badge_default value
48
- bootstrap_badge value, :default
49
- end
50
-
51
- def badge_success value
52
- bootstrap_badge value, :success
53
- end
54
-
55
- def badge_warning value
56
- bootstrap_badge value, :warning
57
- end
58
-
59
- def badge_important value
60
- bootstrap_badge value, :important
61
- end
62
-
63
- def badge_info value
64
- bootstrap_badge value, :info
65
- end
66
-
67
- def badge_inverse value
68
- bootstrap_badge value, :inverse
69
- end
70
-
71
-
72
- ## TWITTER BOOTSTRAP LABELS ************
73
-
74
-
75
- # Gera o Badge DRY
76
- def bootstrap_label value, type
77
- raw(content_tag :span, value, :class => "label label-#{type.to_s}")
78
- end
79
-
80
- def label_default value
81
- bootstrap_label value, :default
82
- end
83
-
84
- def label_success value
85
- bootstrap_label value, :success
86
- end
87
-
88
- def label_warning value
89
- bootstrap_label value, :warning
90
- end
91
-
92
- def label_important value
93
- bootstrap_label value, :important
94
- end
95
-
96
- def label_info value
97
- bootstrap_label value, :info
98
- end
99
-
100
- def label_inverse value
101
- bootstrap_label value, :inverse
102
- end
103
-
104
- # Cria o Pop-over
105
-
106
- def popover title, content, options={}
107
- options[:rel] = "popover"
108
- options[:data] = { :content => content, "original-title" => title }
109
- link_to icon(:info_sign), "#", options
110
- end
111
-
112
-
113
- # links and buttons
114
-
115
-
116
- def tooltip_link title, link, tooltip, opts={}
117
- opts[:rel] = "tooltip"
118
- opts[:tooltip] = tooltip
119
- link_to title, link, opts
120
- end
121
-
122
-
123
- # Cria um botao base para operações crud
124
- def link_to_icon title, link, ico, opts={}
125
- link_to raw( icon(ico.to_sym) + " " + title ).to_s, link, opts
126
- end
127
-
128
-
129
- # Cria um link simples pra si mesmo
130
- def link_to_self link, opts={}
131
- link_to link, link.to_s.delete('http://').insert(0, 'http://'), opts
132
- end
133
-
134
-
135
- # Cria um link simples pra si mesmo, e abre em uma nova janela
136
- def link_to_self_blank link
137
- link_to_blank link, link
138
- end
139
-
140
-
141
- # Cria um link abrindo uma nova janela, e associa um icone ao final do texto ancora
142
- def link_to_blank title, link, opts={}
143
- opts[:target] = :blank
144
- link_to raw(title + " " + icon(:share_alt)).to_s, link.to_s.delete('http://').insert(0, 'http://'), opts
145
- end
146
-
147
-
148
- # Cria um link basa para as opeções crud
149
- def link_to_crud title, link, ico, opts={}
150
- link_to raw( icon(ico.to_sym) + " " + title ).to_s, link, opts
151
- end
152
-
153
-
154
- # Cria um link para editar registros
155
- def link_to_edit title, link, opts={}
156
- link_to_crud title, link, :pencil, opts
157
- end
158
-
159
-
160
- # Cria um link para cancelar edição de registros
161
- def link_to_cancel title, link, opts={}
162
- link_to_crud title, link, :arrow_left, opts
163
- end
164
-
165
-
166
- # Cria um link para voltar
167
- def link_to_back title, link, opts={}
168
- link_to_cancel title, link, opts
169
- end
170
-
171
-
172
- # Cria um link para novos registros
173
- def link_to_new title, link, opts={}
174
- link_to_crud title, link, :plus, opts
175
- end
176
-
177
-
178
- # Cria um link para apagar registros
179
- def link_to_delete title, link, opts={}
180
- link_to_crud title, link, :trash, method: :delete, data: { confirm: 'Tem certeza que deseja apagar este registro?' }
181
- end
182
-
183
-
184
- # Cria um botao base para operações crud
185
- def button_to_crud title, link, ico, color, opts={}
186
- opts[:class] += " btn "
187
- unless opts[:small].nil? then
188
- opts[:class] += " btn-small "
189
- opts.delete(:small)
190
- end
191
- unless opts[:mini].nil? then
192
- opts[:class] += " btn-mini "
193
- opts.delete(:mini)
194
- end
195
- link_to raw( icon(ico.to_sym, color.to_sym) + " " + title ).to_s, link, opts
196
- end
197
-
198
-
199
- # Cria um botao para novos registros
200
- def button_to_edit title, link, opts={}
201
- opts[:class] = "btn-warning"
202
- button_to_crud title, link, :pencil, :white, opts
203
- end
204
-
205
-
206
- # Cria um botao para novos registros
207
- def button_to_cancel title, link, opts={}
208
- opts[:class] = "btn-default"
209
- button_to_crud title, link, :arrow_left, :black, opts
210
- end
211
-
212
-
213
- # Cria um botao para novos registros
214
- def button_to_new title, link, opts={}
215
- opts[:class] = "btn-primary"
216
- button_to_crud title, link, :plus, :white, opts
217
- end
218
-
219
-
220
- # Cria um botao para novos registros
221
- def button_to_delete title, link, opts={}
222
- opts = {
223
- method: :delete,
224
- data: { confirm: 'Tem certeza que deseja apagar este registro?' }
225
- }
226
- opts[:class] = "btn-danger"
227
- button_to_crud title, link, :trash, :white, opts
228
- end
229
-
230
-
231
- ## TEXT HELPERS
232
-
233
-
234
- # Exibe o texto 'Sim' ou 'Não' para um valor booleano em um Label
235
- def yes_no_label val
236
- if val then
237
- label_success "Sim"
238
- else
239
- label_default "Não"
240
- end
241
- end
242
-
243
-
244
- # Exibe o texto 'Sim' ou 'Não' para um valor booleano em um Label
245
- def active_inactive_label val
246
- if val then
247
- label_success "Ativo"
248
- else
249
- label_important "Inativo"
250
- end
251
- end
252
-
253
-
254
- # Toolbars
255
- def toolbar &block
256
- raw '<div class="well">' +
257
- capture(&block) +
258
- "</div>"
259
- end
260
-
261
-
262
-
263
- # alert_block
264
- def alert_block title, alert_context = :alert, &block
265
- raw '<div class="alert alert-block alert-' + alert_context.to_s + '" >' +
266
- ' <a class="close" data-dismiss="alert" href="#">×</a>' +
267
- ' <h4 class="alert-heading">' + title + '</h4>' +
268
- capture(&block) +
269
- '</div>'
270
- end
271
-
272
-
273
-
274
- # alert_inline
275
- def alert_inline title, alert_context = :alert, &block
276
- raw '<div class="alert alert-' + alert_context.to_s + '" >' +
277
- ' <a class="close" data-dismiss="alert" href="#">×</a>' +
278
- ' <strong class="alert-heading">' + title + '</strong>' +
279
- capture(&block) +
280
- '</div>'
281
- end
282
-
283
-
284
-
285
- # Exibe os Flash Notice
286
- def show_notice
287
- unless notice.nil? then
288
- raw(content_tag :div, (alert_inline "Notificação: ", :info do content_tag(:span, notice) end), :id => "notice")
289
- end
290
- end
291
-
292
-
293
- # SimpleForm + Bootstrap Form Helpers
294
-
295
- # Fieldset + Legend
296
- def fieldset title, &block
297
- raw '<div class="form-inputs"><fieldset><legend>' + title + "</legend>" +
298
- capture(&block) +
299
- "</fieldset></div>"
300
- end
301
-
302
-
303
- # Form Actins
304
- def form_actions_block &block
305
- content_tag(:div, capture(&block), :class => "form-actions" )
306
- end
307
-
308
- # Common Form Actions = Submit Button + Cancel Link
309
- def form_actions form, back_url, submit_title = "Gravar", cancel_title = "Cancelar"
310
- form_actions_block do
311
- (form.button :submit, submit_title) + " " + (link_to cancel_title, back_url)
312
- end
313
- end
314
-
315
-
316
-
317
-
318
- # CSS Grid
319
-
320
-
321
- # Bootstrap Grid Row Fixed
322
- def row options = { :class => "" }, &block
323
- options[:class].insert(-1, " row")
324
- content_tag(:div, capture(&block), options)
325
- end
326
-
327
- # Bootstrap Grid Row Fluid
328
- def row_fluid options = { :class => "" }, &block
329
- options[:class].insert(-1, " row-fluid")
330
- content_tag(:div, capture(&block), options)
331
- end
332
-
333
- # Bootstrap Grid Row Fixed
334
- def span cols, options={}, &block
335
- offset = ""
336
-
337
- unless options[:offset].nil? then offset = " offset#{options[:offset]} " end
338
-
339
- if options[:class].nil? then options[:class] = "" end
340
-
341
- options.delete(:offset)
342
-
343
- options[:class].insert(-1, " span#{cols}" + offset)
344
- content_tag(:div, capture(&block), options)
345
- end
346
-
347
-
348
-
349
-
350
- #Star Rating
351
- def star_rating val=0
352
-
353
- rating = case val
354
- when 0 then 0
355
- when 01..05 then 05
356
- when 06..10 then 10
357
- when 11..15 then 15
358
- when 16..20 then 20
359
- when 21..25 then 25
360
- when 26..30 then 30
361
- when 31..35 then 35
362
- when 36..40 then 40
363
- when 41..45 then 45
364
- when 46..50 then 50
365
- else -1
366
- end
367
-
368
- if rating.to_i >= 0 then
369
- content_tag :span, "", :class => "star-rating rating-#{rating}", :rel => "tooltip", :title => "#{rating} estrelas"
370
- else
371
- content_tag :span, "!!! Entre com um valor entre 0 e 50 (#{rating}) !!!",
372
- end
373
-
374
- end
375
-
376
-
377
-
378
- def page_section_fluid title, options = {}
379
- if options[:class].nil? then options[:class] = "" end
380
- options[:class].insert(-1, " row-fluid")
381
- raw content_tag(:div, (content_tag(:hr) << content_tag(:h3, title) << content_tag(:br)), options)
382
- end
383
-
384
- def page_section title, options = {}
385
- if options[:class].nil? then options[:class] = "" end
386
- options[:class].insert(-1, " row-fluid")
387
- raw content_tag(:div, (content_tag(:h3, title) << content_tag(:br)), options)
388
- end
389
-
390
- end
391
-
392
- end
@@ -1,17 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/orangeweb_bootstrap_helper/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Agencia Orangeweb"]
6
- gem.email = ["luizeof@gmail.com"]
7
- gem.description = %q{Helpers that makes easier the use of Twitter Bootstrap with Ruby on Rails}
8
- gem.summary = %q{Herlpers to make easy use of Bootstrap Tables, Grids, Links, Buttons and more.}
9
- gem.homepage = "http://orangeweb.github.com/orangeweb_bootstrap_helpers/"
10
-
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "orangeweb_bootstrap_helper"
15
- gem.require_paths = ["lib"]
16
- gem.version = OrangewebBootstrapHelper::VERSION
17
- end