twitter_bootstrap_builder 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,18 +1,18 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- .idea
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .idea
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in twitter_bootstrap_builder.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in twitter_bootstrap_builder.gemspec
4
+ gemspec
data/LICENSE CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2012 gabriel
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1
+ Copyright (c) 2012 gabriel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
22
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,29 +1,29 @@
1
- # TwitterBootstrapBuilder
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'twitter_bootstrap_builder'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install twitter_bootstrap_builder
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Added some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
1
+ # TwitterBootstrapBuilder
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'twitter_bootstrap_builder'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install twitter_bootstrap_builder
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -12,7 +12,7 @@ module TwitterBootstrapBuilder
12
12
  end
13
13
 
14
14
  def link_to(*args, &block)
15
- Tag.block(:li, template.link_to(*args, &block)).to_s.html_safe
15
+ Tag.block(:li, template.link_to(*args, &block)).html_safe
16
16
  end
17
17
 
18
18
  end
@@ -19,19 +19,19 @@ module TwitterBootstrapBuilder
19
19
  def actions(&block)
20
20
  actions = Tag.block(:div, class: 'form-actions')
21
21
  actions.append template.capture(self, &block) if block
22
- actions.to_s.html_safe
22
+ actions.html_safe
23
23
  end
24
24
 
25
25
  def display_field(method, options={})
26
26
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method)) do |cg|
27
27
  cg.append Tag.block(:span, model.send(method).to_s.gsub("\n", '<br>'), class: 'display')
28
- end.to_s.html_safe
28
+ end.html_safe
29
29
  end
30
30
 
31
31
  def text_field(method, options={})
32
32
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
33
33
  cg.append form_builder.text_field(method, options)
34
- end.to_s.html_safe
34
+ end.html_safe
35
35
  end
36
36
 
37
37
  TwitterBootstrapMarkup::InputSize::VALUES.each do |size|
@@ -39,14 +39,14 @@ module TwitterBootstrapBuilder
39
39
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
40
40
  options.append!(:class, "input-#{size}")
41
41
  cg.append form_builder.text_field(method, options)
42
- end.to_s.html_safe
42
+ end.html_safe
43
43
  end
44
44
  end
45
45
 
46
46
  def text_area(method, options={})
47
47
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
48
48
  cg.append form_builder.text_area(method, options)
49
- end.to_s.html_safe
49
+ end.html_safe
50
50
  end
51
51
 
52
52
  TwitterBootstrapMarkup::InputSize::VALUES.each do |size|
@@ -54,62 +54,62 @@ module TwitterBootstrapBuilder
54
54
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
55
55
  options.append!(:class, "input-#{size}")
56
56
  cg.append form_builder.text_area(method, options)
57
- end.to_s.html_safe
57
+ end.html_safe
58
58
  end
59
59
  end
60
60
 
61
61
  def email_field(method, options={})
62
62
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
63
63
  cg.append form_builder.email_field(method, options)
64
- end.to_s.html_safe
64
+ end.html_safe
65
65
  end
66
66
 
67
67
  def password_field(method, options={})
68
68
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
69
69
  cg.append form_builder.password_field(method, options)
70
- end.to_s.html_safe
70
+ end.html_safe
71
71
  end
72
72
 
73
73
  def check_box(method, options={})
74
74
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
75
75
  cg.append form_builder.check_box(method, options)
76
- end.to_s.html_safe
76
+ end.html_safe
77
77
  end
78
78
 
79
79
  def hidden_field(method, options={})
80
80
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
81
81
  cg.append form_builder.hidden_field(method, options)
82
- end.to_s.html_safe
82
+ end.html_safe
83
83
  end
84
84
 
85
85
  def select(method, choices, options={}, html_options={})
86
86
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
87
87
  cg.append form_builder.select(method, choices, options, html_options)
88
- end.to_s.html_safe
88
+ end.html_safe
89
89
  end
90
90
 
91
91
  def date_select(method, options={}, html_options={})
92
92
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
93
93
  cg.append form_builder.date_select(method, form_builder.send('objectify_options', options), html_options)
94
- end.to_s.html_safe
94
+ end.html_safe
95
95
  end
96
96
 
97
97
  def time_select(method, options={}, html_options={})
98
98
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
99
99
  cg.append form_builder.time_select(method, form_builder.send('objectify_options', options), html_options)
100
- end.to_s.html_safe
100
+ end.html_safe
101
101
  end
102
102
 
103
103
  def datetime_select(method, options={}, html_options={})
104
104
  ControlGroup.new(options[:label] || model.class.human_attribute_name(method), for: "#{form_builder.object_name}_#{method}") do |cg|
105
105
  cg.append form_builder.datetime_select(method, form_builder.send('objectify_options', options), html_options)
106
- end.to_s.html_safe
106
+ end.html_safe
107
107
  end
108
108
 
109
109
  def custom_field(label, options={}, &block)
110
110
  ControlGroup.new(label, options) do |cg|
111
111
  cg.append template.capture(self, &block) if block
112
- end.to_s.html_safe
112
+ end.html_safe
113
113
  end
114
114
 
115
115
  end
@@ -9,7 +9,7 @@ module TwitterBootstrapBuilder
9
9
  end
10
10
 
11
11
  def brand(title, url)
12
- Brand.new(title, url).to_s.html_safe
12
+ Brand.new(title, url).html_safe
13
13
  end
14
14
 
15
15
  def container(&block)
@@ -14,24 +14,24 @@ module TwitterBootstrapBuilder
14
14
  if options[:active_if].is_a?(Proc) ? options[:active_if].call : options[:active_if]
15
15
  active_link_to(*args, &block)
16
16
  else
17
- Tag.block(:li, template.link_to(*args, &block)).to_s.html_safe
17
+ Tag.block(:li, template.link_to(*args, &block)).html_safe
18
18
  end
19
19
  end
20
20
 
21
21
  def active_link_to(*args, &block)
22
- Tag.block(:li, template.link_to(*args, &block), class: 'active').to_s.html_safe
22
+ Tag.block(:li, template.link_to(*args, &block), class: 'active').html_safe
23
23
  end
24
24
 
25
25
  def divider
26
- Tag.block(:li, Divider.vertical).to_s.html_safe
26
+ Tag.block(:li, Divider.vertical).html_safe
27
27
  end
28
28
 
29
29
  def dropdown_link(text, &block)
30
- Tag.block(:li, DropDownLinkBuilder.new(template, text: text, &block).html_safe).to_s.html_safe
30
+ Tag.block(:li, DropDownLinkBuilder.new(template, text: text, &block).html_safe).html_safe
31
31
  end
32
32
 
33
33
  def custom(&block)
34
- Tag.block(:li, Tag.block(:a, template.capture(self, &block))).to_s.html_safe
34
+ Tag.block(:li, Tag.block(:a, template.capture(self, &block))).html_safe
35
35
  end
36
36
 
37
37
  end
@@ -9,7 +9,7 @@ module TwitterBootstrapBuilder
9
9
  end
10
10
 
11
11
  def header(text)
12
- NavHeader.new(text).to_s.html_safe
12
+ NavHeader.new(text).html_safe
13
13
  end
14
14
 
15
15
  def link_to(*args, &block)
@@ -17,20 +17,20 @@ module TwitterBootstrapBuilder
17
17
  if options[:active_if].is_a?(Proc) ? options[:active_if].call : options[:active_if]
18
18
  active_link_to(*args, &block)
19
19
  else
20
- Tag.block(:li, template.link_to(*args, &block)).to_s.html_safe
20
+ Tag.block(:li, template.link_to(*args, &block)).html_safe
21
21
  end
22
22
  end
23
23
 
24
24
  def active_link_to(*args, &block)
25
- Tag.block(:li, template.link_to(*args, &block), class: 'active').to_s.html_safe
25
+ Tag.block(:li, template.link_to(*args, &block), class: 'active').html_safe
26
26
  end
27
27
 
28
28
  def divider
29
- Tag.block(:li, Divider.horizontal).to_s.html_safe
29
+ Tag.block(:li, Divider.horizontal).html_safe
30
30
  end
31
31
 
32
32
  def custom(&block)
33
- Tag.block(:li, template.capture(self, &block)).to_s.html_safe
33
+ Tag.block(:li, template.capture(self, &block)).html_safe
34
34
  end
35
35
 
36
36
  end
@@ -4,7 +4,7 @@ module TwitterBootstrapBuilder
4
4
 
5
5
  def initialize(*args, &block)
6
6
  super
7
- @fields = []
7
+ @fields = {}
8
8
  end
9
9
 
10
10
  def to_s
@@ -18,7 +18,7 @@ module TwitterBootstrapBuilder
18
18
  end
19
19
  end
20
20
  data.append pager
21
- end.to_s.html_safe
21
+ end.html_safe
22
22
  end
23
23
 
24
24
  def collection
@@ -29,8 +29,8 @@ module TwitterBootstrapBuilder
29
29
  options[:model_class] || collection.klass
30
30
  end
31
31
 
32
- def field(method)
33
- @fields << method
32
+ def field(method, &block)
33
+ @fields[method] = block
34
34
  nil
35
35
  end
36
36
 
@@ -46,7 +46,7 @@ module TwitterBootstrapBuilder
46
46
  thead.append do |h|
47
47
  Tag.block(:tr) do |tr|
48
48
  tr.append Tag.block(:th)
49
- @fields.each do |field|
49
+ @fields.keys.each do |field|
50
50
  tr.append Tag.block(:th, model_class.human_attribute_name(field))
51
51
  end
52
52
  end
@@ -60,8 +60,8 @@ module TwitterBootstrapBuilder
60
60
  tbody.append do |b|
61
61
  Tag.block(:tr) do |tr|
62
62
  tr.append Tag.block(:td, template.capture(model, &@actions_block), class: 'actions') if @actions_block
63
- @fields.each do |field|
64
- tr.append Tag.block(:td, model.send(field))
63
+ @fields.each do |field, block|
64
+ tr.append Tag.block(:td, (block ? template.capture(model, &block) : model.send(field)))
65
65
  end
