main-device.js revision 04b85bef6dff6130a273a91f6f4e64bbe84895d2
0N/A/**
0N/A * The contents of this file are subject to the terms of the Common Development and
0N/A * Distribution License (the License). You may not use this file except in compliance with the
0N/A * License.
0N/A *
0N/A * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
0N/A * specific language governing permission and limitations under the License.
0N/A *
0N/A * When distributing Covered Software, include this CDDL Header Notice in each file and include
0N/A * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
0N/A * Header, with the fields enclosed by brackets [] replaced by your own identifying
0N/A * information: "Portions copyright [year] [name of copyright owner]".
0N/A *
0N/A * Copyright 2015-2016 ForgeRock AS.
0N/A */
0N/A
0N/Arequire.config({
0N/A map: {
0N/A "*" : {
0N/A "ThemeManager" : "org/forgerock/openam/ui/common/util/ThemeManager",
0N/A "Router": "org/forgerock/openam/ui/common/SingleRouteRouter",
0N/A // TODO: Remove this when there are no longer any references to the "underscore" dependency
0N/A "underscore" : "lodash"
0N/A }
0N/A },
0N/A paths: {
0N/A "lodash": "libs/lodash-3.10.1-min",
0N/A "handlebars": "libs/handlebars-4.0.5",
0N/A "i18next": "libs/i18next-1.7.3-min",
0N/A "jquery": "libs/jquery-2.1.1-min",
0N/A "text": "libs/text"
0N/A },
0N/A shim: {
0N/A "handlebars": {
0N/A exports: "handlebars"
0N/A },
0N/A "i18next": {
0N/A deps: ["jquery", "handlebars"],
0N/A exports: "i18next"
0N/A },
0N/A "lodash": {
0N/A exports: "_"
0N/A }
0N/A }
0N/A});
0N/A
0N/Arequire([
0N/A "jquery",
0N/A "handlebars",
0N/A "org/forgerock/commons/ui/common/main/Configuration",
0N/A "org/forgerock/openam/ui/common/util/Constants",
0N/A "text!templates/user/DeviceTemplate.html",
0N/A "text!templates/user/DeviceDoneTemplate.html",
0N/A "text!templates/common/LoginBaseTemplate.html",
0N/A "text!templates/common/FooterTemplate.html",
0N/A "text!templates/common/LoginHeaderTemplate.html",
0N/A "org/forgerock/commons/ui/common/main/i18nManager",
0N/A "ThemeManager",
0N/A "Router"
0N/A], function ($, HandleBars, Configuration, Constants, DeviceTemplate, DeviceDoneTemplate,
0N/A LoginBaseTemplate, FooterTemplate, LoginHeaderTemplate, i18nManager, ThemeManager, Router) {
0N/A var data = window.pageData,
0N/A template = data.done ? DeviceDoneTemplate : DeviceTemplate;
0N/A
0N/A i18nManager.init({
0N/A paramLang: {
0N/A locale: data.locale
0N/A },
0N/A defaultLang: Constants.DEFAULT_LANGUAGE,
0N/A nameSpace: "device"
0N/A });
0N/A
0N/A Configuration.globalData = { realm : data.realm };
0N/A Router.currentRoute = {
0N/A navGroup: "user"
0N/A };
0N/A
0N/A ThemeManager.getTheme().always(function (theme) {
0N/A data.theme = theme;
0N/A
0N/A $("#wrapper").html(HandleBars.compile(LoginBaseTemplate)(data));
0N/A $("#footer").html(HandleBars.compile(FooterTemplate)(data));
0N/A $("#loginBaseLogo").html(HandleBars.compile(LoginHeaderTemplate)(data));
0N/A $("#content").html(HandleBars.compile(template)(data));
0N/A });
0N/A});
0N/A