ui_bibz 1.2.5.3 → 2.0.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +10 -7
- data/README.md +8 -1042
- data/app/assets/javascripts/multi_column.coffee +45 -0
- data/app/assets/javascripts/{ui_bibz.js.coffee → ui_bibz.coffee} +16 -3
- data/app/assets/stylesheets/fix-bootstrap-4.sass +2 -0
- data/app/assets/stylesheets/ui_bibz.sass +22 -9
- data/app/inputs/custom_inputs/date_picker_input.rb +10 -0
- data/app/inputs/custom_inputs/date_picker_input_old.rb +61 -0
- data/app/inputs/custom_inputs/multi_column_input.rb +18 -0
- data/app/inputs/custom_inputs/multi_select_input.rb +15 -0
- data/app/inputs/custom_inputs/surround_input.rb +10 -0
- data/doc/UiBibz.html +2 -2
- data/doc/UiBibz/Concerns.html +1 -1
- data/doc/UiBibz/Concerns/Models.html +1 -1
- data/doc/UiBibz/Concerns/Models/Searchable.html +1 -1
- data/doc/UiBibz/Concerns/Models/Searchable/ClassMethods.html +5 -5
- data/doc/UiBibz/Helpers.html +1 -1
- data/doc/UiBibz/Helpers/MetaHelper.html +1 -1
- data/doc/UiBibz/Helpers/UiCoreHelper.html +1 -1
- data/doc/UiBibz/Helpers/UiUxHelper.html +1 -1
- data/doc/UiBibz/Helpers/UtilsHelper.html +1 -1
- data/doc/UiBibz/Rails.html +1 -1
- data/doc/UiBibz/Rails/Engine.html +1 -1
- data/doc/UiBibz/Ui.html +1 -1
- data/doc/UiBibz/Ui/Base.html +1 -1
- data/doc/UiBibz/Ui/Core.html +1 -1
- data/doc/UiBibz/Ui/Core/Alert.html +1 -1
- data/doc/UiBibz/Ui/Core/Bar.html +1 -1
- data/doc/UiBibz/Ui/Core/Breadcrumb.html +1 -1
- data/doc/UiBibz/Ui/Core/BreadcrumbLink.html +1 -1
- data/doc/UiBibz/Ui/Core/Button.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonDropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonGroup.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonLink.html +1 -1
- data/doc/UiBibz/Ui/Core/ButtonSplitDropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/Col.html +1 -1
- data/doc/UiBibz/Ui/Core/Component.html +1 -1
- data/doc/UiBibz/Ui/Core/Dropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/DropdownDivider.html +1 -1
- data/doc/UiBibz/Ui/Core/DropdownHeader.html +1 -1
- data/doc/UiBibz/Ui/Core/DropdownLink.html +1 -1
- data/doc/UiBibz/Ui/Core/Glyph.html +1 -1
- data/doc/UiBibz/Ui/Core/Jumbotron.html +1 -1
- data/doc/UiBibz/Ui/Core/Label.html +1 -1
- data/doc/UiBibz/Ui/Core/List.html +1 -1
- data/doc/UiBibz/Ui/Core/ListGroup.html +1 -1
- data/doc/UiBibz/Ui/Core/Modal.html +1 -1
- data/doc/UiBibz/Ui/Core/ModalBody.html +1 -1
- data/doc/UiBibz/Ui/Core/ModalFooter.html +1 -1
- data/doc/UiBibz/Ui/Core/ModalHeader.html +1 -1
- data/doc/UiBibz/Ui/Core/Nav.html +1 -1
- data/doc/UiBibz/Ui/Core/NavDropdown.html +1 -1
- data/doc/UiBibz/Ui/Core/NavLink.html +1 -1
- data/doc/UiBibz/Ui/Core/Navbar.html +1 -1
- data/doc/UiBibz/Ui/Core/NavbarForm.html +1 -1
- data/doc/UiBibz/Ui/Core/NavbarNav.html +1 -1
- data/doc/UiBibz/Ui/Core/NavbarText.html +1 -1
- data/doc/UiBibz/Ui/Core/Panel.html +1 -1
- data/doc/UiBibz/Ui/Core/ProgressBar.html +1 -1
- data/doc/UiBibz/Ui/Core/Row.html +1 -1
- data/doc/UiBibz/Ui/Core/Stars.html +1 -1
- data/doc/UiBibz/Ui/Ux.html +1 -1
- data/doc/UiBibz/Ui/Ux/Actionable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Actions.html +1 -1
- data/doc/UiBibz/Ui/Ux/Column.html +1 -1
- data/doc/UiBibz/Ui/Ux/Columns.html +1 -1
- data/doc/UiBibz/Ui/Ux/Grid.html +1 -1
- data/doc/UiBibz/Ui/Ux/Paginable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Searchable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Sortable.html +1 -1
- data/doc/UiBibz/Ui/Ux/Store.html +18 -70
- data/doc/UiBibz/Ui/Ux/Table.html +1 -1
- data/doc/UiBibz/Ui/Ux/TablePagination.html +1 -1
- data/doc/UiBibz/Ui/Ux/TablePaginationPerPage.html +1 -1
- data/doc/UiBibz/Ui/Ux/TablePanel.html +1 -1
- data/doc/UiBibz/Ui/Ux/TableSearchField.html +1 -1
- data/doc/UiBibz/Utils.html +1 -1
- data/doc/UiBibz/Utils/Internationalization.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +47 -51
- data/doc/index.html +47 -51
- data/doc/method_list.html +69 -75
- data/doc/top-level-namespace.html +1 -1
- data/lib/ui_bibz.rb +14 -7
- data/lib/ui_bibz/helpers/ui_core_helper.rb +46 -11
- data/lib/ui_bibz/helpers/ui_ux_helper.rb +7 -3
- data/lib/ui_bibz/rails/engine.rb +2 -2
- data/lib/ui_bibz/ui/base.rb +5 -0
- data/lib/ui_bibz/ui/core/alert.rb +15 -6
- data/lib/ui_bibz/ui/core/breadcrumb/breadcrumb.rb +37 -2
- data/lib/ui_bibz/ui/core/breadcrumb/components/breadcrumb_link.rb +3 -3
- data/lib/ui_bibz/ui/core/button/button.rb +39 -6
- data/lib/ui_bibz/ui/core/button/button_choice.rb +104 -0
- data/lib/ui_bibz/ui/core/button/button_dropdown.rb +15 -2
- data/lib/ui_bibz/ui/core/button/button_group.rb +17 -5
- data/lib/ui_bibz/ui/core/button/button_link.rb +8 -11
- data/lib/ui_bibz/ui/core/button/button_split_dropdown.rb +15 -5
- data/lib/ui_bibz/ui/core/card/card.rb +158 -0
- data/lib/ui_bibz/ui/core/card/card_column.rb +60 -0
- data/lib/ui_bibz/ui/core/card/card_deck.rb +62 -0
- data/lib/ui_bibz/ui/core/card/card_group.rb +60 -0
- data/lib/ui_bibz/ui/core/card/components/block/card_block_link.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/block/card_block_text.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/block/card_block_title.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/card_block.rb +67 -0
- data/lib/ui_bibz/ui/core/card/components/card_footer.rb +55 -0
- data/lib/ui_bibz/ui/core/card/components/card_header.rb +51 -0
- data/lib/ui_bibz/ui/core/card/components/card_image.rb +57 -0
- data/lib/ui_bibz/ui/core/card/components/card_list_group.rb +47 -0
- data/lib/ui_bibz/ui/core/component.rb +78 -32
- data/lib/ui_bibz/ui/core/dropdown/components/dropdown_divider.rb +1 -1
- data/lib/ui_bibz/ui/core/dropdown/components/dropdown_header.rb +11 -1
- data/lib/ui_bibz/ui/core/dropdown/components/dropdown_link.rb +11 -4
- data/lib/ui_bibz/ui/core/dropdown/dropdown.rb +14 -6
- data/lib/ui_bibz/ui/core/glyph.rb +22 -4
- data/lib/ui_bibz/ui/core/input/date_picker_field.rb +125 -0
- data/lib/ui_bibz/ui/core/input/multi_column_field.rb +77 -0
- data/lib/ui_bibz/ui/core/input/multi_select_field.rb +89 -0
- data/lib/ui_bibz/ui/core/input/surround_field.rb +74 -0
- data/lib/ui_bibz/ui/core/jumbotron.rb +10 -6
- data/lib/ui_bibz/ui/core/label.rb +13 -3
- data/lib/ui_bibz/ui/core/{col.rb → layout/col.rb} +38 -18
- data/lib/ui_bibz/ui/core/layout/container.rb +65 -0
- data/lib/ui_bibz/ui/core/{row.rb → layout/row.rb} +7 -1
- data/lib/ui_bibz/ui/core/list/components/list.rb +26 -11
- data/lib/ui_bibz/ui/core/list/components/list_body.rb +36 -0
- data/lib/ui_bibz/ui/core/list/components/list_header.rb +36 -0
- data/lib/ui_bibz/ui/core/list/list_group.rb +7 -3
- data/lib/ui_bibz/ui/core/modal/components/modal_body.rb +7 -1
- data/lib/ui_bibz/ui/core/modal/components/modal_footer.rb +7 -1
- data/lib/ui_bibz/ui/core/modal/components/modal_header.rb +5 -2
- data/lib/ui_bibz/ui/core/modal/modal.rb +13 -2
- data/lib/ui_bibz/ui/core/nav/components/nav_dropdown.rb +6 -2
- data/lib/ui_bibz/ui/core/nav/components/nav_link.rb +7 -18
- data/lib/ui_bibz/ui/core/nav/components/nav_link_link.rb +45 -0
- data/lib/ui_bibz/ui/core/nav/components/nav_link_list.rb +35 -0
- data/lib/ui_bibz/ui/core/nav/components/navbar_brand.rb +40 -0
- data/lib/ui_bibz/ui/core/nav/components/navbar_form.rb +2 -2
- data/lib/ui_bibz/ui/core/nav/components/navbar_nav.rb +1 -1
- data/lib/ui_bibz/ui/core/nav/components/navbar_text.rb +6 -2
- data/lib/ui_bibz/ui/core/nav/nav.rb +22 -4
- data/lib/ui_bibz/ui/core/nav/navbar.rb +26 -17
- data/lib/ui_bibz/ui/core/progress.rb +98 -0
- data/lib/ui_bibz/ui/core/stars.rb +13 -5
- data/lib/ui_bibz/ui/ux/table/components/actions.rb +4 -0
- data/lib/ui_bibz/ui/ux/table/components/store.rb +4 -4
- data/lib/ui_bibz/ui/ux/table/extensions/actionable.rb +15 -13
- data/lib/ui_bibz/ui/ux/table/extensions/paginable.rb +7 -6
- data/lib/ui_bibz/ui/ux/table/extensions/searchable.rb +6 -5
- data/lib/ui_bibz/ui/ux/table/table.rb +14 -7
- data/lib/ui_bibz/ui/ux/table/{table_panel.rb → table_card.rb} +34 -36
- data/lib/ui_bibz/ui/ux/table/table_search_field.rb +19 -11
- data/lib/ui_bibz/version.rb +1 -1
- data/test/ui/breadcrumb_test.rb +25 -0
- data/test/ui/button_test.rb +44 -4
- data/test/ui/card_test.rb +106 -0
- data/test/ui/col_test.rb +22 -0
- data/test/ui/dropdown_test.rb +1 -1
- data/test/ui/inputs_test.rb +81 -0
- data/test/ui/list_group_test.rb +1 -1
- data/test/ui/nav_test.rb +4 -5
- data/test/ui/table_test.rb +11 -11
- data/test/ui_helper_test.rb +29 -18
- data/ui_bibz.gemspec +3 -3
- data/vendor/assets/images/switch.png +0 -0
- data/vendor/assets/javascripts/bootstrap-4.0.0-alpha.min.js +7 -0
- data/vendor/assets/javascripts/bootstrap-multiselect.min.js +1180 -0
- data/vendor/assets/javascripts/jquery.multi-select.min.js +1 -0
- data/vendor/assets/javascripts/jquery.quicksearch.min.js +1 -0
- data/vendor/assets/stylesheets/bootstrap-4.0.0-alpha.min.css +6 -0
- data/vendor/assets/stylesheets/bootstrap-datepicker3.min.css +1 -1
- data/vendor/assets/stylesheets/bootstrap-multiselect.min.css +1 -0
- data/vendor/assets/stylesheets/multi-select.min.css +1 -0
- metadata +70 -24
- data/.yardoc/checksums +0 -59
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/lib/ui_bibz/helpers/meta_helper.rb +0 -32
- data/lib/ui_bibz/ui/core/panel.rb +0 -138
- data/lib/ui_bibz/ui/core/progress_bar/components/bar.rb +0 -105
- data/lib/ui_bibz/ui/core/progress_bar/progress_bar.rb +0 -94
- data/lib/ui_bibz/ui/ux/grid.rb +0 -121
- data/test/ui/grid_test.rb +0 -46
- data/test/ui/panel_test.rb +0 -52
@@ -1,3 +1,5 @@
|
|
1
|
+
require "ui_bibz/ui/core/list/components/list_header"
|
2
|
+
require "ui_bibz/ui/core/list/components/list_body"
|
1
3
|
module UiBibz::Ui::Core
|
2
4
|
|
3
5
|
# Create a list
|
@@ -62,36 +64,47 @@ module UiBibz::Ui::Core
|
|
62
64
|
|
63
65
|
# Render html tag
|
64
66
|
def render
|
65
|
-
content_tag
|
67
|
+
content_tag tag_type, html_options do
|
66
68
|
concat glyph_and_content_html if @content
|
67
69
|
concat header_html if @body
|
68
70
|
concat body_html if @body
|
69
|
-
concat
|
71
|
+
concat label_html if @options[:label]
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
75
|
+
|
73
76
|
# Add header which is a component
|
74
77
|
def header content = nil, options = nil, html_options = nil, &block
|
75
|
-
@header =
|
78
|
+
@header = UiBibz::Ui::Core::ListHeader.new content, options, html_options, &block
|
76
79
|
end
|
77
80
|
|
78
81
|
# Add body which is a component
|
79
82
|
def body content = nil, options = nil, html_options = nil, &block
|
80
|
-
@body =
|
83
|
+
@body = UiBibz::Ui::Core::ListBody.new content, options, html_options, &block
|
81
84
|
end
|
82
85
|
|
83
86
|
private
|
84
87
|
|
88
|
+
def component_html_classes
|
89
|
+
'list-group-item'
|
90
|
+
end
|
91
|
+
|
85
92
|
def header_html
|
86
|
-
|
93
|
+
@header.render
|
87
94
|
end
|
88
95
|
|
89
96
|
def body_html
|
90
|
-
|
97
|
+
@body.render
|
91
98
|
end
|
92
99
|
|
93
|
-
def
|
94
|
-
is_link_type?
|
100
|
+
def tag_type
|
101
|
+
if is_link_type?
|
102
|
+
:a
|
103
|
+
elsif is_button_type?
|
104
|
+
:button
|
105
|
+
else
|
106
|
+
:li
|
107
|
+
end
|
95
108
|
end
|
96
109
|
|
97
110
|
def is_link_type?
|
@@ -99,10 +112,12 @@ module UiBibz::Ui::Core
|
|
99
112
|
@options[:type] == :link || @html_options[:type] == :link
|
100
113
|
end
|
101
114
|
|
115
|
+
def is_button_type?
|
116
|
+
@options[:type] == :button || @html_options[:type] == :button
|
117
|
+
end
|
118
|
+
|
102
119
|
def state
|
103
|
-
unless @options[:state].nil?
|
104
|
-
"list-group-item-#{ states[@options[:state]] }"
|
105
|
-
end
|
120
|
+
"list-group-item-#{ @options[:state] }" unless @options[:state].nil?
|
106
121
|
end
|
107
122
|
|
108
123
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a listBody
|
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
|
+
class ListBody < Component
|
18
|
+
|
19
|
+
# See UiBibz::Ui::Core::Component.initialize
|
20
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
# Render html tag
|
25
|
+
def render
|
26
|
+
content_tag :p, content, html_options
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def component_html_classes
|
32
|
+
'list-group-item-text'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a listHeader
|
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
|
+
class ListHeader < Component
|
18
|
+
|
19
|
+
# See UiBibz::Ui::Core::Component.initialize
|
20
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
# Render html tag
|
25
|
+
def render
|
26
|
+
content_tag :h4, content, html_options
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def component_html_classes
|
32
|
+
'list-group-item-heading'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -78,14 +78,14 @@ module UiBibz::Ui::Core
|
|
78
78
|
|
79
79
|
# Render html tag
|
80
80
|
def render
|
81
|
-
content_tag type, @lists.join().html_safe,
|
81
|
+
content_tag type, @lists.join().html_safe, html_options
|
82
82
|
end
|
83
83
|
|
84
84
|
# Add group list
|
85
85
|
# See UiBibz::Ui::Core::List
|
86
86
|
def list content = nil, options = {} , html_options = nil, &block
|
87
87
|
is_tap = (content[:tap] if content.kind_of?(Hash)) || (options[:tap] unless options.nil?)
|
88
|
-
options = options.merge({ type: :
|
88
|
+
options = options.merge({ type: @options[:type] }) unless @options[:type].nil?
|
89
89
|
|
90
90
|
if is_tap
|
91
91
|
@lists << List.new(content, options, html_options).tap(&block).render
|
@@ -96,8 +96,12 @@ module UiBibz::Ui::Core
|
|
96
96
|
|
97
97
|
private
|
98
98
|
|
99
|
+
def component_html_classes
|
100
|
+
"list-group"
|
101
|
+
end
|
102
|
+
|
99
103
|
def type
|
100
|
-
@options[:type]
|
104
|
+
[:link, :button].include?(@options[:type]) ? :div : :ul
|
101
105
|
end
|
102
106
|
|
103
107
|
end
|
@@ -38,7 +38,13 @@ module UiBibz::Ui::Core
|
|
38
38
|
|
39
39
|
# Render html tag
|
40
40
|
def render
|
41
|
-
content_tag :div,
|
41
|
+
content_tag :div, content, html_options
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def component_html_classes
|
47
|
+
'modal-body'
|
42
48
|
end
|
43
49
|
|
44
50
|
end
|
@@ -38,7 +38,13 @@ module UiBibz::Ui::Core
|
|
38
38
|
|
39
39
|
# Render html tag
|
40
40
|
def render
|
41
|
-
content_tag :div,
|
41
|
+
content_tag :div, content, html_options
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def component_html_classes
|
47
|
+
'modal-footer'
|
42
48
|
end
|
43
49
|
|
44
50
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
module UiBibz::Ui::Core
|
3
2
|
|
4
3
|
# Create a modal header
|
@@ -39,7 +38,7 @@ module UiBibz::Ui::Core
|
|
39
38
|
|
40
39
|
# Render html tag
|
41
40
|
def render
|
42
|
-
content_tag :div,
|
41
|
+
content_tag :div, html_options do
|
43
42
|
concat close_button_html
|
44
43
|
concat content_tag :h4, glyph_and_content_html, class: 'modal-title'
|
45
44
|
end
|
@@ -47,6 +46,10 @@ module UiBibz::Ui::Core
|
|
47
46
|
|
48
47
|
private
|
49
48
|
|
49
|
+
def component_html_classes
|
50
|
+
'modal-header'
|
51
|
+
end
|
52
|
+
|
50
53
|
def close_button_html
|
51
54
|
content_tag :button, class: 'close', "data-dismiss" => 'modal', "aria-label" => "Close" do
|
52
55
|
concat content_tag :span, "×", "aria-hidden" => true
|
@@ -17,6 +17,8 @@ module UiBibz::Ui::Core
|
|
17
17
|
#
|
18
18
|
# You can add HTML attributes using the +html_options+.
|
19
19
|
# You can pass arguments in options attribute:
|
20
|
+
# * +size+
|
21
|
+
# (+:sm+, +:lg+)
|
20
22
|
#
|
21
23
|
# ==== Signatures
|
22
24
|
#
|
@@ -59,8 +61,8 @@ module UiBibz::Ui::Core
|
|
59
61
|
|
60
62
|
# Render html tag
|
61
63
|
def render
|
62
|
-
content_tag :div,
|
63
|
-
content_tag :div, class:
|
64
|
+
content_tag :div, html_options do
|
65
|
+
content_tag :div, class: "modal-dialog #{ size }", role: 'document' do
|
64
66
|
content_tag :div, class: 'modal-content' do
|
65
67
|
concat @header
|
66
68
|
concat @body
|
@@ -84,6 +86,15 @@ module UiBibz::Ui::Core
|
|
84
86
|
|
85
87
|
private
|
86
88
|
|
89
|
+
def component_html_classes
|
90
|
+
'modal'
|
91
|
+
end
|
92
|
+
|
93
|
+
# :lg, :sm or :xs
|
94
|
+
def size
|
95
|
+
"modal-#{ @options[:size] }" if @options[:size]
|
96
|
+
end
|
97
|
+
|
87
98
|
def effect
|
88
99
|
@options[:effect] unless @options[:effect].nil?
|
89
100
|
end
|
@@ -50,7 +50,7 @@ module UiBibz::Ui::Core
|
|
50
50
|
|
51
51
|
# Render html tag
|
52
52
|
def render
|
53
|
-
content_tag :li,
|
53
|
+
content_tag :li, html_options do
|
54
54
|
concat link_html
|
55
55
|
concat ul_html
|
56
56
|
end
|
@@ -58,8 +58,12 @@ module UiBibz::Ui::Core
|
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
+
def component_html_classes
|
62
|
+
[type, 'nav-item']
|
63
|
+
end
|
64
|
+
|
61
65
|
def link_html
|
62
|
-
link_to button_content, "#", class:
|
66
|
+
link_to button_content, "#", class: join_classes(size, "dropdown-toggle", 'nav-link'), "data-toggle" => 'dropdown', "aria-expanded" => false
|
63
67
|
end
|
64
68
|
|
65
69
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ui_bibz/ui/core/nav/components/nav_link_link'
|
2
|
+
require 'ui_bibz/ui/core/nav/components/nav_link_list'
|
1
3
|
module UiBibz::Ui::Core
|
2
4
|
|
3
5
|
# Create a NavLink
|
@@ -45,25 +47,12 @@ module UiBibz::Ui::Core
|
|
45
47
|
|
46
48
|
# Render html tag
|
47
49
|
def render
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
# content_htm and not content_html for haml bug
|
54
|
-
def content_htm
|
55
|
-
link_to @options[:url], link_html_options do
|
56
|
-
concat glyph_and_content_html
|
57
|
-
concat badge_html if @options[:badge]
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def link_html_options
|
62
|
-
lho = @options[:link_html_options] || {}
|
63
|
-
if @options[:nav_type] == "nav-tabs"
|
64
|
-
lho.merge({ "aria-controls" => @options[:selector], "role" => "tab", "data-toggle" => "tab" })
|
50
|
+
content_htm = UiBibz::Ui::Core::NavLinkLink.new(content, options, html_options).render
|
51
|
+
if options[:nav_type] == "nav-links"
|
52
|
+
content_htm
|
65
53
|
else
|
66
|
-
|
54
|
+
options.delete(:status)
|
55
|
+
UiBibz::Ui::Core::NavLinkList.new(content_htm, options).render
|
67
56
|
end
|
68
57
|
end
|
69
58
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a NavLinkLink
|
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
|
+
# * +status+ - State of élement with symbol value:
|
18
|
+
# (+:active+)
|
19
|
+
#
|
20
|
+
class NavLinkLink < Component
|
21
|
+
|
22
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
# Render html tag
|
27
|
+
def render
|
28
|
+
link_to options[:url], html_options do
|
29
|
+
concat glyph_and_content_html
|
30
|
+
concat label_html if options[:label]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def component_html_classes
|
37
|
+
"nav-link"
|
38
|
+
end
|
39
|
+
|
40
|
+
def component_html_options
|
41
|
+
options[:nav_type] == "nav-tabs" ? { "data-toggle" => "tab", role: 'tab' } : {}
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a NavLinkList
|
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
|
+
class NavLinkList < Component
|
18
|
+
|
19
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
# Render html tag
|
24
|
+
def render
|
25
|
+
content_tag :li, content, html_options
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def component_html_classes
|
31
|
+
'nav-item'
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a Navbar
|
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
|
+
class NavbarBrand < Component
|
18
|
+
|
19
|
+
# See UiBibz::Ui::Core::Component.initialize
|
20
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
# Render html tag
|
25
|
+
def render
|
26
|
+
link_to content, brand_url, html_options
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def component_html_classes
|
32
|
+
'navbar-brand'
|
33
|
+
end
|
34
|
+
|
35
|
+
def brand_url
|
36
|
+
options[:url] || "/"
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|