70 lines
2.3 KiB
JavaScript
70 lines
2.3 KiB
JavaScript
function Index() {
|
|
$.ajaxSetup({ cache: false })
|
|
var index = this;
|
|
var ResourcesSidebar = $.parseJSON($('#Resources_Home_Sidebar').val());
|
|
|
|
index.initializeHomePage = function () {
|
|
index.bindHomeControls();
|
|
index.checkIfMissingAFacilityModalNeedsToBeOpened();
|
|
};
|
|
|
|
index.bindHomeControl = function (id, whatToDo, returnFalse) {
|
|
$(id).keypress(function () {
|
|
$(this).click();
|
|
});
|
|
$(id).click(function () {
|
|
whatToDo();
|
|
if (returnFalse) {
|
|
return false;
|
|
}
|
|
});
|
|
};
|
|
|
|
index.bindHomeControls = function () {
|
|
index.bindHomeControl("#listingResultButton", SearchSidebar.listingResultTab, true);
|
|
index.bindHomeControl("#mapResultButton", SearchSidebar.mapResultTab, true);
|
|
index.bindHomeControl('#missingAFacilityButton', index.missingAFacilityBinder, true);
|
|
};
|
|
|
|
index.openPopupWindow = function () {
|
|
return
|
|
}
|
|
|
|
index.checkIfMissingAFacilityModalNeedsToBeOpened = function () {
|
|
var doOpen = $.cookie('openMissingAFacilityDialog');
|
|
if (doOpen != null && doOpen != undefined && doOpen == 'true') {
|
|
$.cookie('openMissingAFacilityDialog', false);
|
|
index.checkLoggedInAndOpenMissingAFacilityModal();
|
|
};
|
|
};
|
|
|
|
index.missingAFacility = function () {
|
|
openCpModal({
|
|
title: ResourcesSidebar.SuggestAFacility,
|
|
className: 'modalMissingFacility',
|
|
isFrontEnd: true,
|
|
url: '/Facilities/Facility/GetMissingAFacilityModal'
|
|
});
|
|
};
|
|
|
|
index.checkLoggedInAndOpenMissingAFacilityModal = function () {
|
|
$.ajax({
|
|
url: '/Facilities/Facility/IsLoggedIn',
|
|
type: 'GET',
|
|
success: index.processCheckLoggedInResponseForMissingAFacility,
|
|
async: false
|
|
})
|
|
};
|
|
|
|
index.processCheckLoggedInResponseForMissingAFacility = function (loggedInResponse) {
|
|
if (loggedInResponse.loggedIn == true) {
|
|
index.missingAFacility();
|
|
}
|
|
};
|
|
|
|
index.missingAFacilityBinder = function () {
|
|
$.cookie('openMissingAFacilityDialog', true);
|
|
var popupBasedAuthenticationJs = new PopupBasedAuthentication();
|
|
popupBasedAuthenticationJs.requireLoggedIn('', '');
|
|
};
|
|
} |