...
|
...
|
@@ -86,7 +86,7 @@
|
86
|
86
|
return;
|
87
|
87
|
}
|
88
|
88
|
elsif ($op eq 'api-toggle-label') {
|
89
|
|
- my $label_row_id = param('label-row-id');
|
|
89
|
+ my $label_row_id = param('popup-label-row-id');
|
90
|
90
|
|
91
|
91
|
my $label_checked = app->dbi->model('issue_label')->select(
|
92
|
92
|
where => {issue => $issue_row_id, label => $label_row_id}
|
...
|
...
|
@@ -99,7 +99,10 @@
|
99
|
99
|
}
|
100
|
100
|
else {
|
101
|
101
|
app->dbi->model('issue_label')->insert({issue => $issue_row_id, label => $label_row_id});
|
102
|
|
- $json->{checked} = 1
|
|
102
|
+ my $label = app->dbi->model('label')->select(where => {row_id => $label_row_id})->one;
|
|
103
|
+ $json->{checked} = 1;
|
|
104
|
+ $json->{id} = $label->{id};
|
|
105
|
+ $json->{color} = $label->{color};
|
103
|
106
|
}
|
104
|
107
|
$json->{success} = 1;
|
105
|
108
|
|
...
|
...
|
@@ -166,14 +169,21 @@
|
166
|
169
|
$('.issue-labels-popup-body li').on('click', function () {
|
167
|
170
|
var that = this;
|
168
|
171
|
|
169
|
|
- var label_row_id = $(this).attr('label-row-id');
|
170
|
|
- $.post('<%= url_for %>', {'label-row-id' : label_row_id, op : 'api-toggle-label'}, function (result) {
|
|
172
|
+ var label_row_id = $(this).attr('popup-label-row-id');
|
|
173
|
+ $.post('<%= url_for %>', {'popup-label-row-id' : label_row_id, op : 'api-toggle-label'}, function (result) {
|
171
|
174
|
if (result.success) {
|
172
|
175
|
if (result.checked) {
|
173
|
176
|
$(that).find('.issue-labels-popup-check i').css('display', 'block');
|
|
177
|
+ var li = '<li label-row-id="' + label_row_id + '" style="background:' + result.color + '">' + result.id + '</li>';
|
|
178
|
+ $('.issue-labels-setting-pallet').append(li);
|
174
|
179
|
}
|
175
|
180
|
else {
|
176
|
181
|
$(that).find('.issue-labels-popup-check i').css('display', 'none');
|
|
182
|
+ $('.issue-labels-setting-pallet li').each(function () {
|
|
183
|
+ if ($(this).attr('label-row-id') === label_row_id) {
|
|
184
|
+ $(this).remove();
|
|
185
|
+ }
|
|
186
|
+ });
|
177
|
187
|
}
|
178
|
188
|
}
|
179
|
189
|
});
|
...
|
...
|
@@ -277,7 +287,7 @@
|
277
|
287
|
<ul class="issue-labels-popup-body">
|
278
|
288
|
% for my $label (@$labels) {
|
279
|
289
|
% my $checked = app->dbi->model('issue_label')->select(where => {issue => $issue_row_id, label => $label->{row_id}})->one;
|
280
|
|
- <li label-row-id="<%= $label->{row_id} %>">
|
|
290
|
+ <li popup-label-row-id="<%= $label->{row_id} %>">
|
281
|
291
|
<div class="issue-labels-popup-check"><i class="icon icon-ok" style="display:<%= $checked ? 'block' : 'none' %>"></i></div>
|
282
|
292
|
<div class="issue-labels-popup-pallet" style="background:<%= $label->{color} %>"></div>
|
283
|
293
|
<div class="issue-labels-popup-pallet-id"><%= $label->{id} %></div>
|
...
|
...
|
@@ -288,7 +298,7 @@
|
288
|
298
|
% if (@$labels) {
|
289
|
299
|
<ul class="issue-labels-setting-pallet">
|
290
|
300
|
% for my $issue_label (@$issue_labels) {
|
291
|
|
- <li style="background:<%= $issue_label->{'label.color'} %>">
|
|
301
|
+ <li label-row-id="<%= $issue_label->{'label.row_id'} %>" style="background:<%= $issue_label->{'label.color'} %>">
|
292
|
302
|
<%= $issue_label->{'label.id'} %>
|
293
|
303
|
</li>
|
294
|
304
|
% }
|