ui_bibz 2.0.0.alpha32 → 2.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -51,23 +51,23 @@ module UiBibz::Ui::Core::Forms::Dates
|
|
51
51
|
|
52
52
|
# Render html tag
|
53
53
|
def render
|
54
|
-
|
55
|
-
content_tag :div, class: join_classes('input-group', 'input-daterange', size, status) do
|
56
|
-
concat content_tag :span, options[:append], class: 'input-group-addon' unless @options[:append].nil?
|
57
|
-
concat text_field_input_tag content[0]
|
58
|
-
concat content_tag :span, options[:range], class: 'input-group-addon input-group-range'
|
59
|
-
concat text_field_input_tag content[1]
|
60
|
-
concat content_tag :span, options[:prepend], class: 'input-group-addon' unless @options[:prepend].nil?
|
61
|
-
end
|
62
|
-
else
|
63
|
-
UiBibz::Ui::Core::Forms::Texts::SurroundField.new(content, options, html_options).render
|
64
|
-
end
|
54
|
+
date_picker_field_html_tag
|
65
55
|
end
|
66
56
|
|
67
57
|
private
|
68
58
|
|
69
|
-
def
|
70
|
-
|
59
|
+
def date_picker_field_html_tag
|
60
|
+
if options[:range]
|
61
|
+
UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(class: 'input-daterange').tap do |sf|
|
62
|
+
sf.addon @options[:append] unless @options[:append].nil?
|
63
|
+
sf.text_field content[0], nil, html_options
|
64
|
+
sf.addon options[:range]
|
65
|
+
sf.text_field content[1], nil, html_options
|
66
|
+
sf.addon @options[:prepend] unless @options[:prepend].nil?
|
67
|
+
end.render
|
68
|
+
else
|
69
|
+
UiBibz::Ui::Core::Forms::Texts::TextField.new(content, options, html_options).render
|
70
|
+
end
|
71
71
|
end
|
72
72
|
|
73
73
|
def component_html_data
|
@@ -80,14 +80,18 @@ module UiBibz::Ui::Core::Forms::Dates
|
|
80
80
|
calendar_weeks
|
81
81
|
autoclose
|
82
82
|
dates_disabled
|
83
|
+
toggle_active
|
84
|
+
days_of_week_disabled
|
85
|
+
days_of_week_highlighted
|
86
|
+
multiple
|
83
87
|
end
|
84
88
|
|
85
89
|
def component_html_classes
|
86
|
-
%w(date_picker form-control)
|
90
|
+
super << %w(date_picker form-control)
|
87
91
|
end
|
88
92
|
|
89
93
|
def component_html_options
|
90
|
-
options[:state] == :disabled
|
94
|
+
super.merge({ disabled: options[:state] == :disabled })
|
91
95
|
end
|
92
96
|
|
93
97
|
def date_locale
|
@@ -103,7 +107,7 @@ module UiBibz::Ui::Core::Forms::Dates
|
|
103
107
|
end
|
104
108
|
|
105
109
|
def picker_pattern
|
106
|
-
options[:format] || I18n.t('datepicker.pformat', default: 'dd
|
110
|
+
options[:format] || I18n.t('datepicker.pformat', default: 'yyyy-mm-dd')
|
107
111
|
end
|
108
112
|
|
109
113
|
def today_btn
|
@@ -126,6 +130,22 @@ module UiBibz::Ui::Core::Forms::Dates
|
|
126
130
|
add_html_data("dates_disabled", [options[:dates_disabled]].flatten) if options[:dates_disabled]
|
127
131
|
end
|
128
132
|
|
133
|
+
def toggle_active
|
134
|
+
add_html_data("date_toggle_active", true)
|
135
|
+
end
|
136
|
+
|
137
|
+
def days_of_week_disabled
|
138
|
+
add_html_data("date_days_of_week_disabled", [options[:days_of_week_disabled]].flatten) if options[:days_of_week_disabled]
|
139
|
+
end
|
140
|
+
|
141
|
+
def days_of_week_highlighted
|
142
|
+
add_html_data("date_days_of_week_highlighted", [options[:days_of_week_highlighted]].flatten) if options[:days_of_week_highlighted]
|
143
|
+
end
|
144
|
+
|
145
|
+
def multiple
|
146
|
+
add_html_data("date_multidate", options[:multiple]) if options[:multiple]
|
147
|
+
end
|
148
|
+
|
129
149
|
# :lg, :sm or :xs
|
130
150
|
def size
|
131
151
|
"input-group-#{ options[:size] }" if options[:size]
|
@@ -45,36 +45,41 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
45
45
|
|
46
46
|
# Render html tag
|
47
47
|
def render
|
48
|
-
|
49
|
-
concat text_field_formula_input_tag
|
50
|
-
concat formula_field_sign
|
51
|
-
concat text_field_input_tag
|
52
|
-
concat formula_field_alert
|
53
|
-
end
|
48
|
+
formula_field_html_tag
|
54
49
|
end
|
55
50
|
|
56
51
|
private
|
57
52
|
|
58
|
-
def
|
59
|
-
|
53
|
+
def formula_field_html_tag
|
54
|
+
UiBibz::Ui::Core::Forms::Surrounds::SurroundField.new(class: join_classes('formula_field', status)).tap do |sf|
|
55
|
+
sf.text_field formula_field_name, nil, text_field_formula_html_options
|
56
|
+
sf.addon '=', class: 'formula-field-sign'
|
57
|
+
sf.text_field content, nil, text_field_input_html_options
|
58
|
+
sf.addon formula_field_alert_glyph, { class: 'formula-field-alert' }, { data: { toggle: 'tooltip' }}
|
59
|
+
end.render
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
63
|
-
|
62
|
+
def text_field_formula_html_options
|
63
|
+
opts = html_options.clone || {}
|
64
|
+
opts[:value] = html_options.delete(:formula_field_value)
|
65
|
+
opts
|
66
|
+
end
|
67
|
+
|
68
|
+
def text_field_input_html_options
|
69
|
+
opts = html_options.clone || {}
|
70
|
+
opts.merge({ readonly: true, class: 'formula-field-result'})
|
64
71
|
end
|
65
72
|
|
66
73
|
def component_html_classes
|
67
|
-
'formula-field form-control'
|
74
|
+
super << ['formula-field', 'form-control']
|
68
75
|
end
|
69
76
|
|
70
77
|
def component_html_options
|
71
78
|
options[:state] == :disabled ? { disabled: 'disabled' } : {}
|
72
79
|
end
|
73
80
|
|
74
|
-
def
|
75
|
-
|
76
|
-
UiBibz::Ui::Core::Glyph.new('exclamation-triangle', status: :danger ).render
|
77
|
-
end
|
81
|
+
def formula_field_alert_glyph
|
82
|
+
UiBibz::Ui::Core::Glyph.new('exclamation-triangle', status: :danger ).render
|
78
83
|
end
|
79
84
|
|
80
85
|
def formula_field_name
|
@@ -85,10 +90,6 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
85
90
|
content.to_s.split('').select{ |i| i == "]" }.count > 0 ? content.to_s.gsub(/]$/, "_formula]") : "#{ content }_formula"
|
86
91
|
end
|
87
92
|
|
88
|
-
def formula_field_sign
|
89
|
-
content_tag :span, '=', class: 'formula-field-sign input-group-addon'
|
90
|
-
end
|
91
|
-
|
92
93
|
def status
|
93
94
|
"has-#{ options[:status] }" if options[:status]
|
94
95
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'ui_bibz/ui/extensions/core/forms/surround_extension'
|
2
|
+
module UiBibz::Ui::Core::Forms::Selects
|
3
|
+
|
4
|
+
# Create a SelectField
|
5
|
+
#
|
6
|
+
# This element is an extend of UiBibz::Ui::Core::Component.
|
7
|
+
# source : http://silviomoreto.github.io/bootstrap-select/examples/
|
8
|
+
#
|
9
|
+
# ==== Attributes
|
10
|
+
#
|
11
|
+
# * +content+ - Content of element
|
12
|
+
# * +options+ - Options of element
|
13
|
+
# * +html_options+ - Html Options of element
|
14
|
+
#
|
15
|
+
# ==== Options
|
16
|
+
#
|
17
|
+
# You can add HTML attributes using the +html_options+.
|
18
|
+
# You can pass arguments in options attribute:
|
19
|
+
# * +status+ - status of élement with symbol value:
|
20
|
+
# (+:primary+, +:secondary+, +:info+, +:warning+, +:danger+, +:link+)
|
21
|
+
# * +option_tags+ - Array, Object [required]
|
22
|
+
# * +searchable+ - Boolean
|
23
|
+
# * +max_options+ - Integer
|
24
|
+
# * +selected_text_format+ - String
|
25
|
+
# * +menu_size+ - Integer
|
26
|
+
# * +header+ - String
|
27
|
+
# * +actions_box+ - Boolean
|
28
|
+
# * +show_tick+ - Boolean
|
29
|
+
# * +show_menu_arrow+ - Boolean
|
30
|
+
# * +dropup+ - Boolean
|
31
|
+
# * +append+ - String, Html
|
32
|
+
# * +prepend+ - String, Html
|
33
|
+
# * +connect+ - Hash
|
34
|
+
# * +event+ - String
|
35
|
+
# * +mode+ - String
|
36
|
+
# * +target+ - Hash
|
37
|
+
# * +selector+ - String
|
38
|
+
# * +data+ - Array
|
39
|
+
# * +url+ - String
|
40
|
+
# * +refresh+ - Hash
|
41
|
+
# * +event+ - String
|
42
|
+
# * +mode+ - String
|
43
|
+
# * +target+ - Hash
|
44
|
+
# * +selector+ - String
|
45
|
+
# * +data+ - Array
|
46
|
+
# * +url+ - String
|
47
|
+
#
|
48
|
+
#
|
49
|
+
# ==== Signatures
|
50
|
+
#
|
51
|
+
# UiBibz::Ui::Core::Forms::Selects::SelectField.new(content, options = {}, html_options = {}).render
|
52
|
+
#
|
53
|
+
# UiBibz::Ui::Core::Forms::Selects::SelectField.new(options = {}, html_options = {}) do
|
54
|
+
# content
|
55
|
+
# end.render
|
56
|
+
#
|
57
|
+
# ==== Examples
|
58
|
+
#
|
59
|
+
# UiBibz::Ui::Core::Forms::Selects::SelectField.new('fruits', { option_tags: list_of_fruits, searchable: true }, { class: 'test' })
|
60
|
+
#
|
61
|
+
# UiBibz::Ui::Core::Forms::Selects::SelectField.new({ option_tags: list_of_fruits, actions_box: true }, { class: 'test' }) do
|
62
|
+
# 'fruits'
|
63
|
+
# end
|
64
|
+
#
|
65
|
+
# ==== Helper
|
66
|
+
#
|
67
|
+
# select_field(content, options = {}, html_options = {})
|
68
|
+
#
|
69
|
+
class AbstractSelect < UiBibz::Ui::Core::Component
|
70
|
+
include SurroundExtension
|
71
|
+
|
72
|
+
# See UiBibz::Ui::Core::Component.initialize
|
73
|
+
def initialize content = nil, options = nil, html_options = nil, &block
|
74
|
+
super
|
75
|
+
end
|
76
|
+
|
77
|
+
# Render html tag
|
78
|
+
def render
|
79
|
+
surround_field select_field_html_tag
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
def select_field_html_tag
|
85
|
+
select_tag content, options[:option_tags], html_options
|
86
|
+
end
|
87
|
+
|
88
|
+
# Try to put it on a line
|
89
|
+
def component_html_options
|
90
|
+
super.merge({
|
91
|
+
multiple: options[:multiple],
|
92
|
+
disabled: options[:state] == :disabled,
|
93
|
+
include_blank: options[:include_blank],
|
94
|
+
prompt: options[:prompt]
|
95
|
+
})
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ui_bibz/ui/extensions/core/forms/surround_extension'
|
1
2
|
module UiBibz::Ui::Core::Forms::Selects
|
2
3
|
|
3
4
|
# Create a DropdownSelectField
|
@@ -27,6 +28,8 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
27
28
|
# * +show_tick+ - Boolean
|
28
29
|
# * +show_menu_arrow+ - Boolean
|
29
30
|
# * +dropup+ - Boolean
|
31
|
+
# * +append+ - String, Html
|
32
|
+
# * +prepend+ - String, Html
|
30
33
|
# * +connect+ - Hash
|
31
34
|
# * +event+ - String
|
32
35
|
# * +mode+ - String
|
@@ -62,34 +65,26 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
62
65
|
#
|
63
66
|
# dropdown_select_field(content, options = {}, html_options = {})
|
64
67
|
#
|
65
|
-
class DropdownSelectField < UiBibz::Ui::Core::
|
68
|
+
class DropdownSelectField < UiBibz::Ui::Core::Forms::Selects::AbstractSelect
|
66
69
|
|
67
70
|
# See UiBibz::Ui::Core::Component.initialize
|
68
71
|
def initialize content = nil, options = nil, html_options = nil, &block
|
69
72
|
super
|
70
73
|
end
|
71
74
|
|
72
|
-
# Render html tag
|
73
|
-
def render
|
74
|
-
if options[:refresh]
|
75
|
-
refresh_render
|
76
|
-
else
|
77
|
-
select_tag content, options[:option_tags], html_options
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
75
|
private
|
82
76
|
|
83
77
|
def component_html_options
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
78
|
+
super.merge({
|
79
|
+
multiple: false,
|
80
|
+
disabled: options[:state] == :disabled,
|
81
|
+
include_blank: options[:include_blank],
|
82
|
+
prompt: options[:prompt]
|
83
|
+
})
|
89
84
|
end
|
90
85
|
|
91
86
|
def component_html_classes
|
92
|
-
['dropdown-select-field', show_tick, show_menu_arrow, dropup]
|
87
|
+
super << ['dropdown-select-field', show_tick, show_menu_arrow, dropup]
|
93
88
|
end
|
94
89
|
|
95
90
|
def component_html_data
|
@@ -101,6 +96,7 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
101
96
|
style
|
102
97
|
header
|
103
98
|
actions_box
|
99
|
+
add_status
|
104
100
|
end
|
105
101
|
|
106
102
|
############################ Data html options
|
@@ -133,6 +129,10 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
133
129
|
add_html_data('header', options[:header]) if options[:header]
|
134
130
|
end
|
135
131
|
|
132
|
+
def add_status
|
133
|
+
add_html_data('style', "btn-#{ options[:status]}") if options[:status]
|
134
|
+
end
|
135
|
+
|
136
136
|
############################# Css classes
|
137
137
|
|
138
138
|
def show_tick
|
@@ -45,37 +45,32 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
45
45
|
#
|
46
46
|
# multi_column_field(content, options = {}, html_options = {})
|
47
47
|
#
|
48
|
-
class MultiColumnField < UiBibz::Ui::Core::
|
48
|
+
class MultiColumnField < UiBibz::Ui::Core::Forms::Selects::AbstractSelect
|
49
49
|
|
50
50
|
# See UiBibz::Ui::Core::Component.initialize
|
51
51
|
def initialize content = nil, options = nil, html_options = nil, &block
|
52
52
|
super
|
53
53
|
end
|
54
54
|
|
55
|
-
# Render html tag
|
56
|
-
def render
|
57
|
-
select_tag content, options[:option_tags], html_options
|
58
|
-
end
|
59
|
-
|
60
55
|
private
|
61
56
|
|
62
57
|
def component_html_data
|
63
58
|
super
|
64
59
|
searchable
|
65
60
|
selectable_opt_group
|
66
|
-
connect_options
|
67
61
|
end
|
68
62
|
|
69
63
|
def component_html_classes
|
70
|
-
'multi-column-field'
|
64
|
+
super << 'multi-column-field'
|
71
65
|
end
|
72
66
|
|
73
67
|
def component_html_options
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
68
|
+
super.merge({
|
69
|
+
multiple: true,
|
70
|
+
disabled: options[:state] == :disabled,
|
71
|
+
include_blank: options[:include_blank],
|
72
|
+
prompt: options[:prompt]
|
73
|
+
})
|
79
74
|
end
|
80
75
|
|
81
76
|
def searchable
|
@@ -20,6 +20,8 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
20
20
|
# * +collapsible_opt_group+ - Boolean
|
21
21
|
# * +searchable+ - Boolean
|
22
22
|
# * +select_all_option+ - Boolean
|
23
|
+
# * +append+ - String, Html
|
24
|
+
# * +prepend+ - String, Html
|
23
25
|
# * +connect+ - Hash
|
24
26
|
# * +event+ - String
|
25
27
|
# * +mode+ - String
|
@@ -48,32 +50,26 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
48
50
|
#
|
49
51
|
# multi_select_field(content, options = {}, html_options = {})
|
50
52
|
#
|
51
|
-
class MultiSelectField < UiBibz::Ui::Core::Forms::
|
53
|
+
class MultiSelectField < UiBibz::Ui::Core::Forms::Selects::AbstractSelect
|
52
54
|
|
53
55
|
# See UiBibz::Ui::Core::Forms::Buttons::Button.initialize
|
54
56
|
def initialize content = nil, options = nil, html_options = nil, &block
|
55
57
|
super
|
56
58
|
end
|
57
59
|
|
58
|
-
# Render html tag
|
59
|
-
def render
|
60
|
-
if options[:refresh]
|
61
|
-
refresh_render
|
62
|
-
else
|
63
|
-
select_tag content, options[:option_tags], html_options
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
60
|
private
|
68
61
|
|
69
62
|
def component_html_options
|
70
|
-
|
71
|
-
|
72
|
-
|
63
|
+
super.merge({
|
64
|
+
multiple: true,
|
65
|
+
disabled: options[:state] == :disabled,
|
66
|
+
include_blank: false,
|
67
|
+
prompt: false,
|
68
|
+
})
|
73
69
|
end
|
74
70
|
|
75
71
|
def component_html_classes
|
76
|
-
[size, type, 'multi-select-field']
|
72
|
+
super << [size, type, status, 'multi-select-field']
|
77
73
|
end
|
78
74
|
|
79
75
|
def component_html_data
|
@@ -104,10 +100,13 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
104
100
|
options[:status].nil? ? 'btn-secondary' : "btn-#{ options[:status] }"
|
105
101
|
end
|
106
102
|
|
107
|
-
def
|
108
|
-
|
109
|
-
|
110
|
-
|
103
|
+
def type
|
104
|
+
"btn-block" if options[:type] == :block
|
105
|
+
end
|
106
|
+
|
107
|
+
# :lg, :sm or :xs
|
108
|
+
def size
|
109
|
+
"btn-#{ options[:size] }" if options[:size]
|
111
110
|
end
|
112
111
|
|
113
112
|
end
|
@@ -27,6 +27,8 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
27
27
|
# * +show_tick+ - Boolean
|
28
28
|
# * +show_menu_arrow+ - Boolean
|
29
29
|
# * +dropup+ - Boolean
|
30
|
+
# * +append+ - String, Html
|
31
|
+
# * +prepend+ - String, Html
|
30
32
|
# * +connect+ - Hash
|
31
33
|
# * +event+ - String
|
32
34
|
# * +mode+ - String
|
@@ -61,37 +63,23 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
61
63
|
#
|
62
64
|
# ==== Helper
|
63
65
|
#
|
64
|
-
#
|
66
|
+
# select_field(content, options = {}, html_options = {})
|
65
67
|
#
|
66
|
-
class SelectField < UiBibz::Ui::Core::
|
68
|
+
class SelectField < UiBibz::Ui::Core::Forms::Selects::AbstractSelect
|
67
69
|
|
68
70
|
# See UiBibz::Ui::Core::Component.initialize
|
69
71
|
def initialize content = nil, options = nil, html_options = nil, &block
|
70
72
|
super
|
71
73
|
end
|
72
74
|
|
73
|
-
# Render html tag
|
74
|
-
def render
|
75
|
-
if options[:refresh]
|
76
|
-
refresh_render
|
77
|
-
else
|
78
|
-
select_tag content, options[:option_tags], html_options
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
75
|
private
|
83
76
|
|
84
|
-
def
|
85
|
-
|
86
|
-
opts = opts.merge({ multiple: true }) if options[:multiple]
|
87
|
-
opts = opts.merge({ disabled: true }) if options[:state] == :disabled
|
88
|
-
opts = opts.merge({ include_blank: true}) if options[:include_blank]
|
89
|
-
opts = opts.merge({ prompt: options[:prompt] }) unless options[:prompt].blank?
|
90
|
-
opts
|
77
|
+
def component_html_classes
|
78
|
+
super << ["select-field", "form-control"]
|
91
79
|
end
|
92
80
|
|
93
|
-
def
|
94
|
-
[
|
81
|
+
def component_options
|
82
|
+
options[:status].nil? ? super : super.merge({ surrounded: true })
|
95
83
|
end
|
96
84
|
|
97
85
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundAddon < UiBibz::Ui::Core::Component
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
# Render html tag
|
10
|
+
def render
|
11
|
+
surround_addon_html_tag
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def surround_addon_html_tag
|
17
|
+
content_tag :span, glyph_and_content_html, html_options
|
18
|
+
end
|
19
|
+
|
20
|
+
def component_html_classes
|
21
|
+
'input-group-addon'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundButton < UiBibz::Ui::Core::Forms::Buttons::Button
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def render
|
10
|
+
content_tag :div, class: 'input-group-btn' do
|
11
|
+
button_html_tag
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundButtonGroup < UiBibz::Ui::Core::Forms::Buttons::ButtonGroup
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def component_html_classes
|
12
|
+
'input-group-btn'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundButtonLink < UiBibz::Ui::Core::Forms::Buttons::ButtonLink
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def render
|
10
|
+
content_tag :div, class: 'input-group-btn' do
|
11
|
+
button_link_html_tag
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundButtonRefresh < UiBibz::Ui::Core::Forms::Buttons::ButtonRefresh
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def render
|
10
|
+
content_tag :div, class: 'input-group-btn' do
|
11
|
+
button_refresh_html_tag
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundCheckboxField < UiBibz::Ui::Core::Forms::Choices::CheckboxField
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def component_html_classes
|
12
|
+
super << "input-group-addon"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundDropdown < UiBibz::Ui::Core::Dropdowns::Dropdown
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def component_html_classes
|
12
|
+
super << 'input-group-btn'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundRadioField < UiBibz::Ui::Core::Forms::Choices::RadioField
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def component_html_classes
|
12
|
+
super << 'input-group-addon'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module UiBibz::Ui::Core::Forms::Surrounds
|
2
|
+
class SurroundSwitchField < UiBibz::Ui::Core::Forms::Choices::SwitchField
|
3
|
+
|
4
|
+
# See UiBibz::Ui::Core::Dropdown.initialize
|
5
|
+
def initialize content, options = nil, html_options = nil, &block
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def component_wrapper_html_classes
|
12
|
+
super << 'input-group'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|