src/Products/SchoolNowBundle/Resources/views/dashboard/default/main.html.twig line 1

Open in your IDE?
  1. {% extends '@ProductsSchoolNow/base.html.twig' %}
  2. {% do dom_title_section('Dashboard') %}
  3. {% set compose = (compose is defined) ? compose : true %}
  4. {% set actions = (actions is defined) ? actions : true %}
  5. {% block header %}
  6.     {% if announcements|length > 0 %}
  7.         <div class="feeds__area">
  8.             {% for announcement in announcements %}
  9.                 {% embed '@ui2022/alert.html.twig' with {
  10.                     styles: announcement.state,
  11.                 } %}
  12.                     {% block content %}
  13.                         {% if not (announcement.title starts with 'hideme') %}
  14.                             <h4 class="alert-heading">{{ announcement.title }}</h4>
  15.                         {% endif %}
  16.                         <p>{{ announcement.description|raw }}</p>
  17.                     {% endblock %}
  18.                 {% endembed %}
  19.             {% endfor %}
  20.         </div>
  21.     {% endif %}
  22. {% endblock %}
  23. {% block content %}
  24.     <div class="feeds__area">
  25.         {% if form is defined and form %}
  26.             {% include '@ui2022/schoolnow/feed__search__box.html.twig' with {
  27.                 form: form,
  28.             } %}
  29.         {% endif %}
  30.         {% if compose %}
  31.             <div class="feeds__compose">
  32.                 {% if isGrantedShare %}
  33.                     {% include '@ui2022/schoolnow/feature__button.html.twig' with {
  34.                         title: 'Share a Post',
  35.                         image: '/ui2022/images/sharepost.svg',
  36.                         link: path('app.schoolnow.dashboard.default.create'),
  37.                     } %}
  38.                 {% endif %}
  39.                 {% if maybe_granted(['app.notifications.messaging.general', 'app.notifications.messaging.urgent']) %}
  40.                     {% include '@ui2022/schoolnow/feature__button.html.twig' with {
  41.                         title: 'Send a Message',
  42.                         image: '/ui2022/images/sendmessage.svg',
  43.                         link: path('app.notifications.dashboard.default.select_modal'),
  44.                         modal: 'modal__new_broadcast',
  45.                     } %}
  46.                 {% endif %}
  47.             </div>
  48.         {% endif %}
  49.         <div id="feeds__list" class="feeds__list">
  50.             {% if notifications is defined %}
  51.                 {% for notification in notifications %}
  52.                     {% include '@ProductsSchoolNow/dashboard/default/_entry.html.twig' with {
  53.                         entry: notification,
  54.                         type: 'notification',
  55.                         modal: 'feed-entry-modal',
  56.                         actions: [],
  57.                     } %}
  58.                 {% endfor %}
  59.             {% endif %}
  60.             {% if feed|length %}
  61.                 {% for entry in feed %}
  62.                     {% if entry.entry is defined %}
  63.                         {% set entry = entry.entry %}
  64.                     {% endif %}
  65.                     {% set attributes = attributes_expression([
  66.                         entry.department ? 'campussuite.cms.container.%s.manage'|format(entry.department.type) : null,
  67.                         'campussuite.cms.module.manage',
  68.                     ]) %}
  69.                     {% set socialPostCount = 0 %}
  70.                     {% if (entry.object is defined) and (entry.object is not empty) and (entry.object.socialPosts is defined) and (entry.object.socialPosts is not empty) %}
  71.                         {% set socialPostCount = entry.object.socialPosts|length %}
  72.                     {% endif %}
  73.                     {% set subMenuItems = [] %}
  74.                     {% if 0 < socialPostCount %}
  75.                         {% set subMenuItems = subMenuItems|merge(
  76.                             [
  77.                                 {
  78.                                     title: 'Social Posts (' ~ socialPostCount ~ ')',
  79.                                     link: path('app.schoolnow.dashboard.default.social_accounts', {
  80.                                         entry: entry.id
  81.                                     }),
  82.                                     modal: 'feed-entry-modal2',
  83.                                 },
  84.                             ]
  85.                         ) %}
  86.                     {% endif %}
  87.                     {% set subMenuItems = subMenuItems|merge(
  88.                         [
  89.                             {
  90.                                 title: 'Delete',
  91.                                 link: path('app.schoolnow.dashboard.default.delete', {
  92.                                     entry: entry.id,
  93.                                 }),
  94.                                 modal: 'feed-entry-modal2',
  95.                             },
  96.                         ]
  97.                     ) %}
  98.                     {% include '@ProductsSchoolNow/dashboard/default/_entry.html.twig' with {
  99.                         entry: entry,
  100.                         type: entry.type is not defined ? 'notification' : null,
  101.                         modal: 'feed-entry-modal',
  102.                         actions: actions ? [
  103.                             entry.type is not defined ? null : is_granted('app.feed.pin') ? {
  104.                                 icon: 'icon-pin',
  105.                                 toggled: entry.pinned,
  106.                                 toggler: path('app.schoolnow.dashboard.default.pin', {
  107.                                     entry: entry.id,
  108.                                 }),
  109.                             } : null,
  110.                             is_granted(attributes, [entry, entry.department]) ? {
  111.                                 title: 'More',
  112.                                 items: subMenuItems,
  113.                             } : null,
  114.                             is_granted(attributes, [entry, entry.department]) ? {
  115.                                 title: 'Edit',
  116.                                 link: path('app.schoolnow.dashboard.default.update', {
  117.                                     entry: entry.id,
  118.                                 }),
  119.                             } : null,
  120.                         ]|filter((v) => v is not empty) : null,
  121.                     } %}
  122.                 {% endfor %}
  123.             {% else %}
  124.                 <p class="alert alert-dark text-center">
  125.                     The search did not find any results.<br />
  126.                     <a href="{{ path('app.schoolnow.dashboard.default.main') }}">Clear search</a>
  127.                 </p>
  128.             {% endif %}
  129.         </div>
  130.         {% if feed is not empty and pagination is defined %}
  131.             {% include '@ui2022/pagination.html.twig' with pagination %}
  132.         {% endif %}
  133.     </div>
  134.     <script type="text/javascript">
  135.         (function (window, document, $, undefined) {
  136.             $(function () {
  137.                 $('#feeds__list')
  138.                     .on('done.toggler', '[data-trigger="toggler"]', function (e) {
  139.                         var $target = $(e.currentTarget);
  140.                         $target.closest('.options').find('.feedbox__pinned').toggleClass('pinned', $target.is(':checked'));
  141.                     })
  142.                 ;
  143.             });
  144.         })(window, document, jQuery);
  145.     </script>
  146. {% endblock %}
  147. {% block modals %}
  148.     {{ parent() }}
  149.     {% include '@ui2022/modal.html.twig' with {
  150.         attr: {
  151.             id: 'feed-entry-modal2',
  152.         },
  153.     } %}
  154.     {% include '@ui2022/schoolnow/modal--full.html.twig' with {
  155.         attr: {
  156.             id: 'feed-entry-modal',
  157.             class: 'modal-feedpostdetail modal-feeds',
  158.         },
  159.     } %}
  160.     {% include '@ui2022/modal.html.twig' with {
  161.         dialog_styles: 'scrollable centered',
  162.         attr: {
  163.             id: 'modal__new_broadcast',
  164.             class: 'modal-ajax',
  165.         },
  166.     } %}
  167. {% endblock %}