blob: 03f3483927611390ccced8d2d08cc23facc85b3b (
plain)
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
|
jQuery(function($) {
"use strict";
var TEMPLATES = new LuigiTemplate.Cache({
});
$('.add-post').click(function() {
var type = $(this).data('type');
// dismiss dropdown
$('body').trigger('click');
send(type + '/add').fail(function(r) {
var msg = r.responseText;
try {
var data = $.parseJSON(r);
if (data.error)
msg = data.error;
} catch (e) {}
alert('Error: ' + msg);
}).done(function(r) {
console.log(r);
// show edit dialog
$('#' + type + '-edit-dialog').data('post_id', r.post_id).modal('show')
});
// stop event
return false;
});
});
|