spacevillain (spacevillain) wrote in changelog,
spacevillain
spacevillain
changelog

[ljcom] r11869: LJSUP-12015: First domain doesn't appear...

Committer: atyurin
LJSUP-12015: First domain doesn't appear at the bookmark "Manage domains"
U   trunk/htdocs/js/pay.js
Modified: trunk/htdocs/js/pay.js
===================================================================
--- trunk/htdocs/js/pay.js	2012-05-02 14:31:49 UTC (rev 11868)
+++ trunk/htdocs/js/pay.js	2012-05-03 07:35:39 UTC (rev 11869)
@@ -548,8 +548,7 @@
 			submitButton	= domainForm.find('[type="submit"]'),
 
 			domainTemplate	= jQuery("#domainTemplate"),
-			domains 		= jQuery(".b-domainru-domains").children('tbody'),
-			
+			domains 		= jQuery(".b-domainru-domains"),
 			removeLinks 	= jQuery('.b-domainru-remove');
 
 		var errorClass = [],
@@ -586,7 +585,10 @@
 					} else {
 						var freshClass = 'b-domainru-domains-new';
 
-						domains
+						tabs.children().removeClass('b-domainru-nodomains');
+						if (domains.children().length == 0) domains.append('<tbody/>');
+
+						domains.children('tbody')
 							.children().removeClass(freshClass).end()
 							.append(
 								domainTemplate.tmpl({
@@ -616,7 +618,7 @@
 			});
 		});
 
-		removeLinks.length && shop.on('click', '.b-domainru-remove', function(e) {
+		shop.on('click', '.b-domainru-remove', function(e) {
 			var that = this;
 
 			var sure = confirm(LiveJournal.getLocalizedStr('/shop/selfpromo.bml.ask_delete'));
@@ -632,7 +634,15 @@
 				},
 
 				success: function(res) {
-					if (!res.error) jQuery(that).parents('tr').detach();
+					if (!res.error) {
+						jQuery(that).parents('tr').detach();
+
+						// hide 'manage' tab if no children and switch to 'buy'
+						if (domains.children('tbody').children().length == 0) {
+							tabs.children().first().find('a').click();
+							tabs.children().last().addClass('b-domainru-nodomains')
+						}
+					}
 				}
 			});
 

Tags: atyurin, js, ljcom, spacevillain
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments