script.js
5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
$(function() {
$('.profile_info_accordion .image-wrapper')
.append('<div class="add_image"><i class="glyphicon glyphicon-folder-open" aria-hidden="true"></i></div><div class="delete_image"><i class="glyphicon glyphicon-remove" aria-hidden="true"></i></div>');
if ($(".profile_info_accordion .image-wrapper.hide")
.hasClass("hide")) {
$('.profile_info_accordion .image-manager-input')
.append('<div class="image-wrapper-new"><div class="add_image"><i class="glyphicon glyphicon-folder-open" aria-hidden="true"></i></div></div>');
} else {
$('.profile_info_accordion .image-manager-input')
.append('<div class="image-wrapper-new hide"><div class="add_image"><i class="glyphicon glyphicon-folder-open" aria-hidden="true"></i></div></div>');
}
$(document)
.on('click', '.add_image', function() {
$(this)
.parent()
.parent()
.find(".open-modal-imagemanager")
.click();
$(".image-wrapper-new")
.addClass('hide');
$(".image-wrapper")
.removeClass('hide');
});
$(document)
.on('click', '.delete_image', function() {
$(this)
.parent()
.parent()
.find(".delete-selected-image")
.click();
$(".image-wrapper-new")
.removeClass("hide");
return false;
});
$(document)
.on('click', '.slugify_button', function() {
var id = $(this)
.data('id');
var attribute_id = $(this)
.data('attribute-id');
var url = $(this)
.data('url');
var language_id = $(this)
.data('language-id');
var input = $('#' + id);
var attribute_input = $('#' + attribute_id);
var value = attribute_input.val();
if (id !== undefined && url !== undefined && value !== undefined && attribute_id !== undefined && value.length > 0) {
$.get(url, {
text: value,
languageId: language_id
}, function(data) {
input.val(data);
});
}
});
$(document)
.on('click', '.slugify_cancel_button', function() {
var id = $(this)
.data('id');
var value = $(this)
.data('value');
var input = $('#' + id);
if (id !== undefined && value !== undefined) {
input.val(value);
}
});
$(document)
.on('click', 'a.viewed-toggle', function(e) {
e.preventDefault();
var a = $(this);
$.ajax({
type: "POST",
url: a.attr('href'),
success: function(data) {
console.log(data);
a.parent()
.parent()
.removeClass('success');
a.replaceWith(data.text);
$('.feedback-widget')
.replaceWith(data.widget);
new PNotify({
title: data.message.title,
text: data.message.text,
type: "success",
styling: "bootstrap3",
icon: "glyphicon glyphicon-exclamation-sign"
});
}
});
});
$(document)
.on('click', '.main_menu .homepage_link a', function() {
$(this)
.parents('.homepage_link')
.removeClass('active');
});
$(document)
.on('click', '.sitemap-buttons .btn.ajax', function(e) {
e.preventDefault();
var url = $(this)
.attr('href');
$(this)
.addClass('active');
$.get(url, function() {
$(this)
.removeClass('active');
new PNotify({
title: "Карта сайта",
text: "Карта сайта успещно сгенерирована",
type: "success",
styling: "bootstrap3",
icon: "glyphicon glyphicon-exclamation-sign"
});
if ($(this)
.data('need-reload')) {
setTimeout(function() {
location.reload();
}, 1000);
}
}.bind(this))
.fail(function() {
$(this)
.removeClass('active');
new PNotify({
title: "Карта сайта",
text: "Ошибка при генерации карты сайта",
type: "error",
styling: "bootstrap3",
icon: "glyphicon glyphicon-exclamation-sign"
});
}.bind(this));
});
$('.bar_tabs>li.disabled a')
.removeAttr('data-toggle');
$(document)
.on('click', '.artbox-selection-delete', function(e) {
var selectedRows = $('.grid-view')
.yiiGridView('getSelectedRows');
var msg = $(this)
.data('message');
var url = $(this)
.data('url');
if (selectedRows.length > 0 && confirm(msg)) {
$.post(url + '?ids=' + encodeURIComponent(selectedRows), function(data) {
if (data.success) {
location.reload();
}
})
}
});
});