Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28664

Make it possible to define the theme base on the user's context in the Web UI

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.10
    • Fix Version/s: QualifiedToSchedule
    • Component/s: Web UI

      Description

      Currently, the setting of the theme in the Web UI is quite static, to make it configurable based on e.g. the user's context, some JS code is needed:

      <script>
        const app = document.querySelector('nuxeo-app');
        function customThemeLogics() {
          const setTheme = (theme) => {
            if (localStorage.getItem('theme') !== theme) {
              localStorage.setItem('theme', theme);
              location.reload();
            }
          }
          const groups = app.currentUser.extendedGroups;
          if (groups.find((group) => group.name === 'administrators')) {
            setTheme('kawaii');
          } else {
            setTheme('default');
          }
        }
        if (app.currentUser) {
          customThemeLogics();
        }
        app.$.nxcon.addEventListener('user-changed', customThemeLogics);
      </script>
      

      Make it easier to configure.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vdutat Vincent Dutat
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: