mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Add list of posts to pools
This commit is contained in:
@ -5,6 +5,7 @@ const api = require('../api.js');
|
||||
const misc = require('../util/misc.js');
|
||||
const uri = require('../util/uri.js');
|
||||
const Pool = require('../models/pool.js');
|
||||
const Post = require('../models/post.js');
|
||||
const PoolCategoryList = require('../models/pool_category_list.js');
|
||||
const topNavigation = require('../models/top_navigation.js');
|
||||
const PoolView = require('../views/pool_view.js');
|
||||
@ -42,6 +43,7 @@ class PoolController {
|
||||
canEditNames: api.hasPrivilege('pools:edit:names'),
|
||||
canEditCategory: api.hasPrivilege('pools:edit:category'),
|
||||
canEditDescription: api.hasPrivilege('pools:edit:description'),
|
||||
canEditPosts: api.hasPrivilege('pools:edit:posts'),
|
||||
canMerge: api.hasPrivilege('pools:merge'),
|
||||
canDelete: api.hasPrivilege('pools:delete'),
|
||||
categories: categories,
|
||||
@ -84,6 +86,12 @@ class PoolController {
|
||||
if (e.detail.description !== undefined) {
|
||||
e.detail.pool.description = e.detail.description;
|
||||
}
|
||||
if (e.detail.posts !== undefined) {
|
||||
e.detail.pool.posts.clear()
|
||||
for (let post_id of e.detail.posts) {
|
||||
e.detail.pool.posts.add(Post.fromResponse({ id: parseInt(post_id) }))
|
||||
}
|
||||
}
|
||||
e.detail.pool.save().then(() => {
|
||||
this._view.showSuccess('Pool saved.');
|
||||
this._view.enableForm();
|
||||
|
@ -39,7 +39,7 @@ class PoolCreateController {
|
||||
_evtCreate(e) {
|
||||
this._view.clearMessages();
|
||||
this._view.disableForm();
|
||||
e.detail.pool.save()
|
||||
api.post(uri.formatApiLink('pool'), e.detail)
|
||||
.then(() => {
|
||||
this._view.clearMessages();
|
||||
misc.disableExitConfirmation();
|
||||
@ -50,10 +50,6 @@ class PoolCreateController {
|
||||
this._view.enableForm();
|
||||
});
|
||||
}
|
||||
|
||||
_evtChange(e) {
|
||||
misc.enableExitConfirmation();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = router => {
|
||||
|
@ -13,26 +13,26 @@ const EmptyView = require('../views/empty_view.js');
|
||||
const fields = [
|
||||
'id',
|
||||
'names',
|
||||
/* 'suggestions',
|
||||
* 'implications', */
|
||||
'posts',
|
||||
'creationTime',
|
||||
'postCount',
|
||||
'category'];
|
||||
|
||||
class PoolListController {
|
||||
constructor(ctx) {
|
||||
this._pageController = new PageController();
|
||||
|
||||
if (!api.hasPrivilege('pools:list')) {
|
||||
this._view = new EmptyView();
|
||||
this._view.showError('You don\'t have privileges to view pools.');
|
||||
return;
|
||||
}
|
||||
|
||||
this._ctx = ctx;
|
||||
|
||||
topNavigation.activate('pools');
|
||||
topNavigation.setTitle('Listing pools');
|
||||
|
||||
this._ctx = ctx;
|
||||
this._pageController = new PageController();
|
||||
|
||||
this._headerView = new PoolsHeaderView({
|
||||
hostNode: this._pageController.view.pageHeaderHolderNode,
|
||||
parameters: ctx.parameters,
|
||||
|
@ -17,18 +17,19 @@ const fields = [
|
||||
|
||||
class PostListController {
|
||||
constructor(ctx) {
|
||||
this._pageController = new PageController();
|
||||
|
||||
if (!api.hasPrivilege('posts:list')) {
|
||||
this._view = new EmptyView();
|
||||
this._view.showError('You don\'t have privileges to view posts.');
|
||||
return;
|
||||
}
|
||||
|
||||
this._ctx = ctx;
|
||||
|
||||
topNavigation.activate('posts');
|
||||
topNavigation.setTitle('Listing posts');
|
||||
|
||||
this._ctx = ctx;
|
||||
this._pageController = new PageController();
|
||||
|
||||
this._headerView = new PostsHeaderView({
|
||||
hostNode: this._pageController.view.pageHeaderHolderNode,
|
||||
parameters: ctx.parameters,
|
||||
|
@ -20,18 +20,19 @@ const fields = [
|
||||
|
||||
class TagListController {
|
||||
constructor(ctx) {
|
||||
this._pageController = new PageController();
|
||||
|
||||
if (!api.hasPrivilege('tags:list')) {
|
||||
this._view = new EmptyView();
|
||||
this._view.showError('You don\'t have privileges to view tags.');
|
||||
return;
|
||||
}
|
||||
|
||||
this._ctx = ctx;
|
||||
|
||||
topNavigation.activate('tags');
|
||||
topNavigation.setTitle('Listing tags');
|
||||
|
||||
this._ctx = ctx;
|
||||
this._pageController = new PageController();
|
||||
|
||||
this._headerView = new TagsHeaderView({
|
||||
hostNode: this._pageController.view.pageHeaderHolderNode,
|
||||
parameters: ctx.parameters,
|
||||
|
@ -12,6 +12,8 @@ const EmptyView = require('../views/empty_view.js');
|
||||
|
||||
class UserListController {
|
||||
constructor(ctx) {
|
||||
this._pageController = new PageController();
|
||||
|
||||
if (!api.hasPrivilege('users:list')) {
|
||||
this._view = new EmptyView();
|
||||
this._view.showError('You don\'t have privileges to view users.');
|
||||
@ -22,7 +24,6 @@ class UserListController {
|
||||
topNavigation.setTitle('Listing users');
|
||||
|
||||
this._ctx = ctx;
|
||||
this._pageController = new PageController();
|
||||
|
||||
this._headerView = new UsersHeaderView({
|
||||
hostNode: this._pageController.view.pageHeaderHolderNode,
|
||||
|
Reference in New Issue
Block a user