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.
Files changed (123) hide show
  1. data/.gitignore +4 -4
  2. data/Gemfile +4 -4
  3. data/README.md +28 -28
  4. data/Rakefile +1 -1
  5. data/lib/twitter_bootstrap_markup.rb +52 -52
  6. data/lib/twitter_bootstrap_markup/add_on.rb +8 -8
  7. data/lib/twitter_bootstrap_markup/alert.rb +35 -35
  8. data/lib/twitter_bootstrap_markup/badge.rb +4 -4
  9. data/lib/twitter_bootstrap_markup/brand.rb +8 -8
  10. data/lib/twitter_bootstrap_markup/breadcrumb.rb +21 -21
  11. data/lib/twitter_bootstrap_markup/button.rb +16 -16
  12. data/lib/twitter_bootstrap_markup/button_base.rb +44 -44
  13. data/lib/twitter_bootstrap_markup/control_group.rb +25 -25
  14. data/lib/twitter_bootstrap_markup/divider.rb +29 -29
  15. data/lib/twitter_bootstrap_markup/dropdown_button.rb +58 -58
  16. data/lib/twitter_bootstrap_markup/dropdown_link.rb +29 -29
  17. data/lib/twitter_bootstrap_markup/extended_input.rb +10 -10
  18. data/lib/twitter_bootstrap_markup/extension/hash.rb +10 -10
  19. data/lib/twitter_bootstrap_markup/fieldset.rb +17 -17
  20. data/lib/twitter_bootstrap_markup/form.rb +26 -26
  21. data/lib/twitter_bootstrap_markup/grid_column.rb +13 -13
  22. data/lib/twitter_bootstrap_markup/grid_row.rb +8 -8
  23. data/lib/twitter_bootstrap_markup/help.rb +23 -23
  24. data/lib/twitter_bootstrap_markup/icon.rb +17 -17
  25. data/lib/twitter_bootstrap_markup/input.rb +24 -24
  26. data/lib/twitter_bootstrap_markup/input_size.rb +21 -21
  27. data/lib/twitter_bootstrap_markup/label.rb +4 -4
  28. data/lib/twitter_bootstrap_markup/label_base.rb +32 -32
  29. data/lib/twitter_bootstrap_markup/link.rb +16 -16
  30. data/lib/twitter_bootstrap_markup/link_button.rb +17 -17
  31. data/lib/twitter_bootstrap_markup/nav_bar.rb +33 -33
  32. data/lib/twitter_bootstrap_markup/nav_container.rb +9 -9
  33. data/lib/twitter_bootstrap_markup/nav_header.rb +8 -8
  34. data/lib/twitter_bootstrap_markup/nav_list.rb +15 -15
  35. data/lib/twitter_bootstrap_markup/nav_list_container.rb +9 -9
  36. data/lib/twitter_bootstrap_markup/nav_tab.rb +9 -9
  37. data/lib/twitter_bootstrap_markup/nav_tab_container.rb +12 -12
  38. data/lib/twitter_bootstrap_markup/page_header.rb +16 -16
  39. data/lib/twitter_bootstrap_markup/pagination.rb +28 -28
  40. data/lib/twitter_bootstrap_markup/popover.rb +19 -19
  41. data/lib/twitter_bootstrap_markup/progress_bar.rb +42 -42
  42. data/lib/twitter_bootstrap_markup/select.rb +54 -54
  43. data/lib/twitter_bootstrap_markup/side_position.rb +14 -14
  44. data/lib/twitter_bootstrap_markup/submit.rb +9 -9
  45. data/lib/twitter_bootstrap_markup/tab.rb +13 -13
  46. data/lib/twitter_bootstrap_markup/tab_content.rb +28 -28
  47. data/lib/twitter_bootstrap_markup/table.rb +28 -28
  48. data/lib/twitter_bootstrap_markup/tag.rb +62 -62
  49. data/lib/twitter_bootstrap_markup/tag_builder.rb +21 -21
  50. data/lib/twitter_bootstrap_markup/textarea.rb +14 -14
  51. data/lib/twitter_bootstrap_markup/tooltip.rb +18 -18
  52. data/lib/twitter_bootstrap_markup/ul_container.rb +27 -27
  53. data/lib/twitter_bootstrap_markup/version.rb +3 -3
  54. data/lib/twitter_bootstrap_markup/well.rb +27 -27
  55. data/markup/alerts.html +74 -74
  56. data/markup/badges.html +64 -64
  57. data/markup/breadcrumbs.html +58 -58
  58. data/markup/buttons.html +94 -94
  59. data/markup/control_groups.html +76 -76
  60. data/markup/css/bootstrap-responsive.css +815 -815
  61. data/markup/css/bootstrap-responsive.min.css +9 -9
  62. data/markup/css/bootstrap.css +4914 -4914
  63. data/markup/css/bootstrap.min.css +727 -727
  64. data/markup/dropdown_buttons.html +247 -247
  65. data/markup/dropdown_links.html +111 -111
  66. data/markup/form_fields.html +87 -87
  67. data/markup/forms.html +80 -80
  68. data/markup/grid_system.html +86 -86
  69. data/markup/index.html +38 -38
  70. data/markup/js/bootstrap.js +1835 -1835
  71. data/markup/js/bootstrap.min.js +6 -6
  72. data/markup/js/jquery-1.7.2.js +9402 -9402
  73. data/markup/labels.html +64 -64
  74. data/markup/link_buttons.html +94 -94
  75. data/markup/nav_bars.html +103 -103
  76. data/markup/nav_lists.html +53 -53
  77. data/markup/paginations.html +67 -67
  78. data/markup/popovers.html +55 -55
  79. data/markup/progress_bars.html +92 -92
  80. data/markup/selects.html +123 -123
  81. data/markup/tabs.html +45 -45
  82. data/markup/textareas.html +89 -89
  83. data/markup/textboxes.html +94 -94
  84. data/markup/tooltips.html +55 -55
  85. data/spec/add_on_spec.rb +9 -9
  86. data/spec/alert_spec.rb +77 -77
  87. data/spec/badge_spec.rb +40 -28
  88. data/spec/brand_spec.rb +9 -9
  89. data/spec/breadcrumb_spec.rb +32 -32
  90. data/spec/button_spec.rb +51 -51
  91. data/spec/control_group_spec.rb +28 -28
  92. data/spec/divider_spec.rb +16 -16
  93. data/spec/dropdown_button_spec.rb +100 -100
  94. data/spec/dropdown_link_spec.rb +47 -47
  95. data/spec/fieldset_spec.rb +21 -21
  96. data/spec/form_fields_spec.rb +70 -70
  97. data/spec/form_spec.rb +34 -34
  98. data/spec/grid_system_spec.rb +68 -68
  99. data/spec/help_spec.rb +12 -12
  100. data/spec/icon_spec.rb +17 -17
  101. data/spec/input_spec.rb +10 -10
  102. data/spec/label_spec.rb +40 -28
  103. data/spec/link_button_spec.rb +51 -51
  104. data/spec/link_spec.rb +28 -28
  105. data/spec/nav_bar_spec.rb +37 -37
  106. data/spec/nav_list_spec.rb +39 -39
  107. data/spec/page_header_spec.rb +12 -12
  108. data/spec/pagination_spec.rb +17 -17
  109. data/spec/popover_spec.rb +14 -14
  110. data/spec/progress_bar_spec.rb +52 -52
  111. data/spec/select_spec.rb +59 -59
  112. data/spec/spec_helper.rb +11 -11
  113. data/spec/support/helpers/html_helper.rb +10 -10
  114. data/spec/table_spec.rb +32 -32
  115. data/spec/tabs_spec.rb +21 -21
  116. data/spec/tag_builder_spec.rb +37 -37
  117. data/spec/tag_spec.rb +51 -51
  118. data/spec/text_area_spec.rb +42 -42
  119. data/spec/textbox_spec.rb +59 -59
  120. data/spec/tooltip_spec.rb +14 -14
  121. data/spec/well_spec.rb +16 -16
  122. data/twitter_bootstrap_markup.gemspec +25 -25
  123. metadata +25 -9
@@ -1,9 +1,9 @@
1
- module TwitterBootstrapMarkup
2
- class GridRow < Tag
3
-
4
- def initialize(attributes={}, &block)
5
- super(:div, attributes.prepend!(:class, 'row'), &block)
6
- end
7
-
8
- end
1
+ module TwitterBootstrapMarkup
2
+ class GridRow < Tag
3
+
4
+ def initialize(attributes={}, &block)
5
+ super(:div, attributes.prepend!(:class, 'row'), &block)
6
+ end
7
+
8
+ end
9
9
  end
@@ -1,24 +1,24 @@
1
- module TwitterBootstrapMarkup
2
- class Help < Tag
3
-
4
- def initialize(type, text)
5
- case type
6
- when :inline
7
- super(:span, text, :class => 'help-inline') {}
8
- when :block
9
- super(:p, text, :class => 'help-block') {}
10
- else
11
- raise "Invalid help type [#{type}]"
12
- end
13
- end
14
-
15
- def self.inline(text)
16
- self.new(:inline, text)
17
- end
18
-
19
- def self.block(text)
20
- self.new(:block, text)
21
- end
22
-
23
- end
1
+ module TwitterBootstrapMarkup
2
+ class Help < Tag
3
+
4
+ def initialize(type, text)
5
+ case type
6
+ when :inline
7
+ super(:span, text, :class => 'help-inline') {}
8
+ when :block
9
+ super(:p, text, :class => 'help-block') {}
10
+ else
11
+ raise "Invalid help type [#{type}]"
12
+ end
13
+ end
14
+
15
+ def self.inline(text)
16
+ self.new(:inline, text)
17
+ end
18
+
19
+ def self.block(text)
20
+ self.new(:block, text)
21
+ end
22
+
23
+ end
24
24
  end
@@ -1,18 +1,18 @@
1
- module TwitterBootstrapMarkup
2
- class Icon < Tag
3
-
4
- def initialize(name, attributes={})
5
- super(:i, attributes.prepend!(:class, "icon-#{name}")) {}
6
- end
7
-
8
- def white
9
- attributes.append!(:class, 'icon-white')
10
- self
11
- end
12
-
13
- def self.white(*args)
14
- self.new(*args).white
15
- end
16
-
17
- end
1
+ module TwitterBootstrapMarkup
2
+ class Icon < Tag
3
+
4
+ def initialize(name, attributes={})
5
+ super(:i, attributes.prepend!(:class, "icon-#{name}")) {}
6
+ end
7
+
8
+ def white
9
+ attributes.append!(:class, 'icon-white')
10
+ self
11
+ end
12
+
13
+ def self.white(*args)
14
+ self.new(*args).white
15
+ end
16
+
17
+ end
18
18
  end
@@ -1,25 +1,25 @@
1
- module TwitterBootstrapMarkup
2
- class Input < Tag
3
- TYPES = [:text, :hidden, :email, :password, :button, :checkbox, :radio]
4
-
5
- include InputSize::InstanceMethods
6
-
7
- def initialize(type, attributes={}, &block)
8
- super(:input, {:type => type}.merge(attributes), &block)
9
- end
10
-
11
- TYPES.each do |type|
12
- define_singleton_method(type) do |*args, &block|
13
- self.new(type, *args, &block)
14
- end
15
-
16
- InputSize::VALUES.each do |size|
17
- define_singleton_method("#{type}_#{size}") do |*args, &block|
18
- self.new(type, *args, &block).send(size)
19
- end
20
- end
21
- end
22
-
23
-
24
- end
1
+ module TwitterBootstrapMarkup
2
+ class Input < Tag
3
+ TYPES = [:text, :hidden, :email, :password, :button, :checkbox, :radio]
4
+
5
+ include InputSize::InstanceMethods
6
+
7
+ def initialize(type, attributes={}, &block)
8
+ super(:input, {:type => type}.merge(attributes), &block)
9
+ end
10
+
11
+ TYPES.each do |type|
12
+ define_singleton_method(type) do |*args, &block|
13
+ self.new(type, *args, &block)
14
+ end
15
+
16
+ InputSize::VALUES.each do |size|
17
+ define_singleton_method("#{type}_#{size}") do |*args, &block|
18
+ self.new(type, *args, &block).send(size)
19
+ end
20
+ end
21
+ end
22
+
23
+
24
+ end
25
25
  end
