ui_bibz 2.0.0.alpha32 → 2.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +111 -87
  4. data/app/assets/javascripts/form.coffee +24 -8
  5. data/app/assets/javascripts/ui_bibz.coffee +3 -2
  6. data/app/assets/stylesheets/bootstrap-switch.sass +17 -8
  7. data/app/assets/stylesheets/fix-dropdown-select.sass +1 -1
  8. data/app/assets/stylesheets/table.sass +1 -1
  9. data/app/assets/stylesheets/ui_bibz.sass +60 -22
  10. data/app/inputs/ui_bibz_form/ui_bibz_form_builder.rb +35 -0
  11. data/app/inputs/ui_bibz_inputs/auto_complete_field_input.rb +14 -0
  12. data/app/inputs/{custom_inputs → ui_bibz_inputs}/base_input.rb +7 -1
  13. data/app/inputs/{custom_inputs → ui_bibz_inputs}/collection_input.rb +6 -3
  14. data/app/inputs/{custom_inputs → ui_bibz_inputs}/string_input.rb +5 -1
  15. data/app/inputs/ui_bibz_inputs/ui_auto_complete_field_input.rb +14 -0
  16. data/app/inputs/ui_bibz_inputs/ui_button_choices_input.rb +20 -0
  17. data/app/inputs/{custom_inputs/date_picker_field_input.rb → ui_bibz_inputs/ui_date_picker_field_input.rb} +2 -2
  18. data/app/inputs/{custom_inputs/dropdown_select_field_input.rb → ui_bibz_inputs/ui_dropdown_select_field_input.rb} +2 -2
  19. data/app/inputs/{custom_inputs/formula_field_input.rb → ui_bibz_inputs/ui_formula_field_input.rb} +2 -2
  20. data/app/inputs/{custom_inputs/markdown_editor_field_input.rb → ui_bibz_inputs/ui_markdown_editor_field_input.rb} +2 -2
  21. data/app/inputs/{custom_inputs/multi_column_field_input.rb → ui_bibz_inputs/ui_multi_column_field_input.rb} +2 -2
  22. data/app/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +9 -0
  23. data/app/inputs/{custom_inputs/radio_field_input.rb → ui_bibz_inputs/ui_radio_field_input.rb} +2 -2
  24. data/app/inputs/{custom_inputs/select_field_input.rb → ui_bibz_inputs/ui_select_field_input.rb} +2 -2
  25. data/app/inputs/{custom_inputs/switch_field_input.rb → ui_bibz_inputs/ui_switch_field_input.rb} +2 -2
  26. data/app/inputs/ui_bibz_inputs/ui_text_field_input.rb +13 -0
  27. data/config/initializers/ui_bibz.rb +7 -0
  28. data/lib/ui_bibz/helpers/ui/core/cards_helper.rb +42 -0
  29. data/lib/ui_bibz/helpers/ui/core/dropdowns_helper.rb +21 -0
  30. data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +148 -0
  31. data/lib/ui_bibz/helpers/ui/core/layouts_helper.rb +27 -0
  32. data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +11 -0
  33. data/lib/ui_bibz/helpers/ui/core/navs_helper.rb +27 -0
  34. data/lib/ui_bibz/helpers/ui/core/paths_helper.rb +16 -0
  35. data/lib/ui_bibz/helpers/ui/core/windows_helper.rb +11 -0
  36. data/lib/ui_bibz/helpers/ui/core_helper.rb +89 -0
  37. data/lib/ui_bibz/helpers/{ui_ux_helper.rb → ui/ux_helper.rb} +8 -18
  38. data/lib/ui_bibz/helpers/utils_helper.rb +22 -1
  39. data/lib/ui_bibz/rails/engine.rb +6 -2
  40. data/lib/ui_bibz/ui/base.rb +4 -0
  41. data/lib/ui_bibz/ui/core/{tag.rb → badge.rb} +10 -10
  42. data/lib/ui_bibz/ui/core/cards/card.rb +37 -13
  43. data/lib/ui_bibz/ui/core/cards/components/{block/card_block_link.rb → body/card_body_link.rb} +6 -6
  44. data/lib/ui_bibz/ui/core/cards/components/{block/card_block_text.rb → body/card_body_text.rb} +6 -6
  45. data/lib/ui_bibz/ui/core/cards/components/{block/card_block_title.rb → body/card_body_title.rb} +6 -6
  46. data/lib/ui_bibz/ui/core/cards/components/{card_block.rb → card_body.rb} +17 -13
  47. data/lib/ui_bibz/ui/core/cards/components/card_footer.rb +5 -1
  48. data/lib/ui_bibz/ui/core/cards/components/card_header.rb +5 -1
  49. data/lib/ui_bibz/ui/core/cards/components/card_image.rb +3 -2
  50. data/lib/ui_bibz/ui/core/component.rb +8 -6
  51. data/lib/ui_bibz/ui/core/dropdowns/dropdown.rb +21 -5
  52. data/lib/ui_bibz/ui/core/forms/buttons/button.rb +37 -8
  53. data/lib/ui_bibz/ui/core/forms/buttons/button_choice.rb +17 -29
  54. data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +51 -11
  55. data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +18 -5
  56. data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +13 -4
  57. data/lib/ui_bibz/ui/core/forms/buttons/button_toolbar.rb +90 -0
  58. data/lib/ui_bibz/ui/core/forms/buttons/components/choice.rb +116 -0
  59. data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +21 -8
  60. data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +22 -9
  61. data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +17 -5
  62. data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +36 -16
  63. data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +20 -19
  64. data/lib/ui_bibz/ui/core/forms/selects/abstract_select.rb +99 -0
  65. data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +16 -16
  66. data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +8 -13
  67. data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +17 -18
  68. data/lib/ui_bibz/ui/core/forms/selects/select_field.rb +8 -20
  69. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_addon.rb +25 -0
  70. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +16 -0
  71. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_group.rb +16 -0
  72. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +16 -0
  73. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_refresh.rb +16 -0
  74. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_checkbox_field.rb +16 -0
  75. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +16 -0
  76. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_radio_field.rb +16 -0
  77. data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_switch_field.rb +16 -0
  78. data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +153 -0
  79. data/lib/ui_bibz/ui/core/forms/texts/auto_complete_field.rb +13 -38
  80. data/lib/ui_bibz/ui/core/forms/texts/text_field.rb +81 -0
  81. data/lib/ui_bibz/ui/core/glyph.rb +1 -1
  82. data/lib/ui_bibz/ui/core/layouts/col.rb +10 -2
  83. data/lib/ui_bibz/ui/core/layouts/row.rb +7 -1
  84. data/lib/ui_bibz/ui/core/lists/components/list/list_body.rb +4 -2
  85. data/lib/ui_bibz/ui/core/lists/components/list/list_header.rb +5 -2
  86. data/lib/ui_bibz/ui/core/lists/components/list.rb +35 -14
  87. data/lib/ui_bibz/ui/core/lists/list_group.rb +4 -4
  88. data/lib/ui_bibz/ui/core/navs/components/navbar_form.rb +7 -2
  89. data/lib/ui_bibz/ui/core/navs/components/navbar_nav.rb +4 -0
  90. data/lib/ui_bibz/ui/core/navs/components/navbar_text.rb +1 -1
  91. data/lib/ui_bibz/ui/core/navs/components/pagination_link.rb +60 -0
  92. data/lib/ui_bibz/ui/core/navs/nav.rb +31 -3
  93. data/lib/ui_bibz/ui/core/navs/navbar.rb +32 -22
  94. data/lib/ui_bibz/ui/core/navs/pagination.rb +97 -0
  95. data/lib/ui_bibz/ui/core/{alert.rb → notifications/alert.rb} +23 -11
  96. data/lib/ui_bibz/ui/core/notifications/components/alert_body.rb +50 -0
  97. data/lib/ui_bibz/ui/core/notifications/components/alert_header.rb +67 -0
  98. data/lib/ui_bibz/ui/core/{progress.rb → progresses/components/bar.rb} +21 -28
  99. data/lib/ui_bibz/ui/core/progresses/progress_bar.rb +115 -0
  100. data/lib/ui_bibz/ui/core/windows/components/modal_header.rb +1 -1
  101. data/lib/ui_bibz/ui/{core → extensions/core}/component/glyph_extension.rb +2 -2
  102. data/lib/ui_bibz/ui/{core → extensions/core}/component/klass_extension.rb +1 -2
  103. data/lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb +31 -0
  104. data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +48 -0
  105. data/lib/ui_bibz/utils/internationalization.rb +9 -0
  106. data/lib/ui_bibz/version.rb +1 -1
  107. data/lib/ui_bibz.rb +23 -7
  108. data/test/simple_form_test.rb +58 -41
  109. data/test/ui/core/badge_test.rb +19 -0
  110. data/test/ui/core/cards/card_test.rb +34 -35
  111. data/test/ui/{component_test.rb → core/component_test.rb} +0 -1
  112. data/test/ui/core/dropdowns/dropdown_test.rb +5 -5
  113. data/test/ui/core/forms/buttons/button_choice_test.rb +23 -7
  114. data/test/ui/core/forms/buttons/button_group_test.rb +35 -17
  115. data/test/ui/core/forms/buttons/button_link_test.rb +74 -4
  116. data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -2
  117. data/test/ui/core/forms/buttons/button_test.rb +66 -3
  118. data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -2
  119. data/test/ui/core/forms/choices/radio_field_test.rb +1 -2
  120. data/test/ui/core/forms/choices/switch_field_test.rb +0 -1
  121. data/test/ui/core/forms/dates/date_picker_field_test.rb +2 -3
  122. data/test/ui/core/forms/numbers/formula_field_test.rb +1 -2
  123. data/test/ui/core/forms/selects/dropdown_select_field_test.rb +1 -2
  124. data/test/ui/core/forms/selects/multi_column_field_test.rb +0 -1
  125. data/test/ui/core/forms/selects/multi_select_field_test.rb +1 -2
  126. data/test/ui/core/forms/selects/select_field_test.rb +1 -2
  127. data/test/ui/core/forms/surrounds/surround_field_test.rb +58 -0
  128. data/test/ui/core/forms/textareas/markdown_editor_field_test.rb +0 -1
  129. data/test/ui/core/forms/texts/auto_complete_field_test.rb +21 -4
  130. data/test/ui/core/forms/texts/text_field_test.rb +25 -0
  131. data/test/ui/{glyph_test.rb → core/glyph_test.rb} +5 -5
  132. data/test/ui/core/jumbotron_test.rb +20 -0
  133. data/test/ui/core/layouts/col_test.rb +31 -0
  134. data/test/ui/core/layouts/container_test.rb +13 -0
  135. data/test/ui/core/layouts/row_test.rb +24 -0
  136. data/test/ui/core/lists/list_group_test.rb +5 -4
  137. data/test/ui/core/navs/nav_test.rb +4 -5
  138. data/test/ui/core/navs/navbar_test.rb +39 -0
  139. data/test/ui/core/notifications/alert_test.rb +22 -0
  140. data/test/ui/core/paths/breadcrumb_test.rb +15 -4
  141. data/test/ui/core/progress_test.rb +14 -0
  142. data/test/ui/{star_test.rb → core/star_test.rb} +6 -7
  143. data/test/ui/core/windows/modal_test.rb +20 -0
  144. data/test/ui/ux/tables/table_test.rb +2 -3
  145. data/ui_bibz.gemspec +2 -1
  146. data/vendor/assets/javascripts/bootstrap-select.min.js +8 -7
  147. data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.scss +62 -42
  148. data/vendor/assets/stylesheets/bootstrap-multiselect.min.css +1 -1
  149. data/vendor/assets/stylesheets/bootstrap-select.min.css +3 -3
  150. data/vendor/assets/stylesheets/bootstrap-theme.min.css +1 -1
  151. metadata +105 -44
  152. data/app/inputs/custom_inputs/auto_complete_field_input.rb +0 -16
  153. data/app/inputs/custom_inputs/multi_select_field_input.rb +0 -9
  154. data/app/inputs/custom_inputs/surround_field_input.rb +0 -10
  155. data/lib/ui_bibz/helpers/ui_core_helper.rb +0 -347
  156. data/lib/ui_bibz/ui/core/connected_component.rb +0 -87
  157. data/lib/ui_bibz/ui/core/forms/texts/surround_field.rb +0 -87
  158. data/test/ui/core/forms/texts/surround_field_test.rb +0 -26
  159. data/test/ui/grid_test.rb +0 -31
  160. data/test/ui_helper_test.rb +0 -109
@@ -1,87 +0,0 @@
1
- module UiBibz::Ui::Core
2
-
3
- # Creates a connected component of the given +name+ using options created by the set of +options+.
4
- #
5
- # ==== Attributes
6
- #
7
- # * +content+ - Content of element
8
- # * +options+ - Options of element
9
- # * +html_options+ - Html Options of element
10
- #
11
- # ==== Options
12
- #
13
- # You can add HTML attributes using the +html_options+.
14
- # You can pass arguments in options attribute:
15
- # * +status+ - status of élement with symbol value:
16
- # (+:default+, +:primary+, +:info+, +:warning+, +:danger+)
17
- # * +glyph+ - Add glyph with name or hash options
18
- # * +name+ - String
19
- # * +size+ - Integer
20
- # * +type+ - Symbol
21
- #
22
- # ==== Signatures
23
- #
24
- # UiBibz::Ui::Core::Component.new(content, options = nil, html_options = nil)
25
- #
26
- # UiBibz::Ui::Core::Component.new(options = nil, html_options = nil) do
27
- # content
28
- # end
29
- #
30
- # ==== Examples
31
- #
32
- # UiBibz::Ui::Core::Component.new(content, { type: :success, glyph: 'eye' }, { class: 'test' })
33
- # # or
34
- # UiBibz::Ui::Core::Component.new({glyph: { name: 'eye', size: 3}, { class: 'test' }) do
35
- # content
36
- # end
37
- #
38
- class ConnectedComponent < Component
39
-
40
- # See UiBibz::Ui::Core::Component.initialize
41
- def initialize content = nil, options = nil, html_options = nil, &block
42
- super
43
- end
44
-
45
- # Render html tag
46
- def render
47
- super
48
- end
49
-
50
- protected
51
-
52
- def refresh_render
53
- content_tag :div, class: 'input-group field-refresh' do
54
- concat select_tag content, options[:option_tags], html_options
55
- concat refresh_btn_html
56
- end
57
- end
58
-
59
- def component_html_data
60
- connect_options
61
- end
62
-
63
- private
64
-
65
- def connect_opts
66
- selector = options[:refresh][:target][:selector]
67
- options[:refresh][:target][:selector] = selector.blank? ? "##{ content.to_s.parameterize.underscore }" : selector
68
-
69
- options[:refresh].merge({
70
- connect: {
71
- target: options[:refresh].delete(:target),
72
- event: options[:refresh].delete(:event),
73
- mode: options[:refresh].delete(:mode)
74
- }
75
- })
76
- end
77
-
78
- def refresh_btn_html
79
- content_tag(:span, UiBibz::Ui::Core::Forms::Buttons::ButtonRefresh.new('', connect_opts).render, class: 'input-group-btn')
80
- end
81
-
82
- def connect_options
83
- add_html_data('connect', options[:connect]) if options[:connect]
84
- end
85
-
86
- end
87
- end
@@ -1,87 +0,0 @@
1
- module UiBibz::Ui::Core::Forms::Texts
2
-
3
- # Create a SurroundField
4
- #
5
- # This element is an extend of UiBibz::Ui::Core::Component.
6
- #
7
- # ==== Attributes
8
- #
9
- # * +content+ - Content of element
10
- # * +options+ - Options of element
11
- # * +html_options+ - Html Options of element
12
- #
13
- # ==== Options
14
- #
15
- # You can add HTML attributes using the +html_options+.
16
- # You can pass arguments in options attribute:
17
- # * +prepend+ - String
18
- # * +append+ - String
19
- #
20
- # ==== Signatures
21
- #
22
- # UiBibz::Ui::Core::Forms::Texts::SurroundField.new(content, options = {}, html_options = {}).render
23
- #
24
- # UiBibz::Ui::Core::Forms::Texts::SurroundField.new(options = {}, html_options = {}) do
25
- # content
26
- # end.render
27
- #
28
- # ==== Examples
29
- #
30
- # UiBibz::Ui::Core::Forms::Texts::SurroundField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')
31
- #
32
- # UiBibz::Ui::Core::Forms::Texts::SurroundField.new(prepend: glyph('pencil'), append: glyph('camera-retro')) do
33
- # #content
34
- # end
35
- #
36
- # ==== Helper
37
- #
38
- # surround_field(options = {}, html_options = {}) do
39
- # # content
40
- # end
41
- #
42
- class SurroundField < UiBibz::Ui::Core::Component
43
-
44
- # See UiBibz::Ui::Core::Component.initialize
45
- def initialize content = nil, options = nil, html_options = nil, &block
46
- super
47
- end
48
-
49
- # Render html tag
50
- def render
51
- if options[:append].nil? && options[:prepend].nil?
52
- text_field_input_tag
53
- else
54
- content_tag :div, class: join_classes('input-group', size, status) do
55
- concat content_tag :span, options[:append], class: 'input-group-addon' unless options[:append].nil?
56
- concat text_field_input_tag
57
- concat content_tag :span, options[:prepend], class: 'input-group-addon' unless options[:prepend].nil?
58
- end
59
- end
60
- end
61
-
62
- private
63
-
64
- # Simple_form or not
65
- def text_field_input_tag
66
- text_field_tag content, html_options[:value], html_options
67
- end
68
-
69
- def component_html_classes
70
- 'form-control'
71
- end
72
-
73
- # :lg, :sm or :xs
74
- def size
75
- "input-group-#{ options[:size] }" if options[:size]
76
- end
77
-
78
- def status
79
- "has-#{ options[:status] }" if options[:status]
80
- end
81
-
82
- def component_html_options
83
- options[:state] == :disabled ? { disabled: 'disabled' } : {}
84
- end
85
-
86
- end
87
- end
@@ -1,26 +0,0 @@
1
- require 'test_helper'
2
- include UiBibz::Helpers
3
-
4
- class SurroundFieldTest < ActionView::TestCase
5
-
6
- test 'surround_field without prepend and append' do
7
- actual = UiBibz::Ui::Core::Forms::Texts::SurroundField.new('test').render
8
- expected = "<input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" />"
9
-
10
- assert_equal expected, actual
11
- end
12
-
13
- test 'surround_field with prepend and append' do
14
- actual = UiBibz::Ui::Core::Forms::Texts::SurroundField.new('test', append: '1', prepend: '2').render
15
- expected = "<div class=\"input-group\"><span class=\"input-group-addon\">1</span><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" /><span class=\"input-group-addon\">2</span></div>"
16
-
17
- assert_equal expected, actual
18
- end
19
-
20
- test 'surround_field size' do
21
- actual = UiBibz::Ui::Core::Forms::Texts::SurroundField.new('test', size: :xs, append: '1', prepend: '2').render
22
- expected = "<div class=\"input-group input-group-xs\"><span class=\"input-group-addon\">1</span><input type=\"text\" name=\"test\" id=\"test\" class=\"form-control\" /><span class=\"input-group-addon\">2</span></div>"
23
-
24
- assert_equal expected, actual
25
- end
26
- end
data/test/ui/grid_test.rb DELETED
@@ -1,31 +0,0 @@
1
- require 'test_helper'
2
-
3
- include UiBibz::Helpers
4
- class GridTest < ActionView::TestCase
5
-
6
- test 'row' do
7
- actual = UiBibz::Ui::Core::Layouts::Row.new(class: 'test') do
8
- 'test'
9
- end.render
10
- expected = "<div class=\"test row\">test</div>"
11
-
12
- assert_equal expected, actual
13
- end
14
-
15
- test "col" do
16
- actual = UiBibz::Ui::Core::Layouts::Col.new('test', { num: 1, push: 2, offset: 3, pull: 4 }, { class: 'test' }).render
17
- expected = "<div class=\"test col-md-1 col-md-push-2 offset-md-3 col-md-pull-4\">test</div>"
18
-
19
- assert_equal expected, actual
20
- end
21
-
22
- test "col with several cols" do
23
- actual = UiBibz::Ui::Core::Layouts::Col.new(md: { num: 1, push: 2, pull: 4 }, xl: { num: 6, offset: 5 }, class: 'test') do
24
- "test"
25
- end.render
26
- expected = "<div class=\"test col-md-1 col-md-push-2 col-md-pull-4 col-xl-6 offset-xl-5\">test</div>"
27
-
28
- assert_equal expected, actual
29
- end
30
-
31
- end
@@ -1,109 +0,0 @@
1
- # encoding: UTF-8
2
- require 'test_helper'
3
-
4
- include UiBibz::Helpers::UiCoreHelper
5
- class UiHelperTest < ActionView::TestCase
6
-
7
- test 'breadcrumb' do
8
- actual = breadcrumb(tap: true) do |b|
9
- b.link 'Home', url: '#home', glyph: 'home'
10
- b.link 'state', { url: '#state', state: :active }
11
- end
12
- expected = "<ol class=\"breadcrumb\"><li class=\"breadcrumb-item\"><a href=\"#home\"><i class=\"glyph fa fa-home\"></i> Home</a></li><li class=\"active breadcrumb-item\"><a href=\"#state\">state</a></li></ol>"
13
-
14
- assert_equal expected, actual
15
- end
16
-
17
- test 'breadcrumb with store' do
18
- users = create_list(:user, 3)
19
- actual = breadcrumb store: users, link_label: :name_fr, link_url: user_path(:id)
20
- expected = "<ol class=\"breadcrumb\"><li class=\"breadcrumb-item\"><a href=\"/users/1/\">Name fr</a></li><li class=\"breadcrumb-item\"><a href=\"/users/2/\">Name fr</a></li><li class=\"breadcrumb-item\">Name fr</li></ol>"
21
-
22
- assert_equal expected, actual
23
- end
24
-
25
- test 'alert' do
26
- actual = notify 'state'
27
- expected = "<div class=\"alert-info alert alert-dismissible\" role=\"alert\">state</div>"
28
-
29
- assert_equal expected, actual
30
- end
31
-
32
- test 'etiquette' do
33
- actual = etiquette 'state', status: :success, glyph: 'pencil'
34
- expected = "<span class=\"tag-success tag\"><i class=\"glyph fa fa-pencil\"></i> state</span>"
35
-
36
- assert_equal expected, actual
37
- end
38
-
39
- test 'etiquette pill' do
40
- actual = etiquette 'state', status: :success, type: :pill, glyph: 'pencil'
41
- expected = "<span class=\"tag-success tag tag-pill\"><i class=\"glyph fa fa-pencil\"></i> state</span>"
42
-
43
- assert_equal expected, actual
44
- end
45
-
46
- test 'jumbotron with full_width' do
47
- actual = jumbotron 'state', full_width: true
48
- expected = "<div class=\"jumbotron\">state</div>"
49
-
50
- assert_equal expected, actual
51
- end
52
-
53
- test 'jumbotron' do
54
- actual = jumbotron 'state'
55
- expected = "<div class=\"jumbotron\">state</div>"
56
-
57
- assert_equal expected, actual
58
- end
59
-
60
- test 'navbar' do
61
- actual = navbar(title: 'My title', position: :bottom, type: :inverse, glyph: 'pencil') do |nb|
62
- nb.nav do |n|
63
- n.link 'state', url: '#'
64
- n.link 'Tata', url: '#'
65
- end
66
- nb.nav(position: :right) do |n|
67
- n.link 'lala', url: '#'
68
- n.link 'lolo', url: '#'
69
- end
70
- nb.form '/search', { type: :form_tag, position: :right } do
71
- concat text_field_tag 'search'
72
- concat button :submit
73
- end
74
- end
75
- expected = "<nav class=\"navbar navbar-inverse navbar-fixed-bottom\"><div class=\"container-fluid\"><div class=\"navbar-header\"><button class=\"navbar-toggler hidden-sm-up\" type=\"button\" data-toggle=\"collapse\" data-target=\"#navbar-collapse-243510900091050741589988795055654058002\">☰</button></div><div class=\"collapse navbar-toggleable-xs\" id=\"navbar-collapse-243510900091050741589988795055654058002\"><a class=\"navbar-brand\" href=\"/\">My title</a><ul class=\"nav navbar-nav\"><li class=\"nav-item\"><a class=\"nav-link\" href=\"#\">state</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#\">Tata</a></li></ul><ul class=\"nav navbar-nav pull-right\"><li class=\"nav-item\"><a class=\"nav-link\" href=\"#\">lala</a></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#\">lolo</a></li></ul><form class=\"navbar-form form-inline pull-right\" action=\"/search\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" /><input type=\"text\" name=\"search\" id=\"search\" /><button class=\"btn-primary btn\">submit</button><input type=\"text\" name=\"search\" id=\"search\" /><button class=\"btn-primary btn\">submit</button></form>
76
- +</div></div></nav>"
77
-
78
- refute_equal expected, actual
79
- end
80
-
81
- test 'progress bar' do
82
- actual = progress(20)
83
- expected = "<progress class=\"progress\" max=\"100\" value=\"20\">20</progress>"
84
-
85
- assert_equal expected, actual
86
- end
87
-
88
- test 'contaner' do
89
- actual = container type: :fluid
90
- expected = "<div class=\"container-fluid\"></div>"
91
-
92
- assert_equal expected, actual
93
- end
94
-
95
- test 'modal' do
96
- actual = modal do |m|
97
- m.header 'My title'
98
- m.body 'My body'
99
- m.footer do
100
- concat button_link 'Close', url: '#', status: :link
101
- concat button_link 'Save', url: '#', status: :primary
102
- end
103
- end
104
- expected = "<div class=\"modal\"><div class=\"modal-dialog \" role=\"document\"><div class=\"modal-content\"><div class=\"modal-header\"><button class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button><h4 class=\"modal-title\">My title</h4></div><div class=\"modal-body\">My body</div><div class=\"modal-footer\"><a class=\"btn-link btn\" href=\"#\">Close</a><a class=\"btn-primary btn\" href=\"#\">Save</a></div></div></div></div>"
105
-
106
- assert_equal expected, actual
107
- end
108
-
109
- end