You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2012/07/24 00:18:41 UTC
[4/5] git commit: Tag UI: Make sure data is passed to remove action
Tag UI: Make sure data is passed to remove action
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1c2780f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1c2780f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1c2780f2
Branch: refs/heads/master
Commit: 1c2780f233bbfc23120a41dd72bbb0d2d37c7c9d
Parents: 39e1936
Author: bfederle <bf...@gmail.com>
Authored: Mon Jul 23 15:03:03 2012 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Mon Jul 23 15:18:36 2012 -0700
----------------------------------------------------------------------
ui/scripts/ui/widgets/tagger.js | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1c2780f2/ui/scripts/ui/widgets/tagger.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/tagger.js b/ui/scripts/ui/widgets/tagger.js
index b6d2f0a..f671342 100644
--- a/ui/scripts/ui/widgets/tagger.js
+++ b/ui/scripts/ui/widgets/tagger.js
@@ -56,13 +56,13 @@
return $form;
},
- tagItem: function(title, onRemove) {
+ tagItem: function(title, onRemove, data) {
var $li = $('<li>');
var $label = $('<span>').addClass('label').html(title);
var $remove = $('<span>').addClass('remove').html('X');
$remove.click(function() {
- if (onRemove) onRemove($li);
+ if (onRemove) onRemove($li, data);
});
$li.append($remove, $label);
@@ -90,10 +90,12 @@
var $title = elems.info('Tags').addClass('title');
var $loading = $('<div>').addClass('loading-overlay');
- var onRemoveItem = function($item) {
+ var onRemoveItem = function($item, data) {
$loading.appendTo($container);
actions.remove({
- context: context,
+ context: $.extend(true, {}, context, {
+ tagItems: [data]
+ }),
response: {
success: function(args) {
var notification = $.extend(true, {} , args.notification, {
@@ -133,6 +135,7 @@
$loading.appendTo($container);
actions.add({
+ data: data,
context: context,
response: {
success: function(args) {
@@ -147,7 +150,7 @@
// Success
function() {
$loading.remove();
- elems.tagItem(title, onRemoveItem).appendTo($tagArea);
+ elems.tagItem(title, onRemoveItem, data).appendTo($tagArea);
success();
}, {},
@@ -182,8 +185,9 @@
$(data).map(function(index, item) {
var key = item.key;
var value = item.value;
+ var data = { key: key, value: value };
- elems.tagItem(key + ' = ' + value, onRemoveItem).appendTo($tagArea);
+ elems.tagItem(key + ' = ' + value, onRemoveItem, data).appendTo($tagArea);
});
},
error: function(message) {