templates/topbar.html.twig line 1

Open in your IDE?
  1. {% set avatar = _args.avatar %}
  2. {% set displayName = _args.displayName %}
  3. {% do dom_scripts_top([
  4.     'https://honeycomb.style/js/honeycomb.js',
  5. ]) %}
  6. {% set mainItems = [
  7.     (cms.tenant.products.checkAnyFlag('SCHOOLNOW__BASE')) ? {
  8.         title: 'Home',
  9.         link: path('app.schoolnow.dashboard.default.main'),
  10.         active: (app.request.attributes.get('_route') starts with 'app.schoolnow.'),
  11.     } : null,
  12.     maybe_granted('@app.notifications.access') ? {
  13.         title: 'Messages',
  14.         link: path('app.notifications.dashboard.default.main'),
  15.         active: (app.request.attributes.get('_route') starts with 'app.notifications.'),
  16.     } : null,
  17.     {
  18.         title: 'Website',
  19.         link: path('app.app.dashboard.websites.default.main'),
  20.         active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.websites.'),
  21.     },
  22. ]|filter((item) => item is not empty and (not item.permission is defined or is_granted(item.permission))) %}
  23. {% set settingsItems = [
  24.     {
  25.         header: 'Account set-up',
  26.         permission: 'app.schools.admin',
  27.         items: [
  28.         {
  29.             title: 'Schools',
  30.             link: path('app.app.dashboard.settings.schools.list'),
  31.             active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.settings.schools.'),
  32.             icon: 'school',
  33.         },
  34.         {
  35.             title: 'Branding',
  36.             link: path('app.app.dashboard.settings.branding.list'),
  37.             active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.settings.branding.'),
  38.             icon: 'building',
  39.         },
  40.         {
  41.             title: 'Mobile App',
  42.             link: path('app.app.dashboard.settings.mobile.list'),
  43.             active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.settings.mobile.'),
  44.             icon: 'phone',
  45.         },
  46.         {
  47.             title: 'Accessibility',
  48.             link: path('products.ada.dashboard.default.main'),
  49.             active: (app.request.attributes.get('_route') starts with 'products.ada.'),
  50.             icon: "accessibility",
  51.         },
  52.     ],
  53.     },
  54.     {
  55.         header: 'Users and groups',
  56.         permission: 'app.security.admin',
  57.         items: [
  58.         {
  59.             title: 'User accounts',
  60.             link: path('app.app.dashboard.settings.accounts.main'),
  61.             active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.settings.accounts.'),
  62.             icon: 'users',
  63.         },
  64.         {
  65.             title: 'Groups',
  66.             link: path('app.app.dashboard.settings.groups.main'),
  67.             active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.settings.groups.'),
  68.             icon: 'user-group',
  69.         },
  70.         {
  71.             title: 'Roles',
  72.             link: path('app.app.dashboard.settings.roles.main'),
  73.             active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.settings.roles.'),
  74.             icon: 'eye',
  75.         },
  76.     ],
  77.     },
  78.     {
  79.         header: 'Messages',
  80.         permission: 'app.notifications.automations.admin',
  81.         items: [
  82.         {
  83.             title: 'Auto Notices',
  84.             link: path('app.app.dashboard.settings.automations.main'),
  85.             active: (app.request.attributes.get('_route') starts with 'app.app.dashboard.settings.automations.'),
  86.             icon: 'bolt',
  87.         },
  88.     ],
  89.     },
  90.     {
  91.         header: 'Social media',
  92.         permission: 'app.social.admin',
  93.         items: [
  94.         {
  95.             title: 'Connections',
  96.             link: path('cms.tenant.dashboard.social.main'),
  97.             active: (app.request.attributes.get('_route') starts with 'cms.tenant.dashboard.social'),
  98.             icon: 'share-alt',
  99.         },
  100.     ],
  101.     },
  102.     {
  103.         header: null,
  104.         items: [
  105.         is_granted('campussuite.cms.me.sites') ? {
  106.             title: 'Teacher Websites',
  107.             link: path('cms.container.dashboard.container.index_personal'),
  108.             icon: 'page',
  109.         } : null,
  110.     ]
  111.     },
  112.     {
  113.         header: null,
  114.         items: [
  115.         cms.impersonatedAccount is empty ? {
  116.             title: 'Logout',
  117.             link: path('app.platform.security.logout'),
  118.             color: 'danger',
  119.             icon: 'log-out',
  120.         } : {
  121.             title: 'Stop Impersonation',
  122.             link: path('app.schoolnow.dashboard.default.main', { _switch_user: '_exit' }),
  123.             color: 'danger',
  124.             icon: 'log-out',
  125.         },
  126.     ],
  127.     },
  128. ]|filter((item) => item is not empty and (not item.permission is defined or is_granted(item.permission))) %}
  129. {% embed 'hc/header.html.twig' with {
  130.     logoLink: (cms.tenant.products.checkAnyFlag('SCHOOLNOW__BASE'))
  131.     ? path('app.schoolnow.dashboard.default.main')
  132.     : null,
  133. } %}
  134.     {% block mainMenu %}
  135.         {% include 'hc/header-menu-main.html.twig' with {
  136.             items: mainItems,
  137.         } %}
  138.     {% endblock %}
  139.     {% block settingsMenu %}
  140.         {% include 'hc/button.html.twig' with {
  141.             button: 'button',
  142.             text: 'Help',
  143.             sidepanel: 'topbar-help',
  144.             styles: 'primary brand',
  145.             attr: {
  146.                 class: 'mr-3',
  147.             },
  148.             icon: {
  149.                 glyph: 'support',
  150.                 color: 'solid',
  151.                 varinat: 'contrast',
  152.             }
  153.         } %}
  154.         {% embed 'hc/dropdown.html.twig' with {
  155.             separator: 'left',
  156.             items: settingsItems,
  157.             variant: 'account'
  158.         } %}
  159.             {% block toggle %}
  160.                 {% embed 'hc/button-button.html.twig' with {
  161.                     icon: true,
  162.                     dropdown: {
  163.                         caret: true,
  164.                     },
  165.                 } %}
  166.                     {% block content %}
  167.                         {% if avatar %}
  168.                             {% include 'hc/avatar.html.twig' with {
  169.                                 image: avatar
  170.                             } %}
  171.                         {% else %}
  172.                             {% include 'hc/icon.html.twig' with {
  173.                                 glyph: 'user',
  174.                                 variant: 'contrast',
  175.                             } %}
  176.                         {% endif %}
  177.                     {% endblock %}
  178.                 {% endembed %}
  179.             {% endblock %}
  180.             {% block content %}
  181.                 {% embed 'hc/dropdown-menu.html.twig' with {
  182.                     variant: variant,
  183.                     items: items
  184.                 } %}
  185.                     {% block header %}
  186.                         {% include 'hc/header-menu-session.html.twig' with {
  187.                             variant: 'active',
  188.                             avatar: avatar,
  189.                             displayName: displayName,
  190.                             profileLink: path('app.app.dashboard.settings.profiles.view'),
  191.                         } %}
  192.                     {% endblock %}
  193.                 {% endembed %}
  194.             {% endblock %}
  195.         {% endembed %}
  196.     {% endblock %}
  197.     {% block mobileMenu %}
  198.         {% include 'hc/button.html.twig' with {
  199.             button: 'button',
  200.             sidepanel: 'topbar-help',
  201.             styles: 'primary brand ',
  202.             attr: {
  203.                 class: 'mr-3',
  204.             },
  205.             icon: {
  206.                 glyph: 'support',
  207.                 color: 'solid',
  208.                 varinat: 'contrast',
  209.             }
  210.         } %}
  211.         {% embed 'hc/dropdown.html.twig' with {
  212.             items: [{header:null, items: mainItems}],
  213.             mobile: true,
  214.             caret: false,
  215.             icon: {
  216.                 glyph: 'menu',
  217.                 variant: 'contrast',
  218.             }
  219.         } %}
  220.         {% endembed %}
  221.         {% embed 'hc/dropdown.html.twig' with {
  222.             separator: 'left',
  223.             items: settingsItems,
  224.             variant: 'account',
  225.         } %}
  226.             {% block toggle %}
  227.                 {% embed 'hc/button-button.html.twig' with {
  228.                     icon: true,
  229.                     dropdown: {
  230.                         caret: true,
  231.                     },
  232.                 } %}
  233.                     {% block content %}
  234.                         {% if avatar %}
  235.                             {% include 'hc/avatar.html.twig' with {
  236.                                 image: avatar
  237.                             } %}
  238.                         {% else %}
  239.                             {% include 'hc/icon.html.twig' with {
  240.                                 glyph: 'user',
  241.                                 variant: 'contrast',
  242.                             } %}
  243.                         {% endif %}
  244.                     {% endblock %}
  245.                 {% endembed %}
  246.             {% endblock %}
  247.             {% block content %}
  248.                 {% embed 'hc/dropdown-menu.html.twig' with {
  249.                     variant: variant,
  250.                     items: items,
  251.                     mobile: true,
  252.                 } %}
  253.                     {% block header %}
  254.                         {% include 'hc/header-menu-session.html.twig' with {
  255.                             variant: 'active',
  256.                             avatar: avatar,
  257.                             displayName: displayName,
  258.                             profileLink: path('app.app.dashboard.settings.profiles.view'),
  259.                         } %}
  260.                     {% endblock %}
  261.                 {% endembed %}
  262.             {% endblock %}
  263.         {% endembed %}
  264.     {% endblock %}
  265. {% endembed %}