1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +02:00

force space delete

This commit is contained in:
Harvey Kandola 2017-09-18 13:35:51 +01:00
parent 300b617583
commit cd543a1506
10 changed files with 119 additions and 16 deletions

View file

@ -33,6 +33,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, AuthMixin, {
pinId: '',
newName: '',
},
deleteSpaceName: '',
didReceiveAttrs() {
let targets = _.reject(this.get('folders'), {
@ -108,6 +109,23 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, AuthMixin, {
this.attrs.onDeleteDocument();
},
deleteSpace() {
let spaceName = this.get('folder').get('name');
let spaceNameTyped = this.get('deleteSpaceName');
if (spaceNameTyped !== spaceName || spaceNameTyped === '' || spaceName === '') {
$("#delete-space-name").addClass("error").focus();
return false;
}
this.set('deleteSpaceName', '');
$("#delete-space-name").removeClass("error");
this.attrs.onDeleteSpace();
return true;
},
setMoveFolder(folderId) {
this.set('moveFolderId', folderId);

View file

@ -8,7 +8,8 @@
{{folder/folder-toolbar folders=model.folders folder=model.folder
permissions=model.permissions hasSelectedDocuments=hasSelectedDocuments
onDeleteDocument=(action 'onDeleteDocument') onMoveDocument=(action 'onMoveDocument')}}
onDeleteDocument=(action 'onDeleteDocument') onMoveDocument=(action 'onMoveDocument')
onDeleteSpace=(action 'onDeleteSpace')}}
{{folder/documents-list documents=model.documents folders=model.folders folder=model.folder templates=model.templates
permissions=model.permissions selectedDocuments=(mut selectedDocuments)

View file

@ -0,0 +1,15 @@
// 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 Ember from 'ember';
export default Ember.Controller.extend({
});

View file

@ -0,0 +1,25 @@
// 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 Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
model() {
this.get('browser').setTitle(this.modelFor('folder').folder.get('name'));
return Ember.RSVP.hash({
folder: this.modelFor('folder').folder,
permissions: this.modelFor('folder').permissions,
folders: this.modelFor('folder').folders
});
}
});

View file

@ -0,0 +1 @@
{{folder/invite-user folders=model.folders folder=model.folder}}

View file

@ -35,7 +35,18 @@
{{else}}
{{#if pinState.isPinned}}
<div class="round-button button-gray" id="space-unpin-button" data-tooltip="Unpin space" data-tooltip-position="top center" {{action 'onUnpin'}}>
<i class="material-icons">favorite</i>
</div>
{{else}}
<div class="round-button button-gray" id="space-pin-button" data-tooltip="Pin space" data-tooltip-position="top center">
<i class="material-icons">favorite_border</i>
</div>
{{/if}}
{{#if permissions.spaceManage}}
<div class="button-gap"></div>
{{#link-to 'folder.settings' folder.id folder.slug}}{{model.document.name}}
<div class="round-button button-blue" id="space-settings-button" data-tooltip="Manage permissions" data-tooltip-position="top center">
<i class="material-icons">settings</i>
@ -50,16 +61,7 @@
</div>
{{/if}}
{{#if pinState.isPinned}}
<div class="button-gap"></div>
<div class="round-button button-gray" id="space-unpin-button" data-tooltip="Pin space" data-tooltip-position="top center" {{action 'onUnpin'}}>
<i class="material-icons">favorite</i>
</div>
{{else}}
<div class="button-gap"></div>
<div class="round-button button-gray" id="space-pin-button" data-tooltip="Pin space" data-tooltip-position="top center">
<i class="material-icons">favorite_border</i>
</div>
{{#unless pinState.isPinned}}
{{#dropdown-dialog target="space-pin-button" position="bottom right" button="Pin" color="flat-green" onAction=(action 'onPin') focusOn="pin-space-name" }}
<div class="input-control">
<label>Pin Space</label>
@ -67,6 +69,16 @@
{{input type='text' id="pin-space-name" value=pinState.newName}}
</div>
{{/dropdown-dialog}}
{{/unless}}
{{#if permissions.spaceOwner}}
{{#dropdown-dialog target="space-delete-button" position="bottom right" button="Delete" color="flat-red" onAction=(action 'deleteSpace')}}
<p>Are you sure you want this space and all associated documents?</p>
<div class="input-control">
<div class="tip">Please type the space name to confirm</div>
{{input type='text' id="delete-space-name" value=deleteSpaceName}}
</div>
{{/dropdown-dialog}}
{{/if}}
{{/if}}