twitter-bootstrap-markup-rails 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,3 +4,5 @@ Gemfile.lock
4
4
  .yardoc
5
5
  doc
6
6
  pkg
7
+ .idea
8
+ .rvmrc
data/README.md CHANGED
@@ -1,21 +1,39 @@
1
- Twitter Bootstrap 2.0 Markup for Rails [![Build Status](https://secure.travis-ci.org/pusewicz/twitter-bootstrap-markup-rails.png)](http://travis-ci.org/pusewicz/twitter-bootstrap-markup-rails) [![Dependency Status](https://gemnasium.com/pusewicz/twitter-bootstrap-markup-rails.png)](https://gemnasium.com/pusewicz/twitter-bootstrap-markup-rails)
2
- ===
1
+ # Twitter Bootstrap 2.0 Markup for Rails
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Version</th>
6
+ <td>v0.2.1</td>
7
+ </tr>
8
+ <tr>
9
+ <th>Build Status</th>
10
+ <td><a href="http://travis-ci.org/pusewicz/twitter-bootstrap-markup-rails"><img src="https://secure.travis-ci.org/pusewicz/twitter-bootstrap-markup-rails.png"></a></td>
11
+ </tr>
12
+ <tr>
13
+ <th>Dependency Status</th>
14
+ <td><a href="https://gemnasium.com/pusewicz/twitter-bootstrap-markup-rails"><img src="https://gemnasium.com/pusewicz/twitter-bootstrap-markup-rails.png"></a></td>
15
+ </tr>
16
+ <tr>
17
+ <th>Changelog</th>
18
+ <td><a href="https://github.com/pusewicz/twitter-bootstrap-markup-rails/wiki/Changelog">Changelog</a></td>
19
+ </tr>
20
+ </table>
3
21
 
4
22
  This gem focuses on making it easier to use Twitter's Bootstrap 2.0. It's a collection of helpers which should make it faster to use all the components provided by Twitter Bootstrap.
5
23
 
6
24
 
7
- Installation
8
- ---
25
+ ## Installation
9
26
 
10
27
  Add to your `Gemfile`:
11
28
 
12
- gem "twitter-bootstrap-markup-rails", "0.1.0"
29
+ gem 'twitter-bootstrap-markup-rails', '0.2.1'
13
30
 
14
- Currently Supported
15
- ---
31
+ ## Currently Supported
16
32
 
17
33
  * Alert messages
18
34
  * Inline labels
35
+ * Buttons
36
+ * Button dropdowns
19
37
 
20
38
  Documentation
21
39
  ---
@@ -50,6 +68,30 @@ Notice Inline Label:
50
68
  bootstrap_inline_label_notice_tag("Info")
51
69
  # => '<span class="label notice">Info</span>'
52
70
 
71
+ Buttons:
72
+
73
+ bootstrap_button("Button Text", "#")
74
+ # => '<a class="btn" href="#">Button Text</a>'
75
+
76
+ Dropdown Buttons:
77
+
78
+ ```
79
+ bootstrap_button_dropdown do |b|
80
+ b.bootstrap_button "Button Title", "#"
81
+ b.link_to "First Dropdown Item", @item
82
+ b.link_to "Second Dropdown Item", @item2
83
+ end
84
+ # => '<div class="btn-group">
85
+ <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
86
+ Button Title
87
+ <span class="caret"></span>
88
+ </a>
89
+ <ul class="dropdown-menu">
90
+ <!-- dropdown menu links -->
91
+ </ul>
92
+ </div>'
93
+ ```
94
+
53
95
  Plugins
54
96
  ---
55
97
 
@@ -6,6 +6,8 @@ module Twitter
6
6
  module Rails
7
7
  require "twitter-bootstrap-markup-rails/version"
8
8
 
9
+ require "twitter-bootstrap-markup-rails/helper_collection"
10
+
9
11
  autoload :Helpers, "twitter-bootstrap-markup-rails/helpers"
10
12
  autoload :Components, "twitter-bootstrap-markup-rails/components"
11
13
 
@@ -3,6 +3,10 @@ module Twitter::Bootstrap::Markup::Rails
3
3
  autoload :Base, 'twitter-bootstrap-markup-rails/components/base'
4
4
  autoload :Alert, 'twitter-bootstrap-markup-rails/components/alert'
5
5
  autoload :InlineLabel, 'twitter-bootstrap-markup-rails/components/inline_label'
6
+ autoload :Form, 'twitter-bootstrap-markup-rails/components/form'
7
+ autoload :FormBuilder, 'twitter-bootstrap-markup-rails/components/form_builder'
8
+ autoload :Button, 'twitter-bootstrap-markup-rails/components/button'
9
+ autoload :ButtonDropdown, 'twitter-bootstrap-markup-rails/components/button_dropdown'
6
10
  end
7
11
  end
8
12
 
@@ -0,0 +1,66 @@
1
+ module Twitter::Bootstrap::Markup::Rails::Components
2
+ class Button < Base
3
+ attr_reader :text
4
+
5
+ def initialize(text, link, options = {})
6
+ super
7
+ @text = text
8
+ @link = link
9
+ end
10
+
11
+ def to_s
12
+ html_text = ""
13
+ html_text << build_icon.html_safe << ' ' if options[:icon]
14
+ html_text << text
15
+ html_text << ' ' << build_caret.html_safe if options[:dropdown]
16
+
17
+ output_buffer << content_tag(:a, html_text.html_safe, build_tag_options).html_safe
18
+ super
19
+ end
20
+
21
+ private
22
+ def default_options
23
+ {
24
+ :class => "btn",
25
+ :type => [],
26
+ :disabled => false,
27
+ :icon_white => false,
28
+ :dropdown => false,
29
+ :id => nil
30
+ }
31
+ end
32
+
33
+ def build_class
34
+ classes = [options[:class]]
35
+
36
+ if options[:type].is_a?(Array)
37
+ classes = classes | options[:type].map{|c| c.to_s}
38
+ else
39
+ classes << options[:type]
40
+ end
41
+
42
+ classes << 'dropdown-toggle' if options[:dropdown]
43
+ classes << 'disabled' if options[:disabled]
44
+
45
+ classes.join(" ")
46
+ end
47
+
48
+ def build_icon
49
+ klass = options[:icon]
50
+ klass << ' icon-white' if options[:icon_white]
51
+ content_tag(:i, nil, :class => klass)
52
+ end
53
+
54
+ def build_caret
55
+ content_tag(:span, nil, :class => 'caret')
56
+ end
57
+
58
+ def build_tag_options
59
+ ops = {:href => @link, :class => build_class}
60
+ ops[:"data-toggle"] = 'dropdown' if options[:dropdown]
61
+ ops[:id] = options[:id] if options[:id]
62
+ ops
63
+ end
64
+ end
65
+ end
66
+
@@ -0,0 +1,44 @@
1
+ module Twitter::Bootstrap::Markup::Rails::Components
2
+ class ButtonDropdown < Base
3
+ attr_reader :collection
4
+
5
+ def initialize(elements, options = {})
6
+ super
7
+ @elements = elements
8
+ end
9
+
10
+ def to_s
11
+ output_buffer << content_tag(:div, :class => 'btn-group') do
12
+ html=''
13
+ html << build_dropdown
14
+
15
+ html << content_tag(:ul, :class => 'dropdown-menu') do
16
+ menu = ''
17
+ @elements.each do |e|
18
+ menu << content_tag(:li, e.to_s)
19
+ end
20
+ menu.html_safe
21
+ end
22
+
23
+ html.html_safe
24
+ end
25
+ super
26
+ end
27
+
28
+ private
29
+ def default_options
30
+ {}
31
+ end
32
+
33
+ def build_dropdown
34
+ if @elements.size > 0
35
+ dropdown = @elements.shift
36
+ dropdown.options[:dropdown] = true
37
+ dropdown.to_s
38
+ else
39
+ ''
40
+ end
41
+ end
42
+ end
43
+ end
44
+
@@ -0,0 +1,14 @@
1
+ module Twitter::Bootstrap::Markup::Rails::Components
2
+ class Form < Base
3
+ autoload :InputField, 'twitter-bootstrap-markup-rails/components/form/input_field'
4
+ autoload :Label, 'twitter-bootstrap-markup-rails/components/form/label'
5
+
6
+ include ActionView::Helpers::FormHelper
7
+
8
+ protected
9
+
10
+ def default_options
11
+ {}
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,53 @@
1
+ module Twitter::Bootstrap::Markup::Rails::Components
2
+ class Form::InputField < Form
3
+ attr_accessor :input_html, :label_html
4
+
5
+ def initialize(object_name, method, input_html, options = {})
6
+ super(options)
7
+ @input_html = input_html
8
+ @label_html = Label.new(object_name, method, options) if options[:label] || options[:label_text]
9
+ end
10
+
11
+ def to_s
12
+ output_buffer << content_tag(:div, :class => 'control-group') do
13
+ html = ''
14
+ html << label_html.to_s
15
+ html << content_tag(:div, :class => 'controls') do
16
+ build_input_wrapper << build_help_text
17
+ end
18
+ html.html_safe
19
+ end
20
+ super
21
+ end
22
+
23
+ private
24
+
25
+ def build_input_wrapper
26
+ if options[:add_on]
27
+ build_add_on_wrapper
28
+ else
29
+ input_html
30
+ end
31
+ end
32
+
33
+ def build_help_text
34
+ html = ''
35
+ html = content_tag(:p, options[:help_text], :class => 'help-block') if options[:help_text]
36
+ html.html_safe
37
+ end
38
+
39
+ def build_add_on_wrapper
40
+ content_tag(:div, :class => "input-#{options[:add_on][:position] || 'prepend'}") do
41
+ add_on = ''
42
+ add_on << input_html
43
+ add_on << content_tag(:span, :class => 'add-on') do
44
+ add_on_content = ''
45
+ add_on_content << content_tag(:i, '', :class => options[:add_on][:icon]) if options[:add_on][:icon]
46
+ add_on_content << options[:add_on][:text] if options[:add_on][:text]
47
+ add_on_content.html_safe
48
+ end
49
+ add_on.html_safe
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,8 @@
1
+ module Twitter::Bootstrap::Markup::Rails::Components
2
+ class Form::Label < Form
3
+ def initialize(object_name, method, options)
4
+ super(options)
5
+ output_buffer << label(object_name, method, options[:label_text], :class => 'control-label')
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ module Twitter::Bootstrap::Markup::Rails::Components
2
+ class FormBuilder < ActionView::Helpers::FormBuilder
3
+ def text_field(method, options={})
4
+ input_html = super(method, options)
5
+ Form::InputField.new(object_name, method, input_html, options).to_s
6
+ end
7
+
8
+ def password_field(method, options={})
9
+ input_html = super(method, options)
10
+ Form::InputField.new(object_name, method, input_html, options).to_s
11
+ end
12
+ end
13
+ end
@@ -6,6 +6,8 @@ module Twitter::Bootstrap::Markup::Rails
6
6
  ActiveSupport.on_load(:action_view) do
7
7
  include Twitter::Bootstrap::Markup::Rails::Helpers::AlertHelpers
8
8
  include Twitter::Bootstrap::Markup::Rails::Helpers::InlineLabelHelpers
9
+ include Twitter::Bootstrap::Markup::Rails::Helpers::FormHelpers
10
+ include Twitter::Bootstrap::Markup::Rails::Helpers::ButtonHelpers
9
11
  end
10
12
  end
11
13
  end
@@ -0,0 +1,56 @@
1
+ module Twitter::Bootstrap::Markup::Rails
2
+ class HelperCollection
3
+ attr_accessor :calls, :view
4
+
5
+ def initialize(view)
6
+ @view = view
7
+ @calls = []
8
+ end
9
+
10
+ def method_missing(symbol, *args, &block)
11
+ @calls << HelperMethodCall.new(@view, symbol, args, block)
12
+ end
13
+
14
+ def each
15
+ @calls.each do |c|
16
+ yield c
17
+ end
18
+ end
19
+
20
+ def [](x)
21
+ @calls[x]
22
+ end
23
+
24
+ def size
25
+ @calls.size
26
+ end
27
+
28
+ def shift
29
+ @calls.shift
30
+ end
31
+ end
32
+
33
+ class HelperMethodCall
34
+ attr_accessor :method, :options, :args
35
+
36
+ def initialize(view, symbol, args, block)
37
+ @view = view
38
+ @method = symbol
39
+ @options = args.extract_options!
40
+ @args = args
41
+ @block = block
42
+ end
43
+
44
+ def to_s
45
+ args = @args
46
+ args << @options
47
+
48
+ if @block
49
+ @view.send(@method, *args, &@block).html_safe
50
+ else
51
+ @view.send(@method, *args).html_safe
52
+ end
53
+ end
54
+
55
+ end
56
+ end
@@ -2,6 +2,8 @@ module Twitter::Bootstrap::Markup::Rails
2
2
  module Helpers
3
3
  autoload :AlertHelpers, 'twitter-bootstrap-markup-rails/helpers/alert_helpers'
4
4
  autoload :InlineLabelHelpers, 'twitter-bootstrap-markup-rails/helpers/inline_label_helpers'
5
+ autoload :FormHelpers, 'twitter-bootstrap-markup-rails/helpers/form_helpers'
6
+ autoload :ButtonHelpers, 'twitter-bootstrap-markup-rails/helpers/button_helpers'
5
7
  end
6
8
  end
7
9
 
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+
3
+ module Twitter::Bootstrap::Markup::Rails::Helpers
4
+ module ButtonHelpers
5
+ # Render a bootstrap button
6
+ #
7
+ # @param [String] text for the button face
8
+ # @param [String] link for the button href
9
+ # @param [Hash] options hash containing options (default: {}):
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
+ #
17
+ # Examples
18
+ #
19
+ # bootstrap_button 'Search', '#', :type => 'btn-primary', :icon => 'icon-search'
20
+ #
21
+ def bootstrap_button(text, link, options = {})
22
+ Twitter::Bootstrap::Markup::Rails::Components::Button.new(
23
+ text,
24
+ link,
25
+ options
26
+ ).to_s
27
+ end
28
+
29
+ # Render a dropdown button
30
+ #
31
+ # @param [Hash] options hash containing options (default: {}):
32
+ #
33
+ # Examples
34
+ #
35
+ # bootstrap_button_dropdown do |e|
36
+ # e.bootstrap_button "Button Title", "http://google.com"
37
+ # e.link_to "Blah", @blah
38
+ # end
39
+ #
40
+ # Returns HTML String for the dropdown
41
+ #
42
+ def bootstrap_button_dropdown(options = {})
43
+ # Elements will hold every call made to this block. Self is passed in so the
44
+ # elements can be sent to it in order to be evaluated
45
+ elements = Twitter::Bootstrap::Markup::Rails::HelperCollection.new(self)
46
+
47
+ yield elements
48
+
49
+ Twitter::Bootstrap::Markup::Rails::Components::ButtonDropdown.new(
50
+ elements,
51
+ options
52
+ ).to_s
53
+ end
54
+
55
+ end
56
+ end
57
+
@@ -0,0 +1,11 @@
1
+ module Twitter::Bootstrap::Markup::Rails::Helpers
2
+ module FormHelpers
3
+ # Form builder
4
+ # TODO add documentation
5
+ def bootstrap_form_for(*args, &block)
6
+ options = args.extract_options!
7
+ options.reverse_merge!(:builder => Twitter::Bootstrap::Markup::Rails::Components::FormBuilder)
8
+ form_for(*(args + [options]), &block)
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,8 @@
1
1
  # Renders an ItemContainer as a <ul> element and its containing items as <li> elements.
2
2
  # Prepared to use inside the topbar of Twitter Bootstrap http://twitter.github.com/bootstrap/#navigation
3
3
  #
4
+ # Source: https://gist.github.com/1550309
5
+ #
4
6
  # Examples
5
7
  #
6
8
  # render_navigation(level: 1..2, renderer: :bootstrap_topbar_list, expand_all: true)
@@ -2,7 +2,7 @@ module Twitter
2
2
  module Bootstrap
3
3
  module Markup
4
4
  module Rails
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
8
8
  end
@@ -0,0 +1,79 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Twitter::Bootstrap::Markup::Rails::Helpers::ButtonHelpers do
5
+ include BootstrapSpecHelper
6
+ include BootstrapButtonMacros
7
+
8
+ describe "#bootstrap_button" do
9
+ before do
10
+ @output_buffer = ''
11
+ end
12
+
13
+ it "should create a button with the btn class" do
14
+ concat bootstrap_button("Text", "#")
15
+ output_buffer.should have_tag('a.btn')
16
+ end
17
+
18
+ it "should have text" do
19
+ concat bootstrap_button("Text", "#")
20
+ output_buffer.should have_tag('a', /Text/)
21
+ end
22
+
23
+ it "should link to the specified url" do
24
+ concat bootstrap_button("Text", "http://example.test")
25
+ output_buffer.should have_tag("a[href='http://example.test']")
26
+ end
27
+
28
+ it "should have disabled class when :disabled is true" do
29
+ concat bootstrap_button("Text", "#", :disabled => true)
30
+ output_buffer.should have_tag("a.disabled")
31
+ end
32
+
33
+ it "should add an additional class when :type is a string" do
34
+ concat bootstrap_button("Text", "#", :type => 'test')
35
+ output_buffer.should have_tag("a.test")
36
+ end
37
+
38
+ it "should add additional classes when :type is an array" do
39
+ concat bootstrap_button("Text", "#", :type => ['test1', 'test2'])
40
+ output_buffer.should have_tag("a.test1")
41
+ output_buffer.should have_tag("a.test2")
42
+ end
43
+
44
+ it "should add an icon when :icon is specified" do
45
+ concat bootstrap_button("Text", "#", :icon => 'icon-search')
46
+ output_buffer.should have_tag("a.btn i.icon-search")
47
+ end
48
+
49
+ it "should add a white icon when :icon_white is true" do
50
+ concat bootstrap_button("Text", "#", :icon => 'icon-search', :icon_white => true)
51
+ output_buffer.should have_tag("a.btn i.icon-search")
52
+ output_buffer.should have_tag("a.btn i.icon-white")
53
+ end
54
+
55
+ it "should add an id when :id is specified" do
56
+ concat bootstrap_button("Text", "#", :id => "foo")
57
+ output_buffer.should have_tag("a#foo")
58
+ end
59
+ end
60
+
61
+
62
+ describe "#bootstrap_button_dropdown" do
63
+ before do
64
+ @output_buffer = ''
65
+ end
66
+
67
+ it "should create a dropdown button when called with a button and one (or more) links" do
68
+ build_bootstrap_button_dropdown do |d|
69
+ d.bootstrap_button "Button Text", "#"
70
+ d.link_to "Link Text", "#"
71
+ end
72
+
73
+ output_buffer.should have_tag('div.btn-group') do |div|
74
+ div.should have_tag('a.btn')
75
+ div.should have_tag('ul.dropdown-menu a')
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,126 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe Twitter::Bootstrap::Markup::Rails::Helpers::FormHelpers do
5
+ include BootstrapSpecHelper
6
+ include BootstrapFormMacros
7
+
8
+ describe "#bootstrap_form_for" do
9
+ it "should create a form tag" do
10
+ block = Proc.new {}
11
+ concat bootstrap_form_for 'an_object', :url => 'a_url', &block
12
+ output_buffer.should have_tag('form')
13
+ end
14
+
15
+ context "text_field" do
16
+ it "should wrap a text input within the magical div tags" do
17
+ build_bootstrap_form do |f|
18
+ f.text_field 'method'
19
+ end
20
+
21
+ output_buffer.should have_tag('div.control-group div.controls input[type=text]')
22
+ end
23
+
24
+ it "should add a label tag if :label is true" do
25
+ build_bootstrap_form do |f|
26
+ f.text_field 'method', :label => true
27
+ end
28
+
29
+ output_buffer.should have_tag('div.control-group') do |div|
30
+ div.should have_tag('label.control-label')
31
+ div.should have_tag('div.controls') do |div|
32
+ div.should have_tag('input')
33
+ end
34
+ end
35
+ end
36
+
37
+ it "should add a label tag with custom text if :label_text is specified" do
38
+ build_bootstrap_form do |f|
39
+ f.text_field 'method', :label_text => 'a custom label'
40
+ end
41
+
42
+ output_buffer.should have_tag('div.control-group') do |div|
43
+ div.should have_tag('label.control-label', :text => 'a custom label')
44
+ div.should have_tag('div.controls') do |div|
45
+ div.should have_tag('input')
46
+ end
47
+ end
48
+ end
49
+
50
+ context "add_on" do
51
+ it "should wrap the input in div.input-prepend if :add_on hash is specified" do
52
+ build_bootstrap_form do |f|
53
+ f.text_field 'method', :add_on => {}
54
+ end
55
+
56
+ output_buffer.should have_tag('div.control-group') do |div|
57
+ div.should have_tag('div.controls') do |div|
58
+ div.should have_tag('div.input-prepend') do |div|
59
+ div.should have_tag('input')
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ it "should wrap the input in div.input-append if :position is :append" do
66
+ build_bootstrap_form do |f|
67
+ f.text_field 'method', :add_on => {:position => :append}
68
+ end
69
+
70
+ output_buffer.should have_tag('div.control-group') do |div|
71
+ div.should have_tag('div.controls') do |div|
72
+ div.should have_tag('div.input-append') do |div|
73
+ div.should have_tag('input')
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+ it "should add a span with text if :text is specified" do
80
+ build_bootstrap_form do |f|
81
+ f.text_field 'method', :add_on => {:text => 'a text'}
82
+ end
83
+
84
+ output_buffer.should have_tag('div.control-group') do |div|
85
+ div.should have_tag('div.controls') do |div|
86
+ div.should have_tag('div.input-prepend') do |div|
87
+ div.should have_tag('input')
88
+ div.should have_tag('span', :class => 'add-on', :text => 'a text')
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ it "should add a span with icon if :icon is specified" do
95
+ build_bootstrap_form do |f|
96
+ f.text_field 'method', :add_on => {:icon => 'icon-envelope'}
97
+ end
98
+
99
+ output_buffer.should have_tag('div.control-group') do |div|
100
+ div.should have_tag('div.controls') do |div|
101
+ div.should have_tag('div.input-prepend') do |div|
102
+ div.should have_tag('input')
103
+ div.should have_tag('span', :class => 'add-on') do |span|
104
+ span.should have_tag('i', :class => 'icon-envelope')
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+
111
+ it "should add a help-block with custom text if :html_text is specified" do
112
+ build_bootstrap_form do |f|
113
+ f.text_field 'method', :help_text => 'You need help!'
114
+ end
115
+
116
+ output_buffer.should have_tag('div.control-group') do |div|
117
+ div.should have_tag('div.controls') do |div|
118
+ div.should have_tag('p', :class => 'help-block', :text => 'You need help!')
119
+ end
120
+ end
121
+ end
122
+
123
+ end
124
+ end
125
+ end
126
+ end
@@ -12,4 +12,8 @@ describe ActionView::Base do
12
12
  it "includes inline label helpers" do
13
13
  @view.ancestors.should include(Twitter::Bootstrap::Markup::Rails::Helpers::InlineLabelHelpers)
14
14
  end
15
+
16
+ it "includes inline form helpers" do
17
+ @view.ancestors.should include(Twitter::Bootstrap::Markup::Rails::Helpers::FormHelpers)
18
+ end
15
19
  end
@@ -0,0 +1,14 @@
1
+ describe "README.md" do
2
+ let(:version) {
3
+ require File.expand_path("../../../lib/twitter-bootstrap-markup-rails/version",
4
+ __FILE__)
5
+ Twitter::Bootstrap::Markup::Rails::VERSION
6
+ }
7
+
8
+ subject { File.read(File.expand_path("../../../README.md", __FILE__)) }
9
+
10
+ it "contains correct version number in gem declaration" do
11
+ subject.should include("gem 'twitter-bootstrap-markup-rails', '#{version}'")
12
+ end
13
+ end
14
+
@@ -0,0 +1,8 @@
1
+ module BootstrapButtonMacros
2
+ def build_bootstrap_button_dropdown(&block)
3
+ dropdown = bootstrap_button_dropdown do |d|
4
+ block.call d
5
+ end
6
+ concat dropdown
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module BootstrapFormMacros
2
+ def build_bootstrap_form(&block)
3
+ form_builder = bootstrap_form_for 'object', :url => 'url' do |f|
4
+ block.call f
5
+ end
6
+ concat form_builder
7
+ end
8
+ end
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.2.0
4
+ version: 0.2.1
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-02-02 00:00:00.000000000 Z
12
+ date: 2012-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70220979225840 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70220979225840
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rails
27
- requirement: &70220979225220 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '3.0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70220979225220
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec-rails
38
- requirement: &70220979224720 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '2.8'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70220979224720
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.8'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: guard
49
- requirement: &70220979224240 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '1.0'
55
70
  type: :development
56
71
  prerelease: false
57
- version_requirements: *70220979224240
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: guard-rspec
60
- requirement: &70220979223640 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: '0.6'
66
86
  type: :development
67
87
  prerelease: false
68
- version_requirements: *70220979223640
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '0.6'
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: rspec_tag_matchers
71
- requirement: &70220979223000 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,10 +101,15 @@ dependencies:
76
101
  version: '1.0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *70220979223000
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '1.0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: rake
82
- requirement: &70220979222280 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ! '>='
@@ -87,10 +117,15 @@ dependencies:
87
117
  version: '0'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *70220979222280
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: yard
93
- requirement: &70220979221040 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ! '>='
@@ -98,10 +133,15 @@ dependencies:
98
133
  version: '0'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *70220979221040
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
102
142
  - !ruby/object:Gem::Dependency
103
143
  name: yard-tomdoc
104
- requirement: &70220979220400 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
105
145
  none: false
106
146
  requirements:
107
147
  - - ! '>='
@@ -109,10 +149,15 @@ dependencies:
109
149
  version: '0'
110
150
  type: :development
111
151
  prerelease: false
112
- version_requirements: *70220979220400
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
113
158
  - !ruby/object:Gem::Dependency
114
159
  name: simple-navigation
115
- requirement: &70220979219880 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
116
161
  none: false
117
162
  requirements:
118
163
  - - ! '>='
@@ -120,7 +165,12 @@ dependencies:
120
165
  version: '0'
121
166
  type: :development
122
167
  prerelease: false
123
- version_requirements: *70220979219880
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
124
174
  description: Ruby on Rails helpers for Bootstrap 2.0 - HTML, CSS, and JS toolkit from
125
175
  Twitter
126
176
  email:
@@ -140,20 +190,34 @@ files:
140
190
  - lib/twitter-bootstrap-markup-rails/components.rb
141
191
  - lib/twitter-bootstrap-markup-rails/components/alert.rb
142
192
  - lib/twitter-bootstrap-markup-rails/components/base.rb
193
+ - lib/twitter-bootstrap-markup-rails/components/button.rb
194
+ - lib/twitter-bootstrap-markup-rails/components/button_dropdown.rb
195
+ - lib/twitter-bootstrap-markup-rails/components/form.rb
196
+ - lib/twitter-bootstrap-markup-rails/components/form/input_field.rb
197
+ - lib/twitter-bootstrap-markup-rails/components/form/label.rb
198
+ - lib/twitter-bootstrap-markup-rails/components/form_builder.rb
143
199
  - lib/twitter-bootstrap-markup-rails/components/inline_label.rb
144
200
  - lib/twitter-bootstrap-markup-rails/engine.rb
201
+ - lib/twitter-bootstrap-markup-rails/helper_collection.rb
145
202
  - lib/twitter-bootstrap-markup-rails/helpers.rb
146
203
  - lib/twitter-bootstrap-markup-rails/helpers/alert_helpers.rb
204
+ - lib/twitter-bootstrap-markup-rails/helpers/button_helpers.rb
205
+ - lib/twitter-bootstrap-markup-rails/helpers/form_helpers.rb
147
206
  - lib/twitter-bootstrap-markup-rails/helpers/inline_label_helpers.rb
148
207
  - lib/twitter-bootstrap-markup-rails/plugins.rb
149
208
  - lib/twitter-bootstrap-markup-rails/plugins/simple_navigation/renderer/bootstrap_topbar_list.rb
150
209
  - lib/twitter-bootstrap-markup-rails/version.rb
151
210
  - log/development.log
152
211
  - spec/helpers/alert_helpers_spec.rb
212
+ - spec/helpers/button_helpers_spec.rb
213
+ - spec/helpers/form_helpers_spec.rb
153
214
  - spec/helpers/inline_label_helpers_spec.rb
154
215
  - spec/integration/action_view_spec.rb
216
+ - spec/integration/readme_spec.rb
155
217
  - spec/plugins/bootstrap_topbar_list_spec.rb
156
218
  - spec/spec_helper.rb
219
+ - spec/support/bootstrap_button_macros.rb
220
+ - spec/support/bootstrap_form_macros.rb
157
221
  - spec/support/bootstrap_spec_helper.rb
158
222
  - spec/support/test_environment.rb
159
223
  - twitter-bootstrap-markup-rails.gemspec
@@ -177,17 +241,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
241
  version: '0'
178
242
  requirements: []
179
243
  rubyforge_project:
180
- rubygems_version: 1.8.15
244
+ rubygems_version: 1.8.21
181
245
  signing_key:
182
246
  specification_version: 3
183
247
  summary: Ruby on Rails helpers for Bootstrap 2.0 - HTML, CSS, and JS toolkit from
184
248
  Twitter
185
249
  test_files:
186
250
  - spec/helpers/alert_helpers_spec.rb
251
+ - spec/helpers/button_helpers_spec.rb
252
+ - spec/helpers/form_helpers_spec.rb
187
253
  - spec/helpers/inline_label_helpers_spec.rb
188
254
  - spec/integration/action_view_spec.rb
255
+ - spec/integration/readme_spec.rb
189
256
  - spec/plugins/bootstrap_topbar_list_spec.rb
190
257
  - spec/spec_helper.rb
258
+ - spec/support/bootstrap_button_macros.rb
259
+ - spec/support/bootstrap_form_macros.rb
191
260
  - spec/support/bootstrap_spec_helper.rb
192
261
  - spec/support/test_environment.rb
193
262
  has_rdoc: