-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#101 - ContextHub profile requires "manual" loading of current reques…
…t user. Consolidates JS calls to remove issue w/ duplicative JS code execution. (#117)
- Loading branch information
1 parent
3e8255c
commit 4fdcff3
Showing
5 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,5 @@ data.js | |
navigation.js | ||
form-data.js | ||
ajax.js | ||
events.js | ||
|
||
|
||
|
||
|
||
contexthub.js | ||
events.js |
49 changes: 49 additions & 0 deletions
49
...main/content/jcr_root/apps/asset-share-commons/clientlibs/clientlib-site/js/contexthub.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Asset Share Commons | ||
* | ||
* Copyright [2017] Adobe | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/*global jQuery: false, AssetShare: false, ContextHub: false */ | ||
|
||
AssetShare.ContextHub.Profile = (function ($, ns, contextHub) { | ||
"use strict"; | ||
|
||
$(function() { | ||
// https://github.com/Adobe-Marketing-Cloud/aem-sample-we-retail/blob/master/ui.apps/src/main/content/jcr_root/apps/weretail/components/structure/header/clientlib/js/utilities.js | ||
$.ajax({ | ||
type : "GET", | ||
url : "/libs/granite/security/currentuser.json?nocache=" + new Date().getTime(), | ||
async : true, | ||
success: function (json) { | ||
|
||
// On publish: load the request user into ContextHub | ||
if (typeof contextHub !== "undefined") { | ||
var profileStore = contextHub.getStore("profile"), | ||
requestUser = json.home, | ||
contextHubUser = profileStore.getTree().path; | ||
|
||
if (!contextHubUser || contextHubUser !== requestUser) { | ||
profileStore.loadProfile(requestUser); | ||
} | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
return {}; | ||
}(jQuery, | ||
AssetShare, | ||
ContextHub)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters