ui_bibz 2.0.0.alpha24 → 2.0.0.alpha26
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.
- checksums.yaml +4 -4
- data/CONTRIBUTORS.md +19 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +60 -55
- data/app/assets/javascripts/interface.coffee +11 -0
- data/app/assets/javascripts/ui_bibz.coffee +3 -1
- data/app/assets/stylesheets/table.sass +1 -2
- data/app/assets/stylesheets/ui_bibz.sass +2 -0
- data/app/inputs/custom_inputs/autocomplete_input.rb +3 -2
- data/app/inputs/custom_inputs/date_picker_input.rb +2 -2
- data/app/inputs/custom_inputs/dropdown_select_input.rb +2 -2
- data/app/inputs/custom_inputs/formula_input.rb +2 -2
- data/app/inputs/custom_inputs/markdown_editor_input.rb +2 -2
- data/app/inputs/custom_inputs/multi_column_input.rb +2 -2
- data/app/inputs/custom_inputs/multi_select_input.rb +2 -2
- data/app/inputs/custom_inputs/radios_input.rb +20 -0
- data/app/inputs/custom_inputs/surround_input.rb +2 -2
- data/app/inputs/custom_inputs/switch_input.rb +2 -2
- data/config/initializers/will_paginate.rb +79 -0
- data/lib/ui_bibz.rb +56 -30
- data/lib/ui_bibz/helpers/ui_core_helper.rb +45 -37
- data/lib/ui_bibz/ui/core/alert.rb +1 -2
- data/lib/ui_bibz/ui/core/{breadcrumb/breadcrumb.rb → breadcrumb.rb} +5 -5
- data/lib/ui_bibz/ui/core/cards/card.rb +6 -6
- data/lib/ui_bibz/ui/core/cards/components/block/card_block_link.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/block/card_block_text.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/block/card_block_title.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_block.rb +4 -4
- data/lib/ui_bibz/ui/core/cards/components/card_footer.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_header.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_image.rb +1 -1
- data/lib/ui_bibz/ui/core/cards/components/card_list_group.rb +2 -2
- data/lib/ui_bibz/ui/core/component.rb +4 -51
- data/lib/ui_bibz/ui/core/component/glyph_extension.rb +19 -0
- data/lib/ui_bibz/ui/core/component/klass_extension.rb +38 -0
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/components/dropdown_divider.rb +1 -1
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/components/dropdown_header.rb +2 -2
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/components/dropdown_link.rb +2 -2
- data/lib/ui_bibz/ui/core/{dropdown → dropdowns}/dropdown.rb +11 -12
- data/lib/ui_bibz/ui/core/{buttons/button_split_dropdown.rb → dropdowns/split_dropdown.rb} +6 -10
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button.rb +5 -5
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button_choice.rb +8 -8
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button_group.rb +5 -5
- data/lib/ui_bibz/ui/core/{buttons → forms/buttons}/button_link.rb +13 -9
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +98 -0
- data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +98 -0
- data/lib/ui_bibz/ui/core/{inputs → forms/choices}/switch_field.rb +3 -3
- data/lib/ui_bibz/ui/core/{inputs → forms/dates}/date_picker_field.rb +6 -6
- data/lib/ui_bibz/ui/core/{inputs → forms/numbers}/formula_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/selects}/dropdown_select_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/selects}/multi_column_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/selects}/multi_select_field.rb +8 -8
- data/lib/ui_bibz/ui/core/{inputs → forms/textareas}/markdown_editor_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/texts}/autocomplete_field.rb +5 -5
- data/lib/ui_bibz/ui/core/{inputs → forms/texts}/surround_field.rb +5 -5
- data/lib/ui_bibz/ui/core/glyph.rb +2 -1
- data/lib/ui_bibz/ui/core/{list → lists}/components/list.rb +11 -11
- data/lib/ui_bibz/ui/core/{list/components → lists/components/list}/list_body.rb +2 -2
- data/lib/ui_bibz/ui/core/{list/components → lists/components/list}/list_header.rb +2 -2
- data/lib/ui_bibz/ui/core/{list → lists}/list_group.rb +4 -4
- data/lib/ui_bibz/ui/core/navs/components/nav_dropdown.rb +1 -1
- data/lib/ui_bibz/ui/core/navs/components/navbar_form.rb +3 -1
- data/lib/ui_bibz/ui/core/paths/breadcrumb.rb +109 -0
- data/lib/ui_bibz/ui/core/{breadcrumb → paths}/components/breadcrumb_link.rb +6 -6
- data/lib/ui_bibz/ui/core/{stars.rb → star.rb} +14 -14
- data/lib/ui_bibz/ui/core/tag.rb +1 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/components/modal_body.rb +2 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/components/modal_footer.rb +2 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/components/modal_header.rb +2 -2
- data/lib/ui_bibz/ui/core/{modal → windows}/modal.rb +8 -8
- data/lib/ui_bibz/ui/ux/tables/components/actions.rb +9 -9
- data/lib/ui_bibz/ui/ux/tables/extensions/actionable.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/table_pagination.rb +5 -4
- data/lib/ui_bibz/version.rb +1 -1
- data/test/dummy/app/controllers/users_controller.rb +18 -0
- data/test/dummy/app/models/user.rb +1 -0
- data/test/dummy/config/application.rb +1 -1
- data/test/dummy/config/initializers/simple_form_bootstrap.rb +155 -0
- data/test/simple_form_test.rb +123 -0
- data/test/test_helper.rb +2 -2
- data/test/ui/breadcrumb_test.rb +2 -2
- data/test/ui/button_test.rb +13 -39
- data/test/ui/dropdown_test.rb +14 -1
- data/test/ui/glyph_test.rb +6 -0
- data/test/ui/input_dropdown_select_field_test.rb +9 -9
- data/test/ui/input_switch_field_test.rb +11 -11
- data/test/ui/inputs_test.rb +26 -12
- data/test/ui/list_group_test.rb +2 -2
- data/test/ui/{stars_test.rb → star_test.rb} +7 -7
- data/test/ui/table_test.rb +3 -3
- data/test/ui_helper_test.rb +6 -1
- data/ui_bibz.gemspec +4 -3
- data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.scss +250 -0
- metadata +65 -39
- data/lib/ui_bibz/helpers/pagination_helper.rb +0 -55
- data/lib/ui_bibz/ui/core/buttons/button_dropdown.rb +0 -82
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core::
|
1
|
+
module UiBibz::Ui::Core::Forms::Selects
|
2
2
|
|
3
3
|
# Create a MultiColumnField
|
4
4
|
#
|
@@ -20,17 +20,17 @@ module UiBibz::Ui::Core::Inputs
|
|
20
20
|
#
|
21
21
|
# ==== Signatures
|
22
22
|
#
|
23
|
-
# UiBibz::Ui::Core::
|
23
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiColumnField.new(content, options = {}, html_options = {}).render
|
24
24
|
#
|
25
|
-
# UiBibz::Ui::Core::
|
25
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiColumnField.new(options = {}, html_options = {}) do
|
26
26
|
# content
|
27
27
|
# end.render
|
28
28
|
#
|
29
29
|
# ==== Examples
|
30
30
|
#
|
31
|
-
# UiBibz::Ui::Core::
|
31
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiColumnField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
|
32
32
|
#
|
33
|
-
# UiBibz::Ui::Core::
|
33
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiColumnField.new({ option_tags: list_of_fruits, selectable_opt_group: true }, { class: 'test' }) do
|
34
34
|
# 'fruits'
|
35
35
|
# end
|
36
36
|
#
|
@@ -1,8 +1,8 @@
|
|
1
|
-
module UiBibz::Ui::Core::
|
1
|
+
module UiBibz::Ui::Core::Forms::Selects
|
2
2
|
|
3
3
|
# Create a MultiSelectField
|
4
4
|
#
|
5
|
-
# This element is an extend of UiBibz::Ui::Core::Buttons::Button
|
5
|
+
# This element is an extend of UiBibz::Ui::Core::Forms::Buttons::Button
|
6
6
|
# source : http://loudev.com/
|
7
7
|
#
|
8
8
|
# ==== Attributes
|
@@ -23,17 +23,17 @@ module UiBibz::Ui::Core::Inputs
|
|
23
23
|
#
|
24
24
|
# ==== Signatures
|
25
25
|
#
|
26
|
-
# UiBibz::Ui::Core::
|
26
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(content, options = {}, html_options = {}).render
|
27
27
|
#
|
28
|
-
# UiBibz::Ui::Core::
|
28
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(options = {}, html_options = {}) do
|
29
29
|
# content
|
30
30
|
# end.render
|
31
31
|
#
|
32
32
|
# ==== Examples
|
33
33
|
#
|
34
|
-
# UiBibz::Ui::Core::
|
34
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
|
35
35
|
#
|
36
|
-
# UiBibz::Ui::Core::
|
36
|
+
# UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new({ option_tags: list_of_fruits, select_all_option: true }, { class: 'test' }) do
|
37
37
|
# 'fruits'
|
38
38
|
# end
|
39
39
|
#
|
@@ -41,9 +41,9 @@ module UiBibz::Ui::Core::Inputs
|
|
41
41
|
#
|
42
42
|
# multi_select_field(content, options = {}, html_options = {})
|
43
43
|
#
|
44
|
-
class MultiSelectField < UiBibz::Ui::Core::Buttons::Button
|
44
|
+
class MultiSelectField < UiBibz::Ui::Core::Forms::Buttons::Button
|
45
45
|
|
46
|
-
# See UiBibz::Ui::Core::Buttons::Button.initialize
|
46
|
+
# See UiBibz::Ui::Core::Forms::Buttons::Button.initialize
|
47
47
|
def initialize content = nil, options = nil, html_options = nil, &block
|
48
48
|
super
|
49
49
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core::
|
1
|
+
module UiBibz::Ui::Core::Forms::Textareas
|
2
2
|
|
3
3
|
# Create a MarkdownEditorField
|
4
4
|
#
|
@@ -24,17 +24,17 @@ module UiBibz::Ui::Core::Inputs
|
|
24
24
|
#
|
25
25
|
# ==== Signatures
|
26
26
|
#
|
27
|
-
# UiBibz::Ui::Core::
|
27
|
+
# UiBibz::Ui::Core::Forms::Textareas::MarkdownEditorField.new(content, options = {}, html_options = {}).render
|
28
28
|
#
|
29
|
-
# UiBibz::Ui::Core::
|
29
|
+
# UiBibz::Ui::Core::Forms::Textareas::MarkdownEditorField.new(options = {}, html_options = {}) do
|
30
30
|
# content
|
31
31
|
# end.render
|
32
32
|
#
|
33
33
|
# ==== Examples
|
34
34
|
#
|
35
|
-
# UiBibz::Ui::Core::
|
35
|
+
# UiBibz::Ui::Core::Forms::Textareas::MarkdownEditorField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')
|
36
36
|
#
|
37
|
-
# UiBibz::Ui::Core::
|
37
|
+
# UiBibz::Ui::Core::Forms::Textareas::MarkdownEditorField.new(prepend: glyph('pencil'), append: glyph('camera-retro')) do
|
38
38
|
# #content
|
39
39
|
# end
|
40
40
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core::
|
1
|
+
module UiBibz::Ui::Core::Forms::Texts
|
2
2
|
|
3
3
|
# Create a AutocompleteField
|
4
4
|
#
|
@@ -18,19 +18,19 @@ module UiBibz::Ui::Core::Inputs
|
|
18
18
|
#
|
19
19
|
# ==== Signatures
|
20
20
|
#
|
21
|
-
# UiBibz::Ui::Core::
|
21
|
+
# UiBibz::Ui::Core::Forms::Texts::AutocompleteField.new(content, options = {}, html_options = {}).render
|
22
22
|
#
|
23
|
-
# UiBibz::Ui::Core::
|
23
|
+
# UiBibz::Ui::Core::Forms::Texts::AutocompleteField.new(options = {}, html_options = {}) do
|
24
24
|
# content
|
25
25
|
# end.render
|
26
26
|
#
|
27
27
|
# ==== Examples
|
28
28
|
#
|
29
29
|
# options = options_for_select(2.times.map{ |i| "option #{i}" })
|
30
|
-
# UiBibz::Ui::Core::
|
30
|
+
# UiBibz::Ui::Core::Forms::Texts::AutocompleteField.new('company', { option_tags: options }, { class: 'test' })
|
31
31
|
#
|
32
32
|
# options = options_for_select(2.times.map{ |i| "option #{i}" })
|
33
|
-
# UiBibz::Ui::Core::
|
33
|
+
# UiBibz::Ui::Core::Forms::Texts::AutocompleteField.new(option_tags: options) do
|
34
34
|
# #content
|
35
35
|
# end
|
36
36
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core::
|
1
|
+
module UiBibz::Ui::Core::Forms::Texts
|
2
2
|
|
3
3
|
# Create a SurroundField
|
4
4
|
#
|
@@ -19,17 +19,17 @@ module UiBibz::Ui::Core::Inputs
|
|
19
19
|
#
|
20
20
|
# ==== Signatures
|
21
21
|
#
|
22
|
-
# UiBibz::Ui::Core::
|
22
|
+
# UiBibz::Ui::Core::Forms::Texts::SurroundField.new(content, options = {}, html_options = {}).render
|
23
23
|
#
|
24
|
-
# UiBibz::Ui::Core::
|
24
|
+
# UiBibz::Ui::Core::Forms::Texts::SurroundField.new(options = {}, html_options = {}) do
|
25
25
|
# content
|
26
26
|
# end.render
|
27
27
|
#
|
28
28
|
# ==== Examples
|
29
29
|
#
|
30
|
-
# UiBibz::Ui::Core::
|
30
|
+
# UiBibz::Ui::Core::Forms::Texts::SurroundField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')
|
31
31
|
#
|
32
|
-
# UiBibz::Ui::Core::
|
32
|
+
# UiBibz::Ui::Core::Forms::Texts::SurroundField.new(prepend: glyph('pencil'), append: glyph('camera-retro')) do
|
33
33
|
# #content
|
34
34
|
# end
|
35
35
|
#
|
@@ -17,6 +17,7 @@ module UiBibz::Ui::Core
|
|
17
17
|
# * +name+ - String
|
18
18
|
# * +size+ - Integer
|
19
19
|
# * +type+ - Symbol
|
20
|
+
# * +text+ - String
|
20
21
|
# * +status+ - Symbol
|
21
22
|
# (+:secondary+, +:primary+, +:info+, +:warning+, +:danger+)
|
22
23
|
#
|
@@ -63,7 +64,7 @@ module UiBibz::Ui::Core
|
|
63
64
|
|
64
65
|
# Render html tag
|
65
66
|
def render
|
66
|
-
content_tag
|
67
|
+
[content_tag(:i, '', html_options), options[:label]].compact.join(' ').html_safe
|
67
68
|
end
|
68
69
|
|
69
70
|
private
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require "ui_bibz/ui/core/
|
2
|
-
require "ui_bibz/ui/core/
|
3
|
-
module UiBibz::Ui::Core
|
1
|
+
require "ui_bibz/ui/core/lists/components/list/list_header"
|
2
|
+
require "ui_bibz/ui/core/lists/components/list/list_body"
|
3
|
+
module UiBibz::Ui::Core::Lists::Components
|
4
4
|
|
5
5
|
# Create a list
|
6
6
|
#
|
@@ -29,22 +29,22 @@ module UiBibz::Ui::Core
|
|
29
29
|
#
|
30
30
|
# ==== Signatures
|
31
31
|
#
|
32
|
-
# UiBibz::Ui::Core::List.new(tap: true) do |l|
|
32
|
+
# UiBibz::Ui::Core::Lists::Components::List.new(tap: true) do |l|
|
33
33
|
# l.header content = nil, options = nil, html_options = nil, &block
|
34
34
|
# l.body content = nil, options = nil, html_options = nil, &block
|
35
35
|
# end
|
36
36
|
#
|
37
|
-
# UiBibz::Ui::Core::List.new content, options = nil, html_options = nil
|
37
|
+
# UiBibz::Ui::Core::Lists::Components::List.new content, options = nil, html_options = nil
|
38
38
|
#
|
39
|
-
# UiBibz::Ui::Core::List.new options = nil, html_options = nil do
|
39
|
+
# UiBibz::Ui::Core::Lists::Components::List.new options = nil, html_options = nil do
|
40
40
|
# content
|
41
41
|
# end
|
42
42
|
#
|
43
43
|
# ==== Examples
|
44
44
|
#
|
45
|
-
# UiBibz::Ui::Core::List.new('Test', status: :success, url: '#test').render
|
45
|
+
# UiBibz::Ui::Core::Lists::Components::List.new('Test', status: :success, url: '#test').render
|
46
46
|
#
|
47
|
-
# UiBibz::Ui::Core::List.new(status: :primary) do
|
47
|
+
# UiBibz::Ui::Core::Lists::Components::List.new(status: :primary) do
|
48
48
|
# 'Test 2'
|
49
49
|
# end.render
|
50
50
|
#
|
@@ -55,7 +55,7 @@ module UiBibz::Ui::Core
|
|
55
55
|
# end
|
56
56
|
# end.render
|
57
57
|
#
|
58
|
-
class List < Component
|
58
|
+
class List < UiBibz::Ui::Core::Component
|
59
59
|
|
60
60
|
# See UiBibz::Ui::Core::Component.initialize
|
61
61
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -75,12 +75,12 @@ module UiBibz::Ui::Core
|
|
75
75
|
|
76
76
|
# Add header which is a component
|
77
77
|
def header content = nil, options = nil, html_options = nil, &block
|
78
|
-
@header = UiBibz::Ui::Core::ListHeader.new content, options, html_options, &block
|
78
|
+
@header = UiBibz::Ui::Core::Lists::Components::ListHeader.new content, options, html_options, &block
|
79
79
|
end
|
80
80
|
|
81
81
|
# Add body which is a component
|
82
82
|
def body content = nil, options = nil, html_options = nil, &block
|
83
|
-
@body = UiBibz::Ui::Core::ListBody.new content, options, html_options, &block
|
83
|
+
@body = UiBibz::Ui::Core::Lists::Components::ListBody.new content, options, html_options, &block
|
84
84
|
end
|
85
85
|
|
86
86
|
private
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core
|
1
|
+
module UiBibz::Ui::Core::Lists::Components
|
2
2
|
|
3
3
|
# Create a listBody
|
4
4
|
#
|
@@ -14,7 +14,7 @@ module UiBibz::Ui::Core
|
|
14
14
|
#
|
15
15
|
# You can add HTML attributes using the +html_options+.
|
16
16
|
# You can pass arguments in options attribute:
|
17
|
-
class ListBody < Component
|
17
|
+
class ListBody < UiBibz::Ui::Core::Component
|
18
18
|
|
19
19
|
# See UiBibz::Ui::Core::Component.initialize
|
20
20
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core
|
1
|
+
module UiBibz::Ui::Core::Lists::Components
|
2
2
|
|
3
3
|
# Create a listHeader
|
4
4
|
#
|
@@ -14,7 +14,7 @@ module UiBibz::Ui::Core
|
|
14
14
|
#
|
15
15
|
# You can add HTML attributes using the +html_options+.
|
16
16
|
# You can pass arguments in options attribute:
|
17
|
-
class ListHeader < Component
|
17
|
+
class ListHeader < UiBibz::Ui::Core::Component
|
18
18
|
|
19
19
|
# See UiBibz::Ui::Core::Component.initialize
|
20
20
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require "ui_bibz/ui/core/
|
2
|
-
module UiBibz::Ui::Core
|
1
|
+
require "ui_bibz/ui/core/lists/components/list"
|
2
|
+
module UiBibz::Ui::Core::Lists
|
3
3
|
|
4
4
|
# Create a list group
|
5
5
|
#
|
@@ -88,9 +88,9 @@ module UiBibz::Ui::Core
|
|
88
88
|
options = options.merge({ type: @options[:type] }) unless @options[:type].nil?
|
89
89
|
|
90
90
|
if is_tap
|
91
|
-
@lists << List.new(content, options, html_options).tap(&block).render
|
91
|
+
@lists << UiBibz::Ui::Core::Lists::Components::List.new(content, options, html_options).tap(&block).render
|
92
92
|
else
|
93
|
-
@lists << List.new(content, options, html_options, &block).render
|
93
|
+
@lists << UiBibz::Ui::Core::Lists::Components::List.new(content, options, html_options, &block).render
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -41,7 +41,7 @@ module UiBibz::Ui::Core::Navs
|
|
41
41
|
# d.list link_to('test2', '#')
|
42
42
|
# end.render
|
43
43
|
#
|
44
|
-
class NavDropdown < UiBibz::Ui::Core::Dropdown
|
44
|
+
class NavDropdown < UiBibz::Ui::Core::Dropdowns::Dropdown
|
45
45
|
|
46
46
|
# See UiBibz::Ui::Core::Dropdown.initialize
|
47
47
|
def initialize content, options = nil, html_options = nil, &block
|
@@ -49,7 +49,9 @@ module UiBibz::Ui::Core::Navs
|
|
49
49
|
if type == :form_for
|
50
50
|
@form = form_for(model_or_url, options, &block)
|
51
51
|
else
|
52
|
-
|
52
|
+
#@form = form_tag(model_or_url, class: "navbar-form form-inline #{ position }", block)
|
53
|
+
html_options = html_options_for_form(model_or_url, { class: "navbar-form form-inline #{ position }" })
|
54
|
+
@form = form_tag_with_body(html_options, capture(&block))
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'ui_bibz/ui/core/paths/components/breadcrumb_link'
|
2
|
+
module UiBibz::Ui::Core::Paths
|
3
|
+
|
4
|
+
# Breadcrumb
|
5
|
+
#
|
6
|
+
# Indicate the current page's location within a navigational hierarchy.
|
7
|
+
# Separators are automatically added in CSS through +:before+ and +content+.
|
8
|
+
#
|
9
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
10
|
+
# You can use tap method to add link items.
|
11
|
+
#
|
12
|
+
# ==== Attributes
|
13
|
+
#
|
14
|
+
# * +content+ - Content of element
|
15
|
+
# * +options+ - Options of element
|
16
|
+
# * +html_options+ - Html Options of element
|
17
|
+
#
|
18
|
+
# ==== Components
|
19
|
+
#
|
20
|
+
# +link+ is UiBibz::Ui::Core::BreadCrumb::Components::BreadcrumbLink component
|
21
|
+
#
|
22
|
+
# ==== Signatures
|
23
|
+
#
|
24
|
+
# UiBibz::Ui::Core::Breadcrumb.new().tap do |b|
|
25
|
+
# b.link content = nil, options = nil, html_options = nil, &block
|
26
|
+
# b.link content = nil, options = nil, html_options = nil, &block
|
27
|
+
# b.link content = nil, options = nil, html_options = nil, &block
|
28
|
+
# ...
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# UiBibz::Ui::Core::Alert.new(options = nil, html_options = nil) do
|
32
|
+
# content
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# ==== Examples
|
36
|
+
#
|
37
|
+
# UiBibz::Ui::Core::Breadcrumb.new().tap do |b|
|
38
|
+
# b.link 'Home', url: '#home'
|
39
|
+
# b.link url: '#level-1' do
|
40
|
+
# 'Level 1'
|
41
|
+
# end
|
42
|
+
# b.link 'Level 2', state: :active
|
43
|
+
# end.render
|
44
|
+
#
|
45
|
+
# ==== Helper
|
46
|
+
#
|
47
|
+
# breadcrumb({tap: true}) do |b|
|
48
|
+
# b.link(content, options = {}, html_options = {})
|
49
|
+
# b.link(options = {}, html_options = {}) do
|
50
|
+
# content
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# breadcrumb({store: @users, link_label: name, link_url: user_path(:id)})
|
55
|
+
#
|
56
|
+
class Breadcrumb < UiBibz::Ui::Core::Component
|
57
|
+
|
58
|
+
# See UiBibz::Ui::Core::Component.initialize
|
59
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
60
|
+
super
|
61
|
+
@links = []
|
62
|
+
end
|
63
|
+
|
64
|
+
# Render html tag
|
65
|
+
def render
|
66
|
+
generate_links unless store.nil?
|
67
|
+
content_tag :ol, @links.join.html_safe, html_options
|
68
|
+
end
|
69
|
+
|
70
|
+
# Add breadcrumb link items
|
71
|
+
# See UiBibz::Ui::Core::BreadcrumbLink
|
72
|
+
def link content = nil, options = nil, html_options = nil, &block
|
73
|
+
@links << UiBibz::Ui::Core::Paths::Components::BreadcrumbLink.new(content, options, html_options, &block).render
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def component_html_classes
|
79
|
+
'breadcrumb'
|
80
|
+
end
|
81
|
+
|
82
|
+
def store
|
83
|
+
@options[:store]
|
84
|
+
end
|
85
|
+
|
86
|
+
def model_name
|
87
|
+
store.class.to_s
|
88
|
+
end
|
89
|
+
|
90
|
+
def link_label
|
91
|
+
@options[:link_label] || :name
|
92
|
+
end
|
93
|
+
|
94
|
+
def link_url
|
95
|
+
@options[:link_url] || '#'
|
96
|
+
end
|
97
|
+
|
98
|
+
def generate_links
|
99
|
+
@options[:store].each do |item|
|
100
|
+
if item == @options[:store].last
|
101
|
+
@links << UiBibz::Ui::Core::Paths::Components::BreadcrumbLink.new(item.send(link_label), status: :disabled).render
|
102
|
+
else
|
103
|
+
@links << UiBibz::Ui::Core::Paths::Components::BreadcrumbLink.new(item.send(link_label), url: inject_url(link_url, item)).render
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module UiBibz::Ui::Core
|
1
|
+
module UiBibz::Ui::Core::Paths::Components
|
2
2
|
|
3
3
|
# Create a BreadcrumbLink
|
4
4
|
#
|
@@ -24,21 +24,21 @@ module UiBibz::Ui::Core
|
|
24
24
|
#
|
25
25
|
# ==== Signatures
|
26
26
|
#
|
27
|
-
# UiBibz::Ui::Core::BreadcrumbLink.new(content, options = nil, html_options = nil)
|
27
|
+
# UiBibz::Ui::Core::Breadcrumb::Components::BreadcrumbLink.new(content, options = nil, html_options = nil)
|
28
28
|
#
|
29
|
-
# UiBibz::Ui::Core::BreadcrumbLink.new(options = nil, html_options = nil) do
|
29
|
+
# UiBibz::Ui::Core::Breadcrumb::Components::BreadcrumbLink.new(options = nil, html_options = nil) do
|
30
30
|
# content
|
31
31
|
# end
|
32
32
|
#
|
33
33
|
# ==== Examples
|
34
34
|
#
|
35
|
-
# UiBibz::Ui::Core::BreadcrumbLink.new('Home', { glyph: 'home', state: :active },{ class: 'test' }).render
|
35
|
+
# UiBibz::Ui::Core::Breadcrumb::Components::BreadcrumbLink.new('Home', { glyph: 'home', state: :active },{ class: 'test' }).render
|
36
36
|
#
|
37
|
-
# UiBibz::Ui::Core::BreadcrumbLink.new({glyph: { name: 'eye', size: 3}, { class: 'test' }) do
|
37
|
+
# UiBibz::Ui::Core::Breadcrumb::Components::BreadcrumbLink.new({glyph: { name: 'eye', size: 3}, { class: 'test' }) do
|
38
38
|
# 'Home'
|
39
39
|
# end.render
|
40
40
|
#
|
41
|
-
class BreadcrumbLink < Component
|
41
|
+
class BreadcrumbLink < UiBibz::Ui::Core::Component
|
42
42
|
|
43
43
|
# See UiBibz::Ui::Core::Component.initialize
|
44
44
|
def initialize content = nil, options = nil, html_options = nil, &block
|