mirror of
https://github.com/documize/community.git
synced 2025-07-23 23:29:42 +02:00
Normalized remaining space options into settings admin
Moved space naming and category management into space settings.
This commit is contained in:
parent
29534273b8
commit
d689cbc281
16 changed files with 174 additions and 331 deletions
|
@ -1,45 +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 $ from 'jquery';
|
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend({
|
|
||||||
newCategory: '',
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
didInsertElement() {
|
|
||||||
this._super(...arguments);
|
|
||||||
$('#new-category-name').focus();
|
|
||||||
},
|
|
||||||
|
|
||||||
onAdd(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
let cat = this.get('newCategory');
|
|
||||||
|
|
||||||
if (cat === '') {
|
|
||||||
$('#new-category-name').addClass('is-invalid').focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#new-category-name').removeClass('is-invalid').focus();
|
|
||||||
this.set('newCategory', '');
|
|
||||||
|
|
||||||
let c = {
|
|
||||||
category: cat,
|
|
||||||
folderId: this.get('space.id')
|
|
||||||
};
|
|
||||||
|
|
||||||
this.get('onAdd')(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -14,9 +14,10 @@ import { A } from '@ember/array';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import TooltipMixin from '../../mixins/tooltip';
|
import TooltipMixin from '../../mixins/tooltip';
|
||||||
import ModalMixin from '../../mixins/modal';
|
import ModalMixin from '../../mixins/modal';
|
||||||
|
import Notifer from '../../mixins/notifier';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
|
||||||
export default Component.extend(ModalMixin, TooltipMixin, {
|
export default Component.extend(ModalMixin, TooltipMixin, Notifer, {
|
||||||
spaceSvc: service('folder'),
|
spaceSvc: service('folder'),
|
||||||
groupSvc: service('group'),
|
groupSvc: service('group'),
|
||||||
categorySvc: service('category'),
|
categorySvc: service('category'),
|
||||||
|
@ -24,6 +25,7 @@ export default Component.extend(ModalMixin, TooltipMixin, {
|
||||||
store: service(),
|
store: service(),
|
||||||
deleteId: '',
|
deleteId: '',
|
||||||
dropdown: null,
|
dropdown: null,
|
||||||
|
newCategory: '',
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -43,11 +45,11 @@ export default Component.extend(ModalMixin, TooltipMixin, {
|
||||||
|
|
||||||
load() {
|
load() {
|
||||||
// get categories
|
// get categories
|
||||||
this.get('categorySvc').getAll(this.get('folder.id')).then((c) => {
|
this.get('categorySvc').getAll(this.get('space.id')).then((c) => {
|
||||||
this.set('category', c);
|
this.set('category', c);
|
||||||
|
|
||||||
// get summary of documents and users for each category in space
|
// get summary of documents and users for each category in space
|
||||||
this.get('categorySvc').getSummary(this.get('folder.id')).then((s) => {
|
this.get('categorySvc').getSummary(this.get('space.id')).then((s) => {
|
||||||
c.forEach((cat) => {
|
c.forEach((cat) => {
|
||||||
let docs = _.where(s, {categoryId: cat.get('id'), type: 'documents'});
|
let docs = _.where(s, {categoryId: cat.get('id'), type: 'documents'});
|
||||||
let docCount = 0;
|
let docCount = 0;
|
||||||
|
@ -67,7 +69,7 @@ export default Component.extend(ModalMixin, TooltipMixin, {
|
||||||
permissionRecord(who, whoId, name) {
|
permissionRecord(who, whoId, name) {
|
||||||
let raw = {
|
let raw = {
|
||||||
id: whoId,
|
id: whoId,
|
||||||
orgId: this.get('folder.orgId'),
|
orgId: this.get('space.orgId'),
|
||||||
categoryId: this.get('currentCategory.id'),
|
categoryId: this.get('currentCategory.id'),
|
||||||
whoId: whoId,
|
whoId: whoId,
|
||||||
who: who,
|
who: who,
|
||||||
|
@ -91,6 +93,31 @@ export default Component.extend(ModalMixin, TooltipMixin, {
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
onAdd(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
let cat = this.get('newCategory');
|
||||||
|
|
||||||
|
if (cat === '') {
|
||||||
|
$('#new-category-name').addClass('is-invalid').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#new-category-name').removeClass('is-invalid').focus();
|
||||||
|
this.set('newCategory', '');
|
||||||
|
|
||||||
|
let c = {
|
||||||
|
category: cat,
|
||||||
|
folderId: this.get('space.id')
|
||||||
|
};
|
||||||
|
|
||||||
|
this.showWait();
|
||||||
|
this.get('categorySvc').add(c).then(() => {
|
||||||
|
this.load();
|
||||||
|
this.showDone();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onShowDelete(id) {
|
onShowDelete(id) {
|
||||||
let cat = this.get('category').findBy('id', id);
|
let cat = this.get('category').findBy('id', id);
|
||||||
this.set('deleteId', cat.get('id'));
|
this.set('deleteId', cat.get('id'));
|
||||||
|
@ -144,7 +171,7 @@ export default Component.extend(ModalMixin, TooltipMixin, {
|
||||||
this.set('categoryPermissions', categoryPermissions);
|
this.set('categoryPermissions', categoryPermissions);
|
||||||
|
|
||||||
// get space permissions
|
// get space permissions
|
||||||
this.get('spaceSvc').getPermissions(this.get('folder.id')).then((spacePermissions) => {
|
this.get('spaceSvc').getPermissions(this.get('space.id')).then((spacePermissions) => {
|
||||||
spacePermissions.forEach((sp) => {
|
spacePermissions.forEach((sp) => {
|
||||||
let cp = this.permissionRecord(sp.get('who'), sp.get('whoId'), sp.get('name'));
|
let cp = this.permissionRecord(sp.get('who'), sp.get('whoId'), sp.get('name'));
|
||||||
cp.set('selected', false);
|
cp.set('selected', false);
|
||||||
|
@ -172,11 +199,11 @@ export default Component.extend(ModalMixin, TooltipMixin, {
|
||||||
onGrantAccess() {
|
onGrantAccess() {
|
||||||
this.set('showCategoryAccess', false);
|
this.set('showCategoryAccess', false);
|
||||||
|
|
||||||
let folder = this.get('folder');
|
let space = this.get('space');
|
||||||
let category = this.get('currentCategory');
|
let category = this.get('currentCategory');
|
||||||
let perms = this.get('categoryPermissions').filterBy('selected', true);
|
let perms = this.get('categoryPermissions').filterBy('selected', true);
|
||||||
|
|
||||||
this.get('categorySvc').setViewers(folder.get('id'), category.get('id'), perms).then(() => {
|
this.get('categorySvc').setViewers(space.get('id'), category.get('id'), perms).then(() => {
|
||||||
this.load();
|
this.load();
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -13,6 +13,7 @@ import { A } from '@ember/array';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { schedule } from '@ember/runloop';
|
import { schedule } from '@ember/runloop';
|
||||||
import { computed } from '@ember/object';
|
import { computed } from '@ember/object';
|
||||||
|
import { empty } from '@ember/object/computed';
|
||||||
import AuthMixin from '../../mixins/auth';
|
import AuthMixin from '../../mixins/auth';
|
||||||
import Notifier from '../../mixins/notifier';
|
import Notifier from '../../mixins/notifier';
|
||||||
import Component from '@ember/component';
|
import Component from '@ember/component';
|
||||||
|
@ -26,6 +27,8 @@ export default Component.extend(AuthMixin, Notifier, {
|
||||||
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
return this.get('permissions.spaceOwner') || this.get('permissions.spaceManage');
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
spaceName: '',
|
||||||
|
hasNameError: empty('spaceName'),
|
||||||
spaceTypeOptions: A([]),
|
spaceTypeOptions: A([]),
|
||||||
spaceType: 0,
|
spaceType: 0,
|
||||||
likes: '',
|
likes: '',
|
||||||
|
@ -51,6 +54,8 @@ export default Component.extend(AuthMixin, Notifier, {
|
||||||
} else {
|
} else {
|
||||||
this.set('likes', 'Did this help you?');
|
this.set('likes', 'Did this help you?');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.set('spaceName', this.get('space.name'));
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -75,6 +80,10 @@ export default Component.extend(AuthMixin, Notifier, {
|
||||||
let allowLikes = this.get('allowLikes');
|
let allowLikes = this.get('allowLikes');
|
||||||
space.set('likes', allowLikes ? this.get('likes') : '');
|
space.set('likes', allowLikes ? this.get('likes') : '');
|
||||||
|
|
||||||
|
let spaceName = this.get('spaceName').trim();
|
||||||
|
if (spaceName.length === 0) return;
|
||||||
|
space.set('name', spaceName);
|
||||||
|
|
||||||
this.showWait();
|
this.showWait();
|
||||||
|
|
||||||
this.get('spaceSvc').save(space).then(() => {
|
this.get('spaceSvc').save(space).then(() => {
|
||||||
|
|
|
@ -1,54 +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 $ from 'jquery';
|
|
||||||
import { empty } from '@ember/object/computed';
|
|
||||||
import { schedule } from '@ember/runloop';
|
|
||||||
import { inject as service } from '@ember/service';
|
|
||||||
import Component from '@ember/component';
|
|
||||||
|
|
||||||
export default Component.extend({
|
|
||||||
folderService: service('folder'),
|
|
||||||
spaceName: '',
|
|
||||||
hasNameError: empty('spaceName'),
|
|
||||||
editMode: false,
|
|
||||||
|
|
||||||
keyUp(e) {
|
|
||||||
if (e.keyCode === 27) { // escape key
|
|
||||||
this.send('onCancel');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
toggleEdit() {
|
|
||||||
this.set('spaceName', this.get('space.name'));
|
|
||||||
this.set('editMode', true);
|
|
||||||
|
|
||||||
schedule('afterRender', () => {
|
|
||||||
$('#folder-name').select();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
onSave() {
|
|
||||||
if (this.get('hasNameError')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.set('space.name', this.get('spaceName'));
|
|
||||||
this.get('folderService').save(this.get('space'));
|
|
||||||
this.set('editMode', false);
|
|
||||||
},
|
|
||||||
|
|
||||||
onCancel() {
|
|
||||||
this.set('editMode', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,26 +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 { inject as service } from '@ember/service';
|
|
||||||
import Controller from '@ember/controller';
|
|
||||||
|
|
||||||
export default Controller.extend({
|
|
||||||
categorySvc: service('category'),
|
|
||||||
refresh: 0,
|
|
||||||
|
|
||||||
actions: {
|
|
||||||
onAdd(c) {
|
|
||||||
this.get('categorySvc').add(c).then(() => {
|
|
||||||
this.set('refresh', this.get('refresh')+1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,27 +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 { hash } from 'rsvp';
|
|
||||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
|
||||||
import Route from '@ember/routing/route';
|
|
||||||
|
|
||||||
export default Route.extend(AuthenticatedRouteMixin, {
|
|
||||||
model() {
|
|
||||||
this.get('browser').setTitle(this.modelFor('folder').folder.get('name'));
|
|
||||||
|
|
||||||
return hash({
|
|
||||||
folder: this.modelFor('folder').folder,
|
|
||||||
permissions: this.modelFor('folder').permissions,
|
|
||||||
folders: this.modelFor('folder').folders,
|
|
||||||
templates: this.modelFor('folder').templates,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,27 +0,0 @@
|
||||||
{{#layout/top-bar}}
|
|
||||||
<li class="item">
|
|
||||||
{{#link-to "folder.index" model.folder.id model.folder.slug class='link'}}
|
|
||||||
{{model.folder.name}}
|
|
||||||
{{/link-to}}
|
|
||||||
</li>
|
|
||||||
<li class="item">
|
|
||||||
{{#link-to "folder.category" model.folder.id model.folder.slug class='link selected'}}
|
|
||||||
Categories
|
|
||||||
{{/link-to}}
|
|
||||||
</li>
|
|
||||||
{{/layout/top-bar}}
|
|
||||||
|
|
||||||
{{#layout/middle-zone}}
|
|
||||||
{{#layout/middle-zone-content}}
|
|
||||||
{{folder/category-admin folders=model.folders folder=model.folder refresh=refresh}}
|
|
||||||
{{/layout/middle-zone-content}}
|
|
||||||
|
|
||||||
{{#layout/middle-zone-sidebar}}
|
|
||||||
<div id="sidebar" class="sidebar">
|
|
||||||
{{folder/category-admin-sidebar space=model.folder onAdd=(action 'onAdd')}}
|
|
||||||
</div>
|
|
||||||
{{/layout/middle-zone-sidebar}}
|
|
||||||
{{/layout/middle-zone}}
|
|
||||||
|
|
||||||
{{#layout/bottom-bar}}
|
|
||||||
{{/layout/bottom-bar}}
|
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
{{#layout/middle-zone-sidebar}}
|
{{#layout/middle-zone-sidebar}}
|
||||||
<div id="sidebar" class="sidebar">
|
<div id="sidebar" class="sidebar">
|
||||||
{{folder/space-heading space=model.folder permissions=model.permissions}}
|
|
||||||
|
|
||||||
{{folder/space-view
|
{{folder/space-view
|
||||||
spaces=model.folders
|
spaces=model.folders
|
||||||
space=model.folder
|
space=model.folder
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
{{#if (eq tab 'blocks')}}
|
{{#if (eq tab 'blocks')}}
|
||||||
{{folder/settings-blocks permissions=model.permissions space=model.folder}}
|
{{folder/settings-blocks permissions=model.permissions space=model.folder}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (eq tab 'categories')}}
|
||||||
|
{{folder/settings-category 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}}
|
||||||
|
@ -42,7 +46,7 @@
|
||||||
<li class="tab tab-vertical {{if (eq tab 'invitations') 'selected'}}" {{action 'onTab' 'invitations'}}>Invite Users</li>
|
<li class="tab tab-vertical {{if (eq tab 'invitations') 'selected'}}" {{action 'onTab' 'invitations'}}>Invite Users</li>
|
||||||
<li class="tab tab-vertical {{if (eq tab 'templates') 'selected'}}" {{action 'onTab' 'templates'}}>Document Templates</li>
|
<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>
|
<li class="tab tab-vertical {{if (eq tab 'blocks') 'selected'}}" {{action 'onTab' 'blocks'}}>Content Blocks</li>
|
||||||
<li class="tab tab-vertical" {{action 'onCategories'}}>Categories</li>
|
<li class="tab tab-vertical {{if (eq tab 'categories') 'selected'}}" {{action 'onTab' 'categories'}}>Categories</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{{/layout/middle-zone-sidebar}}
|
{{/layout/middle-zone-sidebar}}
|
||||||
|
|
|
@ -35,9 +35,6 @@ export default Router.map(function () {
|
||||||
path: 's/:folder_id/:folder_slug'
|
path: 's/:folder_id/:folder_slug'
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
this.route('category', {
|
|
||||||
path: 'category'
|
|
||||||
});
|
|
||||||
this.route('settings', {
|
this.route('settings', {
|
||||||
path: 'settings'
|
path: 'settings'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<div class="space-admin">
|
|
||||||
<h1>Categories</h1>
|
|
||||||
<p>Sub-divide spaces into categories which can contain documents with restricted access.</p>
|
|
||||||
<form class="form-inline" onsubmit={{action 'onAdd'}}>
|
|
||||||
<div class="form-group mr-3">
|
|
||||||
{{focus-input id="new-category-name" type='text' class="form-control mousetrap" placeholder="Category name" value=newCategory}}
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-success font-weight-bold" onclick={{action 'onAdd'}}>Add</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
|
@ -1,90 +0,0 @@
|
||||||
<div class="space-admin">
|
|
||||||
<div class="categories">
|
|
||||||
{{#each category as |cat|}}
|
|
||||||
<div class="item row">
|
|
||||||
{{#if cat.editMode}}
|
|
||||||
<form onsubmit={{action 'onSave' cat.id bubbles=false}} class="col-8">
|
|
||||||
{{focus-input id=(concat 'edit-category-' cat.id) type="text" value=cat.category class="form-control"}}
|
|
||||||
</form>
|
|
||||||
{{else}}
|
|
||||||
<div class="category col-8">
|
|
||||||
<div class="name">{{cat.category}}</div>
|
|
||||||
<div class="info">{{cat.documents}} {{if (eq cat.documents 1) 'document' 'documents' }} · {{cat.users}} users/groups</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
<div class="col-4 buttons text-right">
|
|
||||||
{{#if cat.editMode}}
|
|
||||||
<button type="button" class="btn btn-outline-secondary" {{action 'onEditCancel' cat.id}}>Cancel</button>
|
|
||||||
<button type="button" class="btn btn-success" {{action 'onSave' cat.id}}>Save</button>
|
|
||||||
{{else}}
|
|
||||||
<div id="category-access-button-{{cat.id}}" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Category access" {{action 'onShowAccessPicker' cat.id}}>
|
|
||||||
<i class="material-icons">security</i>
|
|
||||||
</div>
|
|
||||||
<div class="button-icon-gap" />
|
|
||||||
<div class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Rename" {{action 'onEdit' cat.id}} >
|
|
||||||
<i class="material-icons">edit</i>
|
|
||||||
</div>
|
|
||||||
<div class="button-icon-gap" />
|
|
||||||
<div id="{{concat 'delete-category-' cat.id}}" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete" {{action 'onShowDelete' cat.id}}>
|
|
||||||
<i class="material-icons">delete</i>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<div class="margin-top-30"><i>No categories</i></div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="category-delete-modal" class="modal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">Category Deletion</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>Are you sure you want to delete this category?</p>
|
|
||||||
</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 'onDelete'}}>Delete</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#ui/ui-dialog title="Set Category Access" confirmCaption="Save" buttonType="btn-success" show=showCategoryAccess onAction=(action 'onGrantAccess')}}
|
|
||||||
<p>Select who can view documents within category</p>
|
|
||||||
|
|
||||||
<div class="widget-list-picker">
|
|
||||||
<ul class="options">
|
|
||||||
{{#each categoryPermissions as |permission|}}
|
|
||||||
<li class="option {{if permission.selected 'selected'}}" {{action 'onToggle' permission}}>
|
|
||||||
<div class="text text-truncate">
|
|
||||||
{{#if (eq permission.who "role")}}
|
|
||||||
<span class="button-icon-gray button-icon-small align-middle">
|
|
||||||
<i class="material-icons">people</i>
|
|
||||||
</span>
|
|
||||||
{{else}}
|
|
||||||
{{#if (eq permission.whoId constants.EveryoneUserId)}}
|
|
||||||
<span class="button-icon-gray button-icon-small align-middle">
|
|
||||||
<i class="material-icons">language</i>
|
|
||||||
</span>
|
|
||||||
{{else}}
|
|
||||||
<span class="button-icon-gray button-icon-small align-middle">
|
|
||||||
<i class="material-icons">person</i>
|
|
||||||
</span>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
{{permission.name}}
|
|
||||||
{{#if (eq permission.whoId session.user.id)}}
|
|
||||||
<small class="form-text text-muted d-inline-block">(you)</small>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{#if permission.selected}}
|
|
||||||
<i class="material-icons">check</i>
|
|
||||||
{{/if}}
|
|
||||||
</li>
|
|
||||||
{{/each}}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{{/ui/ui-dialog}}
|
|
102
gui/app/templates/components/folder/settings-category.hbs
Normal file
102
gui/app/templates/components/folder/settings-category.hbs
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
<div class="content-zone">
|
||||||
|
|
||||||
|
<div class="explainer-header explainer-gap">Categories</div>
|
||||||
|
<form class="form-inline" onsubmit={{action 'onAdd'}}>
|
||||||
|
<div class="form-group mr-3">
|
||||||
|
{{focus-input id="new-category-name" type='text' class="form-control mousetrap" placeholder="Category name" value=newCategory}}
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-success font-weight-bold" onclick={{action 'onAdd'}}>Add</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="space-admin">
|
||||||
|
<div class="categories">
|
||||||
|
{{#each category as |cat|}}
|
||||||
|
<div class="item row">
|
||||||
|
{{#if cat.editMode}}
|
||||||
|
<form onsubmit={{action 'onSave' cat.id bubbles=false}} class="col-8">
|
||||||
|
{{focus-input id=(concat 'edit-category-' cat.id) type="text" value=cat.category class="form-control"}}
|
||||||
|
</form>
|
||||||
|
{{else}}
|
||||||
|
<div class="category col-8">
|
||||||
|
<div class="name">{{cat.category}}</div>
|
||||||
|
<div class="info">{{cat.documents}} {{if (eq cat.documents 1) 'document' 'documents' }} · {{cat.users}} users/groups</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
<div class="col-4 buttons text-right">
|
||||||
|
{{#if cat.editMode}}
|
||||||
|
<button type="button" class="btn btn-outline-secondary" {{action 'onEditCancel' cat.id}}>Cancel</button>
|
||||||
|
<button type="button" class="btn btn-success" {{action 'onSave' cat.id}}>Save</button>
|
||||||
|
{{else}}
|
||||||
|
<div id="category-access-button-{{cat.id}}" class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Category access" {{action 'onShowAccessPicker' cat.id}}>
|
||||||
|
<i class="material-icons">security</i>
|
||||||
|
</div>
|
||||||
|
<div class="button-icon-gap" />
|
||||||
|
<div class="button-icon-gray align-middle" data-toggle="tooltip" data-placement="top" title="Rename" {{action 'onEdit' cat.id}} >
|
||||||
|
<i class="material-icons">edit</i>
|
||||||
|
</div>
|
||||||
|
<div class="button-icon-gap" />
|
||||||
|
<div id="{{concat 'delete-category-' cat.id}}" class="button-icon-danger align-middle" data-toggle="tooltip" data-placement="top" title="Delete" {{action 'onShowDelete' cat.id}}>
|
||||||
|
<i class="material-icons">delete</i>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="margin-top-30"><i>No categories</i></div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="category-delete-modal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">Category Deletion</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Are you sure you want to delete this category?</p>
|
||||||
|
</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 'onDelete'}}>Delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#ui/ui-dialog title="Set Category Access" confirmCaption="Save" buttonType="btn-success" show=showCategoryAccess onAction=(action 'onGrantAccess')}}
|
||||||
|
<p>Select who can view documents within category</p>
|
||||||
|
|
||||||
|
<div class="widget-list-picker">
|
||||||
|
<ul class="options">
|
||||||
|
{{#each categoryPermissions as |permission|}}
|
||||||
|
<li class="option {{if permission.selected 'selected'}}" {{action 'onToggle' permission}}>
|
||||||
|
<div class="text text-truncate">
|
||||||
|
{{#if (eq permission.who "role")}}
|
||||||
|
<span class="button-icon-gray button-icon-small align-middle">
|
||||||
|
<i class="material-icons">people</i>
|
||||||
|
</span>
|
||||||
|
{{else}}
|
||||||
|
{{#if (eq permission.whoId constants.EveryoneUserId)}}
|
||||||
|
<span class="button-icon-gray button-icon-small align-middle">
|
||||||
|
<i class="material-icons">language</i>
|
||||||
|
</span>
|
||||||
|
{{else}}
|
||||||
|
<span class="button-icon-gray button-icon-small align-middle">
|
||||||
|
<i class="material-icons">person</i>
|
||||||
|
</span>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
{{permission.name}}
|
||||||
|
{{#if (eq permission.whoId session.user.id)}}
|
||||||
|
<small class="form-text text-muted d-inline-block">(you)</small>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
{{#if permission.selected}}
|
||||||
|
<i class="material-icons">check</i>
|
||||||
|
{{/if}}
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{/ui/ui-dialog}}
|
||||||
|
|
||||||
|
</div>
|
|
@ -1,9 +1,15 @@
|
||||||
<div class="content-zone">
|
<div class="content-zone">
|
||||||
<div class="explainer-header explainer-gap">General options for this space</div>
|
<div class="explainer-header explainer-gap">General options for this space</div>
|
||||||
<form>
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Space Name</label>
|
||||||
|
{{focus-input id="space-name" type="text" value=spaceName class=(if hasNameError 'form-control is-invalid' 'form-control') placeholder="Space name" autocomplete="off"}}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Space Type</label>
|
<label>Space Type</label>
|
||||||
{{ui-select id="spacetypes-dropdown" content=spaceTypeOptions optionValuePath="id" optionLabelPath="label" selection=spaceType action=(action 'onSetSpaceType')}}
|
{{ui-select id="spacetypes-dropdown" content=spaceTypeOptions optionValuePath="id" optionLabelPath="label" selection=spaceType action=(action 'onSetSpaceType')}}
|
||||||
|
<small class="form-text text-muted">Who can see this space?</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -20,6 +20,24 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="container-fluid my-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="form-group">
|
||||||
|
{{focus-input id="user-search" type="text" class="form-control mousetrap" placeholder="Search for users by firstname, lastname, email" value=searchText key-up=(action 'onSearch')}}
|
||||||
|
</div>
|
||||||
|
{{#each filteredUsers as |user|}}
|
||||||
|
<div class="row my-3">
|
||||||
|
<div class="col-10">{{user.fullname}}</div>
|
||||||
|
<div class="col-2 text-right">
|
||||||
|
<button class="btn btn-primary" {{action 'onAdd' user}}>Add</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="space-admin table-responsive">
|
<div class="space-admin table-responsive">
|
||||||
<table class="table table-hover permission-table mb-3">
|
<table class="table table-hover permission-table mb-3">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -92,22 +110,3 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" class="btn btn-success my-3" onclick= {{action 'onSave'}}>Save</button>
|
<button type="button" class="btn btn-success my-3" onclick= {{action 'onSave'}}>Save</button>
|
||||||
|
|
||||||
<div class="container-fluid mt-5">
|
|
||||||
<div class="row justify-content-center">
|
|
||||||
<div class="col-6">
|
|
||||||
<div class="form-group">
|
|
||||||
{{focus-input id="user-search" type="text" class="form-control mousetrap" placeholder="Search for users by firstname, lastname, email" value=searchText key-up=(action 'onSearch')}}
|
|
||||||
<small class="form-text text-muted">Find and add users to this space</small>
|
|
||||||
</div>
|
|
||||||
{{#each filteredUsers as |user|}}
|
|
||||||
<div class="row my-3">
|
|
||||||
<div class="col-10">{{user.fullname}}</div>
|
|
||||||
<div class="col-2 text-right">
|
|
||||||
<button class="btn btn-primary" {{action 'onAdd' user}}>Add</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
{{#unless editMode}}
|
|
||||||
<div class="view-space">
|
|
||||||
<div class="heading">
|
|
||||||
<h1 class="view-heading {{if permissions.spaceOwner 'cursor-pointer'}}" onclick={{if permissions.spaceOwner (action 'toggleEdit')}}>
|
|
||||||
{{space.name}}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{else}}
|
|
||||||
<form {{action "onSave" on="submit"}}>
|
|
||||||
<div class="view-space">
|
|
||||||
<div class="heading">
|
|
||||||
<div class="form-group">
|
|
||||||
{{focus-input id="space-name" type="text" value=spaceName class=(if hasNameError 'form-control is-invalid' 'form-control') placeholder="Space name" autocomplete="off"}}
|
|
||||||
<small class="form-text text-muted">Press Enter to save or Escape to cancel</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{{/unless}}
|
|
Loading…
Add table
Add a link
Reference in a new issue