tramway-core 1.6.1 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '038d11bab33834b37cee44fc2cfded45bf215d0847a0986fe62234b93885cfdb'
4
- data.tar.gz: a208624475d9b43a3da6f45b266cf34be877a809d542d409a0c6e49dda2cb01d
3
+ metadata.gz: 2e9f970361066db51ffb406b2e00a045f06a0df0417009c44e7b15a1eb6be2ab
4
+ data.tar.gz: 00a4e30c013946f852e62c3ee5bc31ed3f812b8a144be626ab6ba4213b2b0d8d
5
5
  SHA512:
6
- metadata.gz: 14d9cf11bde869129ac7cfb66f8b2f8a2b4768f7eedf988eba6d05591de5e17ed221ee8a98e2cda57a5b0db87f0eb78d800690fe472c27a8ec701dadfaf52634
7
- data.tar.gz: 27c94491389de90ab0e3eb48ab76c6c45ff0f5b8588e4e14017a7e56da3fd8b8a2c1937373b8d924fdd440082224308f6716f44c8c50b71f5eea4188fb1ee1d8
6
+ metadata.gz: 6e2ce3e306e64f91ba5f53d39d743b0b53b4b9d7a86e5ad44f0ea94c85634382330f91218946754b9db3f24f76372276efbee88d62fc1a576d498f9cfc60be5b
7
+ data.tar.gz: 010fad889e94a4e6a33ff92443f4cc0a9001a85f09ef8f9ebb6215f4154f6156e361a55eeef3bd6320eea537f41a43544f150cbd03afc2b9921eb8153b145d3d
@@ -2,6 +2,7 @@
2
2
  #= require jquery_ujs
3
3
  #= require bootstrap-datepicker-1.8.0
4
4
  #= require bootstrap-datepicker-1.8.0.ru.min
5
+ #= require simple_form_extension
5
6
  #= require_tree .
6
7
 
7
8
  $(document).ready ->
