2d107e9e
Yarik
test
|
1
2
|
$(function() {
|
6b42222c
Виталий
git
|
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
|
function addRemoveBlocks(data)
{
$('#overlay, .succses_comm').remove();
$('body').append('<div id="overlay" style="top:0; left:0;"></div>').append('<div class="succses_comm"><div class="closed-form"></div><div class="succses_comm-txt">'+data.text+'</div></div>');
$('#overlay').fadeIn(
400, function()
{
$('.succses_comm').css({display : 'block'}).animate({opacity : 1, top : '50%'}, 200);
}
);
function closeSuccsescomm() {
$('.succses_comm')
.animate(
{opacity : 0, top : '30%'}, 200, function()
{
$(this).css('display', 'none')
$('#overlay').fadeOut(
400, function()
{
$('#overlay, .succses_comm').remove()
}
)
}
)
}
$('body').on('click', '.closed-form, #overlay', function() {
closeSuccsescomm()
}
);
setTimeout(closeSuccsescomm, 4000)
}
|
8a551494
Yarik
test
|
36
37
|
$(document).on('click', '.artbox_comment_container .removeable', function(e) {
e.preventDefault();
|
04bd4f61
Виталий
git
|
38
|
$(this).parent().remove();
|
d7f5a86c
Yarik
test
|
39
40
|
// var container = $(this).parents('.artbox_comment_container');
// $(container).remove();
|
8a551494
Yarik
test
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
});
$(document).on(
'click', '.artbox_comment_delete', function(e)
{
e.preventDefault();
var container = $(this).parents('.artbox_comment_container');
var comment_id = $(container).data('key');
var form_name = $(container).data('form');
if(confirm("Уверены, что хотите удалить комментарий?"))
{
$.post(
'/artbox-comment/delete', {
Comment : {
comment_id : comment_id
}
}, function(data, textStatus, jqXHR)
{
if(!data.error)
{
|
6b42222c
Виталий
git
|
61
62
63
64
65
|
{
$(container).remove();
addRemoveBlocks(data)
// $(container).append('<p class="removeable">' + data.text + '</p>');
}
|
8a551494
Yarik
test
|
66
67
68
69
|
} else
{
$(container).prepend('<p class="removeable error_message">' + data.error + '</p>')
}
|
2d107e9e
Yarik
test
|
70
|
}
|
8a551494
Yarik
test
|
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
);
}
}
);
$(document).on(
'click', '.artbox_comment_reply', function(e)
{
e.preventDefault();
var container = $(this).parents('.artbox_comment_container').first();
var comment_id = $(container).data('key');
var form_name = $(container).data('form');
var author = $(container).find('.artbox_comment_author').first().text();
var comment_form = $(container).parents('.artbox_comment_widget').find('.artbox_comment_form').first();
var offset = $(comment_form).offset();
var reply_block = $(comment_form).find('.artbox_comment_reply_block').first();
$(reply_block).empty();
$(reply_block).append('<input type="hidden" name="' + form_name + '[comment_pid]" value="' + comment_id + '">');
$(reply_block).append('<p class="artbox_comment_reply_author">' + author + '</p>');
$('html, body').animate(
{
scrollTop : offset.top - 50,
|
2d107e9e
Yarik
test
|
93
94
95
|
}
);
}
|
8a551494
Yarik
test
|
96
|
);
|
2d107e9e
Yarik
test
|
97
|
|
8a551494
Yarik
test
|
98
99
100
101
102
103
|
$(document).on(
'click', '.artbox_comment_reply_author', function()
{
$(this).parents('.artbox_comment_reply_block').first().empty();
}
);
|
2d107e9e
Yarik
test
|
104
|
|
8a551494
Yarik
test
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
$(document).on(
'click', '.artbox_comment_update', function(e)
{
e.preventDefault();
var container = $(this).parents('.artbox_comment_container').first();
var comment_id = $(container).data('key');
var form_name = $(container).data('form');
var object = {};
object[form_name] = {comment_id : comment_id};
$.post(
'/artbox-comment/form', object, function(data, textStatus, jqXHR)
{
$(container).empty();
$(container).append(data.result.form);
}
);
}
);
|
2d107e9e
Yarik
test
|
123
|
|
8a551494
Yarik
test
|
124
125
126
127
128
129
130
|
// @TODO What is this
$(document).on(
'click', '.artbox_comment_update_reply', function()
{
$(this).remove();
}
);
|
2d107e9e
Yarik
test
|
131
|
|
8a551494
Yarik
test
|
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
$(document).on(
'click', '.artbox_comment_update_submit', function(e)
{
e.preventDefault();
var container = $(this).parents('.artbox_comment_container').first();
$.post(
'/artbox-comment/update', $(container).find('form').serialize(), function(data)
{
$(container).empty();
if(!data.error)
{
$(container).append('<p>'+data.result.text+'</p>');
$(container).append(data.result.html);
} else {
$(container).append(data.form);
}
|
2d107e9e
Yarik
test
|
148
|
}
|
8a551494
Yarik
test
|
149
150
151
|
)
}
);
|
8eab7c9f
Yarik
test
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
$(document).on(
'click', '.artbox_comment_update_answer', function(e)
{
e.preventDefault();
var container = $(this).parents('.artbox_comment_container').first();
var comment_id = $(container).data('key');
var form_name = $(container).data('form');
var object = {};
object[form_name] = {comment_id : comment_id};
$.post(
'/artbox-comment/form-answer', object, function(data, textStatus, jqXHR)
{
$(container).empty();
$(container).append(data.result.form);
}
);
}
);
$(document).on(
'click', '.artbox_comment_update_answer_submit', function(e)
{
e.preventDefault();
var container = $(this).parents('.artbox_comment_container').first();
$.post(
'/artbox-comment/update-answer', $(container).find('form').serialize(), function(data)
{
$(container).empty();
if(!data.error)
{
$(container).append('<p>'+data.result.text+'</p>');
$(container).append(data.result.html);
} else {
$(container).append(data.form);
}
}
)
}
);
|
d7f5a86c
Yarik
test
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
$(document).on(
'click', '.artbox_comment_delete_answer', function(e)
{
e.preventDefault();
var container = $(this).parents('.artbox_comment_container');
var comment_id = $(container).data('key');
var form_name = $(container).data('form');
if(confirm("Уверены, что хотите удалить вопрос?"))
{
$.post(
'/artbox-comment/delete-answer', {
CommentProjectAnswer : {
comment_id : comment_id
}
}, function(data, textStatus, jqXHR)
{
if(!data.error)
{
|
04bd4f61
Виталий
git
|
211
|
$(container).remove();
|
6b42222c
Виталий
git
|
212
|
addRemoveBlocks(data)
|
d7f5a86c
Yarik
test
|
213
214
215
216
217
218
219
220
221
222
223
224
225
|
} else
{
$(container).prepend('<p class="removeable error_message">' + data.error + '</p>')
}
}
);
}
}
);
$(document).on('click', '.artbox_comment_reply_answer', function(e) {
e.preventDefault();
var widget = $(this).parents('.artbox_comment_widget');
|
d0f3b99f
Yarik
test
|
226
227
|
var form = $(widget).find('.artbox_comment_form');
$(form).removeClass('hidden');
|
d7f5a86c
Yarik
test
|
228
229
230
231
232
|
$(widget).find('.artbox_comment_answer_label').text('Ответ');
});
$(document).on('click', '.artbox_comment_reply_answer_block', function(e) {
var form = $(this).parents('.artbox_comment_form');
|
d0f3b99f
Yarik
test
|
233
|
$(form).addClass('hidden');
|
d7f5a86c
Yarik
test
|
234
235
236
|
$(form).find('.artbox_comment_answer_label').text('Вопрос');
});
|
8a551494
Yarik
test
|
237
|
});
|