lato_core 2.1.2 → 2.1.3

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/lato_core/application.js +18 -9
  3. data/app/assets/javascripts/lato_core/modules/CoreButton.js +38 -0
  4. data/app/assets/javascripts/lato_core/{initializers/Charts.js → modules/CoreChart.js} +12 -12
  5. data/app/assets/javascripts/lato_core/modules/CoreDatepicker.js +42 -0
  6. data/app/assets/javascripts/lato_core/modules/CoreEditor.js +27 -0
  7. data/app/assets/javascripts/lato_core/modules/CoreFlash.js +27 -0
  8. data/app/assets/javascripts/lato_core/modules/CoreFormValidator.js +110 -0
  9. data/app/assets/javascripts/lato_core/{initializers/Layout.js → modules/CoreLayout.js} +6 -5
  10. data/app/assets/javascripts/lato_core/modules/CoreMediapicker.js +140 -0
  11. data/app/assets/javascripts/lato_core/{interfaces/Modal.js → modules/CoreModal.js} +27 -2
  12. data/app/assets/javascripts/lato_core/modules/CoreSelect.js +110 -0
  13. data/app/assets/javascripts/lato_core/{initializers/inputs/SortableManager.js → modules/CoreSortableManager.js} +7 -6
  14. data/app/assets/javascripts/lato_core/modules/CoreTable.js +28 -0
  15. data/app/assets/stylesheets/lato_core/cells/inputs/_inputs.scss +1 -0
  16. data/app/assets/stylesheets/lato_core/cells/inputs/_multipleselect.scss +6 -0
  17. data/app/assets/stylesheets/lato_core/cells/widgets/_index.scss +9 -0
  18. data/app/cells/lato_core/inputs/dropzone/views/show.html.erb +24 -20
  19. data/app/cells/lato_core/inputs/multipleselect/cell.rb +52 -0
  20. data/app/cells/lato_core/inputs/multipleselect/views/show.html.erb +16 -0
  21. data/app/cells/lato_core/inputs/select/cell.rb +19 -1
  22. data/app/cells/lato_core/inputs/select/views/show.html.erb +10 -2
  23. data/app/cells/lato_core/widgets/index/cell.rb +1 -0
  24. data/app/cells/lato_core/widgets/index/views/partials/counter.html.erb +3 -0
  25. data/app/cells/lato_core/widgets/index/views/show.html.erb +2 -0
  26. data/app/controllers/lato_core/back/superusers_controller.rb +9 -9
  27. data/app/controllers/lato_core/doc/cells_inputs_controller.rb +28 -0
  28. data/app/views/lato_core/doc/cells_elements/button.html.erb +0 -4
  29. data/app/views/lato_core/doc/cells_elements/modal.html.erb +4 -4
  30. data/app/views/lato_core/doc/cells_inputs/multipleselect.html.erb +110 -0
  31. data/app/views/lato_core/doc/cells_inputs/select.html.erb +48 -2
  32. data/app/views/lato_core/doc/doc/index.html.erb +1 -0
  33. data/app/views/lato_core/doc/general/generators.html.erb +40 -0
  34. data/app/views/layouts/lato_core/partials/_logo.html.erb +7 -5
  35. data/config/languages/default.yml +2 -1
  36. data/config/languages/it.yml +2 -1
  37. data/config/routes/doc.rb +5 -0
  38. data/lib/generators/lato_core/crud_controller_generator.rb +35 -0
  39. data/lib/generators/lato_core/crud_generator.rb +31 -12
  40. data/lib/generators/lato_core/crud_views_generator.rb +52 -0
  41. data/lib/generators/lato_core/initializer_generator.rb +38 -28
  42. data/lib/generators/lato_core/scaffold_generator.rb +30 -0
  43. data/lib/generators/lato_core/templates/crud_controller/app/controllers/lato/crud_controller.rb +94 -0
  44. data/lib/generators/lato_core/templates/crud_views/app/views/lato/crud/edit.html.erb +24 -0
  45. data/lib/generators/lato_core/templates/crud_views/app/views/lato/crud/index.html.erb +35 -0
  46. data/lib/generators/lato_core/templates/crud_views/app/views/lato/crud/new.html.erb +24 -0
  47. data/lib/generators/lato_core/templates/crud_views/app/views/lato/crud/shared/_form.html.erb +42 -0
  48. data/lib/generators/lato_core/templates/crud_views/app/views/lato/crud/show.html.erb +22 -0
  49. data/lib/generators/lato_core/templates/{assets → initializer/assets}/images/logo.svg +0 -0
  50. data/lib/generators/lato_core/templates/{assets → initializer/assets}/javascripts/application.js +0 -0
  51. data/lib/generators/lato_core/templates/{assets → initializer/assets}/stylesheets/application.scss +0 -0
  52. data/lib/generators/lato_core/templates/{assets → initializer/assets}/stylesheets/theme.scss.erb +0 -0
  53. data/lib/generators/lato_core/templates/initializer/controllers/application_controller.rb +25 -0
  54. data/lib/generators/lato_core/templates/initializer/views/application/index.html.erb +20 -0
  55. data/lib/lato_core/interfaces/token.rb +4 -3
  56. data/lib/lato_core/version.rb +1 -1
  57. metadata +33 -16
  58. data/app/assets/javascripts/lato_core/initializers/Elements.js +0 -67
  59. data/app/assets/javascripts/lato_core/initializers/Inputs.js +0 -249
  60. data/app/assets/javascripts/lato_core/initializers/inputs/MultipleSelect.js +0 -0
  61. data/lib/generators/lato_core/templates/controllers/application_controller.rb +0 -13
  62. data/lib/generators/lato_core/templates/views/application/index.html.erb +0 -16
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lato
4
+
5
+ # ApplicationController.
6
+ class ApplicationController < ::ApplicationController
7
+
8
+ # set lato layout
9
+ layout 'lato_core/admin'
10
+
11
+ # initialize cells dependencies
12
+ before_action :core__cells_initialize
13
+ # manage superuser session for security
14
+ before_action :core__manage_superuser_session
15
+
16
+ def index
17
+ # set current menu active page
18
+ core__set_menu_active_item('sample_page')
19
+ # set current page title
20
+ core__set_header_active_page_title('Sample page')
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,20 @@
1
+ <%
2
+ # initialize a new row
3
+ main_row = cell(:elements, :row).new
4
+ # initialize a new block
5
+ main_block = cell(:elements, :block).new(class: 'xs-12 sm-12 md-12')
6
+ # initialize block title
7
+ main_block_title = cell(:elements, :title).new(label: "Welcome to this Lato sample page", size: 2)
8
+ %>
9
+
10
+ <!-- MAIN ROW -->
11
+ <%=raw main_row.open %>
12
+ <!-- MAIN BLOCK -->
13
+ <%=raw main_block.open %>
14
+
15
+ <%=raw main_block_title %>
16
+
17
+ <%=raw main_block.close %>
18
+ <!-- / MAIN BLOCK -->
19
+ <%=raw main_row.close %>
20
+ <!-- / MAIN ROW -->
@@ -8,13 +8,14 @@ module LatoCore
8
8
  def core__encode_token exp, payload