@@ -1,22 +1,22 @@
1
- module TwitterBootstrapMarkup
2
- module InputSize
3
- VALUES = [:mini, :small, :medium, :large, :xlarge, :xxlarge]
4
-
5
- module InstanceMethods
6
- VALUES.each do |size|
7
- define_method(size) do
8
- attributes.append!(:class, "input-#{size}")
9
- self
10
- end
11
- end
12
- end
13
-
14
- module ClassMethods
15
- VALUES.each do |size|
16
- define_method(size) do |*args, &block|
17
- self.new(*args, &block).send(size)
18
- end
19
- end
20
- end
21
- end
1
+ module TwitterBootstrapMarkup
2
+ module InputSize
3
+ VALUES = [:mini, :small, :medium, :large, :xlarge, :xxlarge]
4
+
5
+ module InstanceMethods
6
+ VALUES.each do |size|
7
+ define_method(size) do
8
+ attributes.append!(:class, "input-#{size}")
9
+ self
10
+ end
11
+ end
12
+ end
13
+
14
+ module ClassMethods
15
+ VALUES.each do |size|
16
+ define_method(size) do |*args, &block|
17
+ self.new(*args, &block).send(size)
18
+ end
19
+ end
20
+ end
21
+ end
22
22
  end
@@ -1,5 +1,5 @@
1
- module TwitterBootstrapMarkup
2
- class Label < Tag
3
- include LabelBase
4
- end
1
+ module TwitterBootstrapMarkup
2
+ class Label < Tag
3
+ include LabelBase
4
+ end
5
5
  end
@@ -1,33 +1,33 @@
1
- module TwitterBootstrapMarkup
2
- module LabelBase
3
- TYPES = [:success, :warning, :important, :info, :inverse]
4
-
5
- def initialize(text)
6
- super(:span, text, :class => class_name.downcase) {}
7
- end
8
-
9
- def self.included(base)
10
-
11
- TYPES.each do |type|
12
- base.send(:define_method, type) do
13
- attributes.append!(:class, "#{class_name.downcase}-#{type}")
14
- self
15
- end
16
- end
17
-
18
- TYPES.each do |type|
19
- base.send(:define_singleton_method, type) do |*args, &block|
20
- self.new(*args, &block).send(type)
21
- end
22
- end
23
-
24
- end
25
-
26
- private
27
-
28
- def class_name
29
- self.class.name.split('::').last
30
- end
31
-
32
- end
1
+ module TwitterBootstrapMarkup
2
+ module LabelBase
3
+ TYPES = [:success, :warning, :important, :info, :inverse]
4
+
5
+ def initialize(text, attributes={})
6
+ super(:span, text, attributes.prepend!(:class, class_name.downcase)) {}
7
+ end
8
+
9
+ def self.included(base)
10
+
11
+ TYPES.each do |type|
12
+ base.send(:define_method, type) do
13
+ attributes.append!(:class, "#{class_name.downcase}-#{type}")
14
+ self
15
+ end
16
+ end
17
+
18
+ TYPES.each do |type|
19
+ base.send(:define_singleton_method, type) do |*args, &block|
20
+ self.new(*args, &block).send(type)
21
+ end
22
+ end
23
+
24
+ end
25
+
26
+ private
27
+
28
+ def class_name
29
+ self.class.name.split('::').last
30
+ end
31
+
32
+ end
33
33
  end
@@ -1,17 +1,17 @@
1
- module TwitterBootstrapMarkup
2
- class Link < Tag
3
-
4
- def initialize(*args, &block)
5
- text = args.shift unless block_given?
6
- url = args.shift
7
- attributes = args.shift || {}
8
-
9
- if block_given?
10
- super(:a, {:href => url}.merge(attributes), &block)
11
- else
12
- super(:a, text, {:href => url}.merge(attributes || {})) {}
13
- end
14
- end
15
-
16
- end
1
+ module TwitterBootstrapMarkup
2
+ class Link < Tag
3
+
4
+ def initialize(*args, &block)
5
+ text = args.shift unless block_given?
6
+ url = args.shift
7
+ attributes = args.shift || {}
8
+
9
+ if block_given?
10
+ super(:a, {:href => url}.merge(attributes), &block)
11
+ else
12
+ super(:a, text, {:href => url}.merge(attributes || {})) {}
13
+ end
14
+ end
15
+
16
+ end
17
17
  end
