diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js
index 0795492588..113a64a9a1 100644
--- a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js
+++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js
@@ -136,27 +136,6 @@ define(function(require) {
return false;
});
- // close icon: removing the tab on click
- $("#roles_tabs", context).on("click", "i.remove-tab", function() {
- var target = $(this).parent().attr("href");
- var dd = $(this).closest('dd');
- var dl = $(this).closest('dl');
- var content = $(target);
-
- var role_id = content.attr("role_id");
-
- dd.remove();
- content.remove();
-
- if (dd.attr("class") == 'is-active') {
- $('a', dl.children('dd').last()).click();
- }
-
- delete that.roleTabObjects[role_id];
-
- return false;
- });
-
// Fill parents table
// Each time a tab is clicked the table is filled with existing tabs (roles)
// Selected roles are kept
@@ -430,10 +409,11 @@ define(function(require) {
}
function _add_role_tab(role_id, dialog) {
+ var that = this;
var html_role_id = 'role' + role_id;
var role_tab = new RoleTab(html_role_id);
- this.roleTabObjects[role_id] = role_tab;
+ that.roleTabObjects[role_id] = role_tab;
// Append the new div containing the tab and add the tab to the list
var role_section = $('
'+
@@ -456,6 +436,27 @@ define(function(require) {
Foundation.reInit($("ul#roles_tabs", dialog));
$("a", a).trigger("click");
+ // close icon: removing the tab on click
+ a.on("click", "i.remove-tab", function() {
+ var target = $(this).parent().attr("href");
+ var li = $(this).closest('li');
+ var ul = $(this).closest('ul');
+ var content = $(target);
+
+ var role_id = content.attr("role_id");
+
+ li.remove();
+ content.remove();
+
+ if (li.hasClass('is-active')) {
+ $('a', ul.children('li').last()).click();
+ }
+
+ delete that.roleTabObjects[role_id];
+
+ return false;
+ });
+
role_tab.setup(role_section);
role_tab.onShow();
}
diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js
index d54c8284be..6df245a8f7 100644
--- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js
+++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/hybrid.js
@@ -364,25 +364,6 @@ define(function(require) {
Foundation.reflow(context, 'tabs');
that.numberOfProviders = 0;
- // close icon: removing the tab on click
- context.on("click", "i.remove-tab", function() {
- var target = $(this).parent().attr("href");
- var li = $(this).closest('li');
- var ul = $(this).closest('ul');
- var content = $(target);
-
- li.remove();
- content.remove();
-
- if (li.attr("class") == 'active') {
- $('a', ul.children('li').last()).click();
- }
-
- $("ul#template_create_hybrid_tabs li", context).each(function(index) {
- $("a", this).html(Locale.tr("Provider") + ' ' + index + "
");
- })
- });
-
context.on("click", "#tf_btn_hybrid", function() {
that.addProviderTab(that.numberOfProviders, context);
that.numberOfProviders++;
@@ -488,6 +469,25 @@ define(function(require) {
$("a", a).trigger("click");
+ // close icon: removing the tab on click
+ a.on("click", "i.remove-tab", function() {
+ var target = $(this).parent().attr("href");
+ var li = $(this).closest('li');
+ var ul = $(this).closest('ul');
+ var content = $(target);
+
+ li.remove();
+ content.remove();
+
+ if (li.hasClass('is-active')) {
+ $('a', ul.children('li').last()).click();
+ }
+
+ $("ul#template_create_hybrid_tabs li", context).each(function(index) {
+ $("a", this).html(Locale.tr("Provider") + ' ' + index + "
");
+ })
+ });
+
var providerSection = $('#' + htmlId + 'Tab', context);
providerSection.on("change", "input.hybridRadio", function() {
diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network.js
index 81ba501aba..21857a04d5 100644
--- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network.js
+++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network.js
@@ -88,26 +88,6 @@ define(function(require) {
Foundation.reflow(context, 'tabs');
- // close icon: removing the tab on click
- context.on("click", "i.remove-tab", function() {
- var target = $(this).parent().attr("href");
- var li = $(this).closest('li');
- var ul = $(this).closest('ul');
- var content = $(target);
-
- li.remove();
- content.remove();
-
- var nicId = content.attr("nicId");
- delete that.nicTabObjects[nicId];
-
- if (li.attr("class") == 'active') {
- $('a', ul.children('li').last()).click();
- }
-
- that.renameTabLinks(context);
- });
-
context.on("click", "#tf_btn_nics", function() {
that.addNicTab(context);
return false;
@@ -171,8 +151,9 @@ define(function(require) {
}
function _addNicTab(context) {
- this.numberOfNics++;
- var nicTab = new NicTab(this.numberOfNics);
+ var that = this;
+ that.numberOfNics++;
+ var nicTab = new NicTab(that.numberOfNics);
var content = $('
' +
nicTab.html() +
@@ -187,10 +168,30 @@ define(function(require) {
$("a", a).trigger("click");
nicTab.setup(content);
- content.attr("nicId", this.numberOfNics);
+ content.attr("nicId", that.numberOfNics);
- this.renameTabLinks(context);
- this.nicTabObjects[this.numberOfNics] = nicTab;
+ that.renameTabLinks(context);
+ that.nicTabObjects[that.numberOfNics] = nicTab;
+
+ // close icon: removing the tab on click
+ a.on("click", "i.remove-tab", function() {
+ var target = $(this).parent().attr("href");
+ var li = $(this).closest('li');
+ var ul = $(this).closest('ul');
+ var content = $(target);
+
+ li.remove();
+ content.remove();
+
+ var nicId = content.attr("nicId");
+ delete that.nicTabObjects[nicId];
+
+ if (li.hasClass('is-active')) {
+ $('a', ul.children('li').last()).click();
+ }
+
+ that.renameTabLinks(context);
+ });
}
function _renameTabLinks(context) {
diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage.js
index a168a0c475..f522c12442 100644
--- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage.js
+++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage.js
@@ -88,26 +88,6 @@ define(function(require) {
Foundation.reflow(context, 'tabs');
- // close icon: removing the tab on click
- context.on("click", "i.remove-tab", function() {
- var target = $(this).parent().attr("href");
- var li = $(this).closest('li');
- var ul = $(this).closest('ul');
- var content = $(target);
-
- li.remove();
- content.remove();
-
- var diskId = content.attr("diskId");
- delete that.diskTabObjects[diskId];
-
- if (li.attr("class") == 'is-active') {
- $('a', ul.children('li').last()).click();
- }
-
- that.renameTabLinks(context);
- });
-
context.on("click", "#tf_btn_disks", function() {
that.addDiskTab(context);
return false;
@@ -155,8 +135,9 @@ define(function(require) {
}
function _addDiskTab(context) {
- this.numberOfDisks++;
- var diskTab = new DiskTab(this.numberOfDisks);
+ var that = this;
+ that.numberOfDisks++;
+ var diskTab = new DiskTab(that.numberOfDisks);
var content = $('
' +
diskTab.html() +
@@ -171,10 +152,30 @@ define(function(require) {
$("a", a).trigger("click");
diskTab.setup(content);
- content.attr("diskId", this.numberOfDisks);
+ content.attr("diskId", that.numberOfDisks);
- this.renameTabLinks(context);
- this.diskTabObjects[this.numberOfDisks] = diskTab;
+ that.renameTabLinks(context);
+ that.diskTabObjects[that.numberOfDisks] = diskTab;
+
+ // close icon: removing the tab on click
+ a.on("click", "i.remove-tab", function() {
+ var target = $(this).parent().attr("href");
+ var li = $(this).closest('li');
+ var ul = $(this).closest('ul');
+ var content = $(target);
+
+ li.remove();
+ content.remove();
+
+ var diskId = content.attr("diskId");
+ delete that.diskTabObjects[diskId];
+
+ if (li.hasClass('is-active')) {
+ $('a', ul.children('li').last()).click();
+ }
+
+ that.renameTabLinks(context);
+ });
}
function _renameTabLinks(context) {