66
66
  end
67
67
  end
@@ -0,0 +1,7 @@
1
+ module TwitterBootstrapMarkup
2
+ class Tag
3
+ def html_safe
4
+ to_s.html_safe
5
+ end
6
+ end
7
+ end
@@ -12,7 +12,7 @@ module TwitterBootstrapBuilder
12
12
 
13
13
  def page_header(*args)
14
14
  if args.any?
15
- content_for(:page_header, TwitterBootstrapMarkup::PageHeader.new(args.shift, args.shift).to_s.html_safe)
15
+ content_for(:page_header, TwitterBootstrapMarkup::PageHeader.new(args.shift, args.shift).html_safe)
16
16
  else
17
17
  content_for?(:page_header) ? content_for(:page_header) : nil
18
18
  end
@@ -59,7 +59,7 @@ module TwitterBootstrapBuilder
59
59
  def well(size=nil, &block)
60
60
  well = TwitterBootstrapMarkup::Well.new(capture(&block))
61
61
  well.send(size) if size
62
- well.to_s.html_safe
62
+ well.html_safe
63
63
  end
64
64
 
65
65
  def well_small(&block)
@@ -76,7 +76,7 @@ module TwitterBootstrapBuilder
76
76
 
77
77
  TwitterBootstrapMarkup::Alert::TYPES.each do |type|
78
78
  define_method "alert_#{type}" do |message|
79
- content_for(:alert_message, TwitterBootstrapMarkup::Alert.new(message).send(type).closable.to_s.html_safe)
79
+ content_for(:alert_message, TwitterBootstrapMarkup::Alert.new(message).send(type).closable.html_safe)
80
80
  end
81
81
  end
82
82
 
@@ -93,20 +93,20 @@ module TwitterBootstrapBuilder
93
93
  end
94
94
 
95
95
  def icon(name)
96
- TwitterBootstrapMarkup::Icon.new(name).to_s.html_safe
96
+ TwitterBootstrapMarkup::Icon.new(name).html_safe
97
97
  end
98
98
 
99
99
  def icon_white(name)
100
- TwitterBootstrapMarkup::Icon.white(name).to_s.html_safe
100
+ TwitterBootstrapMarkup::Icon.white(name).html_safe
101
101
  end
102
102
 
103
103
  TwitterBootstrapMarkup::LabelBase::TYPES.each do |type|
104
104
  define_method "label_#{type}" do |text|
105
- TwitterBootstrapMarkup::Label.send(type, text).to_s.html_safe
105
+ TwitterBootstrapMarkup::Label.send(type, text).html_safe
106
106
  end
107
107
 
108
108
  define_method "badge_#{type}" do |text|
109
- TwitterBootstrapMarkup::Badge.send(type, text).to_s.html_safe
109
+ TwitterBootstrapMarkup::Badge.send(type, text).html_safe
110
110
  end
111
111
  end
112
112
 
@@ -1,3 +1,3 @@
1
1
  module TwitterBootstrapBuilder
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -4,6 +4,8 @@ require 'twitter_bootstrap_builder/engine'
4
4
  require 'twitter_bootstrap_markup'
5
5
  require 'kaminari'
6
6
 
7
+ require 'twitter_bootstrap_builder/extensions/twitter_bootstrap_markup'
8
+
7
9
  require 'twitter_bootstrap_builder/helpers/commons_helper'
8
10
  require 'twitter_bootstrap_builder/helpers/buttons_helper'
9
11
  require 'twitter_bootstrap_builder/helpers/dropdowns_helper'
@@ -20,4 +20,8 @@ Array.prototype.uniq = function () {
20
20
  return this.filter(function (itm, i, a) {
21
21
  return i == a.indexOf(itm);
22
22
  });
23
- };
23
+ };
24
+
25
+ jQuery(function ($) {
26
+ $("[rel=popover]").popover();
27
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_bootstrap_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-23 00:00:00.000000000 Z
12
+ date: 2012-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twitter_bootstrap_markup
16
- requirement: &28680948 !ruby/object:Gem::Requirement
16
+ requirement: &25945224 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *28680948
24
+ version_requirements: *25945224
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: kaminari
27
- requirement: &28680696 !ruby/object:Gem::Requirement
27
+ requirement: &25944816 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *28680696
35
+ version_requirements: *25944816
36
36
  description: Set of helpers to extend Rails for implement Twitter Bootstrap markup
37
37
  email:
38
38
  - gabynaiman@gmail.com
@@ -67,6 +67,7 @@ files:
67
67
  - lib/twitter_bootstrap_builder/builders/tab_builder.rb
68
68
  - lib/twitter_bootstrap_builder/builders/table_builder.rb
69
69
  - lib/twitter_bootstrap_builder/engine.rb
70
+ - lib/twitter_bootstrap_builder/extensions/twitter_bootstrap_markup.rb
70
71
  - lib/twitter_bootstrap_builder/helpers/buttons_helper.rb
71
72
  - lib/twitter_bootstrap_builder/helpers/commons_helper.rb
72
73
  - lib/twitter_bootstrap_builder/helpers/dropdowns_helper.rb