@@ -0,0 +1,375 @@
1
+ /**
2
+ * Selectize bootstrap 4
3
+ */
4
+ .selectize-control {
5
+ position: relative; }
6
+
7
+ .selectize-dropdown, .selectize-input, .selectize-input input {
8
+ color: #343a40;
9
+ font-family: inherit;
10
+ font-size: inherit;
11
+ line-height: 1.5;
12
+ -webkit-font-smoothing: inherit; }
13
+
14
+ .selectize-input, .selectize-control.single .selectize-input.input-active {
15
+ background: #fff;
16
+ cursor: text;
17
+ display: inline-block; }
18
+
19
+ .selectize-input {
20
+ border: 1px solid #ced4da;
21
+ padding: 0.375rem 0.75rem;
22
+ display: inline-block;
23
+ width: 100%;
24
+ overflow: hidden;
25
+ position: relative;
26
+ z-index: 1;
27
+ -webkit-box-sizing: border-box;
28
+ -moz-box-sizing: border-box;
29
+ box-sizing: border-box;
30
+ -webkit-box-shadow: none;
31
+ box-shadow: none;
32
+ -webkit-border-radius: 0.25rem;
33
+ -moz-border-radius: 0.25rem;
34
+ border-radius: 0.25rem; }
35
+ .selectize-control.multi .selectize-input.has-items {
36
+ padding: calc(0.375rem - 1px - 0px) 0.75rem calc(0.375rem - 1px - 3px - 0px); }
37
+ .selectize-input.full {
38
+ background-color: #fff; }
39
+ .selectize-input.disabled, .selectize-input.disabled * {
40
+ cursor: default !important; }
41
+ .selectize-input.focus {
42
+ -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
43
+ box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); }
44
+ .selectize-input.dropdown-active {
45
+ -webkit-border-radius: 0.25rem 0.25rem 0 0;
46
+ -moz-border-radius: 0.25rem 0.25rem 0 0;
47
+ border-radius: 0.25rem 0.25rem 0 0; }
48
+ .selectize-input > * {
49
+ vertical-align: baseline;
50
+ display: -moz-inline-stack;
51
+ display: inline-block;
52
+ zoom: 1;
53
+ *display: inline; }
54
+ .selectize-control.multi .selectize-input > div {
55
+ cursor: pointer;
56
+ margin: 0 3px 3px 0;
57
+ padding: 1px 3px;
58
+ background: #efefef;
59
+ color: #343a40;
60
+ border: 0px solid #999; }
61
+ .selectize-control.multi .selectize-input > div.active {
62
+ background: #007bff;
63
+ color: #fff;
64
+ border: 0px solid rgba(0, 0, 0, 0); }
65
+ .selectize-control.multi .selectize-input.disabled > div, .selectize-control.multi .selectize-input.disabled > div.active {
66
+ color: #878787;
67
+ background: white;
68
+ border: 0px solid #e6e6e6; }
69
+ .selectize-input > input {
70
+ display: inline-block !important;
71
+ padding: 0 !important;
72
+ min-height: 0 !important;
73
+ max-height: none !important;
74
+ max-width: 100% !important;
75
+ margin: 0 !important;
76
+ text-indent: 0 !important;
77
+ border: 0 none !important;
78
+ background: none !important;
79
+ line-height: inherit !important;
80
+ -webkit-user-select: auto !important;
81
+ -webkit-box-shadow: none;
82
+ box-shadow: none; }
83
+ .selectize-input > input::-ms-clear {
84
+ display: none; }
85
+ .selectize-input > input:focus {
86
+ outline: none !important; }
87
+
88
+ .selectize-input::after {
89
+ content: ' ';
90
+ display: block;
91
+ clear: left; }
92
+
93
+ .selectize-input.dropdown-active::before {
94
+ content: ' ';
95
+ display: block;
96
+ position: absolute;
97
+ background: white;
98
+ height: 1px;
99
+ bottom: 0;
100
+ left: 0;
101
+ right: 0; }
102
+
103
+ .selectize-dropdown {
104
+ position: absolute;
105
+ z-index: 10;
106
+ border: 1px solid #d0d0d0;
107
+ background: #fff;
108
+ margin: -1px 0 0 0;
109
+ border-top: 0 none;
110
+ -webkit-box-sizing: border-box;
111
+ -moz-box-sizing: border-box;
112
+ box-sizing: border-box;
113
+ -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
114
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
115
+ -webkit-border-radius: 0 0 0.25rem 0.25rem;
116
+ -moz-border-radius: 0 0 0.25rem 0.25rem;
117
+ border-radius: 0 0 0.25rem 0.25rem; }
118
+ .selectize-dropdown [data-selectable] {
119
+ cursor: pointer;
120
+ overflow: hidden; }
121
+ .selectize-dropdown [data-selectable] .highlight {
122
+ background: rgba(255, 237, 40, 0.4);
123
+ -webkit-border-radius: 1px;
124
+ -moz-border-radius: 1px;
125
+ border-radius: 1px; }
126
+ .selectize-dropdown .option, .selectize-dropdown .optgroup-header {
127
+ padding: 3px 0.75rem; }
128
+ .selectize-dropdown .option, .selectize-dropdown [data-disabled], .selectize-dropdown [data-disabled] [data-selectable].option {
129
+ cursor: inherit;
130
+ opacity: 0.5; }
131
+ .selectize-dropdown [data-selectable].option {
132
+ opacity: 1; }
133
+ .selectize-dropdown .optgroup:first-child .optgroup-header {
134
+ border-top: 0 none; }
135
+ .selectize-dropdown .optgroup-header {
136
+ color: #6c757d;
137
+ background: #fff;
138
+ cursor: default; }
139
+ .selectize-dropdown .active {
140
+ background-color: #007bff;
141
+ color: #fff; }
142
+ .selectize-dropdown .active.create {
143
+ color: #16181b; }
144
+ .selectize-dropdown .create {
145
+ color: rgba(52, 58, 64, 0.5); }
146
+
147
+ .selectize-dropdown-content {
148
+ overflow-y: auto;
149
+ overflow-x: hidden;
150
+ max-height: 200px;
151
+ -webkit-overflow-scrolling: touch; }
152
+
153
+ .selectize-control.single .selectize-input, .selectize-control.single .selectize-input input {
154
+ cursor: pointer; }
155
+
156
+ .selectize-control.single .selectize-input.input-active, .selectize-control.single .selectize-input.input-active input {
157
+ cursor: text; }
158
+
159
+ .selectize-control.single .selectize-input:after {
160
+ content: ' ';
161
+ display: block;
162
+ position: absolute;
163
+ top: 50%;
164
+ right: calc(0.75rem + 5px);
165
+ margin-top: -3px;
166
+ width: 0;
167
+ height: 0;
168
+ border-style: solid;
169
+ border-width: 5px 5px 0 5px;
170
+ border-color: #343a40 transparent transparent transparent; }
171
+
172
+ .selectize-control.single .selectize-input.dropdown-active:after {
173
+ margin-top: -4px;
174
+ border-width: 0 5px 5px 5px;
175
+ border-color: transparent transparent #343a40 transparent; }
176
+
177
+ .selectize-control.rtl.single .selectize-input:after {
178
+ left: calc(0.75rem + 5px);
179
+ right: auto; }
180
+
181
+ .selectize-control.rtl .selectize-input > input {
182
+ margin: 0 4px 0 -2px !important; }
183
+
184
+ .selectize-control .selectize-input.disabled {
185
+ opacity: 0.5;
186
+ background-color: #fff; }
187
+
188
+ .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
189
+ visibility: visible !important;
190
+ background: #f2f2f2 !important;
191
+ background: rgba(0, 0, 0, 0.06) !important;
192
+ border: 0 none !important;
193
+ -webkit-box-shadow: inset 0 0 12px 4px #fff;
194
+ box-shadow: inset 0 0 12px 4px #fff; }
195
+
196
+ .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
197
+ content: '!';
198
+ visibility: hidden; }
199
+
200
+ .selectize-control.plugin-drag_drop .ui-sortable-helper {
201
+ -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
202
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); }
203
+
204
+ .selectize-dropdown-header {
205
+ position: relative;
206
+ padding: 3px 0.75rem;
207
+ border-bottom: 1px solid #d0d0d0;
208
+ background: #f8f8f8;
209
+ -webkit-border-radius: 0.25rem 0.25rem 0 0;
210
+ -moz-border-radius: 0.25rem 0.25rem 0 0;
211
+ border-radius: 0.25rem 0.25rem 0 0; }
212
+
213
+ .selectize-dropdown-header-close {
214
+ position: absolute;
215
+ right: 0.75rem;
216
+ top: 50%;
217
+ color: #343a40;
218
+ opacity: 0.4;
219
+ margin-top: -12px;
220
+ line-height: 20px;
221
+ font-size: 20px !important; }
222
+
223
+ .selectize-dropdown-header-close:hover {
224
+ color: black; }
225
+
226
+ .selectize-dropdown.plugin-optgroup_columns .optgroup {
227
+ border-right: 1px solid #f2f2f2;
228
+ border-top: 0 none;
229
+ float: left;
230
+ -webkit-box-sizing: border-box;
231
+ -moz-box-sizing: border-box;
232
+ box-sizing: border-box; }
233
+
234
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
235
+ border-right: 0 none; }
236
+
237
+ .selectize-dropdown.plugin-optgroup_columns .optgroup:before {
238
+ display: none; }
239
+
240
+ .selectize-dropdown.plugin-optgroup_columns .optgroup-header {
241
+ border-top: 0 none; }
242
+
243
+ .selectize-control.plugin-remove_button [data-value] {
244
+ position: relative;
245
+ padding-right: 24px !important; }
246
+
247
+ .selectize-control.plugin-remove_button [data-value] .remove {
248
+ z-index: 1;
249
+ /* fixes ie bug (see #392) */
250
+ position: absolute;
251
+ top: 0;
252
+ right: 0;
253
+ bottom: 0;
254
+ width: 17px;
255
+ text-align: center;
256
+ font-weight: bold;
257
+ font-size: 12px;
258
+ color: inherit;
259
+ text-decoration: none;
260
+ vertical-align: middle;
261
+ display: inline-block;
262
+ padding: 1px 0 0 0;
263
+ border-left: 1px solid #999;
264
+ -webkit-border-radius: 0 2px 2px 0;
265
+ -moz-border-radius: 0 2px 2px 0;
266
+ border-radius: 0 2px 2px 0;
267
+ -webkit-box-sizing: border-box;
268
+ -moz-box-sizing: border-box;
269
+ box-sizing: border-box; }
270
+
271
+ .selectize-control.plugin-remove_button [data-value] .remove:hover {
272
+ background: rgba(0, 0, 0, 0.05); }
273
+
274
+ .selectize-control.plugin-remove_button [data-value].active .remove {
275
+ border-left-color: rgba(0, 0, 0, 0); }
276
+
277
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover {
278
+ background: none; }
279
+
280
+ .selectize-control.plugin-remove_button .disabled [data-value] .remove {
281
+ border-left-color: #e6e6e6; }
282
+
283
+ .selectize-control.plugin-remove_button .remove-single {
284
+ position: absolute;
285
+ right: 0;
286
+ top: 0;
287
+ font-size: 23px; }
288
+
289
+ .selectize-dropdown, .selectize-dropdown.form-control {
290
+ height: auto;
291
+ padding: 0;
292
+ margin: 2px 0 0 0;
293
+ z-index: 1000;
294
+ background: #fff;
295
+ border: 1px solid rgba(0, 0, 0, 0.15);
296
+ -webkit-border-radius: 0.25rem;
297
+ -moz-border-radius: 0.25rem;
298
+ border-radius: 0.25rem;
299
+ -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
300
+ box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); }
301
+
302
+ .selectize-dropdown .optgroup-header {
303
+ font-size: 0.875rem;
304
+ line-height: 1.5; }
305
+
306
+ .selectize-dropdown .optgroup:first-child:before {
307
+ display: none; }
308
+
309
+ .selectize-dropdown .optgroup:before {
310
+ content: ' ';
311
+ display: block;
312
+ height: 0;
313
+ margin: 0.5rem 0;
314
+ overflow: hidden;
315
+ border-top: 1px solid #e5e5e5;
316
+ margin-left: -0.75rem;
317
+ margin-right: -0.75rem; }
318
+
319
+ .selectize-dropdown .create {
320
+ padding-left: 0.75rem; }
321
+
322
+ .selectize-dropdown-content {
323
+ padding: 5px 0; }
324
+
325
+ .selectize-dropdown-header {
326
+ padding: 6px 0.75rem; }
327
+
328
+ .selectize-input {
329
+ min-height: calc(2.25rem + 2px);
330
+ transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
331
+ .selectize-input.dropdown-active {
332
+ -webkit-border-radius: 0.25rem;
333
+ -moz-border-radius: 0.25rem;
334
+ border-radius: 0.25rem; }
335
+ .selectize-input.dropdown-active::before {
336
+ display: none; }
337
+ .selectize-input.focus {
338
+ border-color: #80bdff;
339
+ outline: 0;
340
+ box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
341
+
342
+ .is-invalid .selectize-input {
343
+ border-color: #dc3545;
344
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
345
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); }
346
+ .is-invalid .selectize-input:focus {
347
+ border-color: #bd2130;
348
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #eb8c95;
349
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #eb8c95; }
350
+
351
+ .selectize-control.multi .selectize-input.has-items {
352
+ padding-left: calc(0.75rem - 3px);
353
+ padding-right: calc(0.75rem - 3px); }
354
+
355
+ .selectize-control.multi .selectize-input > div {
356
+ -webkit-border-radius: calc(0.25rem - 1px);
357
+ -moz-border-radius: calc(0.25rem - 1px);
358
+ border-radius: calc(0.25rem - 1px); }
359
+
360
+ .form-control.selectize-control {
361
+ padding: 0;
362
+ height: auto;
363
+ border: none;
364
+ background: none;
365
+ -webkit-box-shadow: none;
366
+ box-shadow: none;
367
+ -webkit-border-radius: 0;
368
+ -moz-border-radius: 0;
369
+ border-radius: 0; }
370
+
371
+ .input-group .selectize-input {
372
+ overflow: unset;
373
+ -webkit-border-radius: 0 0.25rem 0.25rem 0;
374
+ -moz-border-radius: 0 0.25rem 0.25rem 0;
375
+ border-radius: 0 0.25rem 0.25rem 0; }
@@ -1,10 +1,12 @@
1
1
  /*
2
+ *= require simple_form_extension
2
3
  *= require_tree .
3
4
  *= require_self
4
5
  */
5
6
 
6
7
  @import "font-awesome"
7
8
  @import 'bootstrap-datepicker-1.8.0'
9
+ @import 'selectize.bootstrap4'
8
10
 
9
11
  .datepicker-inline
10
12
  display: none !important
@@ -26,6 +26,18 @@ class Tramway::Core::ApplicationDecorator
26
26
  new object_or_array
27
27
  end
28
28
  end
29
+
30
+ def decorate_association(association_name)
31
+ @@decorated_associations ||= []
32
+ @@decorated_associations << association_name
33
+
34
+ define_method association_name do
35
+ class_name = object.class.reflect_on_association(association_name).options[:class_name]
36
+ object.send(association_name).map do |association_object|
37
+ "#{class_name}Decorator".constantize.decorate association_object
38
+ end
39
+ end
40
+ end
29
41
  end
30
42
 
31
43
  delegate :id, to: :object
@@ -40,6 +52,12 @@ class Tramway::Core::ApplicationDecorator
40
52
  object
41
53
  end
42
54
 
55
+ def associations
56
+ object.class.reflect_on_all_associations.map do |association|
57
+ association unless association.name == :audits
58
+ end.compact
59
+ end
60
+
43
61
  def attributes
44
62
  object.attributes.reduce({}) do |hash, attribute|
45
63
  value = try(attribute[0]) ? send(attribute[0]) : object.send(attribute[0])
@@ -33,6 +33,8 @@ module Tramway::Core
33
33
  end
34
34
 
35
35
  class << self
36
+ delegate :defined_enums, to: :model_class
37
+
36
38
  def association(property)
37
39
  properties property
38
40
  @@associations ||= []
@@ -46,6 +48,10 @@ module Tramway::Core
46
48
  def reflect_on_association(*args)
47
49
  @@model_class.reflect_on_association(*args)
48
50
  end
51
+
52
+ def model_class
53
+ @@model_class ||= self.name.to_s.sub(/Form$/, '')
54
+ end
49
55
  end
50
56
  end
51
57
  end
@@ -0,0 +1,8 @@
1
+ ru:
2
+ simple_form:
3
+ extension:
4
+ selectize:
5
+ add: Добавить
6
+ file:
7
+ select: Выбрать файл
8
+ change: Изменить файл
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module Core
3
- VERSION = '1.6.1'
3
+ VERSION = '1.6.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-26 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reform-rails
@@ -221,6 +221,7 @@ files:
221
221
  - app/assets/javascripts/bootstrap-datepicker-1.8.0.ru.min.js
222
222
  - app/assets/javascripts/tramway/core/application.js.coffee
223
223
  - app/assets/stylesheets/bootstrap-datepicker-1.8.0.css
224
+ - app/assets/stylesheets/selectize.bootstrap4.css
224
225
  - app/assets/stylesheets/tramway/core/application.sass
225
226
  - app/controllers/tramway/core/application_controller.rb
226
227
  - app/decorators/tramway/core/application_decorated_collection.rb
@@ -241,6 +242,7 @@ files:
241
242
  - config/locales/ru/dates.yml
242
243
  - config/locales/ru/helpers.yml
243
244
  - config/locales/ru/models.yml
245
+ - config/locales/ru/simple_form_extension.yml
244
246
  - config/locales/ru/state_machines.yml
245
247
  - config/routes.rb
246
248
  - lib/string.rb