2d107e9e
Yarik
test
|
1
2
|
$(function() {
|
8a551494
Yarik
test
|
3
4
|
$(document).on('click', '.artbox_comment_container .removeable', function(e) {
e.preventDefault();
|
04bd4f61
Виталий
git
|
5
|
$(this).parent().remove();
|
d7f5a86c
Yarik
test
|
6
7
|
// var container = $(this).parents('.artbox_comment_container');
// $(container).remove();
|
8a551494
Yarik
test
|
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
|
});
$(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)
{
$(container).empty();
$(container).append('<p class="removeable">' + data.text + '</p>');
} else
{
$(container).prepend('<p class="removeable error_message">' + data.error + '</p>')
}
|
2d107e9e
Yarik
test
|
34
|
}
|
8a551494
Yarik
test
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
);
}
}
);
$(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
|
57
58
59
|
}
);
}
|
8a551494
Yarik
test
|
60
|
);
|
2d107e9e
Yarik
test
|
61
|
|
8a551494
Yarik
test
|
62
63
64
65
66
67
|
$(document).on(
'click', '.artbox_comment_reply_author', function()
{
$(this).parents('.artbox_comment_reply_block').first().empty();
}
);
|
2d107e9e
Yarik
test
|
68
|
|
8a551494
Yarik
test
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
$(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
|
87
|
|
8a551494
Yarik
test
|
88
89
90
91
92
93
94
|
// @TODO What is this
$(document).on(
'click', '.artbox_comment_update_reply', function()
{
$(this).remove();
}
);
|
2d107e9e
Yarik
test
|
95
|
|
8a551494
Yarik
test
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
$(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
|
112
|
}
|
8a551494
Yarik
test
|
113
114
115
|
)
}
);
|
8eab7c9f
Yarik
test
|
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
|
$(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
|
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
$(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
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
$(container).remove();
addRemoveBlocks()
function addRemoveBlocks()
{
$('#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)
}
// $(container).append('<p class="removeable">' + data.text + '</p>');
|
d7f5a86c
Yarik
test
|
210
211
212
213
214
215
216
217
218
219
220
221
222
|
} 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
|
223
224
|
var form = $(widget).find('.artbox_comment_form');
$(form).removeClass('hidden');
|
d7f5a86c
Yarik
test
|
225
226
227
228
229
|
$(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
|
230
|
$(form).addClass('hidden');
|
d7f5a86c
Yarik
test
|
231
232
233
|
$(form).find('.artbox_comment_answer_label').text('Вопрос');
});
|
8a551494
Yarik
test
|
234
|
});
|