Uploaded image for project: 'OpenAM'
  1. OpenAM
  2. OPENAM-14054

XUI Custom templates and Partials not applied consistently

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0.0, 6.0.0.1, 6.0.0.2, 6.0.0.3, 6.0.0.4, 6.0.0.5, 6.5.0, 6.0.0.6, 6.5.0.1, 7.0.0
    • Fix Version/s: 6.5.2, 7.0.0
    • Component/s: XUI
    • Sprint:
      2019.4 - Coins, 2019.5 - Scissors
    • Support Ticket IDs:

      Description

      Bug description

      There are still a large number of templates that may not be customizable like the KBA and others. Similar in nature to OPENAM-13456

      Usecase:, some of the Templates like Navigation, DefaultBaseTemplate and also some partials like basicSave*.html and basicInput.html cannot be consistently customized as it still uses the default ones. So this make isolating realm customization difficult

      An example :


       

      How to reproduce the issue

      1. Create a test realm
      2. Assign a dark to this realm

      +        "test-theme": {
      +            // An ordered list of URLs to stylesheets that will be applied to e
      +            stylesheets: [
      +                "themes/test-theme/css/bootstrap.min.css",
      +                StructureStyle,
      +                "themes/test-theme/css/theme-dark.css"
      +            ],
      +            path: "test-theme-path/",
      +            settings: {
      +                loginLogo: {
      +                    src: "themes/test-theme/images/login-logo-white.png",
      +                    title: "Test-ForgeRock",
      +                    alt: "Test-ForgeRock",
      +                    height: "128px",
      +                    width: "120px"
      +                }
      +            }
      +        },
               "fr-dark-theme": {
                   // An ordered list of URLs to stylesheets that will be applied to e
                   stylesheets: [
      @@ -80,6 +98,7 @@ export default {
           mappings: [
               // Use the theme with the key "my-theme" if the realm is either /my-rea
               //{ theme: "my-theme", realms: ["/my-realm", "/my/sub-realm"] }
      +        { theme: "test-theme", realms: ["/test"] }
      

      ie: the test-theme folder is same as the dark theme CSS
      and the theme/test-theme-path/ holds the customized template/partials

      3. You can copy the template, partials to test-theme-path
      4. Now edit say the DefaultBaseTemplate and others to tag the context so can see
      which one is used (ie the one in the default or the custom one in test-theme-path)

      Many other templates includes KBA, SelfService, Navigation.

      Expected behaviour
      All customized templates/partials should be used
      
      Current behaviour
      Some of the template, partials uses the default. So inconsistent application. This is seen on 6.0.0.5 and 6.5.0
      

      Work around

      Similar to OPENAM-13456 for some of these.

      Just for the templates case (not the partial), just need to go over all the templates to move the define to like this
      For example, the changes is to make the change from

      --- a/openam-ui/openam-ui-ria/src/main/js/org/forgerock/commons/ui/common/main/AbstractView.js
      +++ b/openam-ui/openam-ui-ria/src/main/js/org/forgerock/commons/ui/common/main/AbstractView
      @@ -25,11 +25,10 @@ define([
           "ThemeManager",
           "org/forgerock/commons/ui/common/util/UIUtils",
           "org/forgerock/commons/ui/common/main/ValidatorsManager",
      -    "templates/common/DefaultBaseTemplate",
           "handlebars-template-loader/runtime",
           "org/forgerock/openam/ui/common/util/es6/unwrapDefaultExport"
       ], ($, _, Backbone, Configuration, Constants, EventManager, Router, ThemeManage
      -    ValidatorsManager, DefaultBaseTemplate, Handlebars, unwrapDefaultExport) =>
      +    ValidatorsManager, Handlebars, unwrapDefaultExport) => {
           /**
            * @exports org/forgerock/commons/ui/common/main/AbstractView
            */
      @@ -68,7 +67,7 @@ define([
                */
               element: "#content",
       
      -        baseTemplate: DefaultBaseTemplate,
      +        baseTemplate: "common/DefaultBaseTemplate",
       
               /**
                * View mode: replace or append
      

      There are many of these KBA, SelfService, Navigation, etc etc. So correcting are required for all these so that it uses only the correct template instead of the default one

      The ones that pertains to partials like basicInput basicSave and kbaItems (especially in The KBA with security question in UsersProfileKBATab.js is a bit problematic)

      One workaround is
      a) Put all the needed partials to the preload list in UIUtils.js (org/forgerock/commons/ui/common/util/UIUtils)
      b) For those code that access these partials using JS import, change them to remove them
      c) For code like UserProfileKBATab.js that access the partials directly the following works

      -    KBAItemPartial) => {
      +    Handlebars) {
      
      ...
      +           // Assuming partials are registered
      +           let KBAItemPartial = Handlebars.partials['profile/_kbaItem'];
                   kbaItems.append(
                       $("<li>").html(KBAItemPartial({
                           questions: this.data.predefinedQuestions,
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                phil.ostler Phil Ostler [X] (Inactive)
                Reporter:
                chee-weng.chea C-Weng C
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: