twitter_bootstrap_markup 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class NavList < Well
|
|
3
|
-
alias :internal_append :append
|
|
4
|
-
|
|
5
|
-
def initialize(attributes={}, &block)
|
|
6
|
-
super(attributes.append!(:style, 'padding: 8px 0;')) {}
|
|
7
|
-
@container = NavListContainer.new(&block)
|
|
8
|
-
internal_append @container
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def append(*args, &block)
|
|
12
|
-
@container.append(*args, &block)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class NavList < Well
|
|
3
|
+
alias :internal_append :append
|
|
4
|
+
|
|
5
|
+
def initialize(attributes={}, &block)
|
|
6
|
+
super(attributes.append!(:style, 'padding: 8px 0;')) {}
|
|
7
|
+
@container = NavListContainer.new(&block)
|
|
8
|
+
internal_append @container
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def append(*args, &block)
|
|
12
|
+
@container.append(*args, &block)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
16
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class NavListContainer < NavContainer
|
|
3
|
-
|
|
4
|
-
def initialize(attributes={}, &block)
|
|
5
|
-
super(attributes.append!(:class, 'nav-list'), &block)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
end
|
|
9
|
-
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class NavListContainer < NavContainer
|
|
3
|
+
|
|
4
|
+
def initialize(attributes={}, &block)
|
|
5
|
+
super(attributes.append!(:class, 'nav-list'), &block)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
end
|
|
9
|
+
|
|
10
10
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class NavTab < Link
|
|
3
|
-
|
|
4
|
-
def initialize(*args, &block)
|
|
5
|
-
super(*args, &block)
|
|
6
|
-
attributes['data-toggle'] = 'tab'
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class NavTab < Link
|
|
3
|
+
|
|
4
|
+
def initialize(*args, &block)
|
|
5
|
+
super(*args, &block)
|
|
6
|
+
attributes['data-toggle'] = 'tab'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
end
|
|
10
10
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class NavTabContainer < NavContainer
|
|
3
|
-
|
|
4
|
-
def initialize(attributes={}, &block)
|
|
5
|
-
if block_given?
|
|
6
|
-
super(attributes.append!(:class, 'nav-tabs'), &block)
|
|
7
|
-
else
|
|
8
|
-
super(attributes.append!(:class, 'nav-tabs')) {}
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class NavTabContainer < NavContainer
|
|
3
|
+
|
|
4
|
+
def initialize(attributes={}, &block)
|
|
5
|
+
if block_given?
|
|
6
|
+
super(attributes.append!(:class, 'nav-tabs'), &block)
|
|
7
|
+
else
|
|
8
|
+
super(attributes.append!(:class, 'nav-tabs')) {}
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
end
|
|
13
13
|
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class PageHeader < Tag
|
|
3
|
-
|
|
4
|
-
def initialize(title, subtitle=nil)
|
|
5
|
-
super(:div, :class => 'page-header') do
|
|
6
|
-
append do
|
|
7
|
-
Tag.block(:h1) do
|
|
8
|
-
append title
|
|
9
|
-
append Tag.block(:small, " #{subtitle}") {} if subtitle
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class PageHeader < Tag
|
|
3
|
+
|
|
4
|
+
def initialize(title, subtitle=nil)
|
|
5
|
+
super(:div, :class => 'page-header') do
|
|
6
|
+
append do
|
|
7
|
+
Tag.block(:h1) do
|
|
8
|
+
append title
|
|
9
|
+
append Tag.block(:small, " #{subtitle}") {} if subtitle
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
17
|
end
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class Pagination < Tag
|
|
3
|
-
|
|
4
|
-
def initialize(attributes={}, &block)
|
|
5
|
-
super(:div, attributes.prepend!(:class, 'pagination')) do
|
|
6
|
-
append UlContainer.new(&block)
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def centered
|
|
11
|
-
attributes.append!(:class, 'pagination-centered')
|
|
12
|
-
self
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def right
|
|
16
|
-
attributes.append!(:class, 'pagination-right')
|
|
17
|
-
self
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def self.centered(*args, &block)
|
|
21
|
-
self.new(*args, &block).centered
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def self.right(*args, &block)
|
|
25
|
-
self.new(*args, &block).right
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class Pagination < Tag
|
|
3
|
+
|
|
4
|
+
def initialize(attributes={}, &block)
|
|
5
|
+
super(:div, attributes.prepend!(:class, 'pagination')) do
|
|
6
|
+
append UlContainer.new(&block)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def centered
|
|
11
|
+
attributes.append!(:class, 'pagination-centered')
|
|
12
|
+
self
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def right
|
|
16
|
+
attributes.append!(:class, 'pagination-right')
|
|
17
|
+
self
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.centered(*args, &block)
|
|
21
|
+
self.new(*args, &block).centered
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.right(*args, &block)
|
|
25
|
+
self.new(*args, &block).right
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
29
|
end
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
module Popover
|
|
3
|
-
POSITIONS = [:top, :bottom, :left, :right]
|
|
4
|
-
|
|
5
|
-
def popover(title, content)
|
|
6
|
-
popover_right(title, content)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
POSITIONS.each do |position|
|
|
10
|
-
define_method "popover_#{position}" do |title, content|
|
|
11
|
-
attributes[:rel] = 'popover'
|
|
12
|
-
attributes['data-original-title'] = title
|
|
13
|
-
attributes['data-content'] = content
|
|
14
|
-
attributes['data-placement'] = position
|
|
15
|
-
self
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
module Popover
|
|
3
|
+
POSITIONS = [:top, :bottom, :left, :right]
|
|
4
|
+
|
|
5
|
+
def popover(title, content)
|
|
6
|
+
popover_right(title, content)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
POSITIONS.each do |position|
|
|
10
|
+
define_method "popover_#{position}" do |title, content|
|
|
11
|
+
attributes[:rel] = 'popover'
|
|
12
|
+
attributes['data-original-title'] = title
|
|
13
|
+
attributes['data-content'] = content
|
|
14
|
+
attributes['data-placement'] = position
|
|
15
|
+
self
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
20
|
end
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class ProgressBar < Tag
|
|
3
|
-
TYPES = [:info, :success, :danger, :warning]
|
|
4
|
-
|
|
5
|
-
def initialize(percentage=0)
|
|
6
|
-
super(:div, :class => 'progress') do
|
|
7
|
-
append Tag.block(:div, :class => 'bar', :style => "width: #{percentage}%;")
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def striped
|
|
12
|
-
attributes.append! :class, "progress-striped"
|
|
13
|
-
self
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def striped_animated
|
|
17
|
-
attributes.append! :class, "progress-striped active"
|
|
18
|
-
self
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
TYPES.each do |type|
|
|
22
|
-
define_method type do
|
|
23
|
-
attributes.append! :class, "progress-#{type}"
|
|
24
|
-
self
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
TYPES.each do |type|
|
|
29
|
-
define_singleton_method type do |*args, &block|
|
|
30
|
-
self.new(*args, &block).send(type)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
define_singleton_method "#{type}_striped" do |*args, &block|
|
|
34
|
-
self.new(*args, &block).send(type).striped
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
define_singleton_method "#{type}_striped_animated" do |*args, &block|
|
|
38
|
-
self.new(*args, &block).send(type).striped_animated
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class ProgressBar < Tag
|
|
3
|
+
TYPES = [:info, :success, :danger, :warning]
|
|
4
|
+
|
|
5
|
+
def initialize(percentage=0)
|
|
6
|
+
super(:div, :class => 'progress') do
|
|
7
|
+
append Tag.block(:div, :class => 'bar', :style => "width: #{percentage}%;")
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def striped
|
|
12
|
+
attributes.append! :class, "progress-striped"
|
|
13
|
+
self
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def striped_animated
|
|
17
|
+
attributes.append! :class, "progress-striped active"
|
|
18
|
+
self
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
TYPES.each do |type|
|
|
22
|
+
define_method type do
|
|
23
|
+
attributes.append! :class, "progress-#{type}"
|
|
24
|
+
self
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
TYPES.each do |type|
|
|
29
|
+
define_singleton_method type do |*args, &block|
|
|
30
|
+
self.new(*args, &block).send(type)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
define_singleton_method "#{type}_striped" do |*args, &block|
|
|
34
|
+
self.new(*args, &block).send(type).striped
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
define_singleton_method "#{type}_striped_animated" do |*args, &block|
|
|
38
|
+
self.new(*args, &block).send(type).striped_animated
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
43
|
end
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
class Select < Tag
|
|
3
|
-
extend InputSize::ClassMethods
|
|
4
|
-
include InputSize::InstanceMethods
|
|
5
|
-
|
|
6
|
-
def initialize(*args, &block)
|
|
7
|
-
@options = args.shift || [] unless block_given?
|
|
8
|
-
attributes = args.shift || {}
|
|
9
|
-
@selected_value = attributes.delete(:selected_value)
|
|
10
|
-
prompt = attributes.delete(:prompt)
|
|
11
|
-
|
|
12
|
-
if block_given?
|
|
13
|
-
super(:select, attributes, &block)
|
|
14
|
-
else
|
|
15
|
-
super(:select, attributes) {}
|
|
16
|
-
append_options
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
prepend Tag.new(:option, prompt, :value => '') {} if prompt
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
def append_options
|
|
25
|
-
if @options.is_a? Hash
|
|
26
|
-
append_options_hash @options
|
|
27
|
-
else
|
|
28
|
-
append_options_array @options
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def append_options_array(options, container=self)
|
|
33
|
-
options.each do |option|
|
|
34
|
-
o = container.append Tag.block(:option, option, :value => option) {}
|
|
35
|
-
o.attributes[:selected] = nil if option.to_s == @selected_value.to_s
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def append_options_hash(options, container=self)
|
|
40
|
-
options.each do |key, value|
|
|
41
|
-
if value.is_a? Array
|
|
42
|
-
group = append Tag.block(:optgroup, :label => key)
|
|
43
|
-
append_options_array(value, group)
|
|
44
|
-
elsif value.is_a? Hash
|
|
45
|
-
group = append Tag.block(:optgroup, :label => key)
|
|
46
|
-
append_options_hash(value, group)
|
|
47
|
-
else
|
|
48
|
-
o = container.append Tag.block(:option, key, :value => value) {}
|
|
49
|
-
o.attributes[:selected] = nil if value.to_s == @selected_value.to_s
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
class Select < Tag
|
|
3
|
+
extend InputSize::ClassMethods
|
|
4
|
+
include InputSize::InstanceMethods
|
|
5
|
+
|
|
6
|
+
def initialize(*args, &block)
|
|
7
|
+
@options = args.shift || [] unless block_given?
|
|
8
|
+
attributes = args.shift || {}
|
|
9
|
+
@selected_value = attributes.delete(:selected_value)
|
|
10
|
+
prompt = attributes.delete(:prompt)
|
|
11
|
+
|
|
12
|
+
if block_given?
|
|
13
|
+
super(:select, attributes, &block)
|
|
14
|
+
else
|
|
15
|
+
super(:select, attributes) {}
|
|
16
|
+
append_options
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
prepend Tag.new(:option, prompt, :value => '') {} if prompt
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def append_options
|
|
25
|
+
if @options.is_a? Hash
|
|
26
|
+
append_options_hash @options
|
|
27
|
+
else
|
|
28
|
+
append_options_array @options
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def append_options_array(options, container=self)
|
|
33
|
+
options.each do |option|
|
|
34
|
+
o = container.append Tag.block(:option, option, :value => option) {}
|
|
35
|
+
o.attributes[:selected] = nil if option.to_s == @selected_value.to_s
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def append_options_hash(options, container=self)
|
|
40
|
+
options.each do |key, value|
|
|
41
|
+
if value.is_a? Array
|
|
42
|
+
group = append Tag.block(:optgroup, :label => key)
|
|
43
|
+
append_options_array(value, group)
|
|
44
|
+
elsif value.is_a? Hash
|
|
45
|
+
group = append Tag.block(:optgroup, :label => key)
|
|
46
|
+
append_options_hash(value, group)
|
|
47
|
+
else
|
|
48
|
+
o = container.append Tag.block(:option, key, :value => value) {}
|
|
49
|
+
o.attributes[:selected] = nil if value.to_s == @selected_value.to_s
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
55
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
module TwitterBootstrapMarkup
|
|
2
|
-
module SidePosition
|
|
3
|
-
|
|
4
|
-
def pull_right
|
|
5
|
-
attributes.append!(:class, 'pull-right')
|
|
6
|
-
self
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def pull_left
|
|
10
|
-
attributes.append!(:class, 'pull-left')
|
|
11
|
-
self
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
end
|
|
1
|
+
module TwitterBootstrapMarkup
|
|
2
|
+
module SidePosition
|
|
3
|
+
|
|
4
|
+
def pull_right
|
|
5
|
+
attributes.append!(:class, 'pull-right')
|
|
6
|
+
self
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def pull_left
|
|
10
|
+
attributes.append!(:class, 'pull-left')
|
|
11
|
+
self
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
end
|
|
15
15
|
end
|