9
9
  exp = 1.day.from_now unless exp
10
10
  payload[:exp] = exp.to_i
11
- return JWT.encode(payload, Rails.application.secrets.secret_key_base)
11
+ JWT.encode(payload, Rails.application.secrets.secret_key_base, 'HS256')
12
12
  end
13
13
 
14
14
  # This function return the payload of a token.
15
15
  def core__decode_token token
16
16
  begin
17
- body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]
17
+ body = JWT.decode(token, Rails.application.secrets.secret_key_base,
18
+ true, algorithm: 'HS256')[0]
18
19
  return HashWithIndifferentAccess.new body
19
20
  rescue => exception
20
21
  return nil
@@ -22,4 +23,4 @@ module LatoCore
22
23
  end
23
24
 
24
25
  end
25
- end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module LatoCore
2
- VERSION = '2.1.2'
2
+ VERSION = '2.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lato_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ideonetwork
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-25 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -138,7 +138,7 @@ dependencies:
138
138
  version: '0'
139
139
  description: Lato is a modular management system for Rails
140
140
  email:
141
- - info@ideonetwork.it
141
+ - dev@ideonetwork.it
142
142
  executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
@@ -169,13 +169,18 @@ files:
169
169
  - app/assets/images/lato_core/logo.svg
170
170
  - app/assets/images/lato_core/user.png
171
171
  - app/assets/javascripts/lato_core/application.js
172
- - app/assets/javascripts/lato_core/initializers/Charts.js
173
- - app/assets/javascripts/lato_core/initializers/Elements.js
174
- - app/assets/javascripts/lato_core/initializers/Inputs.js
175
- - app/assets/javascripts/lato_core/initializers/Layout.js
176
- - app/assets/javascripts/lato_core/initializers/inputs/MultipleSelect.js
177
- - app/assets/javascripts/lato_core/initializers/inputs/SortableManager.js
178
- - app/assets/javascripts/lato_core/interfaces/Modal.js
172
+ - app/assets/javascripts/lato_core/modules/CoreButton.js
173
+ - app/assets/javascripts/lato_core/modules/CoreChart.js
174
+ - app/assets/javascripts/lato_core/modules/CoreDatepicker.js
175
+ - app/assets/javascripts/lato_core/modules/CoreEditor.js
176
+ - app/assets/javascripts/lato_core/modules/CoreFlash.js
177
+ - app/assets/javascripts/lato_core/modules/CoreFormValidator.js
178
+ - app/assets/javascripts/lato_core/modules/CoreLayout.js
179
+ - app/assets/javascripts/lato_core/modules/CoreMediapicker.js
180
+ - app/assets/javascripts/lato_core/modules/CoreModal.js
181
+ - app/assets/javascripts/lato_core/modules/CoreSelect.js
182
+ - app/assets/javascripts/lato_core/modules/CoreSortableManager.js
183
+ - app/assets/javascripts/lato_core/modules/CoreTable.js
179
184
  - app/assets/javascripts/lato_core/vendors/Sortable.min.js
180
185
  - app/assets/javascripts/lato_core/vendors/chart.bundle.js
181
186
  - app/assets/javascripts/lato_core/vendors/dropzone.js
@@ -217,6 +222,7 @@ files:
217
222
  - app/assets/stylesheets/lato_core/cells/inputs/_general.scss
218
223
  - app/assets/stylesheets/lato_core/cells/inputs/_geolocalization.scss
219
224
  - app/assets/stylesheets/lato_core/cells/inputs/_inputs.scss
225
+ - app/assets/stylesheets/lato_core/cells/inputs/_multipleselect.scss
220
226
  - app/assets/stylesheets/lato_core/cells/inputs/_number.scss
221
227
  - app/assets/stylesheets/lato_core/cells/inputs/_password.scss
222
228
  - app/assets/stylesheets/lato_core/cells/inputs/_select.scss
@@ -316,6 +322,7 @@ files:
316
322
  - app/cells/lato_core/inputs/youtube/cell.rb
317
323
  - app/cells/lato_core/inputs/youtube/views/show.html.erb
318
324
  - app/cells/lato_core/widgets/index/cell.rb
325
+ - app/cells/lato_core/widgets/index/views/partials/counter.html.erb
319
326
  - app/cells/lato_core/widgets/index/views/partials/new.html.erb
320
327
  - app/cells/lato_core/widgets/index/views/partials/pagination.html.erb
321
328
  - app/cells/lato_core/widgets/index/views/partials/search.html.erb
@@ -367,6 +374,7 @@ files:
367
374
  - app/views/lato_core/doc/cells_inputs/email.html.erb
368
375
  - app/views/lato_core/doc/cells_inputs/form.html.erb
369
376
  - app/views/lato_core/doc/cells_inputs/geolocalization.html.erb
377
+ - app/views/lato_core/doc/cells_inputs/multipleselect.html.erb
370
378
  - app/views/lato_core/doc/cells_inputs/number.html.erb
371
379
  - app/views/lato_core/doc/cells_inputs/password.html.erb
372
380
  - app/views/lato_core/doc/cells_inputs/select.html.erb
@@ -406,14 +414,23 @@ files:
406
414
  - config/routes/back.rb
407
415
  - config/routes/doc.rb
408
416
  - db/migrate/20160224181217_create_lato_core_superusers.rb
417
+ - lib/generators/lato_core/crud_controller_generator.rb
409
418
  - lib/generators/lato_core/crud_generator.rb
419
+ - lib/generators/lato_core/crud_views_generator.rb
410
420
  - lib/generators/lato_core/initializer_generator.rb
411
- - lib/generators/lato_core/templates/assets/images/logo.svg
412
- - lib/generators/lato_core/templates/assets/javascripts/application.js
413
- - lib/generators/lato_core/templates/assets/stylesheets/application.scss
414
- - lib/generators/lato_core/templates/assets/stylesheets/theme.scss.erb
415
- - lib/generators/lato_core/templates/controllers/application_controller.rb
416
- - lib/generators/lato_core/templates/views/application/index.html.erb
421
+ - lib/generators/lato_core/scaffold_generator.rb
422
+ - lib/generators/lato_core/templates/crud_controller/app/controllers/lato/crud_controller.rb
423
+ - lib/generators/lato_core/templates/crud_views/app/views/lato/crud/edit.html.erb
424
+ - lib/generators/lato_core/templates/crud_views/app/views/lato/crud/index.html.erb
425
+ - lib/generators/lato_core/templates/crud_views/app/views/lato/crud/new.html.erb
426
+ - lib/generators/lato_core/templates/crud_views/app/views/lato/crud/shared/_form.html.erb
427
+ - lib/generators/lato_core/templates/crud_views/app/views/lato/crud/show.html.erb
428
+ - lib/generators/lato_core/templates/initializer/assets/images/logo.svg
429
+ - lib/generators/lato_core/templates/initializer/assets/javascripts/application.js
430
+ - lib/generators/lato_core/templates/initializer/assets/stylesheets/application.scss
431
+ - lib/generators/lato_core/templates/initializer/assets/stylesheets/theme.scss.erb
432
+ - lib/generators/lato_core/templates/initializer/controllers/application_controller.rb
433
+ - lib/generators/lato_core/templates/initializer/views/application/index.html.erb
417
434
  - lib/lato_core.rb
418
435
  - lib/lato_core/cell.rb
419
436
  - lib/lato_core/engine.rb
