ui_bibz 2.0.0.alpha → 2.0.0.alpha2
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/CONTRIBUTORS.md +23 -0
- data/Gemfile.lock +53 -43
- data/Rakefile +1 -0
- data/app/assets/javascripts/fix_bootstrap.coffee +7 -0
- data/app/assets/javascripts/form.coffee +65 -0
- data/app/assets/javascripts/interface.coffee +17 -0
- data/app/assets/javascripts/table.coffee +35 -0
- data/app/assets/javascripts/ui_bibz.coffee +24 -38
- data/app/assets/stylesheets/bootstrap-switch.sass +150 -0
- data/app/assets/stylesheets/fix-bootstrap-4.sass +33 -2
- data/app/assets/stylesheets/fix-dropdown-select.sass +239 -0
- data/app/assets/stylesheets/ui_bibz.sass +29 -18
- data/app/inputs/custom_inputs/autocomplete_input.rb +14 -0
- data/app/inputs/custom_inputs/date_picker_input.rb +2 -0
- data/app/inputs/custom_inputs/dropdown_select_input.rb +15 -0
- data/app/inputs/custom_inputs/multi_column_input.rb +51 -5
- data/app/inputs/custom_inputs/multi_select_input.rb +1 -1
- data/app/inputs/custom_inputs/surround_input.rb +3 -1
- data/app/inputs/custom_inputs/switch_input.rb +11 -0
- data/lib/ui_bibz/concerns/models/searchable.rb +6 -2
- data/lib/ui_bibz/helpers/ui_core_helper.rb +76 -54
- data/lib/ui_bibz/rails/engine.rb +9 -1
- data/lib/ui_bibz/ui/core/button/button_group.rb +1 -1
- data/lib/ui_bibz/ui/core/card/components/card_image.rb +1 -1
- data/lib/ui_bibz/ui/core/component.rb +1 -0
- data/lib/ui_bibz/ui/core/input/autocomplete_field.rb +87 -0
- data/lib/ui_bibz/ui/core/input/date_picker_field.rb +10 -2
- data/lib/ui_bibz/ui/core/input/dropdown_select_field.rb +124 -0
- data/lib/ui_bibz/ui/core/input/multi_select_field.rb +5 -0
- data/lib/ui_bibz/ui/core/input/surround_field.rb +11 -2
- data/lib/ui_bibz/ui/core/input/switch_field.rb +127 -0
- data/lib/ui_bibz/ui/ux/table/components/thead.rb +51 -0
- data/lib/ui_bibz/ui/ux/table/extensions/actionable.rb +1 -1
- data/lib/ui_bibz/ui/ux/table/extensions/sortable.rb +2 -2
- data/lib/ui_bibz/ui/ux/table/table.rb +47 -4
- data/lib/ui_bibz/ui/ux/table/table_card.rb +12 -4
- data/lib/ui_bibz/version.rb +1 -1
- data/lib/ui_bibz.rb +24 -10
- data/test/ui/card_test.rb +1 -1
- data/test/ui/input_dropdown_select_field_test.rb +78 -0
- data/test/ui/input_switch_field_test.rb +86 -0
- data/test/ui/inputs_test.rb +12 -4
- data/test/ui/table_test.rb +16 -0
- data/ui_bibz.gemspec +14 -4
- data/vendor/assets/stylesheets/bootstrap-switch.min.css +1 -1
- metadata +132 -13
- data/app/assets/javascripts/multi_column.coffee +0 -45
- data/app/inputs/custom_inputs/date_picker_input_old.rb +0 -61
- data/vendor/assets/javascripts/bootstrap-4.0.0-alpha.min.js +0 -7
- data/vendor/assets/javascripts/bootstrap-select.min.js +0 -8
- data/vendor/assets/stylesheets/bootstrap-4.0.0-alpha.min.css +0 -6
- data/vendor/assets/stylesheets/bootstrap-select.min.css +0 -6
@@ -0,0 +1,239 @@
|
|
1
|
+
// fix bootstrap-select
|
2
|
+
|
3
|
+
//
|
4
|
+
// Dropdown menus
|
5
|
+
// --------------------------------------------------
|
6
|
+
|
7
|
+
$fix-caret-width-base: 4px !default
|
8
|
+
$fix-dropdown-fallback-border: #ccc !default
|
9
|
+
$fix-border-radius-base: #ccc !default
|
10
|
+
$fix-border-radius-base: 4px !default
|
11
|
+
$fix-border-radius-large: 6px !default
|
12
|
+
$fix-border-radius-small: 3px !default
|
13
|
+
$fix-line-height-base: 1.428571429 !default
|
14
|
+
$fix-font-size-base: 14px
|
15
|
+
$fix-font-size-large: ceil(($fix-font-size-base * 1.25))
|
16
|
+
$fix-font-size-small: ceil(($fix-font-size-base * 0.85))
|
17
|
+
$fix-line-height-computed: floor(($fix-font-size-base * $fix-line-height-base)) !default
|
18
|
+
$fix-screen-sm: 768px
|
19
|
+
$fix-screen-sm-min: $fix-screen-sm
|
20
|
+
$fix-screen-md: 992px
|
21
|
+
$fix-screen-md-min: $fix-screen-md
|
22
|
+
$fix-screen-sm-max: ($fix-screen-md-min - 1)
|
23
|
+
$fix-grid-float-breakpoint: $fix-screen-sm-min
|
24
|
+
$fix-zindex-dropdown: 1000
|
25
|
+
$fix-dropdown-bg: #fff
|
26
|
+
$fix-dropdown-border: rgba(0,0,0,.15)
|
27
|
+
$fix-dropdown-divider-bg: #e5e5e5
|
28
|
+
$fix-dropdown-link-color: $gray-dark
|
29
|
+
$fix-dropdown-link-hover-color: darken($gray-dark, 5%)
|
30
|
+
$fix-dropdown-link-hover-bg: #f5f5f
|
31
|
+
$fix-dropdown-link-active-color: $component-active-color
|
32
|
+
$fix-dropdown-link-active-bg: $component-active-bg
|
33
|
+
$fix-dropdown-link-disabled-color: $gray-light
|
34
|
+
$fix-cursor-disabled: not-allowed
|
35
|
+
$fix-dropdown-header-color: $gray-light
|
36
|
+
$fix-dropdown-caret-color: #000
|
37
|
+
|
38
|
+
|
39
|
+
div.bootstrap-select
|
40
|
+
width: 100% !important
|
41
|
+
|
42
|
+
// Dropdown arrow/caret
|
43
|
+
.dropdown_select .caret
|
44
|
+
display: inline-block
|
45
|
+
width: 0
|
46
|
+
height: 0
|
47
|
+
margin-left: 2px
|
48
|
+
vertical-align: middle
|
49
|
+
border-top: $fix-caret-width-base dashed
|
50
|
+
border-top: $fix-caret-width-base solid \9
|
51
|
+
// IE8
|
52
|
+
border-right: $fix-caret-width-base solid transparent
|
53
|
+
border-left: $fix-caret-width-base solid transparent
|
54
|
+
|
55
|
+
// The dropdown wrapper (div)
|
56
|
+
|
57
|
+
.dropdown_select .dropup
|
58
|
+
position: relative
|
59
|
+
|
60
|
+
// Prevent the focus on the dropdown toggle when closing dropdowns
|
61
|
+
.dropdown_select .dropdown-toggle:focus
|
62
|
+
outline: 0
|
63
|
+
.dropdown_select .dropdown-toggle::after
|
64
|
+
display: none
|
65
|
+
|
66
|
+
// The dropdown menu (ul)
|
67
|
+
.dropdown_select .dropdown-menu
|
68
|
+
position: absolute
|
69
|
+
top: 100%
|
70
|
+
left: 0
|
71
|
+
z-index: $fix-zindex-dropdown
|
72
|
+
display: none
|
73
|
+
// none by default, but block on "open" of the menu
|
74
|
+
float: left
|
75
|
+
min-width: 160px
|
76
|
+
padding: 5px 0
|
77
|
+
margin: 2px 0 0
|
78
|
+
// override default ul
|
79
|
+
list-style: none
|
80
|
+
font-size: $fix-font-size-base
|
81
|
+
text-align: left
|
82
|
+
// Ensures proper alignment if parent has it changed (e.g., modal footer)
|
83
|
+
background-color: $fix-dropdown-bg
|
84
|
+
border: 1px solid $fix-dropdown-fallback-border
|
85
|
+
// IE8 fallback
|
86
|
+
border: 1px solid $fix-dropdown-border
|
87
|
+
border-radius: $fix-border-radius-base
|
88
|
+
box-shadow: 0 6px 12px
|
89
|
+
background-clip: padding-box
|
90
|
+
// Aligns the dropdown menu to right
|
91
|
+
//
|
92
|
+
// Deprecated as of 3.1.0 in favor of `.dropdown-menu-[dir]`
|
93
|
+
&.pull-right
|
94
|
+
right: 0
|
95
|
+
left: auto
|
96
|
+
// Dividers (basically an hr) within the dropdown
|
97
|
+
.divider
|
98
|
+
height: 1px
|
99
|
+
margin: (($fix-line-height-computed / 2) - 1) 0
|
100
|
+
overflow: hidden
|
101
|
+
background-color: $fix-dropdown-divider-bg
|
102
|
+
// Links within the dropdown menu
|
103
|
+
> li > a
|
104
|
+
display: block
|
105
|
+
padding: 3px 20px
|
106
|
+
clear: both
|
107
|
+
font-weight: normal
|
108
|
+
line-height: $fix-line-height-base
|
109
|
+
color: $fix-dropdown-link-color
|
110
|
+
white-space: nowrap
|
111
|
+
// prevent links from randomly breaking onto new lines
|
112
|
+
|
113
|
+
// Hover/Focus state
|
114
|
+
.dropdown_select .dropdown-menu > li > a
|
115
|
+
&:hover,
|
116
|
+
&:focus
|
117
|
+
text-decoration: none
|
118
|
+
color: $fix-dropdown-link-hover-color
|
119
|
+
background-color: $fix-dropdown-link-hover-bg
|
120
|
+
|
121
|
+
// Active state
|
122
|
+
.dropdown_select .dropdown-menu > .active > a
|
123
|
+
&,
|
124
|
+
&:hover,
|
125
|
+
&:focus
|
126
|
+
color: $fix-dropdown-link-active-color
|
127
|
+
text-decoration: none
|
128
|
+
outline: 0
|
129
|
+
background-color: $fix-dropdown-link-active-bg
|
130
|
+
|
131
|
+
// Disabled state
|
132
|
+
//
|
133
|
+
// Gray out text and ensure the hover/focus state remains gray
|
134
|
+
|
135
|
+
.dropdown_select .dropdown-menu > .disabled > a
|
136
|
+
&,
|
137
|
+
&:hover,
|
138
|
+
&:focus
|
139
|
+
color: $fix-dropdown-link-disabled-color
|
140
|
+
// Nuke hover/focus effects
|
141
|
+
&:hover,
|
142
|
+
&:focus
|
143
|
+
text-decoration: none
|
144
|
+
background-color: transparent
|
145
|
+
background-image: none
|
146
|
+
// Remove CSS gradient
|
147
|
+
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false)
|
148
|
+
cursor: $fix-cursor-disabled
|
149
|
+
|
150
|
+
// Open state for the dropdown
|
151
|
+
.dropdown_select .open
|
152
|
+
// Show the menu
|
153
|
+
> .dropdown-menu
|
154
|
+
display: block
|
155
|
+
// Remove the outline when :focus is triggered
|
156
|
+
> a
|
157
|
+
outline: 0
|
158
|
+
|
159
|
+
// Menu positioning
|
160
|
+
//
|
161
|
+
// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown
|
162
|
+
// menu with the parent.
|
163
|
+
.dropdown_select .dropdown-menu-right
|
164
|
+
left: auto
|
165
|
+
// Reset the default from `.dropdown-menu`
|
166
|
+
right: 0
|
167
|
+
|
168
|
+
// With v3, we enabled auto-flipping if you have a dropdown within a right
|
169
|
+
// aligned nav component. To enable the undoing of that, we provide an override
|
170
|
+
// to restore the default dropdown menu alignment.
|
171
|
+
//
|
172
|
+
// This is only for left-aligning a dropdown menu within a `.navbar-right` or
|
173
|
+
// `.pull-right` nav component.
|
174
|
+
.dropdown_select .dropdown-menu-left
|
175
|
+
left: 0
|
176
|
+
right: auto
|
177
|
+
|
178
|
+
// Dropdown section headers
|
179
|
+
.dropdown_select .dropdown-header
|
180
|
+
display: block
|
181
|
+
padding: 3px 20px
|
182
|
+
font-size: $fix-font-size-small
|
183
|
+
line-height: $fix-line-height-base
|
184
|
+
color: $fix-dropdown-header-color
|
185
|
+
white-space: nowrap
|
186
|
+
// as with > li > a
|
187
|
+
|
188
|
+
// Backdrop to catch body clicks on mobile, etc.
|
189
|
+
.dropdown_select .dropdown-backdrop
|
190
|
+
position: fixed
|
191
|
+
left: 0
|
192
|
+
right: 0
|
193
|
+
bottom: 0
|
194
|
+
top: 0
|
195
|
+
z-index: $fix-zindex-dropdown - 10
|
196
|
+
|
197
|
+
// Right aligned dropdowns
|
198
|
+
.dropdown_select .pull-right > .dropdown-menu
|
199
|
+
right: 0
|
200
|
+
left: auto
|
201
|
+
|
202
|
+
// Allow for dropdowns to go bottom up (aka, dropup-menu)
|
203
|
+
//
|
204
|
+
// Just add .dropup after the standard .dropdown class and you're set, bro.
|
205
|
+
// TODO: abstract this so that the navbar fixed styles are not placed here?
|
206
|
+
|
207
|
+
.dropdown_select .dropup
|
208
|
+
// Reverse the caret
|
209
|
+
.caret
|
210
|
+
border-top: 0
|
211
|
+
border-bottom: $fix-caret-width-base dashed
|
212
|
+
border-bottom: $fix-caret-width-base solid \9
|
213
|
+
// IE8
|
214
|
+
content: ""
|
215
|
+
// Different positioning for bottom up menu
|
216
|
+
.dropdown-menu
|
217
|
+
top: auto
|
218
|
+
bottom: 100%
|
219
|
+
margin-bottom: 2px
|
220
|
+
|
221
|
+
// Component alignment
|
222
|
+
//
|
223
|
+
// Reiterate per navbar.less and the modified component alignment there.
|
224
|
+
|
225
|
+
@media (min-width: $fix-grid-float-breakpoint)
|
226
|
+
.dropdown_select .navbar-right
|
227
|
+
.dropdown-menu
|
228
|
+
right: 0
|
229
|
+
left: auto
|
230
|
+
// Necessary for overrides of the default right aligned menu.
|
231
|
+
// Will remove come v4 in all likelihood.
|
232
|
+
.dropdown-menu-left
|
233
|
+
left: 0
|
234
|
+
right: auto
|
235
|
+
|
236
|
+
.dropdown_select
|
237
|
+
.hidden
|
238
|
+
display: none
|
239
|
+
|
@@ -7,13 +7,20 @@
|
|
7
7
|
//@import bootstrap-sprockets
|
8
8
|
@import bootstrap
|
9
9
|
|
10
|
+
|
11
|
+
$brand-secondary: $gray-lighter
|
12
|
+
$states_colors: (success: $brand-success, primary: $brand-primary, secondary: $brand-secondary, info: $brand-info, danger: $brand-danger, warning: $brand-warning)
|
13
|
+
|
10
14
|
// Boostrap Plugins
|
11
|
-
@import bootstrap-
|
12
|
-
@import bootstrap-select
|
13
|
-
@import bootstrap-switch
|
15
|
+
@import bootstrap-datepicker
|
16
|
+
@import bootstrap-select
|
17
|
+
@import bootstrap-switch
|
14
18
|
@import bootstrap-multiselect.min
|
15
19
|
@import multi-select.min
|
16
|
-
|
20
|
+
@import fix-bootstrap-4
|
21
|
+
@import fix-dropdown-select
|
22
|
+
@import bootstrap-select
|
23
|
+
|
17
24
|
|
18
25
|
// Table section
|
19
26
|
.table-card
|
@@ -23,7 +30,7 @@
|
|
23
30
|
th
|
24
31
|
border-top: none
|
25
32
|
.card-header
|
26
|
-
background-color: $table-bg-active
|
33
|
+
//background-color: $table-bg-active
|
27
34
|
.title
|
28
35
|
float: left
|
29
36
|
font-size: 20px
|
@@ -39,9 +46,15 @@
|
|
39
46
|
overflow-x: auto
|
40
47
|
min-height: 200px
|
41
48
|
.card-footer
|
49
|
+
//background-color: $table-bg-active
|
42
50
|
padding: 10px 10px
|
43
51
|
.pagination
|
44
|
-
margin: 0
|
52
|
+
margin: 0.5rem 0 0 0
|
53
|
+
li
|
54
|
+
display: inline
|
55
|
+
float: left
|
56
|
+
li:not(:first-child)
|
57
|
+
margin-left: 0.7rem
|
45
58
|
.table-pagination-per-page
|
46
59
|
float: right
|
47
60
|
select
|
@@ -50,11 +63,11 @@
|
|
50
63
|
|
51
64
|
.table>tbody>tr:hover
|
52
65
|
td:last-child .dropdown-action
|
53
|
-
display:
|
66
|
+
display: inherit
|
54
67
|
|
55
68
|
.table>tbody>tr
|
56
69
|
td:last-child
|
57
|
-
height:
|
70
|
+
height: 45px // Maybe find another way
|
58
71
|
.dropdown-action
|
59
72
|
display: none
|
60
73
|
|
@@ -68,17 +81,15 @@
|
|
68
81
|
.action
|
69
82
|
width: 135px
|
70
83
|
|
84
|
+
@each $key, $value in $states_colors
|
85
|
+
.card-#{$key}
|
86
|
+
.card-header
|
87
|
+
background-color: $value
|
88
|
+
|
71
89
|
// Glyph section
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
color: $brand-primary
|
76
|
-
.glyph-info
|
77
|
-
color: $brand-info
|
78
|
-
.glyph-warning
|
79
|
-
color: $brand-warning
|
80
|
-
.glyph-danger
|
81
|
-
color: $brand-danger
|
90
|
+
@each $key, $value in $states_colors
|
91
|
+
.glyph-#{$key}
|
92
|
+
color: $value
|
82
93
|
|
83
94
|
// Other section
|
84
95
|
.ui-bibz-clear
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module CustomInputs
|
2
|
+
class AutocompleteInput < SimpleForm::Inputs::CollectionInput
|
3
|
+
include UiBibz::Ui::Core
|
4
|
+
include ActionView::Helpers::FormOptionsHelper
|
5
|
+
|
6
|
+
def input(wrapper_options)
|
7
|
+
label_method, value_method = detect_collection_methods
|
8
|
+
options = options || {}
|
9
|
+
options = options.merge({ builder: @builder })
|
10
|
+
options = options.merge(option_tags: options_from_collection_for_select(collection, label_method, label_method))
|
11
|
+
UiBibz::Ui::Core::AutocompleteField.new(attribute_name, options, input_html_options).render
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CustomInputs
|
2
|
+
class DropdownSelectInput < SimpleForm::Inputs::CollectionInput
|
3
|
+
include UiBibz::Ui::Core
|
4
|
+
|
5
|
+
def input(wrapper_options)
|
6
|
+
label_method, value_method = detect_collection_methods
|
7
|
+
i = UiBibz::Ui::Core::DropdownSelectField.new(attribute_name, options, input_html_options)
|
8
|
+
|
9
|
+
@builder.collection_select(
|
10
|
+
attribute_name, collection, value_method, label_method,
|
11
|
+
input_options, i.html_options
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,18 +1,64 @@
|
|
1
1
|
module CustomInputs
|
2
|
+
# multi_column_input manages collection and grouped_collection
|
2
3
|
class MultiColumnInput < SimpleForm::Inputs::CollectionInput
|
3
4
|
include UiBibz::Ui::Core
|
4
5
|
|
5
6
|
def input(wrapper_options)
|
6
7
|
label_method, value_method = detect_collection_methods
|
7
|
-
i = UiBibz::Ui::Core::MultiColumnField.new(attribute_name,
|
8
|
+
i = UiBibz::Ui::Core::MultiColumnField.new(attribute_name, options, input_html_options)
|
8
9
|
|
9
10
|
input_options.delete(:prompt)
|
10
11
|
input_options.merge!({include_blank: false})
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
if options[:grouped] == true
|
14
|
+
@builder.grouped_collection_select(
|
15
|
+
attribute_name, grouped_collection,
|
16
|
+
group_method, group_label_method,
|
17
|
+
value_method, label_method,
|
18
|
+
input_options, i.html_options
|
19
|
+
)
|
20
|
+
else
|
21
|
+
@builder.collection_select(
|
22
|
+
attribute_name, collection, value_method, label_method,
|
23
|
+
input_options, i.html_options
|
24
|
+
)
|
25
|
+
end
|
16
26
|
end
|
27
|
+
|
28
|
+
def grouped_collection
|
29
|
+
@grouped_collection ||= begin
|
30
|
+
grouped_collection = options.delete(:collection)
|
31
|
+
grouped_collection.respond_to?(:call) ? grouped_collection.call : grouped_collection.to_a
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Sample collection
|
36
|
+
#def group_collection
|
37
|
+
#@group_collection ||= grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
|
38
|
+
#end
|
39
|
+
|
40
|
+
def collection
|
41
|
+
if options[:grouped]
|
42
|
+
@collection ||= grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
|
43
|
+
else
|
44
|
+
@collection ||= options[:collection]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def group_method
|
49
|
+
@group_method ||= options.delete(:group_method)
|
50
|
+
end
|
51
|
+
|
52
|
+
def group_label_method
|
53
|
+
label = options.delete(:group_label_method)
|
54
|
+
|
55
|
+
unless label
|
56
|
+
common_method_for = detect_common_display_methods(detect_collection_classes(grouped_collection))
|
57
|
+
label = common_method_for[:label]
|
58
|
+
end
|
59
|
+
|
60
|
+
label
|
61
|
+
end
|
62
|
+
|
17
63
|
end
|
18
64
|
end
|
@@ -4,7 +4,7 @@ module CustomInputs
|
|
4
4
|
|
5
5
|
def input(wrapper_options)
|
6
6
|
label_method, value_method = detect_collection_methods
|
7
|
-
i = UiBibz::Ui::Core::MultiSelectField.new(attribute_name,
|
7
|
+
i = UiBibz::Ui::Core::MultiSelectField.new(attribute_name, options, input_html_options)
|
8
8
|
|
9
9
|
@builder.collection_select(
|
10
10
|
attribute_name, collection, value_method, label_method,
|
@@ -3,7 +3,9 @@ module CustomInputs
|
|
3
3
|
include UiBibz::Ui::Core
|
4
4
|
|
5
5
|
def input(wrapper_options)
|
6
|
-
|
6
|
+
options = options || {}
|
7
|
+
options = options.merge({ builder: @builder })
|
8
|
+
UiBibz::Ui::Core::SurroundField.new(attribute_name, options, input_html_options).render
|
7
9
|
end
|
8
10
|
|
9
11
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module CustomInputs
|
2
|
+
class SwitchInput < SimpleForm::Inputs::Base
|
3
|
+
include UiBibz::Ui::Core
|
4
|
+
|
5
|
+
def input(wrapper_options)
|
6
|
+
options = @options.merge({ builder: @builder })
|
7
|
+
UiBibz::Ui::Core::SwitchField.new(attribute_name, options, input_html_options).render
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
@@ -27,10 +27,14 @@ module UiBibz::Concerns::Models::Searchable
|
|
27
27
|
id: @arguments[:store_id],
|
28
28
|
records: search_sort_paginate,
|
29
29
|
searchable_attributes: @searchable_attributes,
|
30
|
-
model:
|
30
|
+
model: create_model
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
34
|
+
def self.create_model
|
35
|
+
@arguments[:model].nil? ? self : @arguments[:model].to_s.camelize.classify.constantize
|
36
|
+
end
|
37
|
+
|
34
38
|
# If there is more one table in html page
|
35
39
|
def self.initialize_params
|
36
40
|
unless self.is_good_store_id?
|
@@ -115,7 +119,7 @@ module UiBibz::Concerns::Models::Searchable
|
|
115
119
|
sql_subquery << "lower(#{ key_name }.#{ attribute.values.first }) LIKE :#{ key_name }_#{ attribute.values.first }_#{ i }"
|
116
120
|
sql_attributes = sql_attributes.merge(Hash["#{ key_name }_#{ attribute.values.first }_#{ i }".to_sym, "%#{ pattern }%"])
|
117
121
|
else
|
118
|
-
sql_subquery << "lower(#{ self.to_s.underscore.pluralize }.#{ attribute }) LIKE :#{ attribute }_#{ i }"
|
122
|
+
sql_subquery << "lower(#{ self.to_s.underscore.pluralize.split('/').last }.#{ attribute }) LIKE :#{ attribute }_#{ i }"
|
119
123
|
sql_attributes = sql_attributes.merge(Hash["#{ attribute }_#{ i }".to_sym, "%#{ pattern }%"])
|
120
124
|
end
|
121
125
|
end
|