| author | ymh <ymh.work@gmail.com> |
| Fri, 03 Jul 2015 13:39:04 +0200 | |
| changeset 638 | 8dfba6cb0164 |
| parent 474 | 7ec378cc1f8a |
| permissions | -rw-r--r-- |
| 473 | 1 |
"use strict"; |
2 |
||
3 |
$(document).ready(function() { |
|
4 |
||
5 |
$(".favorite-checkbox").click(function(e) { |
|
6 |
var chkbox = $(e.target); |
|
7 |
var form = $(e.target).parents('form')[0]; |
|
8 |
$.post($(form).attr('action'), $(form).serialize(), function(data) { |
|
9 |
if(chkbox.prop('checked') !== data.renkan.favorite) { |
|
10 |
chkbox.prop('checked', data.renkan.favorite); |
|
11 |
} |
|
12 |
}).fail(function() { |
|
13 |
chkbox.prop('checked', !chkbox.prop('checked')); |
|
14 |
}); |
|
15 |
|
|
16 |
}); |
|
|
474
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
17 |
|
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
18 |
|
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
19 |
$(".renkan-publish-action").mousedown(function(e) { |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
20 |
vex.dialog.confirm({ |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
21 |
message: renkanActionMessages.publish, |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
22 |
callback: function(value) { |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
23 |
if(value) { |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
24 |
e.target.click(); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
25 |
} |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
26 |
} |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
27 |
}); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
28 |
e.preventDefault(); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
29 |
}); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
30 |
|
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
31 |
$(".renkan-unpublish-action").mousedown(function(e) { |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
32 |
vex.dialog.prompt({ |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
33 |
message: renkanActionMessages.unpublish, |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
34 |
input: "<textarea name=\"vex\" class=\"vex-dialog-prompt-input\" placeholder=\"message\" rows=\"3\" />", |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
35 |
callback: function(message) { |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
36 |
if(message !== false) { |
|
638
8dfba6cb0164
Correct problem with rejection or unpublication message in Chrome
ymh <ymh.work@gmail.com>
parents:
474
diff
changeset
|
37 |
$('.action-message',$(e.target).parents('form').first()).val(message); |
|
474
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
38 |
e.target.click(); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
39 |
} |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
40 |
} |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
41 |
}); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
42 |
e.preventDefault(); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
43 |
}); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
44 |
|
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
45 |
$(".renkan-reject-action").mousedown(function(e) { |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
46 |
vex.dialog.prompt({ |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
47 |
message: renkanActionMessages.reject, |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
48 |
input: "<textarea name=\"vex\" class=\"vex-dialog-prompt-input\" placeholder=\"message\" rows=\"3\" />", |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
49 |
callback: function(message) { |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
50 |
if(message !== false) { |
|
638
8dfba6cb0164
Correct problem with rejection or unpublication message in Chrome
ymh <ymh.work@gmail.com>
parents:
474
diff
changeset
|
51 |
$('.action-message',$(e.target).parents('form').first()).val(message); |
|
474
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
52 |
e.target.click(); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
53 |
} |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
54 |
} |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
55 |
}); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
56 |
e.preventDefault(); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
57 |
}); |
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
58 |
|
|
7ec378cc1f8a
add message to moderation for reject and unpublish
ymh <ymh.work@gmail.com>
parents:
473
diff
changeset
|
59 |
|
| 473 | 60 |
}); |