twitter-bootstrap-markup-rails 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTORS.md +1 -0
- data/README.md +27 -2
- data/lib/twitter-bootstrap-markup-rails.rb +1 -0
- data/lib/twitter-bootstrap-markup-rails/components.rb +1 -0
- data/lib/twitter-bootstrap-markup-rails/components/alert.rb +13 -7
- data/lib/twitter-bootstrap-markup-rails/components/button.rb +9 -9
- data/lib/twitter-bootstrap-markup-rails/components/button_dropdown.rb +16 -5
- data/lib/twitter-bootstrap-markup-rails/components/inline_label.rb +9 -3
- data/lib/twitter-bootstrap-markup-rails/components/modal.rb +57 -0
- data/lib/twitter-bootstrap-markup-rails/engine.rb +1 -0
- data/lib/twitter-bootstrap-markup-rails/helper_collection_set.rb +18 -0
- data/lib/twitter-bootstrap-markup-rails/helpers.rb +1 -0
- data/lib/twitter-bootstrap-markup-rails/helpers/alert_helpers.rb +6 -5
- data/lib/twitter-bootstrap-markup-rails/helpers/button_helpers.rb +8 -6
- data/lib/twitter-bootstrap-markup-rails/helpers/inline_label_helpers.rb +3 -1
- data/lib/twitter-bootstrap-markup-rails/helpers/modal_helpers.rb +53 -0
- data/lib/twitter-bootstrap-markup-rails/version.rb +1 -1
- data/spec/helpers/alert_helpers_spec.rb +5 -0
- data/spec/helpers/button_helpers_spec.rb +23 -0
- data/spec/helpers/inline_label_helpers_spec.rb +5 -0
- data/spec/helpers/modal_helpers_spec.rb +60 -0
- data/spec/support/bootstrap_button_macros.rb +2 -2
- data/spec/support/bootstrap_modal_macros.rb +8 -0
- data/twitter-bootstrap-markup-rails.gemspec +1 -1
- metadata +11 -4
data/CONTRIBUTORS.md
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<table>
|
4
4
|
<tr>
|
5
5
|
<th>Version</th>
|
6
|
-
<td>v0.
|
6
|
+
<td>v0.3.0</td>
|
7
7
|
</tr>
|
8
8
|
<tr>
|
9
9
|
<th>Build Status</th>
|
@@ -26,7 +26,7 @@ This gem focuses on making it easier to use Twitter's Bootstrap 2.0. It's a coll
|
|
26
26
|
|
27
27
|
Add to your `Gemfile`:
|
28
28
|
|
29
|
-
gem 'twitter-bootstrap-markup-rails', '0.
|
29
|
+
gem 'twitter-bootstrap-markup-rails', '0.3.0'
|
30
30
|
|
31
31
|
## Currently Supported
|
32
32
|
|
@@ -154,6 +154,31 @@ Stacked pills example:
|
|
154
154
|
</li>
|
155
155
|
</ul>
|
156
156
|
|
157
|
+
Modal popup example:
|
158
|
+
|
159
|
+
bootstrap_modal(dom_id: 'a_dom_id', fade: true, header_title: "I'm a bootstrap modal popup") do |modal|
|
160
|
+
modal.body do |c|
|
161
|
+
c.content_tag :div, "the body"
|
162
|
+
end
|
163
|
+
modal.footer do |f|
|
164
|
+
f.bootstrap_button "Save", "/link1", :type => 'btn-primary'
|
165
|
+
f.bootstrap_button "Cancel", "/link2"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
# => <div class="modal fade" id="a_dom_id">
|
169
|
+
<div class="modal-header">
|
170
|
+
<a class="close" data-dismiss="modal">×</a>
|
171
|
+
<h3>I'm a bootstrap modal popup</h3>
|
172
|
+
</div>
|
173
|
+
<div class="modal-body">
|
174
|
+
<div>the body</div>
|
175
|
+
</div>
|
176
|
+
<div class="modal-footer">
|
177
|
+
<a class="btn btn-primary" href="/link1">Save</a>
|
178
|
+
<a class="btn" href="/link2">Cancel</a></div>
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
|
157
182
|
Plugins
|
158
183
|
---
|
159
184
|
|
@@ -7,6 +7,7 @@ module Twitter
|
|
7
7
|
require "twitter-bootstrap-markup-rails/version"
|
8
8
|
|
9
9
|
require "twitter-bootstrap-markup-rails/helper_collection"
|
10
|
+
require "twitter-bootstrap-markup-rails/helper_collection_set"
|
10
11
|
|
11
12
|
autoload :Helpers, "twitter-bootstrap-markup-rails/helpers"
|
12
13
|
autoload :Components, "twitter-bootstrap-markup-rails/components"
|
@@ -8,6 +8,7 @@ module Twitter::Bootstrap::Markup::Rails
|
|
8
8
|
autoload :Button, 'twitter-bootstrap-markup-rails/components/button'
|
9
9
|
autoload :ButtonDropdown, 'twitter-bootstrap-markup-rails/components/button_dropdown'
|
10
10
|
autoload :Navigation, 'twitter-bootstrap-markup-rails/components/navigation'
|
11
|
+
autoload :Modal, 'twitter-bootstrap-markup-rails/components/modal'
|
11
12
|
end
|
12
13
|
end
|
13
14
|
|
@@ -8,7 +8,7 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_s
|
11
|
-
output_buffer << content_tag(:div,
|
11
|
+
output_buffer << content_tag(:div, build_div_options) do
|
12
12
|
html = ""
|
13
13
|
html << build_close_tag.html_safe if options[:close]
|
14
14
|
html << build_heading_tag.html_safe if options[:heading]
|
@@ -21,12 +21,13 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
21
21
|
private
|
22
22
|
def default_options
|
23
23
|
{
|
24
|
-
:class
|
25
|
-
:block
|
26
|
-
:close
|
27
|
-
:heading
|
28
|
-
:dismiss
|
29
|
-
:type
|
24
|
+
:class => "alert",
|
25
|
+
:block => false,
|
26
|
+
:close => true,
|
27
|
+
:heading => nil,
|
28
|
+
:dismiss => true,
|
29
|
+
:type => nil,
|
30
|
+
:html_options => {}
|
30
31
|
}
|
31
32
|
end
|
32
33
|
|
@@ -52,6 +53,11 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
52
53
|
opts
|
53
54
|
end
|
54
55
|
|
56
|
+
def build_div_options
|
57
|
+
opts = { :class => build_class }
|
58
|
+
opts.reverse_merge(options[:html_options])
|
59
|
+
end
|
60
|
+
|
55
61
|
def build_class
|
56
62
|
classes = %w(alert)
|
57
63
|
classes << "alert-block" if options[:block]
|
@@ -21,12 +21,13 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
21
21
|
private
|
22
22
|
def default_options
|
23
23
|
{
|
24
|
-
:class
|
25
|
-
:type
|
26
|
-
:disabled
|
27
|
-
:icon_white
|
28
|
-
:dropdown
|
29
|
-
:id
|
24
|
+
:class => "btn",
|
25
|
+
:type => [],
|
26
|
+
:disabled => false,
|
27
|
+
:icon_white => false,
|
28
|
+
:dropdown => false,
|
29
|
+
:id => nil,
|
30
|
+
:html_options => {}
|
30
31
|
}
|
31
32
|
end
|
32
33
|
|
@@ -59,8 +60,7 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
59
60
|
ops = {:href => @link, :class => build_class}
|
60
61
|
ops[:"data-toggle"] = 'dropdown' if options[:dropdown]
|
61
62
|
ops[:id] = options[:id] if options[:id]
|
62
|
-
ops
|
63
|
+
ops.reverse_merge(options[:html_options])
|
63
64
|
end
|
64
65
|
end
|
65
|
-
end
|
66
|
-
|
66
|
+
end
|
@@ -8,7 +8,8 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_s
|
11
|
-
|
11
|
+
div_options = {:class => build_class}
|
12
|
+
output_buffer << content_tag(:div, div_options.reverse_merge(options[:html_options])) do
|
12
13
|
html=''
|
13
14
|
html << build_dropdown
|
14
15
|
|
@@ -27,17 +28,27 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
27
28
|
|
28
29
|
private
|
29
30
|
def default_options
|
30
|
-
{
|
31
|
+
{
|
32
|
+
:html_options => {}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def build_class
|
37
|
+
classes = %w(btn-group)
|
38
|
+
classes << options[:html_options][:class] if options[:html_options][:class]
|
39
|
+
classes.join(" ")
|
31
40
|
end
|
32
41
|
|
33
42
|
def build_dropdown
|
43
|
+
html = ''
|
44
|
+
|
34
45
|
if @elements.size > 0
|
35
46
|
dropdown = @elements.shift
|
36
47
|
dropdown.options[:dropdown] = true
|
37
|
-
dropdown.to_s
|
38
|
-
else
|
39
|
-
''
|
48
|
+
html << dropdown.to_s
|
40
49
|
end
|
50
|
+
|
51
|
+
html
|
41
52
|
end
|
42
53
|
end
|
43
54
|
end
|
@@ -8,15 +8,16 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_s
|
11
|
-
output_buffer << content_tag(:span, message,
|
11
|
+
output_buffer << content_tag(:span, message, build_tag_options).html_safe
|
12
12
|
super
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
def default_options
|
17
17
|
{
|
18
|
-
:class
|
19
|
-
:type
|
18
|
+
:class => "label",
|
19
|
+
:type => nil,
|
20
|
+
:html_options => {}
|
20
21
|
}
|
21
22
|
end
|
22
23
|
|
@@ -25,6 +26,11 @@ module Twitter::Bootstrap::Markup::Rails::Components
|
|
25
26
|
classes << options[:type] if options[:type]
|
26
27
|
classes.join(" ")
|
27
28
|
end
|
29
|
+
|
30
|
+
def build_tag_options
|
31
|
+
ops = {:class => build_class}
|
32
|
+
ops.reverse_merge(options[:html_options])
|
33
|
+
end
|
28
34
|
end
|
29
35
|
end
|
30
36
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Twitter::Bootstrap::Markup::Rails::Components
|
2
|
+
class Modal < Base
|
3
|
+
attr_reader :collection
|
4
|
+
|
5
|
+
def initialize(body_elements, footer_elements, options = {})
|
6
|
+
super
|
7
|
+
@body_elements = body_elements
|
8
|
+
@footer_elements = footer_elements
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
output_buffer << content_tag(:div, :id => options[:dom_id], :class => modal_classes) do
|
13
|
+
html=''
|
14
|
+
html << build_header
|
15
|
+
html << build_body
|
16
|
+
html << build_footer
|
17
|
+
html.html_safe
|
18
|
+
end
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def default_options
|
24
|
+
{:dom_id => 'twitter-bootstrap-modal', :fade => false, :header_title => ''}
|
25
|
+
end
|
26
|
+
|
27
|
+
def modal_classes
|
28
|
+
classes = %w(modal)
|
29
|
+
classes.push 'fade' if options[:fade]
|
30
|
+
classes.join " "
|
31
|
+
end
|
32
|
+
|
33
|
+
def build_header
|
34
|
+
content_tag(:div, :class => "modal-header") do
|
35
|
+
content_tag(:a, "×".html_safe, :class => 'close', :"data-dismiss" => "modal" ) + content_tag(:h3, options[:header_title])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def build_body
|
40
|
+
html = ''
|
41
|
+
@body_elements.each do |e|
|
42
|
+
html << e.to_s
|
43
|
+
end
|
44
|
+
content_tag(:div, html.html_safe, :class => "modal-body")
|
45
|
+
end
|
46
|
+
|
47
|
+
def build_footer
|
48
|
+
html = ''
|
49
|
+
@footer_elements.each do |e|
|
50
|
+
html << e.to_s
|
51
|
+
end
|
52
|
+
content_tag(:div, html.html_safe, :class => "modal-footer")
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
@@ -9,6 +9,7 @@ module Twitter::Bootstrap::Markup::Rails
|
|
9
9
|
include Twitter::Bootstrap::Markup::Rails::Helpers::FormHelpers
|
10
10
|
include Twitter::Bootstrap::Markup::Rails::Helpers::ButtonHelpers
|
11
11
|
include Twitter::Bootstrap::Markup::Rails::Helpers::NavigationHelpers
|
12
|
+
include Twitter::Bootstrap::Markup::Rails::Helpers::ModalHelpers
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Twitter::Bootstrap::Markup::Rails
|
2
|
+
class HelperCollectionSet
|
3
|
+
attr_accessor :collections
|
4
|
+
|
5
|
+
def initialize(view, items)
|
6
|
+
@collections = {}
|
7
|
+
items.each do |item|
|
8
|
+
@collections[item] = Twitter::Bootstrap::Markup::Rails::HelperCollection.new(view)
|
9
|
+
instance_eval <<-EOF
|
10
|
+
def #{item}
|
11
|
+
yield @collections[#{item.inspect}]
|
12
|
+
end
|
13
|
+
EOF
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -5,6 +5,7 @@ module Twitter::Bootstrap::Markup::Rails
|
|
5
5
|
autoload :FormHelpers, 'twitter-bootstrap-markup-rails/helpers/form_helpers'
|
6
6
|
autoload :ButtonHelpers, 'twitter-bootstrap-markup-rails/helpers/button_helpers'
|
7
7
|
autoload :NavigationHelpers, 'twitter-bootstrap-markup-rails/helpers/navigation_helpers'
|
8
|
+
autoload :ModalHelpers, 'twitter-bootstrap-markup-rails/helpers/modal_helpers'
|
8
9
|
end
|
9
10
|
end
|
10
11
|
|
@@ -6,11 +6,12 @@ module Twitter::Bootstrap::Markup::Rails::Helpers
|
|
6
6
|
#
|
7
7
|
# @param [String] message message to be displayed
|
8
8
|
# @param [Hash] options hash containing options (default: {}):
|
9
|
-
# :block
|
10
|
-
# :close
|
11
|
-
# :heading
|
12
|
-
# :dismiss
|
13
|
-
# :type
|
9
|
+
# :block - The Boolean whether to display as a block (optional)
|
10
|
+
# :close - The Boolean whether to render close button
|
11
|
+
# :heading - The String heading message to render
|
12
|
+
# :dismiss - The Boolean whether to add dismiss attribute
|
13
|
+
# :type - The String type of alert to display: error, success or info
|
14
|
+
# :html_options - Any additional HTML options desired on the alert DIV.
|
14
15
|
#
|
15
16
|
# Examples
|
16
17
|
#
|
@@ -7,12 +7,14 @@ module Twitter::Bootstrap::Markup::Rails::Helpers
|
|
7
7
|
# @param [String] text for the button face
|
8
8
|
# @param [String] link for the button href
|
9
9
|
# @param [Hash] options hash containing options (default: {}):
|
10
|
-
# :type
|
11
|
-
#
|
12
|
-
# :disabled
|
13
|
-
# :icon
|
14
|
-
# :icon_white
|
15
|
-
# :id
|
10
|
+
# :type - Additional button type(s). For one, just specify a string, but
|
11
|
+
# you can also pass an array (of sym or str) for multiple classes
|
12
|
+
# :disabled - Will disable the button if set to true
|
13
|
+
# :icon - Specify an icon class from bootstrap to prepend
|
14
|
+
# :icon_white - Specify true if you want the icon to be white
|
15
|
+
# :id - Assign an ID to the button
|
16
|
+
# :html_options - Any additional options you'd like to pass to the content_tag that will be created
|
17
|
+
# for this button's a tag (for instance :target can be specified in :html_options).
|
16
18
|
#
|
17
19
|
# Examples
|
18
20
|
#
|
@@ -5,7 +5,9 @@ module Twitter::Bootstrap::Markup::Rails::Helpers
|
|
5
5
|
#
|
6
6
|
# @param [String] message message to be displayed
|
7
7
|
# @param [Hash] options hash containing options (default: {}):
|
8
|
-
# :type
|
8
|
+
# :type - The String type of alert to display: success warning important notice
|
9
|
+
# :html_options - Any additional options you'd like to pass to the span tag that will be created
|
10
|
+
# for this label (for instance :"data-whatever" can be specified in :html_options).
|
9
11
|
#
|
10
12
|
# Examples
|
11
13
|
#
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Twitter::Bootstrap::Markup::Rails::Helpers
|
4
|
+
module ModalHelpers
|
5
|
+
|
6
|
+
# Render a modal popup
|
7
|
+
#
|
8
|
+
# @param [Hash] options hash containing options (default: { :dom_id => 'twitter-bootstrap-modal', :fade => false, :header_title => '' }):
|
9
|
+
# :dom_id - DOM ID of the modal element (mandatory).
|
10
|
+
# :fade - if true, add the fade class to the modal DOM element so the modal will be animated when shown.
|
11
|
+
# :header_title - modal title.
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# bootstrap_modal(dom_id: 'a_dom_id', fade: true, header_title: "I'm a bootstrap modal popup") do |modal|
|
15
|
+
# modal.body do |c|
|
16
|
+
# c."some content"
|
17
|
+
# end
|
18
|
+
# modal.footer do |f|
|
19
|
+
# f.bootstrap_button "Save", "url", :type => 'btn-primary'
|
20
|
+
# f.bootstrap_button "Cancel", "url"
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# @example With HAML
|
25
|
+
# =bootstrap_modal(dom_id: 'a_dom_id', fade: true, header_title: "I'm a bootstrap modal popup") do |modal|
|
26
|
+
# -modal.body do |c|
|
27
|
+
# -c.content_tag :div do
|
28
|
+
# %p="some text"
|
29
|
+
# %div.a_class="another_text"
|
30
|
+
# =link_to "link", "#"
|
31
|
+
# -modal.footer do |f|
|
32
|
+
# -f.bootstrap_button "Save", "url", :type => 'btn-primary'
|
33
|
+
# -f.bootstrap_button "Cancel", "url"
|
34
|
+
#
|
35
|
+
# @example To render the button to show the modal use:
|
36
|
+
# =bootstrap_button "Show Modal", "#a_dom_id", :html_options => {:"data-toggle" => "modal"}
|
37
|
+
#
|
38
|
+
# Returns HTML String for the modal popup
|
39
|
+
|
40
|
+
def bootstrap_modal(options = {})
|
41
|
+
elements = Twitter::Bootstrap::Markup::Rails::HelperCollectionSet.new(self, [:body, :footer])
|
42
|
+
|
43
|
+
yield elements
|
44
|
+
|
45
|
+
Twitter::Bootstrap::Markup::Rails::Components::Modal.new(
|
46
|
+
elements.collections[:body],
|
47
|
+
elements.collections[:footer],
|
48
|
+
options
|
49
|
+
).to_s
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
end
|
@@ -49,6 +49,11 @@ describe Twitter::Bootstrap::Markup::Rails::Helpers::AlertHelpers do
|
|
49
49
|
concat bootstrap_alert_tag("Message", :heading => "Heading1", :block => false)
|
50
50
|
output_buffer.should have_tag('div strong', /Heading1/)
|
51
51
|
end
|
52
|
+
|
53
|
+
it "should add html_options to the resulting DIV tag when specified" do
|
54
|
+
concat bootstrap_alert_tag("Message", :html_options => {:"data-test" => "42"})
|
55
|
+
output_buffer.should have_tag("div[data-test='42']")
|
56
|
+
end
|
52
57
|
end
|
53
58
|
|
54
59
|
%w(error success info).each do |type|
|
@@ -56,6 +56,11 @@ describe Twitter::Bootstrap::Markup::Rails::Helpers::ButtonHelpers do
|
|
56
56
|
concat bootstrap_button("Text", "#", :id => "foo")
|
57
57
|
output_buffer.should have_tag("a#foo")
|
58
58
|
end
|
59
|
+
|
60
|
+
it "should add html_options to the resulting a tag when specified" do
|
61
|
+
concat bootstrap_button("Text", "#", :html_options => {:target => "_top"})
|
62
|
+
output_buffer.should have_tag("a[target='_top']")
|
63
|
+
end
|
59
64
|
end
|
60
65
|
|
61
66
|
|
@@ -75,5 +80,23 @@ describe Twitter::Bootstrap::Markup::Rails::Helpers::ButtonHelpers do
|
|
75
80
|
div.should have_tag('ul.dropdown-menu a')
|
76
81
|
end
|
77
82
|
end
|
83
|
+
|
84
|
+
it "should properly merge html_options into the container div" do
|
85
|
+
build_bootstrap_button_dropdown(:html_options => {:id => "foo"}) do |d|
|
86
|
+
d.bootstrap_button "Button Text", "#"
|
87
|
+
d.link_to "This", "#"
|
88
|
+
end
|
89
|
+
|
90
|
+
output_buffer.should have_tag('div.btn-group#foo')
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should properly add classes from html_options onto the container div" do
|
94
|
+
build_bootstrap_button_dropdown(:html_options => {:class => "foo"}) do |d|
|
95
|
+
d.bootstrap_button "Button Text", "#"
|
96
|
+
d.link_to "This", "#"
|
97
|
+
end
|
98
|
+
|
99
|
+
output_buffer.should have_tag('div.btn-group.foo')
|
100
|
+
end
|
78
101
|
end
|
79
102
|
end
|
@@ -17,6 +17,11 @@ describe Twitter::Bootstrap::Markup::Rails::Helpers::InlineLabelHelpers do
|
|
17
17
|
concat bootstrap_inline_label_tag("Hi There")
|
18
18
|
output_buffer.should have_tag("span", "Hi There")
|
19
19
|
end
|
20
|
+
|
21
|
+
it "should add html_options to the resulting SPAN tag when specified" do
|
22
|
+
concat bootstrap_inline_label_tag("Testing", :html_options => {:"data-test" => "42"})
|
23
|
+
output_buffer.should have_tag("span[data-test='42']")
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
%w(success warning important notice).each do |type|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Twitter::Bootstrap::Markup::Rails::Helpers::ModalHelpers do
|
5
|
+
include BootstrapSpecHelper
|
6
|
+
include BootstrapModalMacros
|
7
|
+
|
8
|
+
describe "#bootstrap_modal" do
|
9
|
+
before do
|
10
|
+
@output_buffer = ''
|
11
|
+
build_bootstrap_modal(:dom_id => "an_id", :fade => true, :header_title => "a title") do |modal|
|
12
|
+
modal.body do |body|
|
13
|
+
body.content_tag :div, "the body"
|
14
|
+
end
|
15
|
+
modal.footer do |footer|
|
16
|
+
footer.content_tag :div, "the footer"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should create a modal popup with header, body and footer" do
|
22
|
+
output_buffer.should have_tag('div.modal') do |div|
|
23
|
+
div.should have_tag('div.modal-header')
|
24
|
+
div.should have_tag('div.modal-body')
|
25
|
+
div.should have_tag('div.modal-footer')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should create a modal popup with the given DOM ID" do
|
30
|
+
output_buffer.should have_tag('div.modal#an_id')
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should create a modal popup with the CSS class set if fade was passed" do
|
34
|
+
output_buffer.should have_tag('div.modal.fade#an_id')
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should create a modal popup with the given header title" do
|
38
|
+
output_buffer.should have_tag('div.modal#an_id') do |div|
|
39
|
+
div.should have_tag("h3", :text => "a title")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should create a modal popup with the given body content placed" do
|
44
|
+
output_buffer.should have_tag('div.modal#an_id') do |div|
|
45
|
+
div.should have_tag("div.modal-body") do |body|
|
46
|
+
body.should have_tag("div", :text => "the body")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should create a modal popup with the given footer content placed" do
|
52
|
+
output_buffer.should have_tag('div.modal#an_id') do |div|
|
53
|
+
div.should have_tag("div.modal-footer") do |body|
|
54
|
+
body.should have_tag("div", :text => "the footer")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module BootstrapButtonMacros
|
2
|
-
def build_bootstrap_button_dropdown(&block)
|
3
|
-
dropdown = bootstrap_button_dropdown do |d|
|
2
|
+
def build_bootstrap_button_dropdown(options = {}, &block)
|
3
|
+
dropdown = bootstrap_button_dropdown(options) do |d|
|
4
4
|
block.call d
|
5
5
|
end
|
6
6
|
concat dropdown
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["piotr@layer22.com"]
|
7
7
|
gem.description = %q{Ruby on Rails helpers for Bootstrap 2.0 - HTML, CSS, and JS toolkit from Twitter}
|
8
8
|
gem.summary = %q{Ruby on Rails helpers for Bootstrap 2.0 - HTML, CSS, and JS toolkit from Twitter}
|
9
|
-
gem.homepage = "
|
9
|
+
gem.homepage = "http://pusewicz.github.com/twitter-bootstrap-markup-rails"
|
10
10
|
|
11
11
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
12
|
gem.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-bootstrap-markup-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
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-
|
12
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -214,14 +214,17 @@ files:
|
|
214
214
|
- lib/twitter-bootstrap-markup-rails/components/form/label.rb
|
215
215
|
- lib/twitter-bootstrap-markup-rails/components/form_builder.rb
|
216
216
|
- lib/twitter-bootstrap-markup-rails/components/inline_label.rb
|
217
|
+
- lib/twitter-bootstrap-markup-rails/components/modal.rb
|
217
218
|
- lib/twitter-bootstrap-markup-rails/components/navigation.rb
|
218
219
|
- lib/twitter-bootstrap-markup-rails/engine.rb
|
219
220
|
- lib/twitter-bootstrap-markup-rails/helper_collection.rb
|
221
|
+
- lib/twitter-bootstrap-markup-rails/helper_collection_set.rb
|
220
222
|
- lib/twitter-bootstrap-markup-rails/helpers.rb
|
221
223
|
- lib/twitter-bootstrap-markup-rails/helpers/alert_helpers.rb
|
222
224
|
- lib/twitter-bootstrap-markup-rails/helpers/button_helpers.rb
|
223
225
|
- lib/twitter-bootstrap-markup-rails/helpers/form_helpers.rb
|
224
226
|
- lib/twitter-bootstrap-markup-rails/helpers/inline_label_helpers.rb
|
227
|
+
- lib/twitter-bootstrap-markup-rails/helpers/modal_helpers.rb
|
225
228
|
- lib/twitter-bootstrap-markup-rails/helpers/navigation_helpers.rb
|
226
229
|
- lib/twitter-bootstrap-markup-rails/plugins.rb
|
227
230
|
- lib/twitter-bootstrap-markup-rails/plugins/simple_navigation/renderer/bootstrap_topbar_list.rb
|
@@ -231,6 +234,7 @@ files:
|
|
231
234
|
- spec/helpers/button_helpers_spec.rb
|
232
235
|
- spec/helpers/form_helpers_spec.rb
|
233
236
|
- spec/helpers/inline_label_helpers_spec.rb
|
237
|
+
- spec/helpers/modal_helpers_spec.rb
|
234
238
|
- spec/helpers/navigation_helpers_spec.rb
|
235
239
|
- spec/integration/action_view_spec.rb
|
236
240
|
- spec/integration/readme_spec.rb
|
@@ -238,11 +242,12 @@ files:
|
|
238
242
|
- spec/spec_helper.rb
|
239
243
|
- spec/support/bootstrap_button_macros.rb
|
240
244
|
- spec/support/bootstrap_form_macros.rb
|
245
|
+
- spec/support/bootstrap_modal_macros.rb
|
241
246
|
- spec/support/bootstrap_navigation_macros.rb
|
242
247
|
- spec/support/bootstrap_spec_helper.rb
|
243
248
|
- spec/support/test_environment.rb
|
244
249
|
- twitter-bootstrap-markup-rails.gemspec
|
245
|
-
homepage:
|
250
|
+
homepage: http://pusewicz.github.com/twitter-bootstrap-markup-rails
|
246
251
|
licenses: []
|
247
252
|
post_install_message:
|
248
253
|
rdoc_options: []
|
@@ -262,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
267
|
version: '0'
|
263
268
|
requirements: []
|
264
269
|
rubyforge_project:
|
265
|
-
rubygems_version: 1.8.
|
270
|
+
rubygems_version: 1.8.23
|
266
271
|
signing_key:
|
267
272
|
specification_version: 3
|
268
273
|
summary: Ruby on Rails helpers for Bootstrap 2.0 - HTML, CSS, and JS toolkit from
|
@@ -272,6 +277,7 @@ test_files:
|
|
272
277
|
- spec/helpers/button_helpers_spec.rb
|
273
278
|
- spec/helpers/form_helpers_spec.rb
|
274
279
|
- spec/helpers/inline_label_helpers_spec.rb
|
280
|
+
- spec/helpers/modal_helpers_spec.rb
|
275
281
|
- spec/helpers/navigation_helpers_spec.rb
|
276
282
|
- spec/integration/action_view_spec.rb
|
277
283
|
- spec/integration/readme_spec.rb
|
@@ -279,6 +285,7 @@ test_files:
|
|
279
285
|
- spec/spec_helper.rb
|
280
286
|
- spec/support/bootstrap_button_macros.rb
|
281
287
|
- spec/support/bootstrap_form_macros.rb
|
288
|
+
- spec/support/bootstrap_modal_macros.rb
|
282
289
|
- spec/support/bootstrap_navigation_macros.rb
|
283
290
|
- spec/support/bootstrap_spec_helper.rb
|
284
291
|
- spec/support/test_environment.rb
|