1
|
$(function() {
|
2
|
// init settings
|
3
|
altair_page_settings.init();
|
4
|
});
|
5
|
|
6
|
altair_page_settings = {
|
7
|
init: function() {
|
8
|
var $settings_form = $('#page_settings');
|
9
|
if($settings_form.length) {
|
10
|
|
11
|
$('#settings_visitors_languages').selectize({
|
12
|
plugins: {
|
13
|
'remove_button': {
|
14
|
label : ''
|
15
|
}
|
16
|
},
|
17
|
options: [
|
18
|
{id: 1, title: 'English', value: 'gb'},
|
19
|
{id: 2, title: 'French', value: 'fr'},
|
20
|
{id: 3, title: 'Chinese', value: 'cn'},
|
21
|
{id: 4, title: 'Dutch', value: 'nl'},
|
22
|
{id: 5, title: 'Italian', value: 'it'},
|
23
|
{id: 6, title: 'Spanish', value: 'es'},
|
24
|
{id: 7, title: 'German', value: 'de'},
|
25
|
{id: 8, title: 'Polish', value: 'pl'}
|
26
|
],
|
27
|
render: {
|
28
|
option: function(data, escape) {
|
29
|
return '<div class="option">' +
|
30
|
'<i class="item-icon flag-' + escape(data.value).toUpperCase() + '"></i>' +
|
31
|
'<span>' + escape(data.title) + '</span>' +
|
32
|
'</div>';
|
33
|
},
|
34
|
item: function(data, escape) {
|
35
|
return '<div class="item"><i class="item-icon flag-' + escape(data.value).toUpperCase() + '"></i>' + escape(data.title) + '</div>';
|
36
|
}
|
37
|
},
|
38
|
maxItems: null,
|
39
|
valueField: 'value',
|
40
|
labelField: 'title',
|
41
|
searchField: 'title',
|
42
|
create: false,
|
43
|
onDropdownOpen: function($dropdown) {
|
44
|
$dropdown
|
45
|
.hide()
|
46
|
.velocity('slideDown', {
|
47
|
begin: function() {
|
48
|
$dropdown.css({'margin-top':'0'})
|
49
|
},
|
50
|
duration: 200,
|
51
|
easing: easing_swiftOut
|
52
|
})
|
53
|
},
|
54
|
onDropdownClose: function($dropdown) {
|
55
|
$dropdown
|
56
|
.show()
|
57
|
.velocity('slideUp', {
|
58
|
complete: function() {
|
59
|
$dropdown.css({'margin-top':''})
|
60
|
},
|
61
|
duration: 200,
|
62
|
easing: easing_swiftOut
|
63
|
})
|
64
|
}
|
65
|
});
|
66
|
|
67
|
|
68
|
// show serialized form
|
69
|
$('#page_settings_submit').on('click',function(e) {
|
70
|
e.preventDefault();
|
71
|
var form_serialized = JSON.stringify( $settings_form.serializeObject(), null, 2 );
|
72
|
UIkit.modal.alert('<p>Site settings:</p><pre>' + form_serialized + '</pre>');
|
73
|
})
|
74
|
|
75
|
}
|
76
|
}
|
77
|
};
|