@@ -1,18 +1,18 @@
1
- module TwitterBootstrapMarkup
2
- class LinkButton < Tag
3
- include ButtonBase
4
-
5
- def initialize(*args, &block)
6
- text = args.shift unless block_given?
7
- url = args.shift
8
- attributes = args.shift || {}
9
-
10
- if block_given?
11
- super(:a, attributes.prepend!(:class, 'btn').merge(:href => url), &block)
12
- else
13
- super(:a, text, attributes.prepend!(:class, 'btn').merge(:href => url)) {}
14
- end
15
- end
16
-
17
- end
1
+ module TwitterBootstrapMarkup
2
+ class LinkButton < Tag
3
+ include ButtonBase
4
+
5
+ def initialize(*args, &block)
6
+ text = args.shift unless block_given?
7
+ url = args.shift
8
+ attributes = args.shift || {}
9
+
10
+ if block_given?
11
+ super(:a, attributes.prepend!(:class, 'btn').merge(:href => url), &block)
12
+ else
13
+ super(:a, text, attributes.prepend!(:class, 'btn').merge(:href => url)) {}
14
+ end
15
+ end
16
+
17
+ end
18
18
  end
@@ -1,34 +1,34 @@
1
- module TwitterBootstrapMarkup
2
- class NavBar < Tag
3
- alias :internal_append :append
4
-
5
- def initialize(attributes={}, &block)
6
- super(:div, attributes.prepend!(:class, 'navbar')) {}
7
- @container = Tag.block(:div, :class => 'container', &block)
8
- internal_append Tag.block(:div, @container, :class => 'navbar-inner')
9
- end
10
-
11
- def append(*args, &block)
12
- @container.append(*args, &block)
13
- end
14
-
15
- def top
16
- attributes.append!(:class, 'navbar-fixed-top')
17
- self
18
- end
19
-
20
- def bottom
21
- attributes.append!(:class, 'navbar-fixed-bottom')
22
- self
23
- end
24
-
25
- def self.top(*args, &block)
26
- self.new(*args, &block).top
27
- end
28
-
29
- def self.bottom(*args, &block)
30
- self.new(*args, &block).bottom
31
- end
32
-
33
- end
1
+ module TwitterBootstrapMarkup
2
+ class NavBar < Tag
3
+ alias :internal_append :append
4
+
5
+ def initialize(attributes={}, &block)
6
+ super(:div, attributes.prepend!(:class, 'navbar')) {}
7
+ @container = Tag.block(:div, :class => 'container', &block)
8
+ internal_append Tag.block(:div, @container, :class => 'navbar-inner')
9
+ end
10
+
11
+ def append(*args, &block)
12
+ @container.append(*args, &block)
13
+ end
14
+
15
+ def top
16
+ attributes.append!(:class, 'navbar-fixed-top')
17
+ self
18
+ end
19
+
20
+ def bottom
21
+ attributes.append!(:class, 'navbar-fixed-bottom')
22
+ self
23
+ end
24
+
25
+ def self.top(*args, &block)
26
+ self.new(*args, &block).top
27
+ end
28
+
29
+ def self.bottom(*args, &block)
30
+ self.new(*args, &block).bottom
31
+ end
32
+
33
+ end
34
34
  end
@@ -1,10 +1,10 @@
1
- module TwitterBootstrapMarkup
2
- class NavContainer < UlContainer
3
-
4
- def initialize(attributes={}, &block)
5
- super(attributes.prepend!(:class, 'nav'), &block)
6
- end
7
-
8
- end
9
-
1
+ module TwitterBootstrapMarkup
2
+ class NavContainer < UlContainer
3
+
4
+ def initialize(attributes={}, &block)
5
+ super(attributes.prepend!(:class, 'nav'), &block)
6
+ end
7
+
8
+ end
9
+
10
10
  end
@@ -1,9 +1,9 @@
1
- module TwitterBootstrapMarkup
2
- class NavHeader < Tag
3
-
4
- def initialize(text)
5
- super(:li, text, :class => 'nav-header') {}
6
- end
7
-
8
- end
1
+ module TwitterBootstrapMarkup
2
+ class NavHeader < Tag
3
+
4
+ def initialize(text)
5
+ super(:li, text, :class => 'nav-header') {}
6
+ end
7
+
8
+ end
9
9
  end