|
56 | 56 |
|
57 | 57 | return $form; |
58 | 58 | }, |
59 | | - tagItem: function(title, onRemove) { |
| 59 | + tagItem: function(title, onRemove, data) { |
60 | 60 | var $li = $('<li>'); |
61 | 61 | var $label = $('<span>').addClass('label').html(title); |
62 | 62 | var $remove = $('<span>').addClass('remove').html('X'); |
63 | 63 |
|
64 | 64 | $remove.click(function() { |
65 | | - if (onRemove) onRemove($li); |
| 65 | + if (onRemove) onRemove($li, data); |
66 | 66 | }); |
67 | 67 |
|
68 | 68 | $li.append($remove, $label); |
|
90 | 90 | var $title = elems.info('Tags').addClass('title'); |
91 | 91 | var $loading = $('<div>').addClass('loading-overlay'); |
92 | 92 |
|
93 | | - var onRemoveItem = function($item) { |
| 93 | + var onRemoveItem = function($item, data) { |
94 | 94 | $loading.appendTo($container); |
95 | 95 | actions.remove({ |
96 | | - context: context, |
| 96 | + context: $.extend(true, {}, context, { |
| 97 | + tagItems: [data] |
| 98 | + }), |
97 | 99 | response: { |
98 | 100 | success: function(args) { |
99 | 101 | var notification = $.extend(true, {} , args.notification, { |
|
133 | 135 |
|
134 | 136 | $loading.appendTo($container); |
135 | 137 | actions.add({ |
| 138 | + data: data, |
136 | 139 | context: context, |
137 | 140 | response: { |
138 | 141 | success: function(args) { |
|
147 | 150 | // Success |
148 | 151 | function() { |
149 | 152 | $loading.remove(); |
150 | | - elems.tagItem(title, onRemoveItem).appendTo($tagArea); |
| 153 | + elems.tagItem(title, onRemoveItem, data).appendTo($tagArea); |
151 | 154 | success(); |
152 | 155 | }, {}, |
153 | 156 |
|
|
182 | 185 | $(data).map(function(index, item) { |
183 | 186 | var key = item.key; |
184 | 187 | var value = item.value; |
| 188 | + var data = { key: key, value: value }; |
185 | 189 |
|
186 | | - elems.tagItem(key + ' = ' + value, onRemoveItem).appendTo($tagArea); |
| 190 | + elems.tagItem(key + ' = ' + value, onRemoveItem, data).appendTo($tagArea); |
187 | 191 | }); |
188 | 192 | }, |
189 | 193 | error: function(message) { |
|
0 commit comments