mirror of
https://github.com/documize/community.git
synced 2025-07-23 15:19:42 +02:00
Move space deletion & archived docs into Space settings
This commit is contained in:
parent
b37f9d601f
commit
7e959b448c
17 changed files with 98 additions and 169 deletions
|
@ -1,24 +0,0 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
|
||||||
//
|
|
||||||
// This software (Documize Community Edition) is licensed under
|
|
||||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
|
||||||
//
|
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
|
||||||
// by contacting <sales@documize.com>.
|
|
||||||
//
|
|
||||||
// https://documize.com
|
|
||||||
|
|
||||||
import AuthProvider from '../../mixins/auth';
|
|
||||||
import ModalMixin from '../../mixins/modal';
|
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend(AuthProvider, ModalMixin, {
|
|
||||||
|
|
||||||
init() {
|
|
||||||
this._super(...arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
}
|
|
||||||
});
|
|
44
gui/app/components/folder/settings-delete.js
Normal file
44
gui/app/components/folder/settings-delete.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// This software (Documize Community Edition) is licensed under
|
||||||
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
//
|
||||||
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
|
// by contacting <sales@documize.com>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import $ from 'jquery';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import AuthMixin from '../../mixins/auth';
|
||||||
|
import Notifier from '../../mixins/notifier';
|
||||||
|
import Component from '@ember/component';
|
||||||
|
|
||||||
|
export default Component.extend(AuthMixin, Notifier, {
|
||||||
|
router: service(),
|
||||||
|
spaceSvc: service('folder'),
|
||||||
|
localStorage: service('localStorage'),
|
||||||
|
deleteSpaceName: '',
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
onDelete(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
let spaceName = this.get('space').get('name');
|
||||||
|
let spaceNameTyped = this.get('deleteSpaceName');
|
||||||
|
|
||||||
|
if (spaceNameTyped !== spaceName || spaceNameTyped === '' || spaceName === '') {
|
||||||
|
$("#delete-space-name").addClass("is-invalid").focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#delete-space-name").removeClass("is-invalid");
|
||||||
|
|
||||||
|
this.get('spaceSvc').delete(this.get('space.id')).then(() => { /* jshint ignore:line */
|
||||||
|
this.get('localStorage').clearSessionItem('folder');
|
||||||
|
this.get('router').transitionTo('folders');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -178,26 +178,6 @@ export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, Notifier, {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onSpaceDelete(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
let spaceName = this.get('space').get('name');
|
|
||||||
let spaceNameTyped = this.get('deleteSpaceName');
|
|
||||||
|
|
||||||
if (spaceNameTyped !== spaceName || spaceNameTyped === '' || spaceName === '') {
|
|
||||||
$("#delete-space-name").addClass("is-invalid").focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.set('deleteSpaceName', '');
|
|
||||||
$("#delete-space-name").removeClass("is-invalid");
|
|
||||||
|
|
||||||
let cb = this.get('onDeleteSpace');
|
|
||||||
cb(this.get('space.id'));
|
|
||||||
|
|
||||||
this.modalClose('#space-delete-modal');
|
|
||||||
},
|
|
||||||
|
|
||||||
onShowEmptyDocModal() {
|
onShowEmptyDocModal() {
|
||||||
this.modalOpen("#empty-doc-modal", {"show": true}, '#empty-doc-name');
|
this.modalOpen("#empty-doc-modal", {"show": true}, '#empty-doc-name');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
|
||||||
//
|
|
||||||
// This software (Documize Community Edition) is licensed under
|
|
||||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
|
||||||
//
|
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
|
||||||
// by contacting <sales@documize.com>.
|
|
||||||
//
|
|
||||||
// https://documize.com
|
|
||||||
|
|
||||||
import Controller from '@ember/controller';
|
|
||||||
|
|
||||||
export default Controller.extend({
|
|
||||||
actions: {
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,25 +0,0 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
|
||||||
//
|
|
||||||
// This software (Documize Community Edition) is licensed under
|
|
||||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
|
||||||
//
|
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
|
||||||
// by contacting <sales@documize.com>.
|
|
||||||
//
|
|
||||||
// https://documize.com
|
|
||||||
|
|
||||||
import Route from '@ember/routing/route';
|
|
||||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
|
||||||
|
|
||||||
export default Route.extend(AuthenticatedRouteMixin, {
|
|
||||||
beforeModel() {
|
|
||||||
if (!this.session.isAdmin) {
|
|
||||||
this.transitionTo('auth.login');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
activate() {
|
|
||||||
this.get('browser').setTitle('Archive');
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1 +0,0 @@
|
||||||
{{customize/archive-admin}}
|
|
|
@ -37,9 +37,6 @@
|
||||||
{{#link-to 'customize.audit' activeClass='selected' class="tab tab-vertical" tagName="li" }}Audit{{/link-to}}
|
{{#link-to 'customize.audit' activeClass='selected' class="tab tab-vertical" tagName="li" }}Audit{{/link-to}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq appMeta.edition constants.Product.EnterpriseEdition)}}
|
|
||||||
{{#link-to 'customize.archive' activeClass='selected' class="tab tab-vertical" tagName="li" }}Archive{{/link-to}}
|
|
||||||
{{/if}}
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="mt-4" />
|
<div class="mt-4" />
|
||||||
|
|
|
@ -25,13 +25,6 @@ export default Controller.extend(NotifierMixin, {
|
||||||
filteredDocs: null,
|
filteredDocs: null,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onDeleteSpace(id) {
|
|
||||||
this.get('folderService').delete(id).then(() => { /* jshint ignore:line */
|
|
||||||
this.get('localStorage').clearSessionItem('folder');
|
|
||||||
this.transitionToRoute('folders');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onRefresh() {
|
onRefresh() {
|
||||||
this.get('target._routerMicrolib').refresh();
|
this.get('target._routerMicrolib').refresh();
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
category=category
|
category=category
|
||||||
categories=model.categories
|
categories=model.categories
|
||||||
documents=filteredDocs
|
documents=filteredDocs
|
||||||
onRefresh=(action 'onRefresh')
|
onRefresh=(action 'onRefresh')}}
|
||||||
onDeleteSpace=(action 'onDeleteSpace')}}
|
|
||||||
|
|
||||||
{{folder/documents-list
|
{{folder/documents-list
|
||||||
documents=filteredDocs
|
documents=filteredDocs
|
||||||
|
|
|
@ -17,6 +17,7 @@ export default Controller.extend(NotifierMixin, {
|
||||||
router: service(),
|
router: service(),
|
||||||
folderService: service('folder'),
|
folderService: service('folder'),
|
||||||
localStorage: service('localStorage'),
|
localStorage: service('localStorage'),
|
||||||
|
appMeta: service(),
|
||||||
queryParams: ['tab'],
|
queryParams: ['tab'],
|
||||||
tab: 'general',
|
tab: 'general',
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { hash } from 'rsvp';
|
import { hash } from 'rsvp';
|
||||||
// import { inject as service } from '@ember/service';
|
|
||||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
|
|
||||||
|
|
|
@ -29,20 +29,48 @@
|
||||||
{{folder/settings-blocks permissions=model.permissions space=model.folder}}
|
{{folder/settings-blocks permissions=model.permissions space=model.folder}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq appMeta.edition constants.Product.EnterpriseEdition)}}
|
||||||
|
{{#if (eq tab 'archived')}}
|
||||||
|
{{enterprise/space-archived permissions=model.permissions spaces=model.folder space=model.folder}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if (eq tab 'categories')}}
|
{{#if (eq tab 'categories')}}
|
||||||
{{folder/settings-category permissions=model.permissions spaces=model.folder space=model.folder}}
|
{{folder/settings-category permissions=model.permissions spaces=model.folder space=model.folder}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq tab 'deletion')}}
|
||||||
|
{{folder/settings-delete permissions=model.permissions spaces=model.folder space=model.folder}}
|
||||||
|
{{/if}}
|
||||||
{{/layout/middle-zone-content}}
|
{{/layout/middle-zone-content}}
|
||||||
|
|
||||||
{{#layout/middle-zone-sidebar}}
|
{{#layout/middle-zone-sidebar}}
|
||||||
<div id="sidebar" class="sidebar">
|
<div id="sidebar" class="sidebar">
|
||||||
<ul class="tabnav-control tabnav-control-centered w-75">
|
<ul class="tabnav-control tabnav-control-centered w-75">
|
||||||
<li class="tab tab-vertical {{if (eq tab 'general') 'selected'}}" {{action 'onTab' 'general'}}>Options</li>
|
<li class="tab tab-vertical {{if (eq tab 'general') 'selected'}}" {{action 'onTab' 'general'}}>General</li>
|
||||||
<li class="tab tab-vertical {{if (eq tab 'permissions') 'selected'}}" {{action 'onTab' 'permissions'}}>User Permissions</li>
|
<li class="tab tab-vertical {{if (eq tab 'permissions') 'selected'}}" {{action 'onTab' 'permissions'}}>User Permissions</li>
|
||||||
<li class="tab tab-vertical {{if (eq tab 'templates') 'selected'}}" {{action 'onTab' 'templates'}}>Document Templates</li>
|
</ul>
|
||||||
<li class="tab tab-vertical {{if (eq tab 'blocks') 'selected'}}" {{action 'onTab' 'blocks'}}>Content Blocks</li>
|
|
||||||
|
<div class="mt-4" />
|
||||||
|
<ul class="tabnav-control tabnav-control-centered w-75">
|
||||||
<li class="tab tab-vertical {{if (eq tab 'categories') 'selected'}}" {{action 'onTab' 'categories'}}>Categories</li>
|
<li class="tab tab-vertical {{if (eq tab 'categories') 'selected'}}" {{action 'onTab' 'categories'}}>Categories</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="mt-4" />
|
||||||
|
<ul class="tabnav-control tabnav-control-centered w-75">
|
||||||
|
<li class="tab tab-vertical {{if (eq tab 'templates') 'selected'}}" {{action 'onTab' 'templates'}}>Document Templates</li>
|
||||||
|
<li class="tab tab-vertical {{if (eq tab 'blocks') 'selected'}}" {{action 'onTab' 'blocks'}}>Content Blocks</li>
|
||||||
|
{{#if (eq appMeta.edition constants.Product.EnterpriseEdition)}}
|
||||||
|
<li class="tab tab-vertical {{if (eq tab 'archived') 'selected'}}" {{action 'onTab' 'archived'}}>Archived</li>
|
||||||
|
{{/if}}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{{#if model.permissions.spaceOwner}}
|
||||||
|
<div class="mt-4" />
|
||||||
|
<ul class="tabnav-control tabnav-control-centered w-75">
|
||||||
|
<li class="tab tab-vertical {{if (eq tab 'deletion') 'selected'}}" {{action 'onTab' 'deletion'}}>Delete</li>
|
||||||
|
</ul>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/layout/middle-zone-sidebar}}
|
{{/layout/middle-zone-sidebar}}
|
||||||
{{/layout/middle-zone}}
|
{{/layout/middle-zone}}
|
||||||
|
|
|
@ -89,9 +89,6 @@ export default Router.map(function () {
|
||||||
this.route('audit', {
|
this.route('audit', {
|
||||||
path: 'audit'
|
path: 'audit'
|
||||||
});
|
});
|
||||||
this.route('archive', {
|
|
||||||
path: 'archive'
|
|
||||||
});
|
|
||||||
this.route('search', {
|
this.route('search', {
|
||||||
path: 'search'
|
path: 'search'
|
||||||
});
|
});
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
> .list {
|
> .list {
|
||||||
> .item {
|
> .item {
|
||||||
margin: 15px 0;
|
margin: 15px 0;
|
||||||
padding: 15px;
|
padding: 15px 0;
|
||||||
@include ease-in();
|
@include ease-in();
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
color: $color-primary;
|
color: $color-primary;
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<div class="view-customize">
|
|
||||||
<h1 class="admin-heading">Archive</h1>
|
|
||||||
<h2 class="sub-heading">Mark as live documents currently marked as archived</h2>
|
|
||||||
|
|
||||||
<div class="archive-admin my-5">
|
|
||||||
<ul class="list">
|
|
||||||
{{#each docs as |doc|}}
|
|
||||||
<li class="item row">
|
|
||||||
<div class="col-12 col-sm-10">{{doc.name}}</div>
|
|
||||||
<div class="col-12 col-sm-2 float-right">
|
|
||||||
<button class="btn btn-success" {{action 'onMarkLive' doc.id}}>Unarchive</button>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{{/each}}
|
|
||||||
</ul>
|
|
||||||
{{#if (eq docs.length 0)}}
|
|
||||||
<p>Nothing found</p>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
11
gui/app/templates/components/folder/settings-delete.hbs
Normal file
11
gui/app/templates/components/folder/settings-delete.hbs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<div class="content-zone">
|
||||||
|
<div class="explainer-header explainer-gap">Delete this space and all documents</div>
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Please type space name to confirm</label>
|
||||||
|
{{focus-input id="delete-space-name" type="text" value=deleteSpaceName class="form-control mousetrap" placeholder="Space name" autocomplete="off"}}
|
||||||
|
<small class="form-text text-muted">This will delete all documents and templates within this space!</small>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<button type="button" class="btn btn-danger mt-3" onclick={{action 'onDelete'}}>Delete Space</button>
|
||||||
|
</div>
|
|
@ -94,62 +94,34 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6 text-right">
|
<div class="col-6 text-right">
|
||||||
{{#if (or permissions.spaceOwner permissions.spaceManage)}}
|
|
||||||
{{#link-to 'folder.settings' space.id space.slug class="button-icon-gray align-middle"}}
|
|
||||||
<i class="material-icons" data-toggle="tooltip" data-placement="top" title="Settings, users, permissions, templates">settings</i>
|
|
||||||
{{/link-to}}
|
|
||||||
<div class="button-icon-gap" />
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if hasDocuments}}
|
{{#if hasDocuments}}
|
||||||
<div id="space-export-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Export as HTML" {{action 'onShowExport'}}>
|
<div id="space-export-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Export as HTML" {{action 'onShowExport'}}>
|
||||||
<i class="material-icons">import_export</i>
|
<i class="material-icons">import_export</i>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-icon-gap" />
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if permissions.spaceOwner}}
|
|
||||||
<div id="space-delete-button" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete space">
|
|
||||||
<i class="material-icons" data-toggle="modal" data-target="#space-delete-modal" data-backdrop="static">delete</i>
|
|
||||||
</div>
|
|
||||||
<div class="button-icon-gap" />
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if pinState.isPinned}}
|
{{#if pinState.isPinned}}
|
||||||
|
<div class="button-icon-gap" />
|
||||||
<div id="space-pin-button" class="button-icon-gold align-middle" data-toggle="tooltip" data-placement="top" title="Remove favorite" {{action 'onUnpin'}}>
|
<div id="space-pin-button" class="button-icon-gold align-middle" data-toggle="tooltip" data-placement="top" title="Remove favorite" {{action 'onUnpin'}}>
|
||||||
<i class="material-icons">star</i>
|
<i class="material-icons">star</i>
|
||||||
</div>
|
</div>
|
||||||
{{else if session.authenticated}}
|
{{else if session.authenticated}}
|
||||||
|
<div class="button-icon-gap" />
|
||||||
<div id="space-pin-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save favorite" {{action 'onPin'}}>
|
<div id="space-pin-button" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Save favorite" {{action 'onPin'}}>
|
||||||
<i class="material-icons">star</i>
|
<i class="material-icons">star</i>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (or permissions.spaceOwner permissions.spaceManage)}}
|
||||||
|
<div class="button-icon-gap" />
|
||||||
|
{{#link-to 'folder.settings' space.id space.slug class="button-icon-gray align-middle"}}
|
||||||
|
<i class="material-icons" data-toggle="tooltip" data-placement="top" title="Settings, users, permissions, templates">settings</i>
|
||||||
|
{{/link-to}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="space-delete-modal" class="modal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">Space Deletion</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form onsubmit={{action 'onSpaceDelete'}}>
|
|
||||||
<p>Are you sure you want to delete this space and all documents?</p>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="delete-space-name">Please type space name to confirm</label>
|
|
||||||
{{input type='text' id="delete-space-name" class="form-control mousetrap" placeholder="Space name" value=deleteSpaceName}}
|
|
||||||
<small class="form-text text-muted">This will delete all documents and templates within this space!</small>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Cancel</button>
|
|
||||||
<button type="button" class="btn btn-danger" onclick={{action 'onSpaceDelete'}}>Delete</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="space-export-modal" class="modal" tabindex="-1" role="dialog">
|
<div id="space-export-modal" class="modal" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue