lato_view 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/lato_view/icons/_artist.svg +0 -0
- data/app/assets/images/lato_view/icons/_artwork.svg +0 -0
- data/app/assets/images/lato_view/icons/_calendar.svg +0 -0
- data/app/assets/images/lato_view/icons/_clients.svg +0 -0
- data/app/assets/images/lato_view/icons/_home.svg +0 -0
- data/app/assets/images/lato_view/icons/_list.svg +0 -0
- data/app/assets/images/lato_view/icons/_magni-glass.svg +0 -0
- data/app/assets/images/lato_view/icons/_percentage.svg +0 -0
- data/app/assets/images/lato_view/icons/_sweet.svg +0 -0
- data/app/assets/images/lato_view/icons/_users.svg +0 -0
- data/app/assets/javascripts/lato_view/application.js +8 -6
- data/app/assets/javascripts/lato_view/build/ActionBar.js +0 -0
- data/app/assets/javascripts/lato_view/build/ConfirmationPopup.js +52 -0
- data/app/assets/javascripts/lato_view/build/Dropdown.js +0 -0
- data/app/assets/javascripts/lato_view/build/FormManager.js +170 -50
- data/app/assets/javascripts/lato_view/build/Step.js +169 -0
- data/app/assets/javascripts/lato_view/build/Util.js +25 -9
- data/app/assets/javascripts/lato_view/build/Validator.js +70 -48
- data/app/assets/stylesheets/lato_view/config/_config.scss +4 -4
- data/app/assets/stylesheets/lato_view/config/templates/_base-template.scss +22 -0
- data/app/assets/stylesheets/lato_view/config/templates/_black-template.scss +26 -6
- data/app/assets/stylesheets/lato_view/config/templates/_feral-template.scss +190 -0
- data/app/assets/stylesheets/lato_view/config/templates/_mauve-template.scss +178 -0
- data/app/assets/stylesheets/lato_view/config/templates/_orange-template.scss +184 -0
- data/app/assets/stylesheets/lato_view/modules/_arranger.scss +0 -0
- data/app/assets/stylesheets/lato_view/modules/_button-group.scss +0 -0
- data/app/assets/stylesheets/lato_view/modules/_buttons.scss +13 -7
- data/app/assets/stylesheets/lato_view/modules/_confirmation-popup.scss +63 -0
- data/app/assets/stylesheets/lato_view/modules/_dropdown.scss +0 -0
- data/app/assets/stylesheets/lato_view/modules/_form-controls.scss +11 -2
- data/app/assets/stylesheets/lato_view/modules/_modules.scss +2 -0
- data/app/assets/stylesheets/lato_view/modules/_pagination.scss +0 -0
- data/app/assets/stylesheets/lato_view/modules/_sidebar.scss +2 -2
- data/app/assets/stylesheets/lato_view/modules/_status.scss +0 -0
- data/app/assets/stylesheets/lato_view/modules/_step.scss +53 -0
- data/app/assets/stylesheets/lato_view/modules/_wyswyg.scss +4 -0
- data/app/assets/stylesheets/lato_view/views/_admin.scss +4 -1
- data/app/assets/stylesheets/lato_view/views/_login.scss +5 -4
- data/app/cells/lato_view/cells_v1/buttongroup/cell.rb +0 -0
- data/app/cells/lato_view/cells_v1/buttongroup/views/show.html.erb +0 -0
- data/app/cells/lato_view/cells_v1/dropdown/cell.rb +0 -0
- data/app/cells/lato_view/cells_v1/dropdown/views/show.html.erb +0 -0
- data/app/cells/lato_view/cells_v1/input/cell.rb +21 -1
- data/app/cells/lato_view/cells_v1/input/views/date.html.erb +1 -1
- data/app/cells/lato_view/cells_v1/input/views/number.html.erb +8 -3
- data/app/cells/lato_view/cells_v1/input/views/select.html.erb +1 -1
- data/app/cells/lato_view/cells_v1/input/views/time.html.erb +0 -0
- data/app/cells/lato_view/component/button/cell.rb +4 -2
- data/app/cells/lato_view/component/button/views/show.html.erb +1 -1
- data/app/cells/lato_view/component/buttongroup/cell.rb +0 -0
- data/app/cells/lato_view/component/buttongroup/views/show.html.erb +0 -0
- data/app/cells/lato_view/component/buttonprompt/cell.rb +38 -0
- data/app/cells/lato_view/component/buttonprompt/views/show.html.erb +2 -0
- data/app/cells/lato_view/component/dropdown/cell.rb +0 -0
- data/app/cells/lato_view/component/dropdown/views/show.html.erb +0 -0
- data/app/cells/lato_view/component/form/cell.rb +0 -0
- data/app/cells/lato_view/component/form/views/open.html.erb +0 -0
- data/app/cells/lato_view/component/form/views/show.html.erb +0 -0
- data/app/cells/lato_view/component/searchbar/cell.rb +0 -0
- data/app/cells/lato_view/component/searchbar/views/show.html.erb +0 -0
- data/app/cells/lato_view/input/checkbox/cell.rb +7 -2
- data/app/cells/lato_view/input/checkbox/views/show.html.erb +2 -2
- data/app/cells/lato_view/input/date/cell.rb +4 -2
- data/app/cells/lato_view/input/date/views/show.html.erb +1 -1
- data/app/cells/lato_view/input/doubleselect/cell.rb +72 -0
- data/app/cells/lato_view/input/doubleselect/views/show.html.erb +90 -0
- data/app/cells/lato_view/input/editor/cell.rb +0 -0
- data/app/cells/lato_view/input/editor/views/show.html.erb +0 -0
- data/app/cells/lato_view/input/email/cell.rb +0 -0
- data/app/cells/lato_view/input/email/views/show.html.erb +0 -0
- data/app/cells/lato_view/input/file/cell.rb +0 -0
- data/app/cells/lato_view/input/file/views/show.html.erb +0 -0
- data/app/cells/lato_view/input/map/cell.rb +54 -0
- data/app/cells/lato_view/input/map/views/show.html.erb +103 -0
- data/app/cells/lato_view/input/nselect/cell.rb +47 -0
- data/app/cells/lato_view/input/nselect/views/show.html.erb +15 -0
- data/app/cells/lato_view/input/number/cell.rb +4 -2
- data/app/cells/lato_view/input/number/views/show.html.erb +6 -8
- data/app/cells/lato_view/input/password/cell.rb +0 -0
- data/app/cells/lato_view/input/password/views/show.html.erb +0 -0
- data/app/cells/lato_view/input/radio/cell.rb +0 -0
- data/app/cells/lato_view/input/radio/views/show.html.erb +0 -0
- data/app/cells/lato_view/input/select/cell.rb +3 -2
- data/app/cells/lato_view/input/select/views/show.html.erb +2 -2
- data/app/cells/lato_view/input/text/cell.rb +1 -1
- data/app/cells/lato_view/input/text/views/show.html.erb +3 -3
- data/app/cells/lato_view/input/textarea/cell.rb +0 -0
- data/app/cells/lato_view/input/textarea/views/show.html.erb +1 -4
- data/app/cells/lato_view/input/time/cell.rb +0 -0
- data/app/cells/lato_view/input/time/views/show.html.erb +0 -0
- data/app/cells/lato_view/layout/actionbar/cell.rb +0 -0
- data/app/cells/lato_view/layout/actionbar/views/show.html.erb +0 -0
- data/app/cells/lato_view/layout/block/cell.rb +0 -0
- data/app/cells/lato_view/layout/index/cell.rb +0 -0
- data/app/cells/lato_view/layout/index/views/head.html.erb +0 -0
- data/app/cells/lato_view/layout/index/views/rows.html.erb +29 -17
- data/app/cells/lato_view/layout/step/cell.rb +50 -0
- data/app/cells/lato_view/layout/tablerows/cell.rb +23 -0
- data/app/cells/lato_view/layout/tablerows/views/show.html.erb +13 -0
- data/app/controllers/lato_view/assets_controller.rb +0 -0
- data/app/views/lato_view/develop/home.html.erb +74 -0
- data/app/views/lato_view/icons/_artist.svg +0 -0
- data/app/views/lato_view/icons/_artwork.svg +0 -0
- data/app/views/lato_view/icons/_calendar.svg +0 -0
- data/app/views/lato_view/icons/_clients.svg +0 -0
- data/app/views/lato_view/icons/_home.svg +0 -0
- data/app/views/lato_view/icons/_list.svg +0 -0
- data/app/views/lato_view/icons/_magni-glass.svg +0 -0
- data/app/views/lato_view/icons/_percentage.svg +0 -0
- data/app/views/lato_view/icons/_sweet.svg +0 -0
- data/app/views/lato_view/icons/_users.svg +0 -0
- data/app/views/lato_view/layout/_prompt.html.erb +11 -0
- data/app/views/layouts/lato_layout.html.erb +12 -6
- data/config/example.yml +4 -0
- data/config/initializers/lists.rb +1 -1
- data/config/initializers/ram.rb +1 -0
- data/lang/default.yml +3 -0
- data/lang/en.yml +3 -0
- data/lib/lato_view/interface/assets.rb +16 -0
- data/lib/lato_view/interface/images.rb +0 -0
- data/lib/lato_view/interface/themes.rb +0 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de827c8effaf615e2e52a32fedd15769c1ab11c
|
4
|
+
data.tar.gz: b120b8cc929c762d8d4d6279feb474734df757cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5acfec86c023097390ee87356968c7a9950be7ab6820bf0b1ca763bc4dc093cac2bbb5ebac3e2e02659a24dc8887b8b0f695f2aca882a1f23c07a38905ec345e
|
7
|
+
data.tar.gz: 6f7398e0ef507222e6be9abc0f606f7e4ebd9dbcae8ff4c34fb592755e0b7a226217f6581813912eba71be7abb6e26913235ce99ff9925ab31f6cc4c71c2fa42
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -29,14 +29,14 @@
|
|
29
29
|
//= require lato_view/build/Navigation
|
30
30
|
//= require lato_view/build/ActionBar
|
31
31
|
//= require lato_view/build/Flash
|
32
|
+
//= require lato_view/build/ConfirmationPopup
|
33
|
+
//= require lato_view/build/Step
|
32
34
|
|
33
35
|
var Application = (function($) {
|
34
36
|
|
35
|
-
var onResize = function() {
|
36
|
-
|
37
|
-
|
38
|
-
});
|
39
|
-
};
|
37
|
+
var onResize = Util.debounce(function() {
|
38
|
+
Navigation.manageSidebarDropdown();
|
39
|
+
}, 250);
|
40
40
|
|
41
41
|
var init = function() {
|
42
42
|
$(document).on('ready', function() {
|
@@ -49,13 +49,15 @@ var Application = (function($) {
|
|
49
49
|
Navigation.init();
|
50
50
|
//ActionBar.init();
|
51
51
|
Flash.init();
|
52
|
+
Step.init();
|
52
53
|
FormManager.init();
|
54
|
+
ConfirmationPopup.init();
|
53
55
|
$('.editor').trumbowyg({
|
54
56
|
svgPath: '/ui/icons.svg'
|
55
57
|
});
|
56
58
|
|
57
59
|
// Functions executed on resize
|
58
|
-
onResize();
|
60
|
+
$(window).on('resize', onResize());
|
59
61
|
});
|
60
62
|
};
|
61
63
|
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
var ConfirmationPopup = (function($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var _manageConfirmationPopup = function() {
|
5
|
+
$(document).on('click', '.js-confirmation-popup-trigger', function(event) {
|
6
|
+
var $this = $('.js-confirmation-popup-trigger');
|
7
|
+
|
8
|
+
var $confirmationPopup = $('.js-confirmation-popup');
|
9
|
+
var $confirmationPopupQuestion = $confirmationPopup.find('.js-confirmation-popup-question');
|
10
|
+
var $confirmationPopupAnswerOk = $confirmationPopup.find('.js-confirmation-popup-answer-success');
|
11
|
+
var $confirmationPopupAnswerNope = $confirmationPopup.find('.js-confirmation-popup-answer-nope');
|
12
|
+
|
13
|
+
var location = $this.attr('href');
|
14
|
+
var data_method = $this.data( "fake-method");
|
15
|
+
|
16
|
+
var messageOk = $this.data('popup-ok');
|
17
|
+
var messageNo = $this.data('popup-no');
|
18
|
+
var messageText = $this.data('popup-text');
|
19
|
+
|
20
|
+
// Set property data
|
21
|
+
$confirmationPopupQuestion.text(messageText);
|
22
|
+
$confirmationPopupAnswerOk.text(messageOk);
|
23
|
+
$confirmationPopupAnswerOk.attr('href', location);
|
24
|
+
$confirmationPopupAnswerOk.attr( "data-method", data_method);
|
25
|
+
$confirmationPopupAnswerNope.text(messageNo);
|
26
|
+
|
27
|
+
event.preventDefault();
|
28
|
+
|
29
|
+
|
30
|
+
setTimeout(function() {
|
31
|
+
$('body').addClass('is-confirmation-popup-open');
|
32
|
+
}, 300);
|
33
|
+
|
34
|
+
});
|
35
|
+
};
|
36
|
+
|
37
|
+
var _nopePopup = function() {
|
38
|
+
$(document).on('click', '.js-confirmation-popup-answer-nope', function() {
|
39
|
+
$('body').removeClass('is-confirmation-popup-open');
|
40
|
+
});
|
41
|
+
};
|
42
|
+
|
43
|
+
var init = function() {
|
44
|
+
_manageConfirmationPopup();
|
45
|
+
_nopePopup();
|
46
|
+
};
|
47
|
+
|
48
|
+
return {
|
49
|
+
init: init
|
50
|
+
};
|
51
|
+
|
52
|
+
})(jQuery);
|
File without changes
|
@@ -3,20 +3,129 @@ var FormManager = (function($) {
|
|
3
3
|
|
4
4
|
// Activate selectize.js module
|
5
5
|
var _manageSelect = function() {
|
6
|
-
|
7
|
-
|
6
|
+
|
7
|
+
var $inputNSelects = $('.input-nselect');
|
8
|
+
var $select = $('.select');
|
9
|
+
var $selectCreate = $('.select-create');
|
10
|
+
|
11
|
+
$select.selectize({
|
12
|
+
hideSelected: 'true'
|
8
13
|
});
|
14
|
+
|
15
|
+
$selectCreate.selectize({
|
16
|
+
hideSelected: 'true',
|
17
|
+
create: function(input) {
|
18
|
+
return {
|
19
|
+
value: input,
|
20
|
+
text: input
|
21
|
+
}
|
22
|
+
}
|
23
|
+
});
|
24
|
+
|
25
|
+
$inputNSelects.each(function (index, inputNSelect) {
|
26
|
+
_manageInputNSelect(inputNSelect);
|
27
|
+
});
|
9
28
|
};
|
10
29
|
|
30
|
+
// Main function for each cell
|
31
|
+
var _manageInputNSelect = function(inputNSelect) {
|
32
|
+
var selectInputs = $(inputNSelect).find('.form-control');
|
33
|
+
|
34
|
+
// init selectize
|
35
|
+
selectInputs.each(function(index) {
|
36
|
+
_initSelectize(index, selectInputs);
|
37
|
+
});
|
38
|
+
|
39
|
+
// load options for first selectize
|
40
|
+
_loadOptions(null, 0, selectInputs);
|
41
|
+
};
|
42
|
+
|
43
|
+
// Function to init a select with the call of the api
|
44
|
+
var _loadOptions = function (filterId, selectInputPosition, selectInputs) {
|
45
|
+
var selectInput = selectInputs[selectInputPosition];
|
46
|
+
if (!selectInput) { return }
|
47
|
+
var apiUrl = $(selectInput).attr('data-api-url');
|
48
|
+
$.ajax({
|
49
|
+
url: apiUrl,
|
50
|
+
cache: false,
|
51
|
+
data: (filterId ? {filter_id: filterId} : null),
|
52
|
+
success: function (response) {
|
53
|
+
_updateSelectize(response, selectInputPosition, selectInputs);
|
54
|
+
}
|
55
|
+
});
|
56
|
+
};
|
57
|
+
|
58
|
+
// Function to init an empty input to become a selectize
|
59
|
+
var _initSelectize = function (selectInputPosition, selectInputs) {
|
60
|
+
var selectInput = selectInputs[selectInputPosition];
|
61
|
+
var input = $(selectInput).find('.select-nselect');
|
62
|
+
var valueField = $(selectInput).attr('data-value-field');
|
63
|
+
var labelField = $(selectInput).attr('data-label-field');
|
64
|
+
var initialVal = $(input).val();
|
65
|
+
var id = $(selectInput).attr('data-value-id');
|
66
|
+
|
67
|
+
input.selectize({
|
68
|
+
maxItems: 1,
|
69
|
+
valueField: valueField,
|
70
|
+
labelField: labelField,
|
71
|
+
searchField: labelField,
|
72
|
+
options: [],
|
73
|
+
onChange: function (value) {
|
74
|
+
_loadOptions(value, parseInt(id) + 1, selectInputs);
|
75
|
+
},
|
76
|
+
onInitialize: function() {
|
77
|
+
if (initialVal) {
|
78
|
+
this.setValue(initialVal);
|
79
|
+
_loadOptions(initialVal, parseInt(id) + 1, selectInputs);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
});
|
83
|
+
};
|
84
|
+
|
85
|
+
// Function to update a selectize with correct options
|
86
|
+
var _updateSelectize = function (options, selectInputPosition, selectInputs) {
|
87
|
+
var selectInput = selectInputs[selectInputPosition];
|
88
|
+
var input = $(selectInput).find('.select-nselect');
|
89
|
+
var id = $(selectInput).attr('data-value-id');
|
90
|
+
var initialVal = $(input).val();
|
91
|
+
|
92
|
+
var selectize = $(input)[0].selectize;
|
93
|
+
|
94
|
+
if (selectize) {
|
95
|
+
selectize.clear();
|
96
|
+
selectize.clearOptions();
|
97
|
+
selectize.load(function(callback) {
|
98
|
+
callback(options);
|
99
|
+
});
|
100
|
+
if (initialVal) {
|
101
|
+
selectize.setValue(initialVal);
|
102
|
+
_loadOptions(initialVal, parseInt(id) + 1, selectInputs);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
11
107
|
// Activate pikaday.js module
|
12
108
|
var _manageDatePicker = function() {
|
13
109
|
var $datepicker = $('.date-picker').pickadate({
|
14
110
|
firstDay: 1,
|
15
111
|
min: new Date(1900, 0, 1),
|
16
112
|
max: new Date(3000, 12, 31),
|
113
|
+
selectYears: true,
|
17
114
|
format: 'dd/mm/yyyy',
|
18
115
|
hiddenPrefix: '',
|
19
|
-
hiddenSuffix: ''
|
116
|
+
hiddenSuffix: '',
|
117
|
+
selectMonths: true
|
118
|
+
});
|
119
|
+
|
120
|
+
var $datepicker = $('.birthdate-picker').pickadate({
|
121
|
+
firstDay: 1,
|
122
|
+
selectYears: true,
|
123
|
+
format: 'dd/mm/yyyy',
|
124
|
+
hiddenPrefix: '',
|
125
|
+
hiddenSuffix: '',
|
126
|
+
selectMonths: true,
|
127
|
+
selectYears: 80,
|
128
|
+
max: true
|
20
129
|
});
|
21
130
|
};
|
22
131
|
|
@@ -24,7 +133,8 @@ var FormManager = (function($) {
|
|
24
133
|
var $timePicker = $('.time-picker').pickatime({
|
25
134
|
format: 'H:i',
|
26
135
|
hiddenPrefix: '',
|
27
|
-
hiddenSuffix: ''
|
136
|
+
hiddenSuffix: '',
|
137
|
+
interval: 5
|
28
138
|
});
|
29
139
|
};
|
30
140
|
|
@@ -58,13 +168,12 @@ var FormManager = (function($) {
|
|
58
168
|
} else {
|
59
169
|
$label.html(labelVal);
|
60
170
|
}
|
61
|
-
|
62
171
|
});
|
63
172
|
|
64
173
|
// Firefox bug fix
|
65
174
|
$input
|
66
|
-
.on('focus', function(){ $input.addClass( 'has-focus' ); })
|
67
|
-
.on('blur', function(){ $input.removeClass( 'has-focus' ); });
|
175
|
+
.on('focus', function() { $input.addClass( 'has-focus' ); })
|
176
|
+
.on('blur', function() { $input.removeClass( 'has-focus' ); });
|
68
177
|
});
|
69
178
|
}
|
70
179
|
};
|
@@ -83,7 +192,7 @@ var FormManager = (function($) {
|
|
83
192
|
|
84
193
|
// Activate email data-list autocomplete
|
85
194
|
var _insertSuggestions = function() {
|
86
|
-
if($('.email-suggestion').length) {
|
195
|
+
if ($('.email-suggestion').length) {
|
87
196
|
var domains = ['yahoo.com', 'gmail.com', 'google.com', 'hotmail.com', 'me.com', 'libero.it', 'live.it', 'live.com'];
|
88
197
|
|
89
198
|
$('.email-suggestion').emailautocomplete({
|
@@ -93,57 +202,68 @@ var FormManager = (function($) {
|
|
93
202
|
};
|
94
203
|
|
95
204
|
/*
|
96
|
-
* Manage form
|
205
|
+
* Manage form elements' submit
|
97
206
|
* @return: undefined or boolean
|
98
207
|
*/
|
99
208
|
var _manageFormSubmit = function() {
|
100
|
-
$('.lato-form').
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
// Basta che uno dei test fallisca per generare un errore
|
112
|
-
$.each(tests, function(index, val) {
|
113
|
-
if(val === false) {
|
114
|
-
event.preventDefault();
|
115
|
-
return false;
|
116
|
-
}
|
117
|
-
});
|
209
|
+
$('.lato-form').not('.login-form').each(function(i, el) {
|
210
|
+
$(el).on('submit', function(event) {
|
211
|
+
|
212
|
+
var $requiredControls = $(el).find('.form-control[data-input="required"]');
|
213
|
+
var $emailControls = $(el).find('.input-email');
|
214
|
+
var $lengthControls = $(el).find('.input-length');
|
215
|
+
var $radioControls = $(el).find('.form-control[data-input="radio"]');
|
216
|
+
var $passwordControl = $(el).find('.input-password');
|
217
|
+
var $passwordConfirm = $(el).find('.confirm-password');
|
218
|
+
var $numberControls = $(el).find('.input-number');
|
118
219
|
|
220
|
+
var tests = {
|
221
|
+
//"number": Validator.controlNumber($numberControls),
|
222
|
+
// "required": Validator.controlRequired($requiredControls),
|
223
|
+
// "email": Validator.controlEmail($emailControls),
|
224
|
+
//"password": Validator.controlPasswordEquality($passwordControl, $passwordConfirm)
|
225
|
+
//"length": Validator.controlInputLength($lengthControls),
|
226
|
+
//"radiobox": Validator.controlRadiobox($radioControls)
|
227
|
+
};
|
228
|
+
|
229
|
+
// Basta che uno dei test fallisca per generare un errore
|
230
|
+
$.each(tests, function(index, val) {
|
231
|
+
// if(!val) {
|
232
|
+
// event.preventDefault();
|
233
|
+
// return false;
|
234
|
+
// }
|
235
|
+
});
|
236
|
+
|
237
|
+
console.log(event);
|
238
|
+
});
|
119
239
|
});
|
120
240
|
}
|
121
241
|
|
122
242
|
// Manage form validation in semi-real-time.
|
123
243
|
var _manageBlurValidation = function() {
|
124
|
-
$('.lato-form').on('blur', '.input', function(event) {
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
});
|
244
|
+
// $('.lato-form').on('blur', '.input', function(event) {
|
245
|
+
// var type = $(this).parent('.form-control').data('input');
|
246
|
+
// var controlType = $(this).parent('.form-control').data('control');
|
247
|
+
//
|
248
|
+
// // Email suggestion case
|
249
|
+
// if($('.eac-input-wrap').length) {
|
250
|
+
// Validator.controlEmail('.input-email');
|
251
|
+
// }
|
252
|
+
//
|
253
|
+
// // Get input desired className.
|
254
|
+
// var tester = '.' + $(this).attr('class').split(' ')[1];
|
255
|
+
//
|
256
|
+
// // Manage data-control type
|
257
|
+
// switch(controlType) {
|
258
|
+
// case 'number':
|
259
|
+
// Validator.controlNumber(tester);
|
260
|
+
// break;
|
261
|
+
// case 'email':
|
262
|
+
// Validator.controlEmail(tester);
|
263
|
+
// break;
|
264
|
+
// }
|
265
|
+
//
|
266
|
+
// });
|
147
267
|
};
|
148
268
|
|
149
269
|
var init = function() {
|
@@ -0,0 +1,169 @@
|
|
1
|
+
var Step = (function($) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var $stepElements = $('.element-step');
|
5
|
+
var $stepNavigator = $('.step-navigator');
|
6
|
+
|
7
|
+
var _stepExists = function() {
|
8
|
+
return $stepElements.length;
|
9
|
+
};
|
10
|
+
|
11
|
+
var _sameElementStep = function($elStep, $navigator) {
|
12
|
+
return $elStep.data('step-id') === $navigator.data('step-id');
|
13
|
+
};
|
14
|
+
|
15
|
+
var _setStepsSize = function(currentStepElement) {
|
16
|
+
var elW = $(currentStepElement).outerWidth();
|
17
|
+
var $stepScroller = $(currentStepElement).find('.step-scroller');
|
18
|
+
var $steps = $(currentStepElement).find('.step');
|
19
|
+
var stepsCount = $steps.length;
|
20
|
+
|
21
|
+
$steps.width(elW);
|
22
|
+
$stepScroller.width(elW * stepsCount);
|
23
|
+
};
|
24
|
+
|
25
|
+
var _buildNavigation = function(currentStepElement, currentSteps) {
|
26
|
+
var stepElementid = $(currentStepElement).data('step-id');
|
27
|
+
var stepNavigatorSelector = '.step-navigator[data-step-id=' + stepElementid + ']';
|
28
|
+
var fragment = $(document.createDocumentFragment());
|
29
|
+
|
30
|
+
$.each(currentSteps, function(i, el) {
|
31
|
+
if ((parseInt(i)+1) === 1) {
|
32
|
+
var li = $('<li class="step-paginate-index active">' + (parseInt(i) + 1) + '</li>');
|
33
|
+
} else {
|
34
|
+
var li = $('<li class="step-paginate-index">' + (parseInt(i) + 1) + '</li>');
|
35
|
+
}
|
36
|
+
fragment.append(li);
|
37
|
+
});
|
38
|
+
|
39
|
+
_disableNavigation('.step-prev', stepElementid);
|
40
|
+
$(stepNavigatorSelector).find('.step-paginate').append(fragment);
|
41
|
+
};
|
42
|
+
|
43
|
+
var _disableNavigation = function($navEl, stepId) {
|
44
|
+
var selector = '.step-navigator[data-step-id="' + stepId + '"]';
|
45
|
+
$(selector).find($navEl).addClass('step-disabled');
|
46
|
+
};
|
47
|
+
|
48
|
+
var _enableNavigation = function($navEl, stepId) {
|
49
|
+
var selector = '.step-navigator[data-step-id="' + stepId + '"]';
|
50
|
+
$(selector).find($navEl).removeClass('step-disabled');
|
51
|
+
};
|
52
|
+
|
53
|
+
var _setActiveStep = function(currentStepElement, id) {
|
54
|
+
var stepElementid = $(currentStepElement).data('step-id');
|
55
|
+
var $step = $(currentStepElement).find('.step');
|
56
|
+
var stepNavigatorSelector = '.step-navigator[data-step-id=' + stepElementid + ']';
|
57
|
+
var $stepPaginateIndex = $(stepNavigatorSelector).find('.step-paginate-index');
|
58
|
+
|
59
|
+
$stepPaginateIndex.removeClass('active');
|
60
|
+
$stepPaginateIndex.eq(id).addClass('active');
|
61
|
+
|
62
|
+
$step.removeClass('active');
|
63
|
+
$step.eq(id).addClass('active');
|
64
|
+
};
|
65
|
+
|
66
|
+
var moveStep = function(currentStepElement, direction) {
|
67
|
+
currentStepElement = currentStepElement || $('.element-step:first');
|
68
|
+
direction = direction || 'initial';
|
69
|
+
var transform = ['transform', 'msTransform', 'webkitTransform', 'mozTransform', 'oTransform'];
|
70
|
+
var transformProperty = Util.getSupportedPropertyName(transform);
|
71
|
+
var stepScroller = $(currentStepElement).find('.step-scroller')[0];
|
72
|
+
var muchScroll = $(currentStepElement).outerWidth();
|
73
|
+
var stepCount = parseInt($(currentStepElement).find('.step').length);
|
74
|
+
var currentIndex = parseInt($(currentStepElement).find('.step.active').index() + 1);
|
75
|
+
var stepElementid = $(currentStepElement).data('step-id');
|
76
|
+
|
77
|
+
if (transformProperty) {
|
78
|
+
if (typeof direction === 'string') {
|
79
|
+
switch (direction) {
|
80
|
+
case 'prev':
|
81
|
+
if (currentIndex !== 1) {
|
82
|
+
_setActiveStep(currentStepElement, currentIndex-2);
|
83
|
+
stepScroller.style[transformProperty] = 'translateX(-' + (muchScroll * (currentIndex - 2)) + 'px)';
|
84
|
+
}
|
85
|
+
break;
|
86
|
+
case 'next':
|
87
|
+
if (currentIndex !== stepCount) {
|
88
|
+
stepScroller.style[transformProperty] = 'translateX(-' + (muchScroll * currentIndex) + 'px)';
|
89
|
+
_setActiveStep(currentStepElement, currentIndex);
|
90
|
+
}
|
91
|
+
break;
|
92
|
+
case 'initial':
|
93
|
+
|
94
|
+
break;
|
95
|
+
default:
|
96
|
+
}
|
97
|
+
|
98
|
+
} else if (typeof direction === 'number') {
|
99
|
+
var index = direction-1;
|
100
|
+
stepScroller.style[transformProperty] = 'translateX(-' + (muchScroll * index) + 'px)';
|
101
|
+
_setActiveStep(currentStepElement, index);
|
102
|
+
//_updateNavigationControl(currentIndex, stepElementid, stepCount);
|
103
|
+
} else {
|
104
|
+
return false;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
};
|
108
|
+
|
109
|
+
var prevStep = function(currentStepElement) {
|
110
|
+
$(document).on('click', '.step-prev', function() {
|
111
|
+
moveStep(currentStepElement, 'prev');
|
112
|
+
});
|
113
|
+
};
|
114
|
+
|
115
|
+
var nextStep = function(currentStepElement) {
|
116
|
+
$(document).on('click', '.step-next', function() {
|
117
|
+
moveStep(currentStepElement, 'next');
|
118
|
+
});
|
119
|
+
};
|
120
|
+
|
121
|
+
var resetStep = function() {
|
122
|
+
$(document).on('click', '.step-reset', function() {
|
123
|
+
moveStep(currentStepElement, 'initial');
|
124
|
+
});
|
125
|
+
};
|
126
|
+
|
127
|
+
var _indexNavigation = function() {
|
128
|
+
$(document).on('click', '.step-paginate-index', function() {
|
129
|
+
var stepElementid = $(this).parents('.step-navigator').data('step-id');
|
130
|
+
var paginateId = parseInt($(this).text());
|
131
|
+
var currentStepElementSelector = '.element-step[data-step-id=' + stepElementid + ']';
|
132
|
+
var $currentStepElement = $(currentStepElementSelector);
|
133
|
+
|
134
|
+
moveStep($currentStepElement, paginateId);
|
135
|
+
});
|
136
|
+
};
|
137
|
+
|
138
|
+
var updateStepsSize = function() {
|
139
|
+
if (_stepExists()) {
|
140
|
+
$.each($stepElements, function(i, el) {
|
141
|
+
_setStepsSize(el);
|
142
|
+
});
|
143
|
+
}
|
144
|
+
};
|
145
|
+
|
146
|
+
var init = function() {
|
147
|
+
if (_stepExists()) {
|
148
|
+
$.each($stepElements, function(i, el) {
|
149
|
+
var $elSteps = $(el).find('.step');
|
150
|
+
|
151
|
+
prevStep(el);
|
152
|
+
nextStep(el);
|
153
|
+
_setStepsSize(el);
|
154
|
+
_buildNavigation(el, $elSteps);
|
155
|
+
_indexNavigation();
|
156
|
+
});
|
157
|
+
}
|
158
|
+
};
|
159
|
+
|
160
|
+
return {
|
161
|
+
init: init,
|
162
|
+
move: moveStep,
|
163
|
+
prev: prevStep,
|
164
|
+
next: nextStep,
|
165
|
+
reset: resetStep,
|
166
|
+
update: updateStepsSize
|
167
|
+
};
|
168
|
+
|
169
|
+
})(jQuery);
|