{% extends '@App/dashboard/websites/base.html.twig' %}
{% do dom_title_section('Dashboard') %}
{% block content %}
<div class="row mb-4">
<div class="col text-right">
{% if sites|length %}
{% include '@ui2022/button--a.html.twig' with {
text: 'View Site',
link: web_url_catchall(sites[0]).withQueryParameter('_mimic', app.user.uid),
styles: 'gray',
attr: {
class: 'mr-3',
},
} %}
{% endif %}
{% include '@ui2022/button--a.html.twig' with {
text: '+ Add',
link: path('app.app.dashboard.websites.content.add'),
styles: 'primary',
modal: 'modal__add',
} %}
</div>
</div>
<div class="row">
<div class="col">
{% include '@ui2022/table-filter.html.twig' with {
form: form,
} %}
<div id="{{ form.vars.id }}__results">
{% set headers = [
{
title: 'Name',
sort: 'name',
},
{
title: 'Type',
spacing: 15,
},
{
title: 'Last Modified',
spacing: 25,
sort: 'timestamp',
},
] %}
{% embed '@ui2022/table--search.html.twig' with {
form: form,
headers: headers,
items: items,
} %}
{% block items %}
{% for item in items %}
{% set school = item.container|schoolify %}
{% set link = web_url_view(item) %}
{% set isGranted = is_granted(
attributes_expression([
item.department ? 'campussuite.cms.container.%s.manage'|format(item.department.type) : null,
'campussuite.cms.module.manage',
'campussuite.cms.modules.page.manage',
]),
[item, item.department],
) %}
<tr>
{% include '@ui2022/table__item__cell--status.html.twig' with {
title: item.data.ui,
link: link ? link.withQueryParameter('_mimic', app.user.uid) : null,
actions: [],
status: (not item.placeholder) ? 'sent' : 'draft',
subtext: (not item.placeholder) ? 'Published' : 'Draft',
subicon: school ? 'icon-ui-board' : 'icon-folder',
subinfo: (not school) ? item.container.name : (
(school.department and school.department is same as (item.container))
? school.name
: '%s > %s'|format(
school.name,
item.container.name
)
),
actions: [
isGranted ? {
text: 'More',
dropdown: {
items: [
{
text: 'Delete',
link: path(paths.delete|format(item.discr), {
object: item.id,
}),
modal: 'feed-entry-modal2',
},
],
},
} : null,
isGranted ? {
text: 'Edit',
link: path(paths.update|format(item.discr), {
object: item.id,
}),
} : null,
]|filter((v) => v is not empty),
} %}
<td>
{{ 'app.content.types.%s'|format(item.discr)|trans }}
</td>
<td>
{{ item.timestampedAt|ui_relativeDate }}
{% if item.blamedBy %}
<div class="font-12">{{ item.blamedBy.displayName }}</div>
{% endif %}
</td>
</tr>
{% endfor %}
{% endblock %}
{% endembed %}
{% if items is not empty and pagination is defined %}
{% include '@ui2022/pagination.html.twig' with pagination %}
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% block modals %}
{{ parent() }}
{% include '@ui2022/modal.html.twig' with {
attr: {
id: 'feed-entry-modal2',
},
} %}
{% include '@ui2022/modal.html.twig' with {
dialog_styles: 'scrollable centered',
attr: {
id: 'modal__add',
class: 'modal-ajax',
},
} %}
{% endblock %}