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
@@ -15,9 +15,12 @@ module UiBibz::Ui::Core
|
|
15
15
|
# You can add HTML attributes using the +html_options+.
|
16
16
|
# You can pass arguments in options attribute:
|
17
17
|
# * +state+ - State of élement with symbol value:
|
18
|
-
# (+:
|
18
|
+
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
|
19
19
|
# * +size+
|
20
20
|
# (+:xs+, +:sm+, +:lg+)
|
21
|
+
# * +outline+ - Boolean
|
22
|
+
# * +status+ - Symbol (+:active+, +:disabled)
|
23
|
+
# * +type+ - Symbol (+:block)
|
21
24
|
# * +glyph+ - Add glyph with name or hash options
|
22
25
|
# * +name+ - String
|
23
26
|
# * +size+ - Integer
|
@@ -59,11 +62,21 @@ module UiBibz::Ui::Core
|
|
59
62
|
|
60
63
|
# Render html tag
|
61
64
|
def render
|
62
|
-
content_tag :div,
|
65
|
+
content_tag :div, html_options do
|
63
66
|
concat button_html
|
64
67
|
concat ul_html
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
71
|
+
private
|
72
|
+
|
73
|
+
def component_html_classes
|
74
|
+
['btn-group', type]
|
75
|
+
end
|
76
|
+
|
77
|
+
def component_html_options
|
78
|
+
{ role: 'group' }
|
79
|
+
end
|
80
|
+
|
68
81
|
end
|
69
82
|
end
|
@@ -15,7 +15,7 @@ module UiBibz::Ui::Core
|
|
15
15
|
# You can add HTML attributes using the +html_options+.
|
16
16
|
# You can pass arguments in options attribute:
|
17
17
|
# * +state+ - State of element with +symbol+ value:
|
18
|
-
# (+:
|
18
|
+
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
|
19
19
|
# * +size+ - Size of element with +symbol+ value:
|
20
20
|
# (+:xs+, +:sm+, +:lg+)
|
21
21
|
# * +position+ - Position vertical or horizontal with +symbol+ value:
|
@@ -51,21 +51,33 @@ module UiBibz::Ui::Core
|
|
51
51
|
|
52
52
|
# Render html tag
|
53
53
|
def render
|
54
|
-
content_tag :div,
|
54
|
+
content_tag :div, content, html_options
|
55
55
|
end
|
56
56
|
|
57
57
|
private
|
58
58
|
|
59
|
+
def component_html_classes
|
60
|
+
["btn-#{ type }", size, position]
|
61
|
+
end
|
62
|
+
|
63
|
+
def component_html_options
|
64
|
+
{ role: type, data: { toggle: 'buttons' } }
|
65
|
+
end
|
66
|
+
|
67
|
+
def component_html_data
|
68
|
+
add_html_data "toggle", "buttons"
|
69
|
+
end
|
70
|
+
|
59
71
|
def type
|
60
|
-
|
72
|
+
options[:type] || :group
|
61
73
|
end
|
62
74
|
|
63
75
|
def size
|
64
|
-
"btn-group-#{
|
76
|
+
"btn-group-#{ options[:size] }" if options[:size]
|
65
77
|
end
|
66
78
|
|
67
79
|
def position
|
68
|
-
"btn-group-#{
|
80
|
+
"btn-group-#{ options[:position] }" if options[:position]
|
69
81
|
end
|
70
82
|
|
71
83
|
end
|
@@ -15,10 +15,13 @@ module UiBibz::Ui::Core
|
|
15
15
|
# You can add HTML attributes using the +html_options+.
|
16
16
|
# You can pass arguments in options attribute:
|
17
17
|
# * +state+ - State of élement with symbol value:
|
18
|
-
# (+:
|
18
|
+
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
|
19
19
|
# * +size+
|
20
20
|
# (+:xs+, +:sm+, +:lg+)
|
21
21
|
# * +url+ - String url
|
22
|
+
# * +outline+ - Boolean
|
23
|
+
# * +status+ - Symbol (+:active+, +:disabled)
|
24
|
+
# * +type+ - Symbol (+:block)
|
22
25
|
# * +glyph+ - Add glyph with name or hash options
|
23
26
|
# * +name+ - String
|
24
27
|
# * +size+ - Integer
|
@@ -48,7 +51,7 @@ module UiBibz::Ui::Core
|
|
48
51
|
# content
|
49
52
|
# end
|
50
53
|
#
|
51
|
-
class ButtonLink <
|
54
|
+
class ButtonLink < UiBibz::Ui::Core::Button
|
52
55
|
|
53
56
|
# See UiBibz::Ui::Core::Component.initialize
|
54
57
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -57,19 +60,13 @@ module UiBibz::Ui::Core
|
|
57
60
|
|
58
61
|
# Render html tag
|
59
62
|
def render
|
60
|
-
link_to glyph_and_content_html,
|
63
|
+
link_to glyph_and_content_html, options[:url], html_options
|
61
64
|
end
|
62
65
|
|
63
66
|
private
|
64
67
|
|
65
|
-
def
|
66
|
-
|
67
|
-
"btn-#{ states[sym] }"
|
68
|
-
end
|
69
|
-
|
70
|
-
# :lg, :sm or :xs
|
71
|
-
def size
|
72
|
-
"btn-#{ @options[:size] }" if @options[:size]
|
68
|
+
def component_html_classes
|
69
|
+
['btn', size, type]
|
73
70
|
end
|
74
71
|
|
75
72
|
end
|
@@ -15,9 +15,12 @@ module UiBibz::Ui::Core
|
|
15
15
|
# You can add HTML attributes using the +html_options+.
|
16
16
|
# You can pass arguments in options attribute:
|
17
17
|
# * +state+ - State of élement with symbol value:
|
18
|
-
# (+:
|
18
|
+
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
|
19
19
|
# * +size+
|
20
20
|
# (+:xs+, +:sm+, +:lg+)
|
21
|
+
# * +outline+ - Boolean
|
22
|
+
# * +status+ - Symbol (+:active+, +:disabled)
|
23
|
+
# * +type+ - Symbol (+:block)
|
21
24
|
# * +glyph+ - Add glyph with name or hash options
|
22
25
|
# * +name+ - String
|
23
26
|
# * +size+ - Integer
|
@@ -59,7 +62,7 @@ module UiBibz::Ui::Core
|
|
59
62
|
|
60
63
|
# Render html tag
|
61
64
|
def render
|
62
|
-
content_tag :div,
|
65
|
+
content_tag :div, html_options do
|
63
66
|
concat button_html
|
64
67
|
concat split_html
|
65
68
|
concat ul_html
|
@@ -68,13 +71,20 @@ module UiBibz::Ui::Core
|
|
68
71
|
|
69
72
|
private
|
70
73
|
|
74
|
+
def component_html_classes
|
75
|
+
['btn-group', type]
|
76
|
+
end
|
77
|
+
|
78
|
+
def component_html_options
|
79
|
+
{ role: 'group' }
|
80
|
+
end
|
71
81
|
|
72
82
|
def button_html
|
73
|
-
content_tag :button, button_content, class:
|
83
|
+
content_tag :button, button_content, class: join_classes("btn", button_state, size)
|
74
84
|
end
|
75
85
|
|
76
86
|
def split_html
|
77
|
-
content_tag :button, split_content, class:
|
87
|
+
content_tag :button, split_content, class: join_classes("btn", button_state, size, "dropdown-toggle"), type: 'button', "data-toggle" => 'dropdown', "aria-haspopup" => true, "aria-expanded" => false
|
78
88
|
end
|
79
89
|
|
80
90
|
def split_content
|
@@ -86,7 +96,7 @@ module UiBibz::Ui::Core
|
|
86
96
|
end
|
87
97
|
|
88
98
|
def button_content
|
89
|
-
[glyph_with_space,
|
99
|
+
[glyph_with_space, content].compact.join.html_safe
|
90
100
|
end
|
91
101
|
|
92
102
|
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'ui_bibz/ui/core/card/components/card_header'
|
2
|
+
require 'ui_bibz/ui/core/card/components/card_footer'
|
3
|
+
require 'ui_bibz/ui/core/card/components/card_block'
|
4
|
+
require 'ui_bibz/ui/core/card/components/card_image'
|
5
|
+
require 'ui_bibz/ui/core/card/components/card_list_group'
|
6
|
+
module UiBibz::Ui::Core
|
7
|
+
|
8
|
+
# Create a card
|
9
|
+
#
|
10
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
11
|
+
# You can use tap method to add header, body or footer element.
|
12
|
+
#
|
13
|
+
# ==== Attributes
|
14
|
+
#
|
15
|
+
# * +content+ - Content of element
|
16
|
+
# * +options+ - Options of element
|
17
|
+
# * +html_options+ - Html Options of element
|
18
|
+
#
|
19
|
+
# ==== Options
|
20
|
+
#
|
21
|
+
# You can add HTML attributes using the +html_options+.
|
22
|
+
# You can pass arguments in options attribute:
|
23
|
+
# * +state+ - State of élement with symbol value:
|
24
|
+
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+)
|
25
|
+
# * text_position - Symbole
|
26
|
+
# (+:left+, +:right+, +:center+)
|
27
|
+
# * block - Boolean
|
28
|
+
# * type - Symbol
|
29
|
+
# (+:inverse+)
|
30
|
+
#
|
31
|
+
# ==== Signatures
|
32
|
+
#
|
33
|
+
# UiBibz::Ui::Core::Card.new(content, options = nil, html_options = nil)
|
34
|
+
#
|
35
|
+
# UiBibz::Ui::Core::Card.new(options = nil, html_options = nil) do
|
36
|
+
# content
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# UiBibz::Ui::Core::Card.new(options = nil, html_options = nil).tap do |p|
|
40
|
+
# p.header content = nil, options = nil, html_options = nil, &block
|
41
|
+
# p.block content = nil, options = nil, html_options = nil, &block
|
42
|
+
# p.footer content = nil, options = nil, html_options = nil, &block
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# ==== Examples
|
46
|
+
#
|
47
|
+
# UiBibz::Ui::Core::Card('test').render
|
48
|
+
#
|
49
|
+
# UiBibz::Ui::Core::Card(state: :primary) do |d|
|
50
|
+
# 'test'
|
51
|
+
# end.render
|
52
|
+
#
|
53
|
+
# UiBibz::Ui::Core::Card.new().tap do |p|
|
54
|
+
# p.header 'header', glyph: 'eye', class: 'header-test'
|
55
|
+
# p.block do
|
56
|
+
# 'body'
|
57
|
+
# end
|
58
|
+
# p.footer 'footer'
|
59
|
+
# end.render
|
60
|
+
#
|
61
|
+
# ==== Helper
|
62
|
+
#
|
63
|
+
# card(content, options = {}, html_options = {})
|
64
|
+
#
|
65
|
+
# card(options = {}, html_options = {}) do
|
66
|
+
# content
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# card(options = { tap: true }, html_options = {}) do |p|
|
70
|
+
# p.header(content, options = {}, html_options = {})
|
71
|
+
# # or
|
72
|
+
# p.header(options = {}, html_options = {}) do
|
73
|
+
# content
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# p.block(content, options = {}, html_options = {})
|
77
|
+
# # or
|
78
|
+
# p.block(options = {}, html_options = {}) do
|
79
|
+
# content
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
# p.footer(content, options = {}, html_options = {})
|
83
|
+
# # or
|
84
|
+
# p.footer(options = {}, html_options = {}) do
|
85
|
+
# content
|
86
|
+
# end
|
87
|
+
# end
|
88
|
+
#
|
89
|
+
class Card < Component
|
90
|
+
|
91
|
+
# See UiBibz::Ui::Core::Component.initialize
|
92
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
93
|
+
super
|
94
|
+
@items = [@content]
|
95
|
+
end
|
96
|
+
|
97
|
+
# Add Header which is a component
|
98
|
+
def header content = nil, options = nil, html_options = nil, &block
|
99
|
+
@items << CardHeader.new(content, options, html_options, &block).render
|
100
|
+
end
|
101
|
+
|
102
|
+
# Add Block div which is a component
|
103
|
+
def block content = nil, options = nil, html_options = nil, &block
|
104
|
+
if is_tap(content, options)
|
105
|
+
@items << CardBlock.new(content, options, html_options).tap(&block).render
|
106
|
+
else
|
107
|
+
@items << CardBlock.new(content, options, html_options, &block).render
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Add Footer which is a component
|
112
|
+
def footer content = nil, options = nil, html_options = nil, &block
|
113
|
+
@items << CardFooter.new(content, options, html_options, &block).render
|
114
|
+
end
|
115
|
+
|
116
|
+
# Add List group which is a component
|
117
|
+
def list_group content = nil, options = nil, html_options = nil, &block
|
118
|
+
@items << CardListGroup.new(content, options, html_options).tap(&block).render
|
119
|
+
end
|
120
|
+
|
121
|
+
# Add Image which is a component
|
122
|
+
def image content = nil, options = nil, html_options = nil, &block
|
123
|
+
@items << CardImage.new(content, options, html_options, &block).render
|
124
|
+
end
|
125
|
+
|
126
|
+
# Render html tag
|
127
|
+
def render
|
128
|
+
content_tag :div, @items.join.html_safe, html_options
|
129
|
+
end
|
130
|
+
|
131
|
+
protected
|
132
|
+
|
133
|
+
def component_html_classes
|
134
|
+
["card", text_position, card_block, type, tab_pane]
|
135
|
+
end
|
136
|
+
|
137
|
+
def state
|
138
|
+
"card-#{ @options[:state] }" unless @options[:state].nil?
|
139
|
+
end
|
140
|
+
|
141
|
+
def text_position
|
142
|
+
"text-#{ @options[:text_position] }" unless @options[:text_position].nil?
|
143
|
+
end
|
144
|
+
|
145
|
+
def card_block
|
146
|
+
"card-block" if !@options[:block].nil? || @options[:tap].nil?
|
147
|
+
end
|
148
|
+
|
149
|
+
def type
|
150
|
+
"card-#{ @options[:type] }" unless @options[:type].nil?
|
151
|
+
end
|
152
|
+
|
153
|
+
def tab_pane
|
154
|
+
"tab-pane" if @options[:tab]
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a card column
|
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
|
+
#
|
16
|
+
# ==== Signatures
|
17
|
+
#
|
18
|
+
# UiBibz::Ui::Core::CardColumn.new(content, options = nil, html_options = nil)
|
19
|
+
#
|
20
|
+
# UiBibz::Ui::Core::CardColumn.new(options = nil, html_options = nil) do |cg|
|
21
|
+
# cg.card content, options, html_options, &block
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# ==== Examples
|
25
|
+
#
|
26
|
+
# UiBibz::Ui::Core::CardColumn.new do |cg|
|
27
|
+
# cg.card 'Exemple 1'
|
28
|
+
# cg.card 'Exemple 2'
|
29
|
+
# cg.card 'Exemple 3'
|
30
|
+
# end.render
|
31
|
+
#
|
32
|
+
class CardColumn < Component
|
33
|
+
|
34
|
+
# See UiBibz::Ui::Core::Component.initialize
|
35
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
36
|
+
super
|
37
|
+
@items = []
|
38
|
+
end
|
39
|
+
|
40
|
+
# Render html tag
|
41
|
+
def render
|
42
|
+
content_tag :div, @items.join.html_safe, html_options
|
43
|
+
end
|
44
|
+
|
45
|
+
def card content = nil, options = nil, html_options = nil, &block
|
46
|
+
if is_tap content, options
|
47
|
+
@items << UiBibz::Ui::Core::Card.new(content, options, html_options).tap(&block).render
|
48
|
+
else
|
49
|
+
@items << UiBibz::Ui::Core::Card.new(content, options, html_options, &block).render
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def component_html_classes
|
56
|
+
"card-columns"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a card deck
|
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
|
+
#
|
16
|
+
# ==== Signatures
|
17
|
+
#
|
18
|
+
# UiBibz::Ui::Core::CardDeck.new(content, options = nil, html_options = nil)
|
19
|
+
#
|
20
|
+
# UiBibz::Ui::Core::CardDeck.new(options = nil, html_options = nil) do
|
21
|
+
# cg.card content, options, html_options, &block
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# ==== Examples
|
25
|
+
#
|
26
|
+
# UiBibz::Ui::Core::CardDeck.new do |cg|
|
27
|
+
# cg.card 'Exemple 1'
|
28
|
+
# cg.card 'Exemple 2'
|
29
|
+
# cg.card 'Exemple 3'
|
30
|
+
# end.render
|
31
|
+
#
|
32
|
+
class CardDeck < Component
|
33
|
+
|
34
|
+
# See UiBibz::Ui::Core::Component.initialize
|
35
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
36
|
+
super
|
37
|
+
@items = []
|
38
|
+
end
|
39
|
+
|
40
|
+
# Render html tag
|
41
|
+
def render
|
42
|
+
content_tag :div, html_options do
|
43
|
+
content_tag :div, @items.join.html_safe, class: 'card-deck'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def card content = nil, options = nil, html_options = nil, &block
|
48
|
+
if is_tap content, options
|
49
|
+
@items << UiBibz::Ui::Core::Card.new(content, options, html_options).tap(&block).render
|
50
|
+
else
|
51
|
+
@items << UiBibz::Ui::Core::Card.new(content, options, html_options, &block).render
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def component_html_classes
|
58
|
+
"card-deck-wrapper"
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|