ui_bibz 2.0.0.alpha32 → 2.0.0.beta2
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/Gemfile +2 -1
- data/Gemfile.lock +111 -87
- data/app/assets/javascripts/form.coffee +24 -8
- data/app/assets/javascripts/ui_bibz.coffee +3 -2
- data/app/assets/stylesheets/bootstrap-switch.sass +17 -8
- data/app/assets/stylesheets/fix-dropdown-select.sass +1 -1
- data/app/assets/stylesheets/table.sass +1 -1
- data/app/assets/stylesheets/ui_bibz.sass +60 -22
- data/app/inputs/ui_bibz_form/ui_bibz_form_builder.rb +35 -0
- data/app/inputs/ui_bibz_inputs/auto_complete_field_input.rb +14 -0
- data/app/inputs/{custom_inputs → ui_bibz_inputs}/base_input.rb +7 -1
- data/app/inputs/{custom_inputs → ui_bibz_inputs}/collection_input.rb +6 -3
- data/app/inputs/{custom_inputs → ui_bibz_inputs}/string_input.rb +5 -1
- data/app/inputs/ui_bibz_inputs/ui_auto_complete_field_input.rb +14 -0
- data/app/inputs/ui_bibz_inputs/ui_button_choices_input.rb +20 -0
- data/app/inputs/{custom_inputs/date_picker_field_input.rb → ui_bibz_inputs/ui_date_picker_field_input.rb} +2 -2
- data/app/inputs/{custom_inputs/dropdown_select_field_input.rb → ui_bibz_inputs/ui_dropdown_select_field_input.rb} +2 -2
- data/app/inputs/{custom_inputs/formula_field_input.rb → ui_bibz_inputs/ui_formula_field_input.rb} +2 -2
- data/app/inputs/{custom_inputs/markdown_editor_field_input.rb → ui_bibz_inputs/ui_markdown_editor_field_input.rb} +2 -2
- data/app/inputs/{custom_inputs/multi_column_field_input.rb → ui_bibz_inputs/ui_multi_column_field_input.rb} +2 -2
- data/app/inputs/ui_bibz_inputs/ui_multi_select_field_input.rb +9 -0
- data/app/inputs/{custom_inputs/radio_field_input.rb → ui_bibz_inputs/ui_radio_field_input.rb} +2 -2
- data/app/inputs/{custom_inputs/select_field_input.rb → ui_bibz_inputs/ui_select_field_input.rb} +2 -2
- data/app/inputs/{custom_inputs/switch_field_input.rb → ui_bibz_inputs/ui_switch_field_input.rb} +2 -2
- data/app/inputs/ui_bibz_inputs/ui_text_field_input.rb +13 -0
- data/config/initializers/ui_bibz.rb +7 -0
- data/lib/ui_bibz/helpers/ui/core/cards_helper.rb +42 -0
- data/lib/ui_bibz/helpers/ui/core/dropdowns_helper.rb +21 -0
- data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +148 -0
- data/lib/ui_bibz/helpers/ui/core/layouts_helper.rb +27 -0
- data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +11 -0
- data/lib/ui_bibz/helpers/ui/core/navs_helper.rb +27 -0
- data/lib/ui_bibz/helpers/ui/core/paths_helper.rb +16 -0
- data/lib/ui_bibz/helpers/ui/core/windows_helper.rb +11 -0
- data/lib/ui_bibz/helpers/ui/core_helper.rb +89 -0
- data/lib/ui_bibz/helpers/{ui_ux_helper.rb → ui/ux_helper.rb} +8 -18
- data/lib/ui_bibz/helpers/utils_helper.rb +22 -1
- data/lib/ui_bibz/rails/engine.rb +6 -2
- data/lib/ui_bibz/ui/base.rb +4 -0
- data/lib/ui_bibz/ui/core/{tag.rb → badge.rb} +10 -10
- data/lib/ui_bibz/ui/core/cards/card.rb +37 -13
- data/lib/ui_bibz/ui/core/cards/components/{block/card_block_link.rb → body/card_body_link.rb} +6 -6
- data/lib/ui_bibz/ui/core/cards/components/{block/card_block_text.rb → body/card_body_text.rb} +6 -6
- data/lib/ui_bibz/ui/core/cards/components/{block/card_block_title.rb → body/card_body_title.rb} +6 -6
- data/lib/ui_bibz/ui/core/cards/components/{card_block.rb → card_body.rb} +17 -13
- data/lib/ui_bibz/ui/core/cards/components/card_footer.rb +5 -1
- data/lib/ui_bibz/ui/core/cards/components/card_header.rb +5 -1
- data/lib/ui_bibz/ui/core/cards/components/card_image.rb +3 -2
- data/lib/ui_bibz/ui/core/component.rb +8 -6
- data/lib/ui_bibz/ui/core/dropdowns/dropdown.rb +21 -5
- data/lib/ui_bibz/ui/core/forms/buttons/button.rb +37 -8
- data/lib/ui_bibz/ui/core/forms/buttons/button_choice.rb +17 -29
- data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +51 -11
- data/lib/ui_bibz/ui/core/forms/buttons/button_link.rb +18 -5
- data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +13 -4
- data/lib/ui_bibz/ui/core/forms/buttons/button_toolbar.rb +90 -0
- data/lib/ui_bibz/ui/core/forms/buttons/components/choice.rb +116 -0
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +21 -8
- data/lib/ui_bibz/ui/core/forms/choices/radio_field.rb +22 -9
- data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +17 -5
- data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +36 -16
- data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +20 -19
- data/lib/ui_bibz/ui/core/forms/selects/abstract_select.rb +99 -0
- data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +16 -16
- data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +8 -13
- data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +17 -18
- data/lib/ui_bibz/ui/core/forms/selects/select_field.rb +8 -20
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_addon.rb +25 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_group.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_link.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_button_refresh.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_checkbox_field.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_dropdown.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_radio_field.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/components/surround_switch_field.rb +16 -0
- data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +153 -0
- data/lib/ui_bibz/ui/core/forms/texts/auto_complete_field.rb +13 -38
- data/lib/ui_bibz/ui/core/forms/texts/text_field.rb +81 -0
- data/lib/ui_bibz/ui/core/glyph.rb +1 -1
- data/lib/ui_bibz/ui/core/layouts/col.rb +10 -2
- data/lib/ui_bibz/ui/core/layouts/row.rb +7 -1
- data/lib/ui_bibz/ui/core/lists/components/list/list_body.rb +4 -2
- data/lib/ui_bibz/ui/core/lists/components/list/list_header.rb +5 -2
- data/lib/ui_bibz/ui/core/lists/components/list.rb +35 -14
- data/lib/ui_bibz/ui/core/lists/list_group.rb +4 -4
- data/lib/ui_bibz/ui/core/navs/components/navbar_form.rb +7 -2
- data/lib/ui_bibz/ui/core/navs/components/navbar_nav.rb +4 -0
- data/lib/ui_bibz/ui/core/navs/components/navbar_text.rb +1 -1
- data/lib/ui_bibz/ui/core/navs/components/pagination_link.rb +60 -0
- data/lib/ui_bibz/ui/core/navs/nav.rb +31 -3
- data/lib/ui_bibz/ui/core/navs/navbar.rb +32 -22
- data/lib/ui_bibz/ui/core/navs/pagination.rb +97 -0
- data/lib/ui_bibz/ui/core/{alert.rb → notifications/alert.rb} +23 -11
- data/lib/ui_bibz/ui/core/notifications/components/alert_body.rb +50 -0
- data/lib/ui_bibz/ui/core/notifications/components/alert_header.rb +67 -0
- data/lib/ui_bibz/ui/core/{progress.rb → progresses/components/bar.rb} +21 -28
- data/lib/ui_bibz/ui/core/progresses/progress_bar.rb +115 -0
- data/lib/ui_bibz/ui/core/windows/components/modal_header.rb +1 -1
- data/lib/ui_bibz/ui/{core → extensions/core}/component/glyph_extension.rb +2 -2
- data/lib/ui_bibz/ui/{core → extensions/core}/component/klass_extension.rb +1 -2
- data/lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb +31 -0
- data/lib/ui_bibz/ui/extensions/core/forms/surround_extension.rb +48 -0
- data/lib/ui_bibz/utils/internationalization.rb +9 -0
- data/lib/ui_bibz/version.rb +1 -1
- data/lib/ui_bibz.rb +23 -7
- data/test/simple_form_test.rb +58 -41
- data/test/ui/core/badge_test.rb +19 -0
- data/test/ui/core/cards/card_test.rb +34 -35
- data/test/ui/{component_test.rb → core/component_test.rb} +0 -1
- data/test/ui/core/dropdowns/dropdown_test.rb +5 -5
- data/test/ui/core/forms/buttons/button_choice_test.rb +23 -7
- data/test/ui/core/forms/buttons/button_group_test.rb +35 -17
- data/test/ui/core/forms/buttons/button_link_test.rb +74 -4
- data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -2
- data/test/ui/core/forms/buttons/button_test.rb +66 -3
- data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -2
- data/test/ui/core/forms/choices/radio_field_test.rb +1 -2
- data/test/ui/core/forms/choices/switch_field_test.rb +0 -1
- data/test/ui/core/forms/dates/date_picker_field_test.rb +2 -3
- data/test/ui/core/forms/numbers/formula_field_test.rb +1 -2
- data/test/ui/core/forms/selects/dropdown_select_field_test.rb +1 -2
- data/test/ui/core/forms/selects/multi_column_field_test.rb +0 -1
- data/test/ui/core/forms/selects/multi_select_field_test.rb +1 -2
- data/test/ui/core/forms/selects/select_field_test.rb +1 -2
- data/test/ui/core/forms/surrounds/surround_field_test.rb +58 -0
- data/test/ui/core/forms/textareas/markdown_editor_field_test.rb +0 -1
- data/test/ui/core/forms/texts/auto_complete_field_test.rb +21 -4
- data/test/ui/core/forms/texts/text_field_test.rb +25 -0
- data/test/ui/{glyph_test.rb → core/glyph_test.rb} +5 -5
- data/test/ui/core/jumbotron_test.rb +20 -0
- data/test/ui/core/layouts/col_test.rb +31 -0
- data/test/ui/core/layouts/container_test.rb +13 -0
- data/test/ui/core/layouts/row_test.rb +24 -0
- data/test/ui/core/lists/list_group_test.rb +5 -4
- data/test/ui/core/navs/nav_test.rb +4 -5
- data/test/ui/core/navs/navbar_test.rb +39 -0
- data/test/ui/core/notifications/alert_test.rb +22 -0
- data/test/ui/core/paths/breadcrumb_test.rb +15 -4
- data/test/ui/core/progress_test.rb +14 -0
- data/test/ui/{star_test.rb → core/star_test.rb} +6 -7
- data/test/ui/core/windows/modal_test.rb +20 -0
- data/test/ui/ux/tables/table_test.rb +2 -3
- data/ui_bibz.gemspec +2 -1
- data/vendor/assets/javascripts/bootstrap-select.min.js +8 -7
- data/vendor/assets/stylesheets/awesome-bootstrap-checkbox.scss +62 -42
- data/vendor/assets/stylesheets/bootstrap-multiselect.min.css +1 -1
- data/vendor/assets/stylesheets/bootstrap-select.min.css +3 -3
- data/vendor/assets/stylesheets/bootstrap-theme.min.css +1 -1
- metadata +105 -44
- data/app/inputs/custom_inputs/auto_complete_field_input.rb +0 -16
- data/app/inputs/custom_inputs/multi_select_field_input.rb +0 -9
- data/app/inputs/custom_inputs/surround_field_input.rb +0 -10
- data/lib/ui_bibz/helpers/ui_core_helper.rb +0 -347
- data/lib/ui_bibz/ui/core/connected_component.rb +0 -87
- data/lib/ui_bibz/ui/core/forms/texts/surround_field.rb +0 -87
- data/test/ui/core/forms/texts/surround_field_test.rb +0 -26
- data/test/ui/grid_test.rb +0 -31
- data/test/ui_helper_test.rb +0 -109
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_addon'
|
2
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_button'
|
3
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_button_group'
|
4
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_button_link'
|
5
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_button_refresh'
|
6
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_checkbox_field'
|
7
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_radio_field'
|
8
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_switch_field'
|
9
|
+
require 'ui_bibz/ui/core/forms/surrounds/components/surround_dropdown'
|
10
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
11
|
+
|
12
|
+
# Create a TextField
|
13
|
+
#
|
14
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
15
|
+
#
|
16
|
+
# ==== Attributes
|
17
|
+
#
|
18
|
+
# * +content+ - Content of element
|
19
|
+
# * +options+ - Options of element
|
20
|
+
# * +html_options+ - Html Options of element
|
21
|
+
#
|
22
|
+
# ==== Options
|
23
|
+
#
|
24
|
+
# You can add HTML attributes using the +html_options+.
|
25
|
+
# You can pass arguments in options attribute:
|
26
|
+
# * +prepend+ - String, Html
|
27
|
+
# * +append+ - String, Html
|
28
|
+
#
|
29
|
+
# ==== Signatures
|
30
|
+
#
|
31
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new(content, options = {}, html_options = {}).render
|
32
|
+
#
|
33
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new(options = {}, html_options = {}) do
|
34
|
+
# content
|
35
|
+
# end.render
|
36
|
+
#
|
37
|
+
# ==== Examples
|
38
|
+
#
|
39
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')
|
40
|
+
#
|
41
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new(prepend: glyph('pencil'), append: glyph('camera-retro')) do
|
42
|
+
# #content
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# ==== Helper
|
46
|
+
#
|
47
|
+
# text_field(options = {}, html_options = {}) do
|
48
|
+
# # content
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
class SurroundField < UiBibz::Ui::Core::Component
|
52
|
+
|
53
|
+
# See UiBibz::Ui::Core::Component.initialize
|
54
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
55
|
+
super
|
56
|
+
@items = []
|
57
|
+
end
|
58
|
+
|
59
|
+
# Render html tag
|
60
|
+
def render
|
61
|
+
content_tag :div, @items.join.html_safe, html_options
|
62
|
+
end
|
63
|
+
|
64
|
+
def dropdown content, options = nil, html_options = nil, &block
|
65
|
+
@items << SurroundDropdown.new(content, options, html_options).tap(&block).render
|
66
|
+
end
|
67
|
+
|
68
|
+
def input attribute_name, options = {}, &block
|
69
|
+
@items << @options[:form].input(attribute_name, options.merge({ label: false, wrapper: false }), &block)
|
70
|
+
end
|
71
|
+
|
72
|
+
def glyph content = nil, options = {}, html_options = nil, &block
|
73
|
+
@items << SurroundAddon.new(UiBibz::Ui::Core::Glyph.new(content, options, html_options, &block).render).render
|
74
|
+
end
|
75
|
+
|
76
|
+
def addon content = nil, options = {}, html_options = nil, &block
|
77
|
+
@items << SurroundAddon.new(content, options, html_options, &block).render
|
78
|
+
end
|
79
|
+
|
80
|
+
def button content = nil, options = nil, html_options = nil, &block
|
81
|
+
@items << SurroundButton.new(content, options, html_options, &block).render
|
82
|
+
end
|
83
|
+
|
84
|
+
def button_group content = nil, options = nil, html_options = nil, &block
|
85
|
+
@items << SurroundButtonGroup.new(content, options, html_options).tap(&block).render
|
86
|
+
end
|
87
|
+
|
88
|
+
def button_link content = nil, options = nil, html_options = nil, &block
|
89
|
+
@items << SurroundButtonLink.new(content, options, html_options, &block).render
|
90
|
+
end
|
91
|
+
|
92
|
+
def button_refresh content = nil, options = nil, html_options = nil, &block
|
93
|
+
@items << SurroundButtonRefresh.new(content, options, html_options, &block).render
|
94
|
+
end
|
95
|
+
|
96
|
+
def checkbox_field content = nil, options = nil, html_options = nil, &block
|
97
|
+
@items << SurroundCheckboxField.new(content, options, html_options, &block).render
|
98
|
+
end
|
99
|
+
|
100
|
+
def radio_field content = nil, options = nil, html_options = nil, &block
|
101
|
+
@items << SurroundRadioField.new(content, options, html_options, &block).render
|
102
|
+
end
|
103
|
+
|
104
|
+
def text_field content = nil, options = nil, html_options = nil, &block
|
105
|
+
@items << UiBibz::Ui::Core::Forms::Texts::TextField.new(content, options, html_options, &block).render
|
106
|
+
end
|
107
|
+
|
108
|
+
def date_picker_field content = nil, options = nil, html_options = nil, &block
|
109
|
+
@items << UiBibz::Ui::Core::Forms::Dates::DatePickerField.new(content, options, html_options, &block).render
|
110
|
+
end
|
111
|
+
|
112
|
+
def dropdown_select_field content = nil, options = nil, html_options = nil, &block
|
113
|
+
@items << UiBibz::Ui::Core::Forms::Selects::DropdownSelectField.new(content, options, html_options, &block).render
|
114
|
+
end
|
115
|
+
|
116
|
+
def select_field content = nil, options = nil, html_options = nil, &block
|
117
|
+
@items << UiBibz::Ui::Core::Forms::Selects::SelectField.new(content, options, html_options, &block).render
|
118
|
+
end
|
119
|
+
|
120
|
+
def multi_select_field content = nil, options = nil, html_options = nil, &block
|
121
|
+
@items << UiBibz::Ui::Core::Forms::Selects::MultiSelectField.new(content, options, html_options, &block).render
|
122
|
+
end
|
123
|
+
|
124
|
+
def auto_complete_field content = nil, options = nil, html_options = nil, &block
|
125
|
+
@items << UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new(content, options, html_options, &block).render
|
126
|
+
end
|
127
|
+
|
128
|
+
def html content
|
129
|
+
@items << content
|
130
|
+
end
|
131
|
+
|
132
|
+
# Not correctly implemented
|
133
|
+
# def switch_field content = nil, options = nil, html_options = nil, &block
|
134
|
+
# @items << SurroundSwitchField.new(content, options, html_options, &block).render
|
135
|
+
# end
|
136
|
+
|
137
|
+
private
|
138
|
+
|
139
|
+
def component_html_classes
|
140
|
+
['input-group', status, size, 'ui_surround_field']
|
141
|
+
end
|
142
|
+
|
143
|
+
# :lg, :sm or :xs
|
144
|
+
def size
|
145
|
+
"input-group-#{ options[:size] }" if options[:size]
|
146
|
+
end
|
147
|
+
|
148
|
+
def status
|
149
|
+
"has-#{ options[:status] }" if options[:status]
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ui_bibz/ui/extensions/core/forms/surround_extension'
|
1
2
|
module UiBibz::Ui::Core::Forms::Texts
|
2
3
|
|
3
4
|
# Create a AutoCompleteField
|
@@ -14,7 +15,9 @@ module UiBibz::Ui::Core::Forms::Texts
|
|
14
15
|
#
|
15
16
|
# You can add HTML attributes using the +html_options+.
|
16
17
|
# You can pass arguments in options attribute:
|
17
|
-
# * option_tags - Array, Object [required]
|
18
|
+
# * +option_tags+ - Array, Object [required]
|
19
|
+
# * +append+ - String, Html
|
20
|
+
# * +prepend+ - String, Html
|
18
21
|
#
|
19
22
|
# ==== Signatures
|
20
23
|
#
|
@@ -36,70 +39,42 @@ module UiBibz::Ui::Core::Forms::Texts
|
|
36
39
|
#
|
37
40
|
# ==== Helper
|
38
41
|
#
|
39
|
-
#
|
42
|
+
# auto_complete_field(options = {}, html_options = {}) do
|
40
43
|
# # content
|
41
44
|
# end
|
42
45
|
#
|
43
|
-
class AutoCompleteField < UiBibz::Ui::Core::
|
46
|
+
class AutoCompleteField < UiBibz::Ui::Core::Forms::Texts::TextField
|
44
47
|
|
45
48
|
# See UiBibz::Ui::Core::Component.initialize
|
46
49
|
def initialize content = nil, options = nil, html_options = nil, &block
|
47
50
|
super
|
48
51
|
end
|
49
52
|
|
50
|
-
# Render html tag
|
51
|
-
def render
|
52
|
-
if options[:refresh]
|
53
|
-
refresh_render
|
54
|
-
else
|
55
|
-
text_field_input_tag + data_list_render
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
53
|
private
|
60
54
|
|
61
|
-
def
|
62
|
-
|
63
|
-
concat text_field_input_tag
|
64
|
-
concat data_list_render
|
65
|
-
concat refresh_btn_html
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def component_html_data
|
70
|
-
connect_options
|
55
|
+
def text_field_input_tag
|
56
|
+
text_field_tag(content, options[:value] || html_options[:value], html_options) + data_list_render
|
71
57
|
end
|
72
58
|
|
73
59
|
def data_list_render
|
74
60
|
content_tag :datalist, options[:option_tags], id: data_list_name
|
75
61
|
end
|
76
62
|
|
77
|
-
def text_field_input_tag
|
78
|
-
text_field_tag content, html_options[:value], html_options
|
79
|
-
end
|
80
|
-
|
81
63
|
def component_html_options
|
82
|
-
|
83
|
-
args = args.merge(options[:state] == :disabled ? { disabled: 'disabled' } : {})
|
84
|
-
args
|
85
|
-
end
|
86
|
-
|
87
|
-
def connect_opts
|
88
|
-
selector = options[:refresh][:target][:selector]
|
89
|
-
options[:refresh][:target][:selector] = selector.blank? ? "##{ data_list_name }" : selector
|
90
|
-
options[:refresh]
|
64
|
+
{ autocomplete: true, list: data_list_name, disabled: options[:state] }
|
91
65
|
end
|
92
66
|
|
93
67
|
def component_html_classes
|
94
|
-
|
68
|
+
super << "auto-complete-field"
|
95
69
|
end
|
96
70
|
|
97
71
|
def data_list_name
|
98
72
|
@datalist ||= "#{ html_options[:id] || content.to_s.parameterize.underscore }-datalist"
|
99
73
|
end
|
100
74
|
|
101
|
-
|
102
|
-
|
75
|
+
# Connect option
|
76
|
+
def connect_options_selector
|
77
|
+
data_list_name
|
103
78
|
end
|
104
79
|
|
105
80
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'ui_bibz/ui/extensions/core/forms/surround_extension'
|
2
|
+
module UiBibz::Ui::Core::Forms::Texts
|
3
|
+
|
4
|
+
# Create a TextField
|
5
|
+
#
|
6
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
7
|
+
#
|
8
|
+
# ==== Attributes
|
9
|
+
#
|
10
|
+
# * +content+ - Content of element
|
11
|
+
# * +options+ - Options of element
|
12
|
+
# * +html_options+ - Html Options of element
|
13
|
+
#
|
14
|
+
# ==== Options
|
15
|
+
#
|
16
|
+
# You can add HTML attributes using the +html_options+.
|
17
|
+
# You can pass arguments in options attribute:
|
18
|
+
# * +prepend+ - String, Html
|
19
|
+
# * +append+ - String, Html
|
20
|
+
#
|
21
|
+
# ==== Signatures
|
22
|
+
#
|
23
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new(content, options = {}, html_options = {}).render
|
24
|
+
#
|
25
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new(options = {}, html_options = {}) do
|
26
|
+
# content
|
27
|
+
# end.render
|
28
|
+
#
|
29
|
+
# ==== Examples
|
30
|
+
#
|
31
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new('search', prepend: 'Prepend content', append: 'Append content', class: 'test')
|
32
|
+
#
|
33
|
+
# UiBibz::Ui::Core::Forms::Texts::TextField.new(prepend: glyph('pencil'), append: glyph('camera-retro')) do
|
34
|
+
# #content
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# ==== Helper
|
38
|
+
#
|
39
|
+
# text_field(options = {}, html_options = {}) do
|
40
|
+
# # content
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
class TextField < UiBibz::Ui::Core::Component
|
44
|
+
include SurroundExtension
|
45
|
+
|
46
|
+
# See UiBibz::Ui::Core::Component.initialize
|
47
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
48
|
+
super
|
49
|
+
end
|
50
|
+
|
51
|
+
# Render html tag
|
52
|
+
def render
|
53
|
+
surround_field text_field_input_tag
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
# Simple_form or not
|
59
|
+
def text_field_input_tag
|
60
|
+
text_field_tag content, options[:value] || html_options[:value], html_options
|
61
|
+
end
|
62
|
+
|
63
|
+
# Todo
|
64
|
+
def component_options
|
65
|
+
options[:status].nil? ? super : super.merge({ surrounded: true })
|
66
|
+
end
|
67
|
+
|
68
|
+
def component_html_classes
|
69
|
+
['form-control', status]
|
70
|
+
end
|
71
|
+
|
72
|
+
def component_html_options
|
73
|
+
options[:state] == :disabled ? { disabled: 'disabled' } : {}
|
74
|
+
end
|
75
|
+
|
76
|
+
def status
|
77
|
+
"form-control-#{ options[:status] }" unless options[:status].nil?
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
@@ -70,17 +70,25 @@ module UiBibz::Ui::Core::Layouts
|
|
70
70
|
@options.each do |ke,va|
|
71
71
|
kl << write_classes(ke, va) if %i(xs sm md lg xl).include?(ke)
|
72
72
|
end
|
73
|
-
|
73
|
+
if not_col_options?
|
74
|
+
kl = "col"
|
75
|
+
else
|
76
|
+
kl << write_classes(:md, @options) if kl.empty?
|
77
|
+
end
|
74
78
|
kl
|
75
79
|
end
|
76
80
|
|
81
|
+
def not_col_options?
|
82
|
+
(@options.keys & %i(xs sm md lg xl num offset push pull)).empty?
|
83
|
+
end
|
84
|
+
|
77
85
|
def write_classes size, opts
|
78
86
|
opts.map{ |k, v| send(k, size.to_sym, v) if %i(num offset push pull).include?(k) }.join(' ')
|
79
87
|
end
|
80
88
|
|
81
89
|
# col-md-9
|
82
90
|
def num size, n
|
83
|
-
"col-#{ size }-#{ n }"
|
91
|
+
size == :auto ? "col" : "col-#{ size }-#{ n }"
|
84
92
|
end
|
85
93
|
|
86
94
|
# col-md-offset-9
|
@@ -10,6 +10,12 @@ module UiBibz::Ui::Core::Layouts
|
|
10
10
|
# * +options+ - Options of element
|
11
11
|
# * +html_options+ - Html Options of element
|
12
12
|
#
|
13
|
+
# ==== Options
|
14
|
+
#
|
15
|
+
# You can add HTML attributes using the +html_options+.
|
16
|
+
# You can pass arguments in options attribute:
|
17
|
+
# * +type+ - Symbol | :form
|
18
|
+
#
|
13
19
|
# ==== Signatures
|
14
20
|
#
|
15
21
|
# UiBibz::Ui::Core::Layouts::Row.new(content, options = {}, html_options = {})
|
@@ -41,7 +47,7 @@ module UiBibz::Ui::Core::Layouts
|
|
41
47
|
private
|
42
48
|
|
43
49
|
def component_html_classes
|
44
|
-
'row'
|
50
|
+
options[:type] == :form ? 'form-row' : 'row'
|
45
51
|
end
|
46
52
|
|
47
53
|
end
|
@@ -23,13 +23,15 @@ module UiBibz::Ui::Core::Lists::Components
|
|
23
23
|
|
24
24
|
# Render html tag
|
25
25
|
def render
|
26
|
-
content_tag
|
26
|
+
output = [content_tag(:p, content, html_options)]
|
27
|
+
output << content_tag(:small, options[:extra])
|
28
|
+
output.join.html_safe
|
27
29
|
end
|
28
30
|
|
29
31
|
private
|
30
32
|
|
31
33
|
def component_html_classes
|
32
|
-
'
|
34
|
+
'mb-1'
|
33
35
|
end
|
34
36
|
|
35
37
|
end
|
@@ -23,13 +23,16 @@ module UiBibz::Ui::Core::Lists::Components
|
|
23
23
|
|
24
24
|
# Render html tag
|
25
25
|
def render
|
26
|
-
content_tag :
|
26
|
+
content_tag :div, html_options do
|
27
|
+
concat content_tag(:h5, content, class: 'mb-1')
|
28
|
+
concat content_tag(:small, options[:extra])
|
29
|
+
end
|
27
30
|
end
|
28
31
|
|
29
32
|
private
|
30
33
|
|
31
34
|
def component_html_classes
|
32
|
-
|
35
|
+
super << ["d-flex", "w-100", "justify-content-between"]
|
33
36
|
end
|
34
37
|
|
35
38
|
end
|
@@ -25,7 +25,7 @@ module UiBibz::Ui::Core::Lists::Components
|
|
25
25
|
# * +glyph+ - Add glyph with name or hash options
|
26
26
|
# * +name+ - String
|
27
27
|
# * +size+ - Integer
|
28
|
-
# * +
|
28
|
+
# * +tag+ - Symbol (+:a+, +:button+, +:li+)
|
29
29
|
#
|
30
30
|
# ==== Signatures
|
31
31
|
#
|
@@ -68,11 +68,10 @@ module UiBibz::Ui::Core::Lists::Components
|
|
68
68
|
concat glyph_and_content_html if @content
|
69
69
|
concat header_html if @body
|
70
70
|
concat body_html if @body
|
71
|
-
concat
|
71
|
+
concat badge_html if @options[:badge]
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
75
|
# Add header which is a component
|
77
76
|
def header content = nil, options = nil, html_options = nil, &block
|
78
77
|
@header = UiBibz::Ui::Core::Lists::Components::ListHeader.new content, options, html_options, &block
|
@@ -86,7 +85,7 @@ module UiBibz::Ui::Core::Lists::Components
|
|
86
85
|
private
|
87
86
|
|
88
87
|
def component_html_classes
|
89
|
-
'list-group-item'
|
88
|
+
super << ['list-group-item', tag_type_class, badge_classes, header_classes]
|
90
89
|
end
|
91
90
|
|
92
91
|
def header_html
|
@@ -97,6 +96,31 @@ module UiBibz::Ui::Core::Lists::Components
|
|
97
96
|
@body.render
|
98
97
|
end
|
99
98
|
|
99
|
+
def badge_classes
|
100
|
+
"d-flex justify-content-between align-items-center" unless options[:badge].nil?
|
101
|
+
end
|
102
|
+
|
103
|
+
def status
|
104
|
+
"list-group-item-#{ @options[:status] }" unless @options[:status].nil?
|
105
|
+
end
|
106
|
+
|
107
|
+
def header_classes
|
108
|
+
"flex-column align-items-start" unless options[:tap].nil?
|
109
|
+
end
|
110
|
+
|
111
|
+
def tag_type_class
|
112
|
+
"list-group-item-action" if is_button_type? || is_link_type?
|
113
|
+
end
|
114
|
+
|
115
|
+
def is_link_type?
|
116
|
+
@html_options[:href] = @options[:url] if @options[:url]
|
117
|
+
@options[:tag] == :a || @html_options[:tag] == :a
|
118
|
+
end
|
119
|
+
|
120
|
+
def is_button_type?
|
121
|
+
@options[:tag] == :button || @html_options[:tag] == :button
|
122
|
+
end
|
123
|
+
|
100
124
|
def tag_type
|
101
125
|
if is_link_type?
|
102
126
|
:a
|
@@ -107,17 +131,14 @@ module UiBibz::Ui::Core::Lists::Components
|
|
107
131
|
end
|
108
132
|
end
|
109
133
|
|
110
|
-
def
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
def is_button_type?
|
116
|
-
@options[:type] == :button || @html_options[:type] == :button
|
117
|
-
end
|
134
|
+
def badge_html
|
135
|
+
if options[:badge].kind_of? Hash
|
136
|
+
options[:badge][:status] = options[:status] || :secondary
|
137
|
+
UiBibz::Ui::Core::Badge.new(options[:badge].delete(:content), options[:badge]).render
|
118
138
|
|
119
|
-
|
120
|
-
|
139
|
+
else
|
140
|
+
UiBibz::Ui::Core::Badge.new(options[:badge], type: :pill, status: (options[:status] || :secondary)).render
|
141
|
+
end
|
121
142
|
end
|
122
143
|
|
123
144
|
end
|
@@ -78,14 +78,14 @@ module UiBibz::Ui::Core::Lists
|
|
78
78
|
|
79
79
|
# Render html tag
|
80
80
|
def render
|
81
|
-
content_tag
|
81
|
+
content_tag 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({
|
88
|
+
options = options.merge({ tag: @options[:tag] }) unless @options[:tag].nil?
|
89
89
|
|
90
90
|
if is_tap
|
91
91
|
@lists << UiBibz::Ui::Core::Lists::Components::List.new(content, options, html_options).tap(&block).render
|
@@ -100,8 +100,8 @@ module UiBibz::Ui::Core::Lists
|
|
100
100
|
"list-group"
|
101
101
|
end
|
102
102
|
|
103
|
-
def
|
104
|
-
[:
|
103
|
+
def tag_type
|
104
|
+
[:a, :button].include?(options[:tag]) ? :div : :ul
|
105
105
|
end
|
106
106
|
|
107
107
|
end
|
@@ -41,13 +41,18 @@ module UiBibz::Ui::Core::Navs
|
|
41
41
|
#
|
42
42
|
class NavbarForm < UiBibz::Ui::Base
|
43
43
|
include Haml::Helpers
|
44
|
+
include SimpleForm::ActionViewExtensions::FormHelper
|
45
|
+
include UiBibz::Helpers::UtilsHelper
|
44
46
|
include ActionView::Helpers#::FormHelper
|
45
47
|
|
46
48
|
def initialize model_or_url, options = {}, &block
|
47
49
|
init_haml_helpers
|
48
50
|
@options = options
|
49
|
-
|
51
|
+
case type
|
52
|
+
when :form_for
|
50
53
|
@form = form_for(model_or_url, new_option, &block)
|
54
|
+
when :ui_form_for
|
55
|
+
@form = ui_form_for(model_or_url, new_option, &block)
|
51
56
|
else
|
52
57
|
#@form = form_tag(model_or_url, class: "navbar-form form-inline #{ position }", block)
|
53
58
|
html_options = html_options_for_form(model_or_url, new_option)
|
@@ -63,7 +68,7 @@ module UiBibz::Ui::Core::Navs
|
|
63
68
|
private
|
64
69
|
|
65
70
|
def new_option
|
66
|
-
(@options || {}).merge({ class: "navbar-form form-inline #{ position }" })
|
71
|
+
(@options || {}).merge({ class: "navbar-form form-inline #{ position } my-2 my-lg-0" })
|
67
72
|
end
|
68
73
|
|
69
74
|
def protect_against_forgery?
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module UiBibz::Ui::Core::Navs
|
2
|
+
|
3
|
+
# Create a PageLink
|
4
|
+
#
|
5
|
+
# This element is an extend of UiBibz::Ui::Core::Navs::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
|
+
# * +state+ - status of élement with symbol value:
|
18
|
+
# (+:active+)
|
19
|
+
# * +url+ - String
|
20
|
+
# * +badge+ - String
|
21
|
+
# * +link_html_options+ - Hash
|
22
|
+
#
|
23
|
+
# ==== Signatures
|
24
|
+
#
|
25
|
+
# UiBibz::Ui::Core::Navs::PageLink.new(content, options = nil, html_options = nil)
|
26
|
+
#
|
27
|
+
# UiBibz::Ui::Core::Navs::PageLink.new(options = nil, html_options = nil) do
|
28
|
+
# content
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# ==== Examples
|
32
|
+
#
|
33
|
+
# UiBibz::Ui::Core::Navs::PageLink.new(content, { badge: 15, url: '/', state: :active, link_html_options: { class: 'link1' }},{ class: 'test' }).render
|
34
|
+
#
|
35
|
+
# UiBibz::Ui::Core::Navs::PageLink.new({glyph: { name: 'eye', size: 3 }, { class: 'test' }) do
|
36
|
+
# 'Home'
|
37
|
+
# end.render
|
38
|
+
#
|
39
|
+
class PaginationLink < UiBibz::Ui::Core::Component
|
40
|
+
|
41
|
+
# See UiBibz::Ui::Core::Component.initialize
|
42
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
# Render html tag
|
47
|
+
def render
|
48
|
+
content_tag :li, html_options do
|
49
|
+
link_to content, options[:url], class: 'page-link'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def component_html_classes
|
56
|
+
"page-item"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|