Case 22025 - Create temporary placename doesn't appear when no places are listed

This commit is contained in:
Roxanne Skelly 2019-04-03 13:57:37 -07:00
parent 05cab9a3cc
commit 75671be2de

View file

@ -678,12 +678,9 @@ $(document).ready(function(){
var errorEl = createDomainLoadingError("There was an error retrieving your places."); var errorEl = createDomainLoadingError("There was an error retrieving your places.");
$("#" + Settings.PLACES_TABLE_ID).after(errorEl); $("#" + Settings.PLACES_TABLE_ID).after(errorEl);
// do we have a domain ID? var temporaryPlaceButton = dynamicButton(Settings.GET_TEMPORARY_NAME_BTN_ID, 'Get a temporary place name');
if (!domainIDIsSet()) { temporaryPlaceButton.hide();
// we don't have a domain ID - add a button to offer the user a chance to get a temporary one $('#' + Settings.PLACES_TABLE_ID).after(temporaryPlaceButton);
var temporaryPlaceButton = dynamicButton(Settings.GET_TEMPORARY_NAME_BTN_ID, 'Get a temporary place name');
$('#' + Settings.PLACES_TABLE_ID).after(temporaryPlaceButton);
}
if (accessTokenIsSet()) { if (accessTokenIsSet()) {
appendAddButtonToPlacesTable(); appendAddButtonToPlacesTable();
} }
@ -774,8 +771,9 @@ $(document).ready(function(){
// check if we have owner_places (for a real domain) or a name (for a temporary domain) // check if we have owner_places (for a real domain) or a name (for a temporary domain)
if (data.status == "success") { if (data.status == "success") {
$('#' + Settings.GET_TEMPORARY_NAME_BTN_ID).hide();
$('.domain-loading-hide').show(); $('.domain-loading-hide').show();
if (data.domain.owner_places) { if (data.domain.owner_places && data.domain.owner_places.length > 0) {
// add a table row for each of these names // add a table row for each of these names
_.each(data.domain.owner_places, function(place){ _.each(data.domain.owner_places, function(place){
$('#' + Settings.PLACES_TABLE_ID + " tbody").append(placeTableRowForPlaceObject(place)); $('#' + Settings.PLACES_TABLE_ID + " tbody").append(placeTableRowForPlaceObject(place));
@ -783,8 +781,9 @@ $(document).ready(function(){
} else if (data.domain.name) { } else if (data.domain.name) {
// add a table row for this temporary domain name // add a table row for this temporary domain name
$('#' + Settings.PLACES_TABLE_ID + " tbody").append(placeTableRow(data.domain.name, '/', true)); $('#' + Settings.PLACES_TABLE_ID + " tbody").append(placeTableRow(data.domain.name, '/', true));
} else {
$('#' + Settings.GET_TEMPORARY_NAME_BTN_ID).show();
} }
// Update label // Update label
if (showOrHideLabel()) { if (showOrHideLabel()) {
var label = data.domain.label; var label = data.domain.label;