Ghost/ghost/admin/app/templates/pages.hbs
Simon Backx 854f616f70
Added bulk edit pages API and admin UI (#16633)
refs https://github.com/TryGhost/Team/issues/2677

- This extends the bulk editing UI to pages.
- New endpoints for editing pages in bulk
- Support for type in bulk edit UI
- Fixed empty messages for lists
- Minor bugfixes (e.g. save button when adding tags became red because
task didn't return true)

---

This pull request adds support for bulk editing and deleting of pages in
the admin UI and the API. It refactors the context menu component and
the list templates to handle different types of content (posts or pages)
dynamically. It also updates the selection list utility and the no posts
box component to work with the new feature. It modifies the `posts.js`
and `pages.js` API files and the corresponding input and output
serializers and routes.
2023-04-14 12:16:15 +02:00

90 lines
4.4 KiB
Handlebars

<section class="gh-canvas gh-canvas-sticky">
<GhCanvasHeader class="gh-canvas-header sticky break tablet post-header">
<GhCustomViewTitle @title="Pages" @query={{reset-query-params "posts"}} />
<section class="view-actions">
<PostsList::ContentFilter
@currentUser={{this.session.user}}
@selectedType={{this.selectedType}}
@availableTypes={{this.availableTypes}}
@onTypeChange={{this.changeType}}
@selectedVisibility={{this.selectedVisibility}}
@availableVisibilities={{this.availableVisibilities}}
@onVisibilityChange={{this.changeVisibility}}
@selectedAuthor={{this.selectedAuthor}}
@availableAuthors={{this.availableAuthors}}
@onAuthorChange={{this.changeAuthor}}
@selectedTag={{this.selectedTag}}
@availableTags={{this.availableTags}}
@onTagChange={{this.changeTag}}
@selectedOrder={{this.selectedOrder}}
@availableOrders={{this.availableOrders}}
@onOrderChange={{this.changeOrder}}
/>
<LinkTo @route="editor.new" @model="page" class="gh-btn gh-btn-primary view-actions-top-row" data-test-new-page-button={{true}}><span>New page</span></LinkTo>
</section>
</GhCanvasHeader>
<section class="view-container content-list">
<div class="{{if this.feature.memberAttribution 'gh-list-sticky'}}">
{{#if (feature "makingItRain")}}
<PostsList::List
@model={{this.postsInfinityModel}}
@list={{this.selectionList}}
>
<li class="no-posts-box">
<div class="no-posts">
{{#if this.showingAll}}
{{svg-jar "pages-placeholder" class="gh-pages-placeholder"}}
<h4>Tell the world about yourself.</h4>
<LinkTo @route="editor.new" @model="page" class="gh-btn gh-btn-green">
<span>Create a new page</span>
</LinkTo>
{{else}}
<h4>No pages match the current filter</h4>
<LinkTo @route="pages" @query={{hash type=null author=null tag=null}} class="gh-btn">
<span>Show all pages</span>
</LinkTo>
{{/if}}
</div>
</li>
</PostsList::List>
{{else}}
<ol class="pages-list gh-list {{unless this.postsInfinityModel "no-posts"}} {{if this.feature.memberAttribution 'feature-memberAttribution'}}">
{{#each this.postsInfinityModel as |page|}}
<PostsList::ListItemOld
@post={{page}}
data-test-page-id={{page.id}}
/>
{{else}}
<li class="no-posts-box">
<div class="no-posts">
{{#if this.showingAll}}
{{svg-jar "pages-placeholder" class="gh-pages-placeholder"}}
<h4>Tell the world about yourself.</h4>
<LinkTo @route="editor.new" @model="page" class="gh-btn gh-btn-green">
<span>Create a new page</span>
</LinkTo>
{{else}}
<h4>No pages match the current filter</h4>
<LinkTo @route="pages" @query={{hash type=null author=null tag=null}} class="gh-btn">
<span>Show all pages</span>
</LinkTo>
{{/if}}
</div>
</li>
{{/each}}
</ol>
{{/if}}
</div>
<GhInfinityLoader
@infinityModel={{this.postsInfinityModel}}
@scrollable=".gh-main"
@triggerOffset={{1000}} />
</section>
{{outlet}}
</section>