Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-30214: Add Content Tree to Bookmarks, Trash & Search #877

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/bundle/Resources/encore/ez.js.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ module.exports = (Encore) => {
path.resolve(__dirname, '../public/js/scripts/button.state.toggle.js'),
path.resolve(__dirname, '../public/js/scripts/button.content.edit.js'),
path.resolve(__dirname, '../public/js/scripts/admin.version.edit.conflict.js'),
path.resolve(__dirname, '../public/js/scripts/admin.content.tree.js'),
])
.addEntry('ezplatform-admin-ui-content-draft-list-js', [
path.resolve(__dirname, '../public/js/scripts/button.state.toggle.js'),
path.resolve(__dirname, '../public/js/scripts/button.content.edit.js'),
path.resolve(__dirname, '../public/js/scripts/admin.version.edit.conflict.js'),
path.resolve(__dirname, '../public/js/scripts/admin.content.tree.js'),
])
.addEntry('ezplatform-admin-ui-content-type-create-js', [
path.resolve(__dirname, '../public/js/scripts/admin.contenttype.selection.js'),
Expand Down Expand Up @@ -155,17 +157,21 @@ module.exports = (Encore) => {
path.resolve(__dirname, '../public/js/scripts/button.content.edit.js'),
path.resolve(__dirname, '../public/js/scripts/admin.search.filters.js'),
path.resolve(__dirname, '../public/js/scripts/udw/select.location.js'),
path.resolve(__dirname, '../public/js/scripts/admin.content.tree.js'),
])
.addEntry('ezplatform-admin-ui-section-list-js', [
path.resolve(__dirname, '../public/js/scripts/admin.section.list.js'),
path.resolve(__dirname, '../public/js/scripts/button.state.toggle.js'),
])
.addEntry('ezplatform-admin-ui-section-view-js', [path.resolve(__dirname, '../public/js/scripts/admin.section.view.js')])
.addEntry('ezplatform-admin-ui-trash-list-js', [path.resolve(__dirname, '../public/js/scripts/admin.trash.list.js')])
.addEntry('ezplatform-admin-ui-trash-list-js', [
path.resolve(__dirname, '../public/js/scripts/admin.trash.list.js'),
path.resolve(__dirname, '../public/js/scripts/admin.content.tree.js'),
])
.addEntry('ezplatform-admin-ui-content-preview-js', [path.resolve(__dirname, '../public/js/scripts/admin.preview.js')])
.addEntry('ezplatform-admin-ui-location-view-js', [
path.resolve(__dirname, '../public/js/scripts/admin.location.change.language.js'),
path.resolve(__dirname, '../public/js/scripts/admin.location.content.tree.js'),
path.resolve(__dirname, '../public/js/scripts/admin.content.tree.js'),
path.resolve(__dirname, '../public/js/scripts/admin.location.view.js'),
path.resolve(__dirname, '../public/js/scripts/admin.location.tab.js'),
path.resolve(__dirname, '../public/js/scripts/admin.location.visibility.js'),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.ez-content-view {
.ez-content-view,
.ez-bookmark-list-view,
.ez-search-view,
.ez-trash-list-view,
.ez-drafts-list-view {
.ez-content-container {
display: flex;
min-width: 0;
}

Expand All @@ -12,7 +15,6 @@
background: $ez-white;
color: inherit;
transition: max-width 0.2s $ez-admin-transition;
margin-bottom: calculateRem(-24px);

&--expanded {
display: initial;
Expand All @@ -27,7 +29,7 @@
}
}

.ez-location-view-container {
.ez-view-container {
flex: 1 1 auto;
min-width: 0;
}
Expand Down
37 changes: 6 additions & 31 deletions src/bundle/Resources/public/scss/_main-row.scss
Original file line number Diff line number Diff line change
@@ -1,38 +1,13 @@
.ez-main-row {
display: grid;
grid-template-columns: 1fr calculateRem(80px);
grid-template-rows: auto;
grid-template-areas: 'ez-content-container ez-context-menu';

.ez-content-container {
grid-area: ez-content-container;
}
display: flex;
flex-wrap: nowrap;

.ez-side-menu,
.ez-context-menu {
grid-area: ez-context-menu;
}

.ez-has-two-sidebars & {
grid-template-columns: calculateRem(80px) 1fr calculateRem(80px);
grid-template-areas: 'ez-side-menu ez-content-container ez-context-menu';

.ez-side-menu {
grid-area: ez-side-menu;
}
flex: 0 0 calculateRem(80px);
}

.ez-has-no-sidebars & {
grid-template-columns: 1fr;
grid-template-areas: 'ez-content-container';

.ez-context-menu,
.ez-side-menu {
display: none;
}
}

&.ez-dashboard-row {
grid-template-columns: 1fr;
grid-template-areas: 'ez-content-container';
.ez-content-container {
flex: 1 1 auto;
}
}
2 changes: 1 addition & 1 deletion src/bundle/Resources/public/scss/ezplatform.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@
@import 'admin.section-view';
@import 'admin.content-type-view';
@import 'main-row';
@import 'view-content';
@import 'content-tree';
132 changes: 69 additions & 63 deletions src/bundle/Resources/views/admin/bookmark/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,72 +22,74 @@
'attr': { 'class': 'ez-toggle-btn-state', 'data-toggle-button-id': '#bookmark_remove_remove' }
}) }}
{% include '@ezdesign/parts/table_header.html.twig' with {
ground: 'mt-3',
headerText: 'bookmark.table.header'|trans|desc('Bookmarks') ~ ' (' ~ pager.count ~ ')',
tools: form_widget(form_remove.remove, {'attr': {'class': 'btn btn-danger', 'disabled': true}})
} %}
<table class="ez-table table">
<thead>
<tr>
<th class="ez-table__header-cell"></th>
<th class="ez-table__header-cell ez-table__header-cell--has-icon"></th>
<th class="ez-table__header-cell ez-table__header-cell--after-icon">{{ 'bookmark.list.name'|trans|desc('Name') }}</th>
<th class="ez-table__header-cell">{{ 'bookmark.list.content_type'|trans|desc('Content Type') }}</th>
<th class="ez-table__header-cell">{{ 'bookmark.list.path'|trans|desc('Path') }}</th>
<th class="ez-table__header-cell"></th>
</tr>
</thead>
<tbody>
{% if pager.count is same as(0) %}
<tr>
<td class="ez-table__cell ez-table__cell--no-content" colspan="5">
<span class="mb-0 py-1 pl-0">{{ 'bookmark.list.empty'|trans|desc('The bookmark list is empty. Any Content item you bookmark will end up here.') }}</span>
</td>
</tr>
{% else %}
{% for bookmark in pager.currentPageResults %}
ground: 'mt-3',
headerText: 'bookmark.table.header'|trans|desc('Bookmarks') ~ ' (' ~ pager.count ~ ')',
tools: form_widget(form_remove.remove, {'attr': {'class': 'btn btn-danger', 'disabled': true}})
} %}
<div class="ez-scrollable-table-wrapper">
<table class="ez-table table">
<thead>
<tr>
<td class="ez-table__cell ez-table__cell--has-checkbox">{{ form_widget(form_remove.bookmarks[bookmark.id]) }}</td>
<td class="ez-table__cell ez-table__cell--has-icon">
<svg class="ez-icon ez-icon--small">
<use xlink:href="{{ ez_content_type_icon(bookmark.contentType.identifier) }}"></use>
</svg>
</td>
<td class="ez-table__cell ez-table__cell--after-icon"><a href="{{ path('_ezpublishLocation', { 'locationId': bookmark.id }) }}">{{ ez_content_name(bookmark.contentInfo) }}</a></td>
<td class="ez-table__cell">{{ bookmark.contentType.name }}</td>
<td class="ez-table__cell">
{% if bookmark.pathLocations|length > 1 %}
{% for location in bookmark.pathLocations %}
{% if loop.revindex > 1 %}
<a href="{{ path('_ezpublishLocation', {'locationId': location.id}) }}">
{{ ez_content_name(location.contentInfo) }}
</a>
{% if loop.revindex > 2 %}/{% endif %}
{% endif %}
{% endfor %}
{% else %}
-
{% endif %}
</td>
<td class="ez-table__cell ez-table__cell--has-action-btns text-right">
{% if bookmark.userCanEdit %}
<button
class="btn btn-icon mx-2 ez-btn--content-edit"
title="{{ 'bookmark.list.content.edit'|trans|desc('Edit Content') }}"
data-content-id="{{ bookmark.contentInfo.id }}"
data-version-no="{{ bookmark.contentInfo.currentVersionNo }}"
data-language-code="{{ bookmark.contentInfo.mainLanguageCode }}">
<svg class="ez-icon ez-icon-edit">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#edit"></use>
</svg>
</button>
{% endif %}
<th class="ez-table__header-cell"></th>
<th class="ez-table__header-cell ez-table__header-cell--has-icon"></th>
<th class="ez-table__header-cell ez-table__header-cell--after-icon">{{ 'bookmark.list.name'|trans|desc('Name') }}</th>
<th class="ez-table__header-cell">{{ 'bookmark.list.content_type'|trans|desc('Content Type') }}</th>
<th class="ez-table__header-cell">{{ 'bookmark.list.path'|trans|desc('Path') }}</th>
<th class="ez-table__header-cell"></th>
</tr>
</thead>
<tbody>
{% if pager.count is same as(0) %}
<tr>
<td class="ez-table__cell ez-table__cell--no-content" colspan="5">
<span class="mb-0 py-1 pl-0">{{ 'bookmark.list.empty'|trans|desc('The bookmark list is empty. Any Content item you bookmark will end up here.') }}</span>
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
{% else %}
{% for bookmark in pager.currentPageResults %}
<tr>
<td class="ez-table__cell ez-table__cell--has-checkbox">{{ form_widget(form_remove.bookmarks[bookmark.id]) }}</td>
<td class="ez-table__cell ez-table__cell--has-icon">
<svg class="ez-icon ez-icon--small">
<use xlink:href="{{ ez_content_type_icon(bookmark.contentType.identifier) }}"></use>
</svg>
</td>
<td class="ez-table__cell ez-table__cell--after-icon"><a href="{{ path('_ezpublishLocation', { 'locationId': bookmark.id }) }}">{{ ez_content_name(bookmark.contentInfo) }}</a></td>
<td class="ez-table__cell">{{ bookmark.contentType.name }}</td>
<td class="ez-table__cell">
{% if bookmark.pathLocations|length > 1 %}
{% for location in bookmark.pathLocations %}
{% if loop.revindex > 1 %}
<a href="{{ path('_ezpublishLocation', {'locationId': location.id}) }}">
{{ ez_content_name(location.contentInfo) }}
</a>
{% if loop.revindex > 2 %}/{% endif %}
{% endif %}
{% endfor %}
{% else %}
-
{% endif %}
</td>
<td class="ez-table__cell ez-table__cell--has-action-btns text-right">
{% if bookmark.userCanEdit %}
<button
class="btn btn-icon mx-2 ez-btn--content-edit"
title="{{ 'bookmark.list.content.edit'|trans|desc('Edit Content') }}"
data-content-id="{{ bookmark.contentInfo.id }}"
data-version-no="{{ bookmark.contentInfo.currentVersionNo }}"
data-language-code="{{ bookmark.contentInfo.mainLanguageCode }}">
<svg class="ez-icon ez-icon-edit">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#edit"></use>
</svg>
</button>
{% endif %}
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
{{ form_end(form_remove) }}


Expand Down Expand Up @@ -115,6 +117,10 @@
</div>
{% endblock %}

{% block react_modules %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved Content Tree container div to parent twig, but I've left JS in lower templates as I don't want to load them globally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone has idea how to solve this problem I would readily hear it. :)

{{ encore_entry_script_tags('ezplatform-admin-ui-modules-content-tree-js', null, 'ezplatform') }}
{% endblock %}

{% block javascripts %}
{{ encore_entry_script_tags('ezplatform-admin-ui-bookmark-list-js', null, 'ezplatform') }}
{% endblock %}
Loading