@@ -1,67 +0,0 @@
1
- var ElementsInitializer = (function () {
2
-
3
- function modalCloseButton () {
4
- $('.elements-modal__close-button').click(function (e) {
5
- var modal = $(this).parent()
6
- var modalContent = modal.parent()
7
- var modalContainer = modalContent.parent()
8
- modalContainer.removeClass('elements-modal--active')
9
- modalContainer.find('.elements-modal__modal').removeClass('elements-modal__modal--active')
10
- $('body').removeClass('stop-scrolling')
11
- e.preventDefault()
12
- })
13
- }
14
-
15
- function flashCloseButton () {
16
- $('.elements-flash__close-button').click(function (e) {
17
- var flash = $(this).parent()
18
- flash.addClass('elements-flash--hidden')
19
- e.preventDefault()
20
- })
21
- }
22
-
23
- function tableHeadFixed () {
24
- var table = $('.elements-table--fixed .elements-table__table')
25
- table.floatThead({
26
- scrollContainer: function (table) {
27
- return table.closest('.elements-table--fixed')
28
- }
29
- })
30
- }
31
-
32
- function buttonConfirmation () {
33
- var button = $('.elements-button__element')
34
- button.click(function (e) {
35
- if ($(this).attr('data-confirmation') && $(this).attr('data-confirmation') === 'true') {
36
- var confirmation = $(this).parent().find('.elements-button__confirmation')
37
-
38
- // remove old confirmations popup
39
- $('.elements-button__element').parent().find('.elements-button__confirmation').removeClass('elements-button__confirmation--active')
40
- // open confirmation popup
41
- $(confirmation).addClass('elements-button__confirmation--active')
42
- // manage delete click
43
- $(confirmation).find('.button.popup.false').click(function(e) {
44
- $(confirmation).removeClass('elements-button__confirmation--active')
45
- e.preventDefault()
46
- })
47
-
48
- e.preventDefault()
49
- }
50
- })
51
- }
52
-
53
- // Init:
54
-
55
- function init () {
56
- modalCloseButton()
57
- flashCloseButton()
58
- tableHeadFixed()
59
- buttonConfirmation()
60
- }
61
-
62
- return {
63
- init: init
64
- }
65
-
66
- })()
67
-
@@ -1,249 +0,0 @@
1
- var InputsInitializer = (function () {
2
-
3
- // Init plugins:
4
-
5
- function initializeSelect () {
6
- $('.inputs__select').each(function () {
7
- $(this).selectize({
8
- create: $(this).attr('data-create') === 'true',
9
- maxItems: $(this).attr('data-multiple') === 'true' ? null : 1
10
- })
11
- })
12
- }
13
-
14
- function initializeDatetime () {
15
- $('.inputs__input--datetime').datetimepicker({
16
- format: 'd/m/Y H:i'
17
- })
18
- }
19
-
20
- function initializeDate () {
21
- $('.inputs__input--date').datetimepicker({
22
- timepicker: false,
23
- format: 'd/m/Y'
24
- })
25
- }
26
-
27
- function initializeEditor () {
28
- $('.inputs__editor').trumbowyg({
29
- svgPath: $('#ddtj__editor-icons-path').html()
30
- });
31
- }
32
-
33
- function initializeDropzone () {
34
- $('.inputs__dropzone').each(function () {
35
- var paramName = $(this).attr('data-param-name')
36
- var maxFilesize = $(this).attr('data-max-size')
37
- var maxFiles = $(this).attr('data.max-files')
38
- $(this).dropzone({
39
- paramName: paramName,
40
- maxFilesize: maxFilesize,
41
- maxFiles: maxFiles
42
- })
43
- })
44
- }
45
-
46
- function initializeGeolocalizationMap () {
47
- $('.inputs-geolocalization').each(function () {
48
- // find dom elements
49
- var mapContainer = $(this).find('.inputs-geolocalization__map')[0]
50
- var searchBoxInput = $(this).find('.inputs-geolocalization__search')[0]
51
- var latInput = $(this).find('.inputs-geolocalization__input-lat')[0]
52
- var lngInput = $(this).find('.inputs-geolocalization__input-lng')[0]
53
- var addressInput = $(this).find('.inputs-geolocalization__input-address')[0]
54
- // initialize map
55
- var map = new google.maps.Map(mapContainer, {
56
- zoom: parseInt($(mapContainer).attr('data-default-zoom')),
57
- center: {
58
- lat: parseFloat($(mapContainer).attr('data-default-lat')),
59
- lng: parseFloat($(mapContainer).attr('data-default-lng'))
60
- },
61
- mapTypeId: $(mapContainer).attr('data-default-type'),
62
- streetViewControl: false
63
- })
64
- // initialize markers
65
- var markers = []
66
- if ($(latInput).val() && $(lngInput).val()) {
67
- markers.push(new google.maps.Marker({
68
- map: map,
69
- position: {lat: parseFloat($(latInput).val()), lng: parseFloat($(lngInput).val())},
70
- title: $(addressInput).val()
71
- }))
72
- }
73
- // initialize searchbox
74
- var searchBox = new google.maps.places.SearchBox(searchBoxInput)
75
- // sync map bounds with search
76
- map.addListener('bounds_changed', function () {
77
- searchBox.setBounds(map.getBounds())
78
- })
79
- // sync searchbox search with map and hidden inputs
80
- searchBox.addListener('places_changed', function () {
81
- // get search palces
82
- var places = searchBox.getPlaces()
83
- if (places.length === 0) { return }
84
- // clean old markers
85
- markers.forEach(function (marker) { marker.setMap(null) })
86
- markers = []
87
- // show first place on map
88
- var bounds = new google.maps.LatLngBounds()
89
- var place = places[0]
90
- if (!place.geometry) { return }
91
- markers.push(new google.maps.Marker({
92
- map: map,
93
- position: place.geometry.location,
94
- title: place.formatted_address
95
- }))
96
- if (place.geometry.viewport) {
97
- bounds.union(place.geometry.viewport)
98
- } else {
99
- bounds.extend(place.geometry.location)
100
- }
101
- map.fitBounds(bounds)
102
- // save place info on hidden inputs
103
- $(latInput).val(place.geometry.location.lat())
104
- $(lngInput).val(place.geometry.location.lng())
105
- $(addressInput).val(place.formatted_address)
106
- })
107
- })
108
- }
109
-
110
- function initializeYoutube () {
111
- // manage input change
112
- $('.inputs-youtube .inputs__input').change(function () {
113
- var inputVal = $(this).val()
114
- var videoId = getId(inputVal)
115
- var iframeMarkup = '<iframe src="//www.youtube.com/embed/' + videoId + '" frameborder="0" allowfullscreen></iframe>'
116
- var videoContainer = $(this).parent().find('.inputs-youtube__video')
117
- if (inputVal && inputVal !== '') {
118
- $(videoContainer).html(iframeMarkup)
119
- $(videoContainer).addClass('inputs-youtube__video--active')
120
- } else {
121
- $(videoContainer).html('')
122
- $(videoContainer).removeClass('inputs-youtube__video--active')
123
- }
124
- })
125
-
126
- // trigger initial change
127
- $('.inputs-youtube .inputs__input').trigger('change')
128
-
129
- // function to get youtube video
130
- function getId (url) {
131
- var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/
132
- var match = url.match(regExp)
133
-
134
- if (match && match[2].length === 11) {
135
- return match[2]
136
- } else {
137
- return 'error'
138
- }
139
- }
140
- }
141
-
142
- // Validations:
143
-
144
- function formInputsValidator () {
145
- $('.inputs__form').submit(function (e) {
146
- $(e.target).find('input').each(function () {
147
- if (!validateInput(this)) { e.preventDefault() }
148
- })
149
- $(e.target).find('select').each(function () {
150
- if (!validateInput(this)) { e.preventDefault() }
151
- })
152
- $(e.target).find('textarea').each(function () {
153
- if (!validateInput(this)) { e.preventDefault() }
154
- })
155
- })
156
- }
157
-
158
- function validateInput (input) {
159
- if ($(input).attr('data-required') && $(input).attr('data-required') === 'true') {
160
- if (!validateInputRequired(input)) { return false }
161
- }
162
-
163
- if ($(input).attr('data-max-length')) {
164
- if (!validateInputMaxLength(input)) { return false }
165
- }
166
-
167
- if ($(input).attr('data-min-length')) {
168
- if (!validateInputMinLength(input)) { return false }
169
- }
170
-
171
- return true
172
- }
173
-
174
- function validateInputRequired (input) {
175
- if ($(input).is(':checkbox')) {
176
- var inputChecked = $(input).is(':checked')
177
- if (!inputChecked || inputChecked === null || inputChecked === false) {
178
- addInputErrorStyle(input)
179
- return false
180
- }
181
- } else {
182
- var inputValue = $(input).val()
183
- if (inputValue === null || inputValue === '' || inputValue === ' ') {
184
- addInputErrorStyle(input)
185
- return false
186
- }
187
- }
188
-
189
- return true
190
- }
191
-
192
- function validateInputMaxLength (input) {
193
- var inputValue = $(input).val()
194
- if (inputValue !== null && inputValue !== '' && inputValue.length > $(input).attr('data-max-length')) {
195
- addInputErrorStyle(input)
196
- return false
197
- }
198
-
199
- return true
200
- }
201
-
202
- function validateInputMinLength (input) {
203
- var inputValue = $(input).val()
204
- if (inputValue !== null && inputValue !== '' && inputValue.length < $(input).attr('data-min-length')) {
205
- addInputErrorStyle(input)
206
- return false
207
- }
208
-
209
- return true
210
- }
211
-
212
- function addInputErrorStyle (input) {
213
- if ($(input).is('select')) {
214
- $(input).next().addClass('inputs__select--error')
215
- $(input).next().click(function () {
216
- $(this).removeClass('inputs__select--error')
217
- })
218
- } else if ($(input).is('textarea')) {
219
- $(input).addClass('inputs__textarea--error')
220
- $(input).click(function () {
221
- $(this).removeClass('inputs__textarea--error')
222
- })
223
- } else {
224
- $(input).addClass('inputs__input--error')
225
- $(input).focus(function () {
226
- $(this).removeClass('inputs__input--error')
227
- })
228
- }
229
- }
230
-
231
- // Init:
232
- function init () {
233
- initializeSelect()
234
- initializeDatetime()
235
- initializeDate()
236
- initializeEditor()
237
- initializeDropzone()
238
- initializeGeolocalizationMap()
239
- initializeYoutube()
240
- formInputsValidator()
241
-
242
- SortableManager.init()
243
- }
244
-
245
- return {
246
- init: init
247
- }
248
-
249
- })()