ui_bibz 2.0.0.alpha28 → 2.0.0.alpha29
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 +5 -3
- data/app/assets/javascripts/form.coffee +16 -54
- data/app/assets/javascripts/input-connected.coffee +39 -15
- data/app/assets/javascripts/table.coffee +3 -2
- data/app/assets/stylesheets/fix-dropdown-select.sass +6 -0
- data/app/assets/stylesheets/ui_bibz.sass +3 -3
- data/app/inputs/custom_inputs/{autocomplete_input.rb → auto_complete_field_input.rb} +2 -2
- data/app/inputs/custom_inputs/{dropdown_select_input.rb → collection_input.rb} +19 -12
- data/app/inputs/custom_inputs/{date_picker_input.rb → date_picker_field_input.rb} +1 -1
- data/app/inputs/custom_inputs/dropdown_select_field_input.rb +9 -0
- data/app/inputs/custom_inputs/{formula_input.rb → formula_field_input.rb} +1 -1
- data/app/inputs/custom_inputs/{markdown_editor_input.rb → markdown_editor_field_input.rb} +1 -1
- data/app/inputs/custom_inputs/{multi_column_input.rb → multi_column_field_input.rb} +1 -1
- data/app/inputs/custom_inputs/multi_select_field_input.rb +9 -0
- data/app/inputs/custom_inputs/{radios_input.rb → radio_field_input.rb} +1 -1
- data/app/inputs/custom_inputs/select_field_input.rb +8 -0
- data/app/inputs/custom_inputs/{surround_input.rb → surround_field_input.rb} +1 -1
- data/app/inputs/custom_inputs/{switch_input.rb → switch_field_input.rb} +1 -1
- data/lib/ui_bibz/concerns/models/searchable.rb +6 -1
- data/lib/ui_bibz/helpers/ui_core_helper.rb +2 -2
- data/lib/ui_bibz/ui/core/component.rb +0 -1
- data/lib/ui_bibz/ui/core/connected_component.rb +80 -0
- data/lib/ui_bibz/ui/core/forms/buttons/button.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/buttons/button_refresh.rb +3 -3
- data/lib/ui_bibz/ui/core/forms/choices/switch_field.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/numbers/formula_field.rb +5 -5
- data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +12 -21
- data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +8 -3
- data/lib/ui_bibz/ui/core/forms/selects/multi_select_field.rb +7 -12
- data/lib/ui_bibz/ui/core/forms/selects/select_field.rb +11 -10
- data/lib/ui_bibz/ui/core/forms/texts/{autocomplete_field.rb → auto_complete_field.rb} +30 -8
- data/lib/ui_bibz/ui/ux/tables/extensions/paginable.rb +2 -2
- data/lib/ui_bibz/ui/ux/tables/extensions/searchable.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/extensions/sortable.rb +4 -2
- data/lib/ui_bibz/ui/ux/tables/table_card.rb +3 -3
- data/lib/ui_bibz/ui/ux/tables/table_pagination.rb +5 -1
- data/lib/ui_bibz/ui/ux/tables/table_pagination_per_page.rb +3 -3
- data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +6 -4
- data/lib/ui_bibz/version.rb +1 -1
- data/lib/ui_bibz.rb +2 -1
- data/test/dummy/app/models/continent.rb +3 -0
- data/test/dummy/app/models/country.rb +3 -0
- data/test/dummy/db/migrate/20170309084406_continents.rb +9 -0
- data/test/dummy/db/migrate/20170309084453_countries.rb +10 -0
- data/test/dummy/db/schema.rb +15 -3
- data/test/simple_form_test.rb +98 -36
- data/test/ui/core/forms/choices/switch_field_test.rb +10 -10
- data/test/ui/core/forms/numbers/formula_field_test.rb +1 -1
- data/test/ui/core/forms/selects/dropdown_select_field_test.rb +10 -10
- data/test/ui/core/forms/selects/multi_column_field_test.rb +2 -2
- data/test/ui/core/forms/selects/multi_select_field_test.rb +3 -3
- data/test/ui/core/forms/selects/select_field_test.rb +1 -1
- data/test/ui/core/forms/texts/auto_complete_field_test.rb +23 -0
- data/test/ui/ux/tables/table_test.rb +5 -5
- metadata +26 -16
- data/app/inputs/custom_inputs/multi_select_input.rb +0 -15
- data/app/inputs/custom_inputs/select_input.rb +0 -15
- data/test/ui/core/forms/texts/autocomplete_field_test.rb +0 -14
@@ -57,9 +57,9 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
57
57
|
|
58
58
|
def text_field_input_tag
|
59
59
|
if options[:builder].nil?
|
60
|
-
text_field_tag content, html_options[:value], readonly: true, class: '
|
60
|
+
text_field_tag content, html_options[:value], readonly: true, class: 'formula-field-result form-control'
|
61
61
|
else
|
62
|
-
options[:builder].text_field content, readonly: true, class: '
|
62
|
+
options[:builder].text_field content, readonly: true, class: 'formula-field-result form-control'
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -72,7 +72,7 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def component_html_classes
|
75
|
-
'
|
75
|
+
'formula-field form-control'
|
76
76
|
end
|
77
77
|
|
78
78
|
def component_html_options
|
@@ -80,7 +80,7 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def formula_field_alert
|
83
|
-
content_tag :span, class: '
|
83
|
+
content_tag :span, class: 'formula-field-alert input-group-addon', data: { toggle: 'tooltip' } do
|
84
84
|
UiBibz::Ui::Core::Glyph.new('exclamation-triangle', status: :danger ).render
|
85
85
|
end
|
86
86
|
end
|
@@ -90,7 +90,7 @@ module UiBibz::Ui::Core::Forms::Numbers
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def formula_field_sign
|
93
|
-
content_tag :span, '=', class: '
|
93
|
+
content_tag :span, '=', class: 'formula-field-sign input-group-addon'
|
94
94
|
end
|
95
95
|
|
96
96
|
def status
|
@@ -62,7 +62,7 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
62
62
|
#
|
63
63
|
# dropdown_select_field(content, options = {}, html_options = {})
|
64
64
|
#
|
65
|
-
class DropdownSelectField < UiBibz::Ui::Core::
|
65
|
+
class DropdownSelectField < UiBibz::Ui::Core::ConnectedComponent
|
66
66
|
|
67
67
|
# See UiBibz::Ui::Core::Component.initialize
|
68
68
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -72,10 +72,7 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
72
72
|
# Render html tag
|
73
73
|
def render
|
74
74
|
if options[:refresh]
|
75
|
-
|
76
|
-
concat select_tag content, options[:option_tags], html_options
|
77
|
-
concat content_tag(:span, UiBibz::Ui::Core::Forms::Buttons::ButtonRefresh.new('', connect: connect_opts).render, class: 'input-group-btn')
|
78
|
-
end
|
75
|
+
refresh_render
|
79
76
|
else
|
80
77
|
select_tag content, options[:option_tags], html_options
|
81
78
|
end
|
@@ -83,11 +80,20 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
83
80
|
|
84
81
|
private
|
85
82
|
|
83
|
+
def component_html_options
|
84
|
+
opts = {}
|
85
|
+
opts = opts.merge({ disabled: true }) if options[:state] == :disabled
|
86
|
+
opts = opts.merge({ include_blank: true}) if options[:include_blank]
|
87
|
+
opts = opts.merge({ prompt: options[:prompt] }) unless options[:prompt].blank?
|
88
|
+
opts
|
89
|
+
end
|
90
|
+
|
86
91
|
def component_html_classes
|
87
|
-
['
|
92
|
+
['dropdown-select-field', show_tick, show_menu_arrow, dropup]
|
88
93
|
end
|
89
94
|
|
90
95
|
def component_html_data
|
96
|
+
super
|
91
97
|
searchable
|
92
98
|
max_options
|
93
99
|
selected_text_format
|
@@ -95,16 +101,6 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
95
101
|
style
|
96
102
|
header
|
97
103
|
actions_box
|
98
|
-
connect_options
|
99
|
-
end
|
100
|
-
|
101
|
-
def component_html_options
|
102
|
-
options[:state] == :disabled ? { disabled: 'disabled' } : {}
|
103
|
-
end
|
104
|
-
|
105
|
-
def connect_opts
|
106
|
-
options[:refresh][:target].merge!({ selector: "##{ content.parameterize.underscore }" })
|
107
|
-
options[:refresh]
|
108
104
|
end
|
109
105
|
|
110
106
|
############################ Data html options
|
@@ -137,11 +133,6 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
137
133
|
add_html_data('header', options[:header]) if options[:header]
|
138
134
|
end
|
139
135
|
|
140
|
-
def connect_options
|
141
|
-
add_html_data('connect', options[:connect]) if options[:connect]
|
142
|
-
end
|
143
|
-
|
144
|
-
|
145
136
|
############################# Css classes
|
146
137
|
|
147
138
|
def show_tick
|
@@ -45,7 +45,7 @@ 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::ConnectedComponent
|
49
49
|
|
50
50
|
# See UiBibz::Ui::Core::Component.initialize
|
51
51
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -63,14 +63,19 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
63
63
|
super
|
64
64
|
searchable
|
65
65
|
selectable_opt_group
|
66
|
+
connect_options
|
66
67
|
end
|
67
68
|
|
68
69
|
def component_html_classes
|
69
|
-
'multi-column'
|
70
|
+
'multi-column-field'
|
70
71
|
end
|
71
72
|
|
72
73
|
def component_html_options
|
73
|
-
{ multiple: true }
|
74
|
+
opts = { multiple: true }
|
75
|
+
opts = opts.merge({ disabled: true }) if options[:state] == :disabled
|
76
|
+
opts = opts.merge({ include_blank: true}) if options[:include_blank]
|
77
|
+
opts = opts.merge({ prompt: options[:prompt] }) unless options[:prompt].blank?
|
78
|
+
opts
|
74
79
|
end
|
75
80
|
|
76
81
|
def searchable
|
@@ -58,10 +58,7 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
58
58
|
# Render html tag
|
59
59
|
def render
|
60
60
|
if options[:refresh]
|
61
|
-
|
62
|
-
concat select_tag content, options[:option_tags], html_options
|
63
|
-
concat content_tag(:span, UiBibz::Ui::Core::Forms::Buttons::ButtonRefresh.new('', connect: connect_opts).render, class: 'input-group-btn')
|
64
|
-
end
|
61
|
+
refresh_render
|
65
62
|
else
|
66
63
|
select_tag content, options[:option_tags], html_options
|
67
64
|
end
|
@@ -70,11 +67,13 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
70
67
|
private
|
71
68
|
|
72
69
|
def component_html_options
|
73
|
-
|
70
|
+
opts = { include_blank: false, prompt: false, multiple: true }
|
71
|
+
opts = opts.merge({ disabled: true }) if options[:state] == :disabled
|
72
|
+
opts
|
74
73
|
end
|
75
74
|
|
76
75
|
def component_html_classes
|
77
|
-
[
|
76
|
+
[size, type, 'multi-select-field']
|
78
77
|
end
|
79
78
|
|
80
79
|
def component_html_data
|
@@ -83,7 +82,6 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
83
82
|
collapsible_opt_group
|
84
83
|
searchable
|
85
84
|
select_all_option
|
86
|
-
connect_options
|
87
85
|
end
|
88
86
|
|
89
87
|
def clickable_opt_group
|
@@ -107,13 +105,10 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
107
105
|
end
|
108
106
|
|
109
107
|
def connect_opts
|
110
|
-
options[:refresh][:target]
|
108
|
+
selector = options[:refresh][:target][:selector]
|
109
|
+
options[:refresh][:target][:selector] = selector.blank? ? "##{ content.to_s.parameterize.underscore }" : selector
|
111
110
|
options[:refresh]
|
112
111
|
end
|
113
112
|
|
114
|
-
def connect_options
|
115
|
-
add_html_data('connect', options[:connect]) if options[:connect]
|
116
|
-
end
|
117
|
-
|
118
113
|
end
|
119
114
|
end
|
@@ -63,7 +63,7 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
63
63
|
#
|
64
64
|
# dropdown_select_field(content, options = {}, html_options = {})
|
65
65
|
#
|
66
|
-
class SelectField < UiBibz::Ui::Core::
|
66
|
+
class SelectField < UiBibz::Ui::Core::ConnectedComponent
|
67
67
|
|
68
68
|
# See UiBibz::Ui::Core::Component.initialize
|
69
69
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -73,10 +73,7 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
73
73
|
# Render html tag
|
74
74
|
def render
|
75
75
|
if options[:refresh]
|
76
|
-
|
77
|
-
concat select_tag content, options[:option_tags], html_options
|
78
|
-
concat content_tag(:span, UiBibz::Ui::Core::Forms::Buttons::ButtonRefresh.new('', connect: connect_opts).render, class: 'input-group-btn')
|
79
|
-
end
|
76
|
+
refresh_render
|
80
77
|
else
|
81
78
|
select_tag content, options[:option_tags], html_options
|
82
79
|
end
|
@@ -84,13 +81,17 @@ module UiBibz::Ui::Core::Forms::Selects
|
|
84
81
|
|
85
82
|
private
|
86
83
|
|
87
|
-
def
|
88
|
-
|
84
|
+
def component_html_options
|
85
|
+
opts = {}
|
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
|
89
91
|
end
|
90
92
|
|
91
|
-
def
|
92
|
-
|
93
|
-
options[:refresh]
|
93
|
+
def component_html_classes
|
94
|
+
['select-field', 'form-control']
|
94
95
|
end
|
95
96
|
|
96
97
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module UiBibz::Ui::Core::Forms::Texts
|
2
2
|
|
3
|
-
# Create a
|
3
|
+
# Create a AutoCompleteField
|
4
4
|
#
|
5
5
|
# This element is an extend of UiBibz::Ui::Core::Component.
|
6
6
|
#
|
@@ -18,19 +18,19 @@ module UiBibz::Ui::Core::Forms::Texts
|
|
18
18
|
#
|
19
19
|
# ==== Signatures
|
20
20
|
#
|
21
|
-
# UiBibz::Ui::Core::Forms::Texts::
|
21
|
+
# UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new(content, options = {}, html_options = {}).render
|
22
22
|
#
|
23
|
-
# UiBibz::Ui::Core::Forms::Texts::
|
23
|
+
# UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new(options = {}, html_options = {}) do
|
24
24
|
# content
|
25
25
|
# end.render
|
26
26
|
#
|
27
27
|
# ==== Examples
|
28
28
|
#
|
29
29
|
# options = options_for_select(2.times.map{ |i| "option #{i}" })
|
30
|
-
# UiBibz::Ui::Core::Forms::Texts::
|
30
|
+
# UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new('company', { option_tags: options }, { class: 'test' })
|
31
31
|
#
|
32
32
|
# options = options_for_select(2.times.map{ |i| "option #{i}" })
|
33
|
-
# UiBibz::Ui::Core::Forms::Texts::
|
33
|
+
# UiBibz::Ui::Core::Forms::Texts::AutoCompleteField.new(option_tags: options) do
|
34
34
|
# #content
|
35
35
|
# end
|
36
36
|
#
|
@@ -40,7 +40,7 @@ module UiBibz::Ui::Core::Forms::Texts
|
|
40
40
|
# # content
|
41
41
|
# end
|
42
42
|
#
|
43
|
-
class
|
43
|
+
class AutoCompleteField < UiBibz::Ui::Core::ConnectedComponent
|
44
44
|
|
45
45
|
# See UiBibz::Ui::Core::Component.initialize
|
46
46
|
def initialize content = nil, options = nil, html_options = nil, &block
|
@@ -49,11 +49,27 @@ module UiBibz::Ui::Core::Forms::Texts
|
|
49
49
|
|
50
50
|
# Render html tag
|
51
51
|
def render
|
52
|
-
|
52
|
+
if options[:refresh]
|
53
|
+
refresh_render
|
54
|
+
else
|
55
|
+
text_field_input_tag + data_list_render
|
56
|
+
end
|
53
57
|
end
|
54
58
|
|
55
59
|
private
|
56
60
|
|
61
|
+
def refresh_render
|
62
|
+
content_tag :div, class: 'input-group field-refresh' do
|
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
|
71
|
+
end
|
72
|
+
|
57
73
|
def data_list_render
|
58
74
|
content_tag :datalist, options[:option_tags], id: data_list_name
|
59
75
|
end
|
@@ -72,12 +88,18 @@ module UiBibz::Ui::Core::Forms::Texts
|
|
72
88
|
args
|
73
89
|
end
|
74
90
|
|
91
|
+
def connect_opts
|
92
|
+
selector = options[:refresh][:target][:selector]
|
93
|
+
options[:refresh][:target][:selector] = selector.blank? ? "##{ data_list_name }" : selector
|
94
|
+
options[:refresh]
|
95
|
+
end
|
96
|
+
|
75
97
|
def component_html_classes
|
76
98
|
'form-control'
|
77
99
|
end
|
78
100
|
|
79
101
|
def data_list_name
|
80
|
-
@datalist ||= "#{ html_options[:id] || content }-datalist"
|
102
|
+
@datalist ||= "#{ html_options[:id] || content.to_s.parameterize.underscore }-datalist"
|
81
103
|
end
|
82
104
|
|
83
105
|
def status
|
@@ -11,8 +11,8 @@ module UiBibz::Ui::Ux::Tables
|
|
11
11
|
# Render html tag
|
12
12
|
def render
|
13
13
|
content_tag :div, @html_options do
|
14
|
-
concat UiBibz::Ui::Ux::Tables::TablePagination.new(store: @store).render
|
15
|
-
concat UiBibz::Ui::Ux::Tables::TablePaginationPerPage.new(store: @store).render
|
14
|
+
concat UiBibz::Ui::Ux::Tables::TablePagination.new(store: @store, wrap_form: @options[:wrap_form]).render
|
15
|
+
concat UiBibz::Ui::Ux::Tables::TablePaginationPerPage.new(store: @store, wrap_form: @options[:wrap_form]).render
|
16
16
|
concat tag(:br, class: 'ui-bibz-clear')
|
17
17
|
end
|
18
18
|
end
|
@@ -11,7 +11,7 @@ module UiBibz::Ui::Ux::Tables
|
|
11
11
|
def render
|
12
12
|
content_tag :div, @html_options do
|
13
13
|
concat content_tag(:div, table_name, class: 'title')
|
14
|
-
concat TableSearchField.new({ store: @store, wrap_form:
|
14
|
+
concat TableSearchField.new({ store: @store, wrap_form: @options[:wrap_form] }).render if searchable?
|
15
15
|
concat tag :br, class: 'ui-bibz-clear'
|
16
16
|
end
|
17
17
|
end
|
@@ -49,13 +49,15 @@ module UiBibz::Ui::Ux::Tables
|
|
49
49
|
search: @store.search,
|
50
50
|
sort: sort_name,
|
51
51
|
column_id: @column.id,
|
52
|
-
direction: direction
|
52
|
+
direction: direction,
|
53
|
+
only_path: true
|
53
54
|
}
|
54
55
|
args = args.merge({ custom_sort: true, column_name: @column.data_index }) if @column.custom_sort
|
55
56
|
args = args.merge({ parent: true }) if @column.parent
|
56
57
|
args = args.merge({ store_id: @store.id }) unless @store.id.nil?
|
58
|
+
args = args.merge({ link_type: 'column' })
|
57
59
|
args = args.merge(@store.parameters.reject{ |k,v| default_parameters.include?(k.to_s) })
|
58
|
-
args
|
60
|
+
args.with_indifferent_access
|
59
61
|
end
|
60
62
|
|
61
63
|
def default_parameters
|
@@ -120,8 +120,8 @@ module UiBibz::Ui::Ux::Tables
|
|
120
120
|
|
121
121
|
content_tag :div, html_options do
|
122
122
|
form_tag(url_for(url_parameters), method: :get) do
|
123
|
-
store.parameters.each do |k,v|
|
124
|
-
concat tag(:input, type: 'hidden', name: k, value: v)
|
123
|
+
store.parameters.with_indifferent_access.reject{ |k,v| default_parameters?(k) || v.blank? }.each do |k,v|
|
124
|
+
concat tag(:input, type: 'hidden', name: k, value: v)
|
125
125
|
end
|
126
126
|
concat tag(:input, type: 'hidden', name: 'store_id', value: store.id) unless store.id.nil? # if there is more one table in html page
|
127
127
|
concat @items.join.html_safe
|
@@ -167,7 +167,7 @@ module UiBibz::Ui::Ux::Tables
|
|
167
167
|
end
|
168
168
|
|
169
169
|
def default_parameters?(k)
|
170
|
-
%w(store_id per_page search utf8 search controller action
|
170
|
+
%w(store_id per_page page search utf8 search controller action link_type).include?(k)
|
171
171
|
end
|
172
172
|
|
173
173
|
def url_parameters
|
@@ -40,11 +40,15 @@ module UiBibz::Ui::Ux::Tables
|
|
40
40
|
paginate_parameters = { controller: store.controller }
|
41
41
|
paginate_parameters = paginate_parameters.merge({ store_id: store.id }) unless store.id.nil?
|
42
42
|
paginate_parameters = paginate_parameters.merge(store.parameters)
|
43
|
-
|
43
|
+
paginate_parameters = paginate_parameters.merge({ link_type: 'pagination' })
|
44
|
+
will_paginate(store.records, params: paginate_parameters.with_indifferent_access.reject{|k,v| default_parameters?(k) || v.blank? }, renderer: WillPaginate::ActionView::BootstrapLinkRenderer)
|
44
45
|
end
|
45
46
|
|
46
47
|
private
|
47
48
|
|
49
|
+
def default_parameters?(k)
|
50
|
+
%w(per_page page link_type).include?(k)
|
51
|
+
end
|
48
52
|
|
49
53
|
# Store must be generated by *table_search_pagination* method
|
50
54
|
def store
|
@@ -70,8 +70,8 @@ module UiBibz::Ui::Ux::Tables
|
|
70
70
|
content_tag :div, class: 'table-pagination-per-page' do
|
71
71
|
concat results_count_html
|
72
72
|
concat UiBibz::Utils::Internationalization.new("ui_bibz.table.pagination.per_page", default: "Per page: ").translate
|
73
|
-
store.parameters.each do |k,v|
|
74
|
-
concat tag(:input, type: 'hidden', name: k, value: v)
|
73
|
+
store.parameters.with_indifferent_access.reject{ |k, v| default_parameters?(k) || v.blank? }.each do |k,v|
|
74
|
+
concat tag(:input, type: 'hidden', name: k, value: v)
|
75
75
|
end
|
76
76
|
concat select_tag('per_page', options_for_select([5, 10, 20, 30, 50, 100, 200, 500], store.per_page), class: 'form-control')
|
77
77
|
concat tag(:input, type: 'hidden', name: 'store_id', value: store.id) unless store.id.nil? # If there is more 1 table in html page
|
@@ -91,7 +91,7 @@ module UiBibz::Ui::Ux::Tables
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def default_parameters?(k)
|
94
|
-
%w(store_id search controller action utf8).include?(k)
|
94
|
+
%w(store_id search controller action page link_type utf8).include?(k)
|
95
95
|
end
|
96
96
|
|
97
97
|
end
|
@@ -45,6 +45,7 @@ module UiBibz::Ui::Ux::Tables
|
|
45
45
|
content_tag :div, html_options do
|
46
46
|
concat content_tag(:span, UiBibz::Ui::Core::Glyph.new('search').render, class: 'input-group-addon')
|
47
47
|
concat tag(:input, type: 'search', value: search_content, name: 'search', class: 'form-control', placeholder: search_placeholder_field)
|
48
|
+
concat tag(:input, type: 'hidden', name: 'link_type', value: 'search')
|
48
49
|
concat content_tag(:span, UiBibz::Ui::Core::Glyph.new('times-circle').render, class: 'clear-search-btn input-group-addon')
|
49
50
|
end
|
50
51
|
end
|
@@ -52,12 +53,13 @@ module UiBibz::Ui::Ux::Tables
|
|
52
53
|
def search_field_html_in_wrap
|
53
54
|
content_tag :div, html_options do
|
54
55
|
concat content_tag(:span, UiBibz::Ui::Core::Glyph.new('search').render, class: 'input-group-addon')
|
55
|
-
store.parameters.each do |k,v|
|
56
|
-
concat tag(:input, type: 'hidden', name: k, value: v)
|
56
|
+
store.parameters.with_indifferent_access.reject{ |k,_| default_parameters?(k) }.each do |k,v|
|
57
|
+
concat tag(:input, type: 'hidden', name: k, value: v)
|
57
58
|
end
|
58
59
|
concat tag(:input, type: 'hidden', name: 'store_id', value: store.id) unless store.id.nil? # if there is more one table in html page
|
60
|
+
concat tag(:input, type: 'hidden', name: 'link_type', value: 'search')
|
59
61
|
concat tag(:input, type: 'search', value: search_content, name: 'search', class: 'form-control', placeholder: search_placeholder_field)
|
60
|
-
concat content_tag(:span, clear_button, class: 'input-group-btn')
|
62
|
+
concat content_tag(:span, clear_button, class: 'input-group-btn clear-search-btn')
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
@@ -101,7 +103,7 @@ module UiBibz::Ui::Ux::Tables
|
|
101
103
|
end
|
102
104
|
|
103
105
|
def default_parameters?(k)
|
104
|
-
%w(store_id search controller action utf8).include?(k)
|
106
|
+
%w(store_id search controller action utf8 link_type).include?(k)
|
105
107
|
end
|
106
108
|
|
107
109
|
end
|
data/lib/ui_bibz/version.rb
CHANGED
data/lib/ui_bibz.rb
CHANGED
@@ -57,7 +57,7 @@ module UiBibz
|
|
57
57
|
end
|
58
58
|
|
59
59
|
module Texts
|
60
|
-
autoload :
|
60
|
+
autoload :AutoCompleteField, "ui_bibz/ui/core/forms/texts/auto_complete_field"
|
61
61
|
autoload :SurroundField, "ui_bibz/ui/core/forms/texts/surround_field"
|
62
62
|
end
|
63
63
|
|
@@ -92,6 +92,7 @@ module UiBibz
|
|
92
92
|
|
93
93
|
# Other section
|
94
94
|
autoload :Alert, "ui_bibz/ui/core/alert"
|
95
|
+
autoload :ConnectedComponent, "ui_bibz/ui/core/connected_component"
|
95
96
|
autoload :Component, "ui_bibz/ui/core/component"
|
96
97
|
autoload :Glyph, "ui_bibz/ui/core/glyph"
|
97
98
|
autoload :Jumbotron, "ui_bibz/ui/core/jumbotron"
|
data/test/dummy/db/schema.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
#
|
2
|
-
# This file is auto-generated from the current status of the database. Instead
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
2
|
# of editing this file, please use the migrations feature of Active Record to
|
4
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
5
4
|
#
|
@@ -11,7 +10,20 @@
|
|
11
10
|
#
|
12
11
|
# It's strongly recommended that you check this file into your version control system.
|
13
12
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20170309084453) do
|
14
|
+
|
15
|
+
create_table "continents", force: :cascade do |t|
|
16
|
+
t.string "name"
|
17
|
+
t.datetime "created_at", null: false
|
18
|
+
t.datetime "updated_at", null: false
|
19
|
+
end
|
20
|
+
|
21
|
+
create_table "countries", force: :cascade do |t|
|
22
|
+
t.string "name"
|
23
|
+
t.integer "continent_id"
|
24
|
+
t.datetime "created_at", null: false
|
25
|
+
t.datetime "updated_at", null: false
|
26
|
+
end
|
15
27
|
|
16
28
|
create_table "users", force: :cascade do |t|
|
17
29
|
t.string "name_fr"
|