{% extends '@ProductsSchoolNow/base.html.twig' %}
{% do dom_title_section('Dashboard') %}
{% set compose = (compose is defined) ? compose : true %}
{% set actions = (actions is defined) ? actions : true %}
{% block header %}
{% if announcements|length > 0 %}
<div class="feeds__area">
{% for announcement in announcements %}
{% embed '@ui2022/alert.html.twig' with {
styles: announcement.state,
} %}
{% block content %}
{% if not (announcement.title starts with 'hideme') %}
<h4 class="alert-heading">{{ announcement.title }}</h4>
{% endif %}
<p>{{ announcement.description|raw }}</p>
{% endblock %}
{% endembed %}
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% block content %}
<div class="feeds__area">
{% if form is defined and form %}
{% include '@ui2022/schoolnow/feed__search__box.html.twig' with {
form: form,
} %}
{% endif %}
{% if compose %}
<div class="feeds__compose">
{% if isGrantedShare %}
{% include '@ui2022/schoolnow/feature__button.html.twig' with {
title: 'Share a Post',
image: '/ui2022/images/sharepost.svg',
link: path('app.schoolnow.dashboard.default.create'),
} %}
{% endif %}
{% if maybe_granted(['app.notifications.messaging.general', 'app.notifications.messaging.urgent']) %}
{% include '@ui2022/schoolnow/feature__button.html.twig' with {
title: 'Send a Message',
image: '/ui2022/images/sendmessage.svg',
link: path('app.notifications.dashboard.default.select_modal'),
modal: 'modal__new_broadcast',
} %}
{% endif %}
</div>
{% endif %}
<div id="feeds__list" class="feeds__list">
{% if notifications is defined %}
{% for notification in notifications %}
{% include '@ProductsSchoolNow/dashboard/default/_entry.html.twig' with {
entry: notification,
type: 'notification',
modal: 'feed-entry-modal',
actions: [],
} %}
{% endfor %}
{% endif %}
{% if feed|length %}
{% for entry in feed %}
{% if entry.entry is defined %}
{% set entry = entry.entry %}
{% endif %}
{% set attributes = attributes_expression([
entry.department ? 'campussuite.cms.container.%s.manage'|format(entry.department.type) : null,
'campussuite.cms.module.manage',
]) %}
{% set socialPostCount = 0 %}
{% if (entry.object is defined) and (entry.object is not empty) and (entry.object.socialPosts is defined) and (entry.object.socialPosts is not empty) %}
{% set socialPostCount = entry.object.socialPosts|length %}
{% endif %}
{% set subMenuItems = [] %}
{% if 0 < socialPostCount %}
{% set subMenuItems = subMenuItems|merge(
[
{
title: 'Social Posts (' ~ socialPostCount ~ ')',
link: path('app.schoolnow.dashboard.default.social_accounts', {
entry: entry.id
}),
modal: 'feed-entry-modal2',
},
]
) %}
{% endif %}
{% set subMenuItems = subMenuItems|merge(
[
{
title: 'Delete',
link: path('app.schoolnow.dashboard.default.delete', {
entry: entry.id,
}),
modal: 'feed-entry-modal2',
},
]
) %}
{% include '@ProductsSchoolNow/dashboard/default/_entry.html.twig' with {
entry: entry,
type: entry.type is not defined ? 'notification' : null,
modal: 'feed-entry-modal',
actions: actions ? [
entry.type is not defined ? null : is_granted('app.feed.pin') ? {
icon: 'icon-pin',
toggled: entry.pinned,
toggler: path('app.schoolnow.dashboard.default.pin', {
entry: entry.id,
}),
} : null,
is_granted(attributes, [entry, entry.department]) ? {
title: 'More',
items: subMenuItems,
} : null,
is_granted(attributes, [entry, entry.department]) ? {
title: 'Edit',
link: path('app.schoolnow.dashboard.default.update', {
entry: entry.id,
}),
} : null,
]|filter((v) => v is not empty) : null,
} %}
{% endfor %}
{% else %}
<p class="alert alert-dark text-center">
The search did not find any results.<br />
<a href="{{ path('app.schoolnow.dashboard.default.main') }}">Clear search</a>
</p>
{% endif %}
</div>
{% if feed is not empty and pagination is defined %}
{% include '@ui2022/pagination.html.twig' with pagination %}
{% endif %}
</div>
<script type="text/javascript">
(function (window, document, $, undefined) {
$(function () {
$('#feeds__list')
.on('done.toggler', '[data-trigger="toggler"]', function (e) {
var $target = $(e.currentTarget);
$target.closest('.options').find('.feedbox__pinned').toggleClass('pinned', $target.is(':checked'));
})
;
});
})(window, document, jQuery);
</script>
{% endblock %}
{% block modals %}
{{ parent() }}
{% include '@ui2022/modal.html.twig' with {
attr: {
id: 'feed-entry-modal2',
},
} %}
{% include '@ui2022/schoolnow/modal--full.html.twig' with {
attr: {
id: 'feed-entry-modal',
class: 'modal-feedpostdetail modal-feeds',
},
} %}
{% include '@ui2022/modal.html.twig' with {
dialog_styles: 'scrollable centered',
attr: {
id: 'modal__new_broadcast',
class: 'modal-ajax',
},
} %}
{% endblock %}