1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

Provide basis for document lifecycle

This commit is contained in:
Harvey Kandola 2018-03-15 17:11:53 +00:00
parent d9a9a828ed
commit ba52dfa11d
20 changed files with 350 additions and 154 deletions

View file

@ -9,18 +9,16 @@
//
// https://documize.com
import Service, { inject as service } from '@ember/service';
import AuthProvider from '../../mixins/auth';
import ModalMixin from '../../mixins/modal';
import Component from '@ember/component';
export default Service.extend({
ajax: service(),
export default Component.extend(AuthProvider, ModalMixin, {
getDocumentSummary(documentId) {
return this.get('ajax').request(`activity/document/${documentId}`, {
method: "GET"
}).then((response) => {
return response;
}).catch(() => {
return [];
});
init() {
this._super(...arguments);
},
actions: {
}
});

View file

@ -13,11 +13,12 @@ import $ from 'jquery';
import { computed } from '@ember/object';
import { notEmpty } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { A } from "@ember/array"
import { schedule } from '@ember/runloop';
import ModalMixin from '../../mixins/modal';
import Component from '@ember/component';
export default Component.extend({
export default Component.extend(ModalMixin, {
documentService: service('document'),
categoryService: service('category'),
sessionService: service('session'),

View file

@ -11,10 +11,10 @@
import $ from 'jquery';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import AuthMixin from '../../mixins/auth';
import TooltipMixin from '../../mixins/tooltip';
import ModalMixin from '../../mixins/modal';
import Component from '@ember/component';
export default Component.extend(ModalMixin, TooltipMixin, AuthMixin, {
userSvc: service('user'),

View file

@ -1,11 +1,11 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// 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>.
// by contacting <sales@documize.com>.
//
// https://documize.com
@ -15,52 +15,63 @@ import EmberObject from "@ember/object";
// let constants = this.get('constants');
let constants = EmberObject.extend({
// Document
ProtectionType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
None: 0,
Lock: 1,
Review: 2,
// Document
ProtectionType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
None: 0,
Lock: 1,
Review: 2,
NoneLabel: 'Changes permitted without approval',
LockLabel: 'Locked, changes not permitted',
ReviewLabel: 'Changes require approval before publication'
},
NoneLabel: 'Changes permitted without approval',
LockLabel: 'Locked, changes not permitted',
ReviewLabel: 'Changes require approval before publication'
},
// Document
ApprovalType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
None: 0,
Anybody: 1,
Majority: 2,
Unanimous: 3,
// Document
ApprovalType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
None: 0,
Anybody: 1,
Majority: 2,
Unanimous: 3,
AnybodyLabel: 'Approval required from any approver',
MajorityLabel: 'Majority approval required from approvers',
UnanimousLabel: 'Unanimous approval required from all approvers'
},
AnybodyLabel: 'Approval required from any approver',
MajorityLabel: 'Majority approval required from approvers',
UnanimousLabel: 'Unanimous approval required from all approvers'
},
// Section
ChangeState: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
Published: 0,
Pending: 1,
UnderReview: 2,
Rejected: 3,
PendingNew: 4,
},
// Section
ChangeState: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
Published: 0,
Pending: 1,
UnderReview: 2,
Rejected: 3,
PendingNew: 4,
},
// Section
PageType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
Tab: 'tab',
Section: 'section'
},
// Section
PageType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
Tab: 'tab',
Section: 'section'
},
// Who a permission record relates to
WhoType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
User: 'user',
Group: 'role'
},
// Who a permission record relates to
WhoType: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
User: 'user',
Group: 'role'
},
EveryoneUserId: "0",
EveryoneUserName: "Everyone"
EveryoneUserId: "0",
EveryoneUserName: "Everyone",
// Document
Lifecycle: { // eslint-disable-line ember/avoid-leaking-state-in-ember-objects
Draft: 0,
Live: 1,
Archived: 2,
DraftLabel: 'Draft',
LiveLabel: 'Live',
ArchivedLabel: 'Archived',
}
});
export default { constants }
export default { constants }

View file

@ -1,24 +1,25 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// 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>.
// by contacting <sales@documize.com>.
//
// https://documize.com
export function initialize(application) {
application.inject('route', 'econstants', 'econstants:main');
application.inject('controller', 'econstants', 'econstants:main');
application.inject('component', 'econstants', 'econstants:main');
application.inject('template', 'econstants', 'econstants:main');
application.inject('service', 'econstants', 'econstants:main');
application.inject('route', 'econstants', 'econstants:main');
application.inject('controller', 'econstants', 'econstants:main');
application.inject('component', 'econstants', 'econstants:main');
application.inject('template', 'econstants', 'econstants:main');
application.inject('service', 'econstants', 'econstants:main');
application.inject('model', 'econstants', 'econstants:main');
}
export default {
name: 'econstants',
after: "application",
initialize: initialize
};
name: 'econstants',
after: "application",
initialize: initialize
};

View file

@ -10,10 +10,9 @@
// https://documize.com
import { computed } from '@ember/object';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import stringUtil from '../utils/string';
// import { belongsTo, hasMany } from 'ember-data/relationships';
import Model from 'ember-data/model';
export default Model.extend({
name: attr('string'),
@ -27,6 +26,11 @@ export default Model.extend({
template: attr('boolean'),
protection: attr('number', { defaultValue: 0 }),
approval: attr('number', { defaultValue: 0 }),
lifecycle: attr('number', { defaultValue: 1 }),
versioned: attr('boolean'),
versionID: attr('string'),
versionOrder: attr('number', { defaultValue: 0 }),
groupID: attr('string'),
// client-side property
selected: attr('boolean', { defaultValue: false }),
@ -34,5 +38,24 @@ export default Model.extend({
return stringUtil.makeSlug(this.get('name'));
}),
created: attr(),
revised: attr()
revised: attr(),
isDraft: computed('lifecycle', function () {
let constants = this.get('constants');
return this.get('lifecycle') == constants.Lifecycle.Draft;
}),
lifecycleLabel: computed('lifecycle', function () {
let constants = this.get('constants');
switch (this.get('lifecycle')) {
case constants.Lifecycle.Draft:
return constants.Lifecycle.DraftLabel;
case constants.Lifecycle.Live:
return constants.Lifecycle.LiveLabel;
case constants.Lifecycle.Archived:
return constants.Lifecycle.ArchivedLabel;
}
return '';
}),
});

View file

@ -10,11 +10,10 @@
// https://documize.com
import { computed } from '@ember/object';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import constants from '../utils/constants';
import stringUtil from '../utils/string';
// import { belongsTo, hasMany } from 'ember-data/relationships';
import Model from 'ember-data/model';
export default Model.extend({
name: attr('string'),

View file

@ -0,0 +1,17 @@
// 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: {
}
});

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 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');
}
});

View file

@ -0,0 +1 @@
{{customize/archive-admin}}

View file

@ -2,7 +2,7 @@
{{#toolbar/t-toolbar}}
{{#toolbar/t-links}}
{{#link-to "folders" class="link" tagName="li"}}Spaces{{/link-to}}
{{#link-to "folders" class="link" tagName="li" }}Spaces{{/link-to}}
{{/toolbar/t-links}}
{{#toolbar/t-actions}}
{{/toolbar/t-actions}}
@ -12,19 +12,20 @@
<div class="row">
<div class="col my-5">
<ul class="tabnav-control">
{{#link-to 'customize.general' activeClass='selected' class="tab" tagName="li"}}General{{/link-to}}
{{#link-to 'customize.folders' activeClass='selected' class="tab" tagName="li"}}Spaces{{/link-to}}
{{#link-to 'customize.groups' activeClass='selected' class="tab" tagName="li"}}Groups{{/link-to}}
{{#link-to 'customize.users' activeClass='selected' class="tab" tagName="li"}}Users{{/link-to}}
{{#link-to 'customize.general' activeClass='selected' class="tab" tagName="li" }}General{{/link-to}}
{{#link-to 'customize.folders' activeClass='selected' class="tab" tagName="li" }}Spaces{{/link-to}}
{{#link-to 'customize.groups' activeClass='selected' class="tab" tagName="li" }}Groups{{/link-to}}
{{#link-to 'customize.users' activeClass='selected' class="tab" tagName="li" }}Users{{/link-to}}
{{#if session.isGlobalAdmin}}
{{#link-to 'customize.smtp' activeClass='selected' class="tab" tagName="li"}}SMTP{{/link-to}}
{{#link-to 'customize.license' activeClass='selected' class="tab" tagName="li"}}License{{/link-to}}
{{#link-to 'customize.auth' activeClass='selected' class="tab" tagName="li"}}Authentication{{/link-to}}
{{#link-to 'customize.smtp' activeClass='selected' class="tab" tagName="li" }}SMTP{{/link-to}}
{{#link-to 'customize.license' activeClass='selected' class="tab" tagName="li" }}License{{/link-to}}
{{#link-to 'customize.auth' activeClass='selected' class="tab" tagName="li" }}Authentication{{/link-to}}
{{/if}}
{{#link-to 'customize.archive' activeClass='selected' class="tab" tagName="li" }}Archive{{/link-to}}
</ul>
</div>
</div>
<div class="mt-4 margin-bottom-100">
{{outlet}}
</div>
</div>
</div>

View file

@ -16,7 +16,7 @@ var Router = EmberRouter.extend({
location: config.locationType
});
export default Router.map(function() {
export default Router.map(function () {
this.route('folders', {
path: '/'
});
@ -30,7 +30,7 @@ export default Router.map(function() {
{
path: 's/:folder_id/:folder_slug'
},
function() {
function () {
this.route('category', {
path: 'category'
});
@ -42,7 +42,7 @@ export default Router.map(function() {
{
path: 's/:folder_id/:folder_slug/d/:document_id/:document_slug'
},
function() {
function () {
this.route('section', {
path: 'section/:page_id'
});
@ -57,7 +57,7 @@ export default Router.map(function() {
{
path: 'settings'
},
function() {
function () {
this.route('general', {
path: 'general'
});
@ -82,6 +82,9 @@ export default Router.map(function() {
this.route('audit', {
path: 'audit'
});
this.route('archive', {
path: 'archive'
});
}
);
@ -98,7 +101,7 @@ export default Router.map(function() {
{
path: 'auth'
},
function() {
function () {
this.route('sso', {
path: 'sso/:token'
});

View file

@ -23,7 +23,7 @@
margin: 0 0 0 10px;
display: inline-block;
cursor: pointer;
> .email {
font-size: 0.9rem;
color: $color-off-black;
@ -124,7 +124,7 @@
}
}
}
> .smtp-failure {
font-size: 1.2rem;
font-weight: bold;
@ -136,4 +136,16 @@
font-weight: bold;
color: $color-green;
}
> .archive-admin {
> .list {
> .item {
margin: 15px 0;
padding: 15px;
@include ease-in();
font-size: 1.2rem;
color: $color-primary;
}
}
}
}

View file

@ -0,0 +1,25 @@
<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>

View file

@ -7,6 +7,9 @@
<div class="title">{{ document.name }}</div>
<div class="snippet">{{ document.excerpt }}</div>
{{folder/document-tags documentTags=document.tags}}
{{#if (not-eq document.lifecycle constants.Lifecycle.Live)}}
<button type="button" class="mt-3 btn btn-warning text-uppercase font-weight-bold">{{document.lifecycleLabel}}</button>
{{/if}}
{{/link-to}}
{{#if hasDocumentActions}}
@ -39,11 +42,13 @@
</ul>
</div>
{{#ui/ui-dialog title="Delete Documents" confirmCaption="Delete" buttonType="btn-danger" show=showDeleteDialog onAction=(action 'onDeleteDocuments')}}
{{#ui/ui-dialog title="Delete Documents" confirmCaption="Delete" buttonType="btn-danger" show=showDeleteDialog onAction=(action
'onDeleteDocuments')}}
<p>Are you sure you want to delete {{selectedDocuments.length}} {{selectedCaption}}?</p>
{{/ui/ui-dialog}}
{{#ui/ui-dialog title="Move Documents" confirmCaption="Move" buttonType="btn-success" show=showMoveDialog onAction=(action 'onMoveDocuments')}}
{{#ui/ui-dialog title="Move Documents" confirmCaption="Move" buttonType="btn-success" show=showMoveDialog onAction=(action
'onMoveDocuments')}}
<p>Select space for {{selectedDocuments.length}} {{selectedCaption}}</p>
{{ui/ui-list-picker items=moveOptions nameField='name' singleSelect=true}}
{{/ui/ui-dialog}}