Revision 66d9afe6
Added by Serghei Mihai over 10 years ago
calebasse/static/js/calebasse.agenda.js | ||
---|---|---|
63 | 63 |
var textarea = $(this).prev(); |
64 | 64 |
var span = textarea.prev(); |
65 | 65 |
var btn = $(this); |
66 |
var comment = {comment: textarea.val()}; |
|
67 |
var data = JSON.stringify(comment); |
|
66 | 68 |
if ($(this).data('act-id')) |
67 | 69 |
{ |
68 |
var data = {comment: textarea.val() }; |
|
69 |
var data = JSON.stringify(data); |
|
70 |
|
|
70 | 71 |
$.ajax({ |
71 | 72 |
url: '/api/v1/act/' + $(this).data("act-id") + '/?format=json&date=' + $(this).data('date'), |
72 | 73 |
type: 'PATCH', |
... | ... | |
74 | 75 |
data: data, |
75 | 76 |
success: function(data) { |
76 | 77 |
btn.attr('disabled', 'disabled'); |
78 |
if (comment['comment']) { |
|
79 |
$('h3#' + btn.data("event-id") + ' span.icon-comment').fadeIn(); |
|
80 |
} |
|
81 |
else { |
|
82 |
$('h3#' + btn.data("event-id") + ' span.icon-comment').fadeOut(); |
|
83 |
} |
|
77 | 84 |
span.html('Commentaire modifié avec succès'); |
78 | 85 |
} |
79 | 86 |
}); |
80 | 87 |
} |
81 | 88 |
else |
82 | 89 |
{ |
83 |
var comment = {description: textarea.val()}; |
|
84 |
var data = JSON.stringify(comment); |
|
85 | 90 |
$.ajax({ |
86 | 91 |
url: '/api/v1/event/' + $(this).data("event-id") + '/?format=json&date=' + $(this).data('date'), |
87 | 92 |
type: 'PATCH', |
... | ... | |
89 | 94 |
data: data, |
90 | 95 |
success: function(response) { |
91 | 96 |
btn.attr('disabled', 'disabled'); |
92 |
if (comment['description'])
|
|
97 |
if (comment['comment'])
|
|
93 | 98 |
$('h3#' + btn.data("event-id") + ' span.icon-comment').fadeIn(); |
94 | 99 |
else |
95 | 100 |
$('h3#' + btn.data("event-id") + ' span.icon-comment').fadeOut(); |
Also available in: Unified diff
agenda: comment icon updated also for appointments in schedules listing
Closes #2509