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
@@ -0,0 +1,77 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a MultiColumnField
|
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
|
+
# * option_tags - Array, Object [required]
|
18
|
+
# * selectable_opt_group - Boolean
|
19
|
+
# * searchable - Boolean
|
20
|
+
#
|
21
|
+
# ==== Signatures
|
22
|
+
#
|
23
|
+
# UiBibz::Ui::Core::MultiColumnField.new(content, options = {}, html_options = {}).render
|
24
|
+
#
|
25
|
+
# UiBibz::Ui::Core::MultiColumnField.new(options = {}, html_options = {}) do
|
26
|
+
# content
|
27
|
+
# end.render
|
28
|
+
#
|
29
|
+
# ==== Examples
|
30
|
+
#
|
31
|
+
# UiBibz::Ui::Core::MultiColumnField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
|
32
|
+
#
|
33
|
+
# UiBibz::Ui::Core::MultiColumnField.new({ option_tags: list_of_fruits, selectable_opt_group: true }, { class: 'test' }) do
|
34
|
+
# 'fruits'
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# ==== Helper
|
38
|
+
#
|
39
|
+
# multi_column_field(content, options = {}, html_options = {})
|
40
|
+
#
|
41
|
+
class MultiColumnField < Component
|
42
|
+
|
43
|
+
# See UiBibz::Ui::Core::Component.initialize
|
44
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
45
|
+
super
|
46
|
+
end
|
47
|
+
|
48
|
+
# Render html tag
|
49
|
+
def render
|
50
|
+
select_tag content, options[:option_tags], html_options
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def component_html_data
|
56
|
+
searchable
|
57
|
+
selectable_opt_group
|
58
|
+
end
|
59
|
+
|
60
|
+
def component_html_classes
|
61
|
+
'multi-column'
|
62
|
+
end
|
63
|
+
|
64
|
+
def component_html_options
|
65
|
+
{ multiple: true }
|
66
|
+
end
|
67
|
+
|
68
|
+
def searchable
|
69
|
+
add_html_data('searchable') if options[:searchable]
|
70
|
+
end
|
71
|
+
|
72
|
+
def selectable_opt_group
|
73
|
+
add_html_data('selectable_optgroup') if options[:selectable_opt_group]
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a MultiSelectField
|
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
|
+
# * option_tags - Array, Object [required]
|
18
|
+
# * clickable_opt_group - Boolean
|
19
|
+
# * collapsible_opt_group - Boolean
|
20
|
+
# * searchable - Boolean
|
21
|
+
# * select_all_option - Boolean
|
22
|
+
#
|
23
|
+
# ==== Signatures
|
24
|
+
#
|
25
|
+
# UiBibz::Ui::Core::MultiSelectField.new(content, options = {}, html_options = {}).render
|
26
|
+
#
|
27
|
+
# UiBibz::Ui::Core::MultiSelectField.new(options = {}, html_options = {}) do
|
28
|
+
# content
|
29
|
+
# end.render
|
30
|
+
#
|
31
|
+
# ==== Examples
|
32
|
+
#
|
33
|
+
# UiBibz::Ui::Core::MultiSelectField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
|
34
|
+
#
|
35
|
+
# UiBibz::Ui::Core::MultiSelectField.new({ option_tags: list_of_fruits, select_all_option: true }, { class: 'test' }) do
|
36
|
+
# 'fruits'
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# ==== Helper
|
40
|
+
#
|
41
|
+
# multi_select_field(content, options = {}, html_options = {})
|
42
|
+
#
|
43
|
+
class MultiSelectField < UiBibz::Ui::Core::Button
|
44
|
+
|
45
|
+
# See UiBibz::Ui::Core::Component.initialize
|
46
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
# Render html tag
|
51
|
+
def render
|
52
|
+
select_tag content, options[:option_tags], html_options
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def component_html_options
|
58
|
+
{ multiple: true }
|
59
|
+
end
|
60
|
+
|
61
|
+
def component_html_classes
|
62
|
+
['btn', size, type, 'multi-select']
|
63
|
+
end
|
64
|
+
|
65
|
+
def component_html_data
|
66
|
+
clickable_opt_group
|
67
|
+
collapsible_opt_group
|
68
|
+
searchable
|
69
|
+
select_all_option
|
70
|
+
end
|
71
|
+
|
72
|
+
def clickable_opt_group
|
73
|
+
add_html_data('enable_clickable_opt_groups') if options[:clickable_opt_group]
|
74
|
+
end
|
75
|
+
|
76
|
+
def collapsible_opt_group
|
77
|
+
add_html_data('enable_collapsible_opt_groups') if options[:collapsible_opt_group]
|
78
|
+
end
|
79
|
+
|
80
|
+
def searchable
|
81
|
+
add_html_data('enable_filtering') if options[:searchable]
|
82
|
+
end
|
83
|
+
|
84
|
+
def select_all_option
|
85
|
+
add_html_data('include_select_all_option') if options[:select_all_option]
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
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::SurroundField.new(content, options = {}, html_options = {}).render
|
23
|
+
#
|
24
|
+
# UiBibz::Ui::Core::SurroundField.new(options = {}, html_options = {}) do
|
25
|
+
# content
|
26
|
+
# end.render
|
27
|
+
#
|
28
|
+
# ==== Examples
|
29
|
+
#
|
30
|
+
# UiBibz::Ui::Core::SurroundField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')
|
31
|
+
#
|
32
|
+
# UiBibz::Ui::Core::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 < 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_tag content, html_options[:value], html_options
|
53
|
+
else
|
54
|
+
content_tag :div, class: join_classes('input-group', size) do
|
55
|
+
concat content_tag :span, options[:append], class: 'input-group-addon' unless options[:append].nil?
|
56
|
+
concat text_field_tag content, html_options[:value], html_options
|
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
|
+
def component_html_classes
|
65
|
+
'form-control'
|
66
|
+
end
|
67
|
+
|
68
|
+
# :lg, :sm or :xs
|
69
|
+
def size
|
70
|
+
"input-group-#{ options[:size] }" if options[:size]
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -49,19 +49,23 @@ module UiBibz::Ui::Core
|
|
49
49
|
|
50
50
|
# Render html tag
|
51
51
|
def render
|
52
|
-
content_tag :div,
|
53
|
-
if
|
54
|
-
|
52
|
+
content_tag :div, html_options do
|
53
|
+
if fluid
|
54
|
+
Container.new(content).render
|
55
55
|
else
|
56
|
-
|
56
|
+
content
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
private
|
62
62
|
|
63
|
-
def
|
64
|
-
|
63
|
+
def component_html_classes
|
64
|
+
['jumbotron', fluid]
|
65
|
+
end
|
66
|
+
|
67
|
+
def fluid
|
68
|
+
"jumbotron-fluid" unless options[:fluid].nil?
|
65
69
|
end
|
66
70
|
|
67
71
|
end
|
@@ -21,6 +21,8 @@ module UiBibz::Ui::Core
|
|
21
21
|
# * +name+ - String
|
22
22
|
# * +size+ - Integer
|
23
23
|
# * +type+ - Symbol
|
24
|
+
# * +type+ - Symbol
|
25
|
+
# (+pill+)
|
24
26
|
#
|
25
27
|
# ==== Signatures
|
26
28
|
#
|
@@ -32,7 +34,7 @@ module UiBibz::Ui::Core
|
|
32
34
|
#
|
33
35
|
# ==== Examples
|
34
36
|
#
|
35
|
-
# UiBibz::Ui::Core::Label.new(content, state: :success).render
|
37
|
+
# UiBibz::Ui::Core::Label.new(content, state: :success, type: :pill).render
|
36
38
|
#
|
37
39
|
# UiBibz::Ui::Core::Label.new() do
|
38
40
|
# #content
|
@@ -55,14 +57,22 @@ module UiBibz::Ui::Core
|
|
55
57
|
|
56
58
|
# Render html tag
|
57
59
|
def render
|
58
|
-
content_tag :span, glyph_and_content_html,
|
60
|
+
content_tag :span, glyph_and_content_html, html_options
|
59
61
|
end
|
60
62
|
|
61
63
|
private
|
62
64
|
|
65
|
+
def component_html_classes
|
66
|
+
['label', type]
|
67
|
+
end
|
68
|
+
|
63
69
|
def state
|
64
70
|
sym = @options[:state] || :default
|
65
|
-
"label-#{
|
71
|
+
"label-#{ sym }"
|
72
|
+
end
|
73
|
+
|
74
|
+
def type
|
75
|
+
"label-pill" if @options[:type] == :pill
|
66
76
|
end
|
67
77
|
|
68
78
|
end
|
@@ -3,6 +3,7 @@ module UiBibz::Ui::Core
|
|
3
3
|
# Create a col
|
4
4
|
#
|
5
5
|
# This element is an extend of UiBibz::Ui::Core::Component.
|
6
|
+
# size are xs, sm, md, lg, xl
|
6
7
|
#
|
7
8
|
# ==== Attributes
|
8
9
|
#
|
@@ -16,7 +17,13 @@ module UiBibz::Ui::Core
|
|
16
17
|
# You can pass arguments in options attribute:
|
17
18
|
# * +num+ - Integer | 0..12
|
18
19
|
# * +offset+ - Integer
|
19
|
-
# * +
|
20
|
+
# * +pull+ - Integer
|
21
|
+
# * +push+ - Integer
|
22
|
+
# * +xs+ - Hash
|
23
|
+
# * +sm+ - Hash
|
24
|
+
# * +md+ - Hash
|
25
|
+
# * +lg+ - Hash
|
26
|
+
# * +xl+ - Hash
|
20
27
|
#
|
21
28
|
# ==== Signatures
|
22
29
|
#
|
@@ -28,11 +35,9 @@ module UiBibz::Ui::Core
|
|
28
35
|
#
|
29
36
|
# ==== Examples
|
30
37
|
#
|
31
|
-
# UiBibz::Ui::Core::Col.new({num: 2, offset: 1
|
32
|
-
# #content
|
33
|
-
# end
|
38
|
+
# UiBibz::Ui::Core::Col.new('content', { num: 2, offset: 1 }, { class: 'test' })
|
34
39
|
#
|
35
|
-
# UiBibz::Ui::Core::Col.new(
|
40
|
+
# UiBibz::Ui::Core::Col.new(xs: { num: 2, pull: 1, push: 1}, md: { num: 3 }, { class: 'test' }) do
|
36
41
|
# #content
|
37
42
|
# end
|
38
43
|
#
|
@@ -47,35 +52,50 @@ module UiBibz::Ui::Core
|
|
47
52
|
# See UiBibz::Ui::Core::Component.initialize
|
48
53
|
def initialize content = nil, options = nil, html_options = nil, &block
|
49
54
|
super
|
50
|
-
@cols = []
|
51
55
|
end
|
52
56
|
|
53
57
|
# Render html tag
|
54
58
|
def render
|
55
|
-
content_tag :div,
|
59
|
+
content_tag :div, content, html_options
|
56
60
|
end
|
57
61
|
|
58
62
|
private
|
59
63
|
|
64
|
+
def component_html_classes
|
65
|
+
col_classes
|
66
|
+
end
|
67
|
+
|
60
68
|
def col_classes
|
61
|
-
|
62
|
-
|
63
|
-
|
69
|
+
kl = []
|
70
|
+
@options.each do |ke,va|
|
71
|
+
kl << write_classes(ke, va) if %i(xs sm md lg xl).include?(ke)
|
64
72
|
end
|
65
|
-
@options
|
66
|
-
|
73
|
+
kl << write_classes(:md, @options) if kl.empty?
|
74
|
+
kl
|
75
|
+
end
|
76
|
+
|
77
|
+
def write_classes size, opts
|
78
|
+
opts.map{ |k, v| send(k, size.to_sym, v) if %i(num offset push pull).include?(k) }.join(' ')
|
79
|
+
end
|
80
|
+
|
81
|
+
# col-md-9
|
82
|
+
def num size, n
|
83
|
+
"col-#{ size }-#{ n }"
|
67
84
|
end
|
68
85
|
|
69
|
-
|
70
|
-
|
86
|
+
# col-md-offset-9
|
87
|
+
def offset size, n
|
88
|
+
"col-#{ size }-offset-#{ n }"
|
71
89
|
end
|
72
90
|
|
73
|
-
|
74
|
-
|
91
|
+
# col-md-push-9
|
92
|
+
def push size, n
|
93
|
+
"col-#{ size }-push-#{ n }"
|
75
94
|
end
|
76
95
|
|
77
|
-
|
78
|
-
|
96
|
+
# col-md-pull-9
|
97
|
+
def pull size, n
|
98
|
+
"col-#{ size }-pull-#{ n }"
|
79
99
|
end
|
80
100
|
|
81
101
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module UiBibz::Ui::Core
|
2
|
+
|
3
|
+
# Create a Container
|
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
|
+
# * +type+ - Symbol (:fluid)
|
17
|
+
#
|
18
|
+
# ==== Signatures
|
19
|
+
#
|
20
|
+
# UiBibz::Ui::Core::Container.new(content, options = nil, html_options = nil)
|
21
|
+
#
|
22
|
+
# UiBibz::Ui::Core::Container.new(options = nil, html_options = nil) do
|
23
|
+
# content
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# ==== Examples
|
27
|
+
#
|
28
|
+
# UiBibz::Ui::Core::Container.new(content, { type: :fluid },{ class: 'test' }).render
|
29
|
+
#
|
30
|
+
# UiBibz::Ui::Core::Container.new({ class: 'test' }) do
|
31
|
+
# content
|
32
|
+
# end.render
|
33
|
+
#
|
34
|
+
# ==== Helper
|
35
|
+
#
|
36
|
+
# container(content, options = {}, html_options = {})
|
37
|
+
#
|
38
|
+
# container(options = {}, html_options = {}) do
|
39
|
+
# content
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
class Container < 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
|
+
content_tag :div, content, html_options
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def component_html_classes
|
57
|
+
type
|
58
|
+
end
|
59
|
+
|
60
|
+
def type
|
61
|
+
options[:type] == :fluid ? "container-fluid" : "container"
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|