twitter_bootstrap_markup 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -4
- data/Gemfile +4 -4
- data/README.md +28 -28
- data/Rakefile +1 -1
- data/lib/twitter_bootstrap_markup.rb +52 -52
- data/lib/twitter_bootstrap_markup/add_on.rb +8 -8
- data/lib/twitter_bootstrap_markup/alert.rb +35 -35
- data/lib/twitter_bootstrap_markup/badge.rb +4 -4
- data/lib/twitter_bootstrap_markup/brand.rb +8 -8
- data/lib/twitter_bootstrap_markup/breadcrumb.rb +21 -21
- data/lib/twitter_bootstrap_markup/button.rb +16 -16
- data/lib/twitter_bootstrap_markup/button_base.rb +44 -44
- data/lib/twitter_bootstrap_markup/control_group.rb +25 -25
- data/lib/twitter_bootstrap_markup/divider.rb +29 -29
- data/lib/twitter_bootstrap_markup/dropdown_button.rb +58 -58
- data/lib/twitter_bootstrap_markup/dropdown_link.rb +29 -29
- data/lib/twitter_bootstrap_markup/extended_input.rb +10 -10
- data/lib/twitter_bootstrap_markup/extension/hash.rb +10 -10
- data/lib/twitter_bootstrap_markup/fieldset.rb +17 -17
- data/lib/twitter_bootstrap_markup/form.rb +26 -26
- data/lib/twitter_bootstrap_markup/grid_column.rb +13 -13
- data/lib/twitter_bootstrap_markup/grid_row.rb +8 -8
- data/lib/twitter_bootstrap_markup/help.rb +23 -23
- data/lib/twitter_bootstrap_markup/icon.rb +17 -17
- data/lib/twitter_bootstrap_markup/input.rb +24 -24
- data/lib/twitter_bootstrap_markup/input_size.rb +21 -21
- data/lib/twitter_bootstrap_markup/label.rb +4 -4
- data/lib/twitter_bootstrap_markup/label_base.rb +32 -32
- data/lib/twitter_bootstrap_markup/link.rb +16 -16
- data/lib/twitter_bootstrap_markup/link_button.rb +17 -17
- data/lib/twitter_bootstrap_markup/nav_bar.rb +33 -33
- data/lib/twitter_bootstrap_markup/nav_container.rb +9 -9
- data/lib/twitter_bootstrap_markup/nav_header.rb +8 -8
- data/lib/twitter_bootstrap_markup/nav_list.rb +15 -15
- data/lib/twitter_bootstrap_markup/nav_list_container.rb +9 -9
- data/lib/twitter_bootstrap_markup/nav_tab.rb +9 -9
- data/lib/twitter_bootstrap_markup/nav_tab_container.rb +12 -12
- data/lib/twitter_bootstrap_markup/page_header.rb +16 -16
- data/lib/twitter_bootstrap_markup/pagination.rb +28 -28
- data/lib/twitter_bootstrap_markup/popover.rb +19 -19
- data/lib/twitter_bootstrap_markup/progress_bar.rb +42 -42
- data/lib/twitter_bootstrap_markup/select.rb +54 -54
- data/lib/twitter_bootstrap_markup/side_position.rb +14 -14
- data/lib/twitter_bootstrap_markup/submit.rb +9 -9
- data/lib/twitter_bootstrap_markup/tab.rb +13 -13
- data/lib/twitter_bootstrap_markup/tab_content.rb +28 -28
- data/lib/twitter_bootstrap_markup/table.rb +28 -28
- data/lib/twitter_bootstrap_markup/tag.rb +62 -62
- data/lib/twitter_bootstrap_markup/tag_builder.rb +21 -21
- data/lib/twitter_bootstrap_markup/textarea.rb +14 -14
- data/lib/twitter_bootstrap_markup/tooltip.rb +18 -18
- data/lib/twitter_bootstrap_markup/ul_container.rb +27 -27
- data/lib/twitter_bootstrap_markup/version.rb +3 -3
- data/lib/twitter_bootstrap_markup/well.rb +27 -27
- data/markup/alerts.html +74 -74
- data/markup/badges.html +64 -64
- data/markup/breadcrumbs.html +58 -58
- data/markup/buttons.html +94 -94
- data/markup/control_groups.html +76 -76
- data/markup/css/bootstrap-responsive.css +815 -815
- data/markup/css/bootstrap-responsive.min.css +9 -9
- data/markup/css/bootstrap.css +4914 -4914
- data/markup/css/bootstrap.min.css +727 -727
- data/markup/dropdown_buttons.html +247 -247
- data/markup/dropdown_links.html +111 -111
- data/markup/form_fields.html +87 -87
- data/markup/forms.html +80 -80
- data/markup/grid_system.html +86 -86
- data/markup/index.html +38 -38
- data/markup/js/bootstrap.js +1835 -1835
- data/markup/js/bootstrap.min.js +6 -6
- data/markup/js/jquery-1.7.2.js +9402 -9402
- data/markup/labels.html +64 -64
- data/markup/link_buttons.html +94 -94
- data/markup/nav_bars.html +103 -103
- data/markup/nav_lists.html +53 -53
- data/markup/paginations.html +67 -67
- data/markup/popovers.html +55 -55
- data/markup/progress_bars.html +92 -92
- data/markup/selects.html +123 -123
- data/markup/tabs.html +45 -45
- data/markup/textareas.html +89 -89
- data/markup/textboxes.html +94 -94
- data/markup/tooltips.html +55 -55
- data/spec/add_on_spec.rb +9 -9
- data/spec/alert_spec.rb +77 -77
- data/spec/badge_spec.rb +40 -28
- data/spec/brand_spec.rb +9 -9
- data/spec/breadcrumb_spec.rb +32 -32
- data/spec/button_spec.rb +51 -51
- data/spec/control_group_spec.rb +28 -28
- data/spec/divider_spec.rb +16 -16
- data/spec/dropdown_button_spec.rb +100 -100
- data/spec/dropdown_link_spec.rb +47 -47
- data/spec/fieldset_spec.rb +21 -21
- data/spec/form_fields_spec.rb +70 -70
- data/spec/form_spec.rb +34 -34
- data/spec/grid_system_spec.rb +68 -68
- data/spec/help_spec.rb +12 -12
- data/spec/icon_spec.rb +17 -17
- data/spec/input_spec.rb +10 -10
- data/spec/label_spec.rb +40 -28
- data/spec/link_button_spec.rb +51 -51
- data/spec/link_spec.rb +28 -28
- data/spec/nav_bar_spec.rb +37 -37
- data/spec/nav_list_spec.rb +39 -39
- data/spec/page_header_spec.rb +12 -12
- data/spec/pagination_spec.rb +17 -17
- data/spec/popover_spec.rb +14 -14
- data/spec/progress_bar_spec.rb +52 -52
- data/spec/select_spec.rb +59 -59
- data/spec/spec_helper.rb +11 -11
- data/spec/support/helpers/html_helper.rb +10 -10
- data/spec/table_spec.rb +32 -32
- data/spec/tabs_spec.rb +21 -21
- data/spec/tag_builder_spec.rb +37 -37
- data/spec/tag_spec.rb +51 -51
- data/spec/text_area_spec.rb +42 -42
- data/spec/textbox_spec.rb +59 -59
- data/spec/tooltip_spec.rb +14 -14
- data/spec/well_spec.rb +16 -16
- data/twitter_bootstrap_markup.gemspec +25 -25
- metadata +25 -9
data/.gitignore
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
*.gem
|
2
|
-
.bundle
|
3
|
-
Gemfile.lock
|
4
|
-
pkg/*
|
1
|
+
*.gem
|
2
|
+
.bundle
|
3
|
+
Gemfile.lock
|
4
|
+
pkg/*
|
5
5
|
.idea
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in twitter_bootstrap_markup.gemspec
|
4
|
-
gemspec
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in twitter_bootstrap_markup.gemspec
|
4
|
+
gemspec
|
data/README.md
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
# twitter_bootstrap_markup
|
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_markup'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install twitter_bootstrap_markup
|
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`)
|
1
|
+
# twitter_bootstrap_markup
|
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_markup'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install twitter_bootstrap_markup
|
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
29
|
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
@@ -1,52 +1,52 @@
|
|
1
|
-
require 'active_support/all'
|
2
|
-
|
3
|
-
require 'twitter_bootstrap_markup/extension/hash'
|
4
|
-
require 'twitter_bootstrap_markup/version'
|
5
|
-
require 'twitter_bootstrap_markup/tooltip'
|
6
|
-
require 'twitter_bootstrap_markup/popover'
|
7
|
-
require 'twitter_bootstrap_markup/side_position'
|
8
|
-
require 'twitter_bootstrap_markup/tag'
|
9
|
-
require 'twitter_bootstrap_markup/link'
|
10
|
-
require 'twitter_bootstrap_markup/button_base'
|
11
|
-
require 'twitter_bootstrap_markup/button'
|
12
|
-
require 'twitter_bootstrap_markup/submit'
|
13
|
-
require 'twitter_bootstrap_markup/link_button'
|
14
|
-
require 'twitter_bootstrap_markup/icon'
|
15
|
-
require 'twitter_bootstrap_markup/divider'
|
16
|
-
require 'twitter_bootstrap_markup/dropdown_button'
|
17
|
-
require 'twitter_bootstrap_markup/dropdown_link'
|
18
|
-
require 'twitter_bootstrap_markup/alert'
|
19
|
-
require 'twitter_bootstrap_markup/input_size'
|
20
|
-
require 'twitter_bootstrap_markup/textarea'
|
21
|
-
require 'twitter_bootstrap_markup/input'
|
22
|
-
require 'twitter_bootstrap_markup/select'
|
23
|
-
require 'twitter_bootstrap_markup/add_on'
|
24
|
-
require 'twitter_bootstrap_markup/extended_input'
|
25
|
-
require 'twitter_bootstrap_markup/help'
|
26
|
-
require 'twitter_bootstrap_markup/control_group'
|
27
|
-
require 'twitter_bootstrap_markup/form'
|
28
|
-
require 'twitter_bootstrap_markup/fieldset'
|
29
|
-
require 'twitter_bootstrap_markup/well'
|
30
|
-
require 'twitter_bootstrap_markup/brand'
|
31
|
-
require 'twitter_bootstrap_markup/nav_header'
|
32
|
-
require 'twitter_bootstrap_markup/ul_container'
|
33
|
-
require 'twitter_bootstrap_markup/nav_container'
|
34
|
-
require 'twitter_bootstrap_markup/nav_list_container'
|
35
|
-
require 'twitter_bootstrap_markup/nav_list'
|
36
|
-
require 'twitter_bootstrap_markup/nav_bar'
|
37
|
-
require 'twitter_bootstrap_markup/nav_tab_container'
|
38
|
-
require 'twitter_bootstrap_markup/nav_tab'
|
39
|
-
require 'twitter_bootstrap_markup/tab_content'
|
40
|
-
require 'twitter_bootstrap_markup/tab'
|
41
|
-
require 'twitter_bootstrap_markup/table'
|
42
|
-
require 'twitter_bootstrap_markup/label_base'
|
43
|
-
require 'twitter_bootstrap_markup/label'
|
44
|
-
require 'twitter_bootstrap_markup/badge'
|
45
|
-
require 'twitter_bootstrap_markup/page_header'
|
46
|
-
require 'twitter_bootstrap_markup/breadcrumb'
|
47
|
-
require 'twitter_bootstrap_markup/pagination'
|
48
|
-
require 'twitter_bootstrap_markup/progress_bar'
|
49
|
-
require 'twitter_bootstrap_markup/grid_row'
|
50
|
-
require 'twitter_bootstrap_markup/grid_column'
|
51
|
-
|
52
|
-
require 'twitter_bootstrap_markup/tag_builder'
|
1
|
+
require 'active_support/all'
|
2
|
+
|
3
|
+
require 'twitter_bootstrap_markup/extension/hash'
|
4
|
+
require 'twitter_bootstrap_markup/version'
|
5
|
+
require 'twitter_bootstrap_markup/tooltip'
|
6
|
+
require 'twitter_bootstrap_markup/popover'
|
7
|
+
require 'twitter_bootstrap_markup/side_position'
|
8
|
+
require 'twitter_bootstrap_markup/tag'
|
9
|
+
require 'twitter_bootstrap_markup/link'
|
10
|
+
require 'twitter_bootstrap_markup/button_base'
|
11
|
+
require 'twitter_bootstrap_markup/button'
|
12
|
+
require 'twitter_bootstrap_markup/submit'
|
13
|
+
require 'twitter_bootstrap_markup/link_button'
|
14
|
+
require 'twitter_bootstrap_markup/icon'
|
15
|
+
require 'twitter_bootstrap_markup/divider'
|
16
|
+
require 'twitter_bootstrap_markup/dropdown_button'
|
17
|
+
require 'twitter_bootstrap_markup/dropdown_link'
|
18
|
+
require 'twitter_bootstrap_markup/alert'
|
19
|
+
require 'twitter_bootstrap_markup/input_size'
|
20
|
+
require 'twitter_bootstrap_markup/textarea'
|
21
|
+
require 'twitter_bootstrap_markup/input'
|
22
|
+
require 'twitter_bootstrap_markup/select'
|
23
|
+
require 'twitter_bootstrap_markup/add_on'
|
24
|
+
require 'twitter_bootstrap_markup/extended_input'
|
25
|
+
require 'twitter_bootstrap_markup/help'
|
26
|
+
require 'twitter_bootstrap_markup/control_group'
|
27
|
+
require 'twitter_bootstrap_markup/form'
|
28
|
+
require 'twitter_bootstrap_markup/fieldset'
|
29
|
+
require 'twitter_bootstrap_markup/well'
|
30
|
+
require 'twitter_bootstrap_markup/brand'
|
31
|
+
require 'twitter_bootstrap_markup/nav_header'
|
32
|
+
require 'twitter_bootstrap_markup/ul_container'
|
33
|
+
require 'twitter_bootstrap_markup/nav_container'
|
34
|
+
require 'twitter_bootstrap_markup/nav_list_container'
|
35
|
+
require 'twitter_bootstrap_markup/nav_list'
|
36
|
+
require 'twitter_bootstrap_markup/nav_bar'
|
37
|
+
require 'twitter_bootstrap_markup/nav_tab_container'
|
38
|
+
require 'twitter_bootstrap_markup/nav_tab'
|
39
|
+
require 'twitter_bootstrap_markup/tab_content'
|
40
|
+
require 'twitter_bootstrap_markup/tab'
|
41
|
+
require 'twitter_bootstrap_markup/table'
|
42
|
+
require 'twitter_bootstrap_markup/label_base'
|
43
|
+
require 'twitter_bootstrap_markup/label'
|
44
|
+
require 'twitter_bootstrap_markup/badge'
|
45
|
+
require 'twitter_bootstrap_markup/page_header'
|
46
|
+
require 'twitter_bootstrap_markup/breadcrumb'
|
47
|
+
require 'twitter_bootstrap_markup/pagination'
|
48
|
+
require 'twitter_bootstrap_markup/progress_bar'
|
49
|
+
require 'twitter_bootstrap_markup/grid_row'
|
50
|
+
require 'twitter_bootstrap_markup/grid_column'
|
51
|
+
|
52
|
+
require 'twitter_bootstrap_markup/tag_builder'
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module TwitterBootstrapMarkup
|
2
|
-
class AddOn < Tag
|
3
|
-
|
4
|
-
def initialize(text)
|
5
|
-
super(:span, text, :class => 'add-on')
|
6
|
-
end
|
7
|
-
|
8
|
-
end
|
1
|
+
module TwitterBootstrapMarkup
|
2
|
+
class AddOn < Tag
|
3
|
+
|
4
|
+
def initialize(text)
|
5
|
+
super(:span, text, :class => 'add-on')
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
9
9
|
end
|
@@ -1,36 +1,36 @@
|
|
1
|
-
module TwitterBootstrapMarkup
|
2
|
-
class Alert < Tag
|
3
|
-
TYPES = [:warning, :info, :success, :danger]
|
4
|
-
|
5
|
-
def initialize(*args, &block)
|
6
|
-
super(:div, *args, &block)
|
7
|
-
attributes.prepend!(:class, 'alert')
|
8
|
-
end
|
9
|
-
|
10
|
-
TYPES.each do |type|
|
11
|
-
define_method type do
|
12
|
-
attributes.append!(:class, "alert-#{type}") unless type == :warning
|
13
|
-
self
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def closable
|
18
|
-
prepend Tag.new(:a, :class => 'close', 'data-dismiss' => 'alert') { append '×' }
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
TYPES.each do |type|
|
23
|
-
define_singleton_method type do |*args, &block|
|
24
|
-
self.new(*args, &block).send(type)
|
25
|
-
end
|
26
|
-
|
27
|
-
define_singleton_method "#{type}_closable" do |*args, &block|
|
28
|
-
self.new(*args, &block).send(type).closable
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.closable(*args, &block)
|
33
|
-
self.new(*args, &block).closable
|
34
|
-
end
|
35
|
-
end
|
1
|
+
module TwitterBootstrapMarkup
|
2
|
+
class Alert < Tag
|
3
|
+
TYPES = [:warning, :info, :success, :danger]
|
4
|
+
|
5
|
+
def initialize(*args, &block)
|
6
|
+
super(:div, *args, &block)
|
7
|
+
attributes.prepend!(:class, 'alert')
|
8
|
+
end
|
9
|
+
|
10
|
+
TYPES.each do |type|
|
11
|
+
define_method type do
|
12
|
+
attributes.append!(:class, "alert-#{type}") unless type == :warning
|
13
|
+
self
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def closable
|
18
|
+
prepend Tag.new(:a, :class => 'close', 'data-dismiss' => 'alert') { append '×' }
|
19
|
+
self
|
20
|
+
end
|
21
|
+
|
22
|
+
TYPES.each do |type|
|
23
|
+
define_singleton_method type do |*args, &block|
|
24
|
+
self.new(*args, &block).send(type)
|
25
|
+
end
|
26
|
+
|
27
|
+
define_singleton_method "#{type}_closable" do |*args, &block|
|
28
|
+
self.new(*args, &block).send(type).closable
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.closable(*args, &block)
|
33
|
+
self.new(*args, &block).closable
|
34
|
+
end
|
35
|
+
end
|
36
36
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module TwitterBootstrapMarkup
|
2
|
-
class Badge < Tag
|
3
|
-
include LabelBase
|
4
|
-
end
|
1
|
+
module TwitterBootstrapMarkup
|
2
|
+
class Badge < Tag
|
3
|
+
include LabelBase
|
4
|
+
end
|
5
5
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module TwitterBootstrapMarkup
|
2
|
-
class Brand < Tag
|
3
|
-
|
4
|
-
def initialize(title, url)
|
5
|
-
super(:a, title, :class => 'brand', :href => url)
|
6
|
-
end
|
7
|
-
|
8
|
-
end
|
1
|
+
module TwitterBootstrapMarkup
|
2
|
+
class Brand < Tag
|
3
|
+
|
4
|
+
def initialize(title, url)
|
5
|
+
super(:a, title, :class => 'brand', :href => url)
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
9
9
|
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
module TwitterBootstrapMarkup
|
2
|
-
class Breadcrumb < Tag
|
3
|
-
alias :internal_append :append
|
4
|
-
|
5
|
-
def initialize(*args, &block)
|
6
|
-
super(:ul, *args, &block)
|
7
|
-
attributes.prepend!(:class, 'breadcrumb')
|
8
|
-
end
|
9
|
-
|
10
|
-
def append(element=nil, &block)
|
11
|
-
internal_append Tag.block(:li, Divider.breadcrumb) unless children.empty?
|
12
|
-
|
13
|
-
element = instance_eval(&block) if block_given?
|
14
|
-
if element.is_a?(Tag) && element.name == :li
|
15
|
-
internal_append element
|
16
|
-
else
|
17
|
-
internal_append Tag.block(:li, element)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
1
|
+
module TwitterBootstrapMarkup
|
2
|
+
class Breadcrumb < Tag
|
3
|
+
alias :internal_append :append
|
4
|
+
|
5
|
+
def initialize(*args, &block)
|
6
|
+
super(:ul, *args, &block)
|
7
|
+
attributes.prepend!(:class, 'breadcrumb')
|
8
|
+
end
|
9
|
+
|
10
|
+
def append(element=nil, &block)
|
11
|
+
internal_append Tag.block(:li, Divider.breadcrumb) unless children.empty?
|
12
|
+
|
13
|
+
element = instance_eval(&block) if block_given?
|
14
|
+
if element.is_a?(Tag) && element.name == :li
|
15
|
+
internal_append element
|
16
|
+
else
|
17
|
+
internal_append Tag.block(:li, element)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
22
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
module TwitterBootstrapMarkup
|
2
|
-
class Button < Tag
|
3
|
-
include ButtonBase
|
4
|
-
|
5
|
-
def initialize(*args, &block)
|
6
|
-
text = args.shift unless block_given?
|
7
|
-
attributes = args.shift || {}
|
8
|
-
|
9
|
-
if block_given?
|
10
|
-
super(:button, attributes.prepend!(:class, 'btn'), &block)
|
11
|
-
else
|
12
|
-
super(:button, text, attributes.prepend!(:class, 'btn'))
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
1
|
+
module TwitterBootstrapMarkup
|
2
|
+
class Button < Tag
|
3
|
+
include ButtonBase
|
4
|
+
|
5
|
+
def initialize(*args, &block)
|
6
|
+
text = args.shift unless block_given?
|
7
|
+
attributes = args.shift || {}
|
8
|
+
|
9
|
+
if block_given?
|
10
|
+
super(:button, attributes.prepend!(:class, 'btn'), &block)
|
11
|
+
else
|
12
|
+
super(:button, text, attributes.prepend!(:class, 'btn'))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
17
|
end
|
@@ -1,45 +1,45 @@
|
|
1
|
-
module TwitterBootstrapMarkup
|
2
|
-
module ButtonBase
|
3
|
-
TYPES = [:primary, :info, :success, :warning, :danger, :inverse]
|
4
|
-
SIZES = [:large, :small, :mini]
|
5
|
-
|
6
|
-
def self.included(base)
|
7
|
-
|
8
|
-
TYPES.each do |type|
|
9
|
-
base.send(:define_method, type) do
|
10
|
-
attributes.append!(:class, "btn-#{type}")
|
11
|
-
self
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
SIZES.each do |size|
|
16
|
-
base.send(:define_method, size) do
|
17
|
-
self.attributes.append!(:class, "btn-#{size}")
|
18
|
-
self
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
TYPES.each do |type|
|
23
|
-
base.send(:define_singleton_method, type) do |*args, &block|
|
24
|
-
self.new(*args, &block).send(type)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
SIZES.each do |size|
|
29
|
-
base.send(:define_singleton_method, size) do |*args, &block|
|
30
|
-
self.new(*args, &block).send(size)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
TYPES.each do |type|
|
35
|
-
SIZES.each do |size|
|
36
|
-
base.send(:define_singleton_method, "#{type}_#{size}") do |*args, &block|
|
37
|
-
self.new(*args, &block).send(type).send(size)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
1
|
+
module TwitterBootstrapMarkup
|
2
|
+
module ButtonBase
|
3
|
+
TYPES = [:primary, :info, :success, :warning, :danger, :inverse]
|
4
|
+
SIZES = [:large, :small, :mini]
|
5
|
+
|
6
|
+
def self.included(base)
|
7
|
+
|
8
|
+
TYPES.each do |type|
|
9
|
+
base.send(:define_method, type) do
|
10
|
+
attributes.append!(:class, "btn-#{type}")
|
11
|
+
self
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
SIZES.each do |size|
|
16
|
+
base.send(:define_method, size) do
|
17
|
+
self.attributes.append!(:class, "btn-#{size}")
|
18
|
+
self
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
TYPES.each do |type|
|
23
|
+
base.send(:define_singleton_method, type) do |*args, &block|
|
24
|
+
self.new(*args, &block).send(type)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
SIZES.each do |size|
|
29
|
+
base.send(:define_singleton_method, size) do |*args, &block|
|
30
|
+
self.new(*args, &block).send(size)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
TYPES.each do |type|
|
35
|
+
SIZES.each do |size|
|
36
|
+
base.send(:define_singleton_method, "#{type}_#{size}") do |*args, &block|
|
37
|
+
self.new(*args, &block).send(type).send(size)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
45
|
end
|