mirror of
https://github.com/documize/community.git
synced 2025-07-22 14:49:42 +02:00
commit
3d450bcbc7
20 changed files with 626 additions and 468 deletions
|
@ -32,6 +32,7 @@ export default Ember.Component.extend({
|
||||||
targetOffset: "10px 0",
|
targetOffset: "10px 0",
|
||||||
constrainToWindow: true,
|
constrainToWindow: true,
|
||||||
constrainToScrollParent: true,
|
constrainToScrollParent: true,
|
||||||
|
tether: Ember.inject.service(),
|
||||||
|
|
||||||
hasSecondButton: Ember.computed('button2', 'color2', function () {
|
hasSecondButton: Ember.computed('button2', 'color2', function () {
|
||||||
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
|
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
|
||||||
|
@ -43,9 +44,10 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
// TODO: refactor to eliminate self
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
let drop = new Drop({
|
let drop = this.get('tether').createDrop({
|
||||||
target: document.getElementById(self.get('target')),
|
target: document.getElementById(self.get('target')),
|
||||||
content: self.$(".dropdown-dialog")[0],
|
content: self.$(".dropdown-dialog")[0],
|
||||||
classes: 'drop-theme-basic',
|
classes: 'drop-theme-basic',
|
||||||
|
@ -65,30 +67,38 @@ export default Ember.Component.extend({
|
||||||
remove: true
|
remove: true
|
||||||
});
|
});
|
||||||
|
|
||||||
self.set('drop', drop);
|
if (drop) {
|
||||||
|
drop.on('open', function () {
|
||||||
|
if (is.not.null(self.get("focusOn"))) {
|
||||||
|
document.getElementById(self.get("focusOn")).focus();
|
||||||
|
}
|
||||||
|
|
||||||
drop.on('open', function () {
|
if (is.not.null(self.get("selectOn"))) {
|
||||||
if (is.not.null(self.get("focusOn"))) {
|
document.getElementById(self.get("selectOn")).select();
|
||||||
document.getElementById(self.get("focusOn")).focus();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (is.not.null(self.get("selectOn"))) {
|
if (is.not.null(self.get("onOpenCallback"))) {
|
||||||
document.getElementById(self.get("selectOn")).select();
|
self.attrs.onOpenCallback(drop);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
self.set('drop', drop);
|
||||||
|
}
|
||||||
|
|
||||||
if (is.not.null(self.get("onOpenCallback"))) {
|
|
||||||
self.attrs.onOpenCallback(drop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this.get('drop').destroy();
|
let drop = this.get('drop');
|
||||||
|
if (drop) {
|
||||||
|
drop.destroy();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onCancel() {
|
onCancel() {
|
||||||
this.get('drop').close();
|
let drop = this.get('drop');
|
||||||
|
if (drop) {
|
||||||
|
drop.close();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onAction() {
|
onAction() {
|
||||||
|
@ -98,8 +108,9 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
let close = this.attrs.onAction();
|
let close = this.attrs.onAction();
|
||||||
|
|
||||||
if (close) {
|
let drop = this.get('drop');
|
||||||
this.get('drop').close();
|
if (close && drop) {
|
||||||
|
drop.close();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -110,9 +121,10 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
let close = this.attrs.onAction2();
|
let close = this.attrs.onAction2();
|
||||||
|
|
||||||
if (close) {
|
let drop = this.get('drop');
|
||||||
this.get('drop').close();
|
if (close && drop) {
|
||||||
|
drop.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
|
@ -13,40 +13,44 @@ import Ember from 'ember';
|
||||||
import stringUtil from '../utils/string';
|
import stringUtil from '../utils/string';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
target: null,
|
target: null,
|
||||||
open: "click",
|
open: "click",
|
||||||
position: 'bottom right',
|
position: 'bottom right',
|
||||||
contentId: "",
|
contentId: "",
|
||||||
drop: null,
|
drop: null,
|
||||||
|
tether: Ember.inject.service(),
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
this.set("contentId", 'dropdown-menu-' + stringUtil.makeId(10));
|
this.set("contentId", 'dropdown-menu-' + stringUtil.makeId(10));
|
||||||
|
|
||||||
// if (this.session.get('isMobile')) {
|
// if (this.session.get('isMobile')) {
|
||||||
// this.set('open', "click");
|
// this.set('open', "click");
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
let drop = new Drop({
|
let drop = this.get('tether').createDrop({
|
||||||
target: document.getElementById(self.get('target')),
|
target: document.getElementById(self.get('target')),
|
||||||
content: self.$(".dropdown-menu")[0],
|
content: self.$(".dropdown-menu")[0],
|
||||||
classes: 'drop-theme-menu',
|
classes: 'drop-theme-menu',
|
||||||
position: self.get('position'),
|
position: self.get('position'),
|
||||||
openOn: self.get('open'),
|
openOn: self.get('open'),
|
||||||
tetherOptions: {
|
tetherOptions: {
|
||||||
offset: "5px 0",
|
offset: "5px 0",
|
||||||
targetOffset: "10px 0"
|
targetOffset: "10px 0"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.set('drop', drop);
|
self.set('drop', drop);
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
this.get('drop').destroy();
|
let drop = this.get('drop');
|
||||||
}
|
if (drop) {
|
||||||
});
|
drop.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
33
app/app/services/tether.js
Normal file
33
app/app/services/tether.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a work around problems that tether introduces into testing.
|
||||||
|
* TODO: remove this code and refactor in favour of ember-tether
|
||||||
|
*/
|
||||||
|
export default Ember.Service.extend({
|
||||||
|
createDrop() {
|
||||||
|
if (Ember.testing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Drop(...arguments);
|
||||||
|
},
|
||||||
|
createTooltip() {
|
||||||
|
if (Ember.testing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Tooltip(...arguments);
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,3 +1,14 @@
|
||||||
|
// 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 Mirage from 'ember-cli-mirage';
|
import Mirage from 'ember-cli-mirage';
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
|
@ -13,48 +24,6 @@ export default function () {
|
||||||
return schema.db.meta[0];
|
return schema.db.meta[0];
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/public/validate', function (schema, request) {
|
|
||||||
let serverToken = request.queryParams.token;
|
|
||||||
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0";
|
|
||||||
|
|
||||||
if (token = serverToken) {
|
|
||||||
return {
|
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/users/0/permissions', function () {
|
|
||||||
return [{
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "",
|
|
||||||
"canView": true,
|
|
||||||
"canEdit": false
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/templates', function () {
|
this.get('/templates', function () {
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
@ -63,55 +32,231 @@ export default function () {
|
||||||
let folder_id = request.queryParams.folder;
|
let folder_id = request.queryParams.folder;
|
||||||
|
|
||||||
if (folder_id = "VzMuyEw_3WqiafcG") {
|
if (folder_id = "VzMuyEw_3WqiafcG") {
|
||||||
return [{
|
return schema.db.documents.where({ folderId: folder_id });
|
||||||
"id": "VzMwX0w_3WrtFztd",
|
}
|
||||||
"created": "2016-05-11T13:15:11Z",
|
|
||||||
"revised": "2016-05-11T13:22:16Z",
|
if (folder_id = 'V0Vy5Uw_3QeDAMW9') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id', function (schema, request) {
|
||||||
|
let id = request.params.id;
|
||||||
|
return schema.db.documents.where({ id: `${id}` })[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id/pages', function () {
|
||||||
|
return [{
|
||||||
|
"id": "VzMzBUw_3WrtFztw",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 1,
|
||||||
|
"sequence": 1024,
|
||||||
|
"title": "README",
|
||||||
|
"body": "",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFztx",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 2,
|
||||||
|
"sequence": 2048,
|
||||||
|
"title": "To Document / Instructions ",
|
||||||
|
"body": "\n\n\u003cp\u003eThe build process around go get github.com/elazarl/go-bindata-assetfs\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFzty",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 3072,
|
||||||
|
"title": "GO ",
|
||||||
|
"body": "\n\n\u003cp\u003egobin / go env\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFztz",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 4096,
|
||||||
|
"title": "go-bindata-assetsfs ",
|
||||||
|
"body": "\n\n\u003cp\u003emake sure you do install cmd from inside go-* folder where main.go lives\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFzt0",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 5120,
|
||||||
|
"title": "SSL ",
|
||||||
|
"body": "\n\n\u003cp\u003eselfcert generation and avoiding red lock\u003c/p\u003e\n\n\u003cp\u003e\u003ca href=\"https://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/\"\u003ehttps://www.accuweaver.com/2014/09/19/make-chrome-accept-a-self-signed-certificate-on-osx/\u003c/a\u003e\u003c/p\u003e\n\n\u003cp\u003echrome://restart\u003c/p\u003e\n\n\u003cp\u003ego run generate_cert.go -host demo1.dev\u003c/p\u003e\n\n\u003cp\u003eport number not required\nbut browser restart is!\u003c/p\u003e\n\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "VzMzBUw_3WrtFzt1",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"revised": "2016-05-11T13:26:29Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "wysiwyg",
|
||||||
|
"level": 3,
|
||||||
|
"sequence": 6144,
|
||||||
|
"title": "after clone ",
|
||||||
|
"body": "\n\n\u003cul\u003e\n\u003cli\u003ecd app\u003c/li\u003e\n\u003cli\u003enpm install\u003c/li\u003e\n\u003cli\u003ebower install\u003c/li\u003e\n\u003cli\u003ecd ..\u003c/li\u003e\n\u003cli\u003e./build.sh\u003c/li\u003e\n\u003c/ul\u003e\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "V1qnNUw_3QRDs13j",
|
||||||
|
"created": "2016-06-10T11:40:37Z",
|
||||||
|
"revised": "2016-06-10T11:40:37Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "github",
|
||||||
|
"level": 2,
|
||||||
|
"sequence": 12288,
|
||||||
|
"title": "GitHub Section",
|
||||||
|
"body": "\n\u003cdiv class=\"section-github-render\"\u003e\n\t\u003cp\u003eThere are 0 commits for branch \u003ca href=\"\"\u003e\u003c/a\u003e of repository \u003ca href=\"\"\u003e.\u003c/a\u003e\u003c/p\u003e\n\t\u003cdiv class=\"github-board\"\u003e\n\t\t\n\t\u003c/div\u003e\n\u003c/div\u003e\n",
|
||||||
|
"revisions": 0
|
||||||
|
}, {
|
||||||
|
"id": "V1qqJkw_3RXs3w1D",
|
||||||
|
"created": "2016-06-10T11:53:10Z",
|
||||||
|
"revised": "2016-06-10T11:53:10Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"documentId": "VzMzBUw_3WrtFztv",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"contentType": "github",
|
||||||
|
"level": 2,
|
||||||
|
"sequence": 24576,
|
||||||
|
"title": "GitHub Section",
|
||||||
|
"body": "\n\u003cdiv class=\"section-github-render\"\u003e\n\t\u003cp\u003eThere are 0 commits for branch \u003ca href=\"\"\u003e\u003c/a\u003e of repository \u003ca href=\"\"\u003e.\u003c/a\u003e\u003c/p\u003e\n\t\u003cdiv class=\"github-board\"\u003e\n\t\t\n\t\u003c/div\u003e\n\u003c/div\u003e\n",
|
||||||
|
"revisions": 0
|
||||||
|
}];
|
||||||
|
});
|
||||||
|
|
||||||
|
this.post('/templates/0/folder/VzMuyEw_3WqiafcG', function (schema, request) {
|
||||||
|
let type = request.queryParams.type;
|
||||||
|
if (type === 'saved') {
|
||||||
|
return schema.db.documents.insert({
|
||||||
|
"id": "V4y7jkw_3QvCDSeS",
|
||||||
|
"created": "2016-07-18T11:20:47Z",
|
||||||
|
"revised": "2016-07-18T11:20:47Z",
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
"folderId": "VzMuyEw_3WqiafcG",
|
"folderId": "VzMuyEw_3WqiafcG",
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
"job": "",
|
"job": "",
|
||||||
"location": "template-0",
|
"location": "template-0",
|
||||||
"name": "Empty Document",
|
"name": "New Document",
|
||||||
"excerpt": "My test document",
|
"excerpt": "A new document",
|
||||||
"tags": "",
|
"tags": "",
|
||||||
"template": false
|
"template": false
|
||||||
}, {
|
});
|
||||||
"id": "VzMvJEw_3WqiafcI",
|
|
||||||
"created": "2016-05-11T13:09:56Z",
|
|
||||||
"revised": "2016-05-11T13:09:56Z",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"folderId": "VzMuyEw_3WqiafcG",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"job": "0bf9b076-cb74-4e8e-75be-8ee2d24a8171",
|
|
||||||
"location": "/var/folders/d6/kr81d2fs5bsbm8rz2p092fy80000gn/T/documize/_uploads/0bf9b076-cb74-4e8e-75be-8ee2d24a8171/README.md",
|
|
||||||
"name": "README",
|
|
||||||
"excerpt": "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.",
|
|
||||||
"tags": "",
|
|
||||||
"template": false
|
|
||||||
}];
|
|
||||||
} else if (folder_id = "VzMygEw_3WrtFzto") {
|
|
||||||
return {
|
|
||||||
"id": "VzMygEw_3WrtFzto",
|
|
||||||
"created": "2016-05-11T13:24:17Z",
|
|
||||||
"revised": "2016-05-11T13:25:51Z",
|
|
||||||
"name": "Test",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"folderType": 1
|
|
||||||
};
|
|
||||||
} else if (folder_id = 'V0Vy5Uw_3QeDAMW9') {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.delete('/documents/:id', function (schema, request) {
|
||||||
|
let id = request.params.id;
|
||||||
|
return schema.db.documents.remove(id);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id/attachments', function () {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/documents/:id/meta', function () {
|
||||||
|
return {
|
||||||
|
"viewers": [{
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"created": "2016-07-14T13:46:24Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}],
|
||||||
|
"editors": [{
|
||||||
|
"pageId": "V1qqJkw_3RXs3w1D",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-06-10T11:53:10Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "V1qnNUw_3QRDs13j",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-06-10T11:40:37Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFztw",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFztx",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFzty",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFztz",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFzt0",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}, {
|
||||||
|
"pageId": "VzMzBUw_3WrtFzt1",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"action": "add-page",
|
||||||
|
"created": "2016-05-11T13:26:29Z",
|
||||||
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando"
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
this.get('/folders', function (schema) {
|
this.get('/folders', function (schema) {
|
||||||
return schema.db.folders;
|
return schema.db.folders;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/folders', function (schema, request) {
|
this.post('/folders', function (schema, request) {
|
||||||
var name = JSON.parse(request.requestBody).name;
|
var name = JSON.parse(request.requestBody).name;
|
||||||
let newFolder = {
|
let folder = {
|
||||||
"id": "V0Vy5Uw_3QeDAMW9",
|
"id": "V0Vy5Uw_3QeDAMW9",
|
||||||
"created": "2016-05-25T09:39:49Z",
|
"created": "2016-05-25T09:39:49Z",
|
||||||
"revised": "2016-05-25T09:39:49Z",
|
"revised": "2016-05-25T09:39:49Z",
|
||||||
|
@ -121,43 +266,19 @@ export default function () {
|
||||||
"folderType": 2
|
"folderType": 2
|
||||||
};
|
};
|
||||||
|
|
||||||
let folder = schema.db.folders.insert(newFolder);
|
return schema.db.folders.insert(folder);
|
||||||
return folder;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/public/authenticate', (schema, request) => {
|
this.post('/public/authenticate', (schema, request) => {
|
||||||
let authorization = request.requestHeaders.Authorization;
|
let authorization = request.requestHeaders.Authorization;
|
||||||
let expectedAuthorization = "Basic OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==";
|
let expectedAuthorization = "Basic OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==";
|
||||||
|
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0";
|
||||||
|
let user = schema.db.users.where({ id: "VzMuyEw_3WqiafcE" });
|
||||||
|
|
||||||
if (expectedAuthorization === authorization) {
|
if (expectedAuthorization === authorization) {
|
||||||
console.log("SSO login success");
|
|
||||||
return {
|
return {
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
|
"token": `${token}`,
|
||||||
"user": {
|
"user": user[0]
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,78 +287,49 @@ export default function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkb21haW4iOiIiLCJleHAiOjE0NjQwMjM2NjcsImlzcyI6IkRvY3VtaXplIiwib3JnIjoiVnpNdXlFd18zV3FpYWZjRCIsInN1YiI6IndlYmFwcCIsInVzZXIiOiJWek11eUV3XzNXcWlhZmNFIn0.NXZ6bo8mtvdZF_b9HavbidVUJqhmBA1zr0fSAPvbah0",
|
"token": `${token}`,
|
||||||
"user": {
|
"user": user[0]
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/users/VzMuyEw_3WqiafcE/permissions', (schema) => {
|
this.get('/users/:id/permissions', (schema, request) => {
|
||||||
return schema.db.permissions;
|
let userId = request.params.id;
|
||||||
|
return schema.db.permissions.where({ userId: `${userId}` });
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/folders/VzMuyEw_3WqiafcG/permissions', () => {
|
this.get('/folders/:id/permissions', (schema, request) => {
|
||||||
|
let id = request.params.id;
|
||||||
|
return schema.db.folderPermissions.where({ id: `${id}` });
|
||||||
|
});
|
||||||
|
|
||||||
|
this.put('/folders/:id/permissions', () => {
|
||||||
|
// let id = request.params.id;
|
||||||
|
// let attrs = JSON.parse(request.requestBody).Roles;
|
||||||
|
// return schema.db.folderPermissions.update('VzMygEw_3WrtFzto', attrs[0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/users/folder/:id', () => {
|
||||||
return [{
|
return [{
|
||||||
"folderId": "VzMuyEw_3WqiafcG",
|
"id": "VzMuyEw_3WqiafcE",
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
"created": "2016-05-11T15:08:24Z",
|
||||||
"canView": true,
|
"revised": "2016-07-04T10:24:41Z",
|
||||||
"canEdit": true
|
"firstname": "Lennex",
|
||||||
|
"lastname": "Zinyando",
|
||||||
|
"email": "brizdigital@gmail.com",
|
||||||
|
"initials": "LZ",
|
||||||
|
"active": true,
|
||||||
|
"editor": false,
|
||||||
|
"admin": false,
|
||||||
|
"accounts": null
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
|
|
||||||
this.put('/folders/VzMygEw_3WrtFzto/permissions', () => {
|
this.get('/sections/refresh', (schema, request) => {
|
||||||
return [{
|
let documentID = request.queryParams.documentID;
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
if (documentID) {
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
return {};
|
||||||
"userId": "",
|
}
|
||||||
"canEdit": true,
|
|
||||||
"canView": true
|
|
||||||
}, {
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "VzMyp0w_3WrtFztq",
|
|
||||||
"canEdit": false,
|
|
||||||
"canView": false
|
|
||||||
}, {
|
|
||||||
"orgId": "",
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"canEdit": true,
|
|
||||||
"canView": true
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
|
|
||||||
this.get('/folders/VzMygEw_3WrtFzto/permissions', () => {
|
|
||||||
return [{
|
|
||||||
"folderId": "VzMygEw_3WrtFzto",
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"canView": true,
|
|
||||||
"canEdit": true
|
|
||||||
}];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.put('/folders/:id', (schema, request) => {
|
this.put('/folders/:id', (schema, request) => {
|
||||||
|
@ -264,18 +356,8 @@ export default function () {
|
||||||
return schema.db.folders.find(id);
|
return schema.db.folders.find(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/organizations/VzMuyEw_3WqiafcD', () => {
|
this.get('/organizations/VzMuyEw_3WqiafcD', (schema) => {
|
||||||
return {
|
return schema.db.organizations[0];
|
||||||
"id": "VzMuyEw_3WqiafcD",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-23T11:23:20Z",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"url": "",
|
|
||||||
"domain": "",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"allowAnonymousAccess": false
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.put('/organizations/VzMuyEw_3WqiafcD', (schema, request) => {
|
this.put('/organizations/VzMuyEw_3WqiafcD', (schema, request) => {
|
||||||
|
@ -283,69 +365,15 @@ export default function () {
|
||||||
let message = JSON.parse(request.requestBody).title;
|
let message = JSON.parse(request.requestBody).title;
|
||||||
let allowAnonymousAccess = JSON.parse(request.requestBody).allowAnonymousAccess;
|
let allowAnonymousAccess = JSON.parse(request.requestBody).allowAnonymousAccess;
|
||||||
|
|
||||||
return {
|
return schema.db.organizations.update('VzMuyEw_3WqiafcD', {
|
||||||
"id": "VzMuyEw_3WqiafcD",
|
title: `${title}`,
|
||||||
"created": "2016-05-11T15:08:24Z",
|
message: `${message}`,
|
||||||
"revised": "2016-05-23T11:23:20Z",
|
allowAnonymousAccess: `${allowAnonymousAccess}`
|
||||||
"title": `${title}`,
|
});
|
||||||
"message": `${message}`,
|
|
||||||
"url": "",
|
|
||||||
"domain": "",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"allowAnonymousAccess": `${allowAnonymousAccess}`
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/users', () => {
|
this.get('/users', (schema) => {
|
||||||
return [{
|
return schema.db.users;
|
||||||
"id": "VzMyp0w_3WrtFztq",
|
|
||||||
"created": "2016-05-11T13:24:55Z",
|
|
||||||
"revised": "2016-05-11T13:33:47Z",
|
|
||||||
"firstname": "Len",
|
|
||||||
"lastname": "Random",
|
|
||||||
"email": "zinyando@gmail.com",
|
|
||||||
"initials": "LR",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": false,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMyp0w_3WrtFztr",
|
|
||||||
"created": "2016-05-11T13:24:55Z",
|
|
||||||
"revised": "2016-05-11T13:24:55Z",
|
|
||||||
"admin": false,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMyp0w_3WrtFztq",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}, {
|
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
}];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/users', (schema, request) => {
|
this.post('/users', (schema, request) => {
|
||||||
|
@ -353,7 +381,7 @@ export default function () {
|
||||||
let lastname = JSON.parse(request.requestBody).lastname;
|
let lastname = JSON.parse(request.requestBody).lastname;
|
||||||
let email = JSON.parse(request.requestBody).email;
|
let email = JSON.parse(request.requestBody).email;
|
||||||
|
|
||||||
return {
|
let user = {
|
||||||
"id": "V0RmtUw_3QeDAMW7",
|
"id": "V0RmtUw_3QeDAMW7",
|
||||||
"created": "2016-05-24T14:35:33Z",
|
"created": "2016-05-24T14:35:33Z",
|
||||||
"revised": "2016-05-24T14:35:33Z",
|
"revised": "2016-05-24T14:35:33Z",
|
||||||
|
@ -378,35 +406,14 @@ export default function () {
|
||||||
"domain": ""
|
"domain": ""
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return schema.db.users.insert(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.get('/users/VzMuyEw_3WqiafcE', () => {
|
this.get('/users/:id', (schema, request) => {
|
||||||
|
let id = request.params.id;
|
||||||
return {
|
let user = schema.db.users.where({ id: `${id}` });
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
return user[0];
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"firstname": "Lennex",
|
|
||||||
"lastname": "Zinyando",
|
|
||||||
"email": "brizdigital@gmail.com",
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.put('/users/VzMuyEw_3WqiafcE', (schema, request) => {
|
this.put('/users/VzMuyEw_3WqiafcE', (schema, request) => {
|
||||||
|
@ -414,35 +421,15 @@ export default function () {
|
||||||
let lastname = JSON.parse(request.requestBody).lastname;
|
let lastname = JSON.parse(request.requestBody).lastname;
|
||||||
let email = JSON.parse(request.requestBody).email;
|
let email = JSON.parse(request.requestBody).email;
|
||||||
|
|
||||||
return {
|
return schema.db.users.update('VzMuyEw_3WqiafcE', {
|
||||||
"id": "VzMuyEw_3WqiafcE",
|
firstname: `${firstname}`,
|
||||||
"created": "2016-05-11T15:08:24Z",
|
lastname: `${lastname}`,
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
email: `${email}`
|
||||||
"firstname": `${firstname}`,
|
});
|
||||||
"lastname": `${lastname}`,
|
|
||||||
"email": `${email}`,
|
|
||||||
"initials": "LZ",
|
|
||||||
"active": true,
|
|
||||||
"editor": true,
|
|
||||||
"admin": true,
|
|
||||||
"accounts": [{
|
|
||||||
"id": "VzMuyEw_3WqiafcF",
|
|
||||||
"created": "2016-05-11T15:08:24Z",
|
|
||||||
"revised": "2016-05-11T15:08:24Z",
|
|
||||||
"admin": true,
|
|
||||||
"editor": true,
|
|
||||||
"userId": "VzMuyEw_3WqiafcE",
|
|
||||||
"orgId": "VzMuyEw_3WqiafcD",
|
|
||||||
"company": "EmberSherpa",
|
|
||||||
"title": "EmberSherpa",
|
|
||||||
"message": "This Documize instance contains all our team documentation",
|
|
||||||
"domain": ""
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.post('/folders/VzMuyEw_3WqiafcG/invitation', () => {
|
this.post('/folders/VzMuyEw_3WqiafcG/invitation', () => {
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,31 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is an example factory definition.
|
This is an example factory definition.
|
||||||
|
|
||||||
Create more files in this directory to define additional factories.
|
Create more files in this directory to define additional factories.
|
||||||
*/
|
*/
|
||||||
import Mirage/*, {faker} */ from 'ember-cli-mirage';
|
import Mirage /*, {faker} */ from 'ember-cli-mirage';
|
||||||
|
|
||||||
export default Mirage.Factory.extend({
|
export default Mirage.Factory.extend({
|
||||||
// name: 'Pete', // strings
|
// name: 'Pete', // strings
|
||||||
// age: 20, // numbers
|
// age: 20, // numbers
|
||||||
// tall: true, // booleans
|
// tall: true, // booleans
|
||||||
|
|
||||||
// email: function(i) { // and functions
|
// email: function(i) { // and functions
|
||||||
// return 'person' + i + '@test.com';
|
// return 'person' + i + '@test.com';
|
||||||
// },
|
// },
|
||||||
|
|
||||||
// firstName: faker.name.firstName, // using faker
|
// firstName: faker.name.firstName, // using faker
|
||||||
// lastName: faker.name.firstName,
|
// lastName: faker.name.firstName,
|
||||||
// zipCode: faker.address.zipCode
|
// zipCode: faker.address.zipCode
|
||||||
});
|
});
|
||||||
|
|
27
app/mirage/factories/document.js
Normal file
27
app/mirage/factories/document.js
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// 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 { Factory, faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"id": faker.list.cycle("VzMwX0w_3WrtFztd", "VzMvJEw_3WqiafcI", "VzMzBUw_3WrtFztv"),
|
||||||
|
"created": "2016-05-11T13:15:11Z",
|
||||||
|
"revised": "2016-05-11T13:22:16Z",
|
||||||
|
"orgId": "VzMuyEw_3WqiafcD",
|
||||||
|
"folderId": "VzMuyEw_3WqiafcG",
|
||||||
|
"userId": "VzMuyEw_3WqiafcE",
|
||||||
|
"job": faker.list.cycle("", "0bf9b076-cb74-4e8e-75be-8ee2d24a8171", "3004c449-b053-49a6-4abc-72688136184d"),
|
||||||
|
"location": faker.list.cycle("template-0", "/var/folders/README.md", "/var/folders/d6/3004c449-b053-49a6-4abc-72688136184d/README.md"),
|
||||||
|
"name": faker.list.cycle("Empty Document", "README", "README"),
|
||||||
|
"excerpt": faker.list.cycle("My test document", "To Document/ Instructions. GO. go- bindata- assetsfs. SSL.", "To Document/ Instructions. GO. go- bindata- assetsfs. SSL."),
|
||||||
|
"tags": "",
|
||||||
|
"template": false
|
||||||
|
});
|
19
app/mirage/factories/folder-permission.js
Normal file
19
app/mirage/factories/folder-permission.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// 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 { Factory, faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"folderId": faker.list.cycle("VzMuyEw_3WqiafcG", "VzMygEw_3WrtFzto"),
|
||||||
|
"userId": faker.list.cycle("VzMuyEw_3WqiafcE", "VzMuyEw_3WqiafcE"),
|
||||||
|
"canView": true,
|
||||||
|
"canEdit": true
|
||||||
|
});
|
24
app/mirage/factories/organization.js
Normal file
24
app/mirage/factories/organization.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// 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 { Factory } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"id": "VzMuyEw_3WqiafcD",
|
||||||
|
"created": "2016-05-11T15:08:24Z",
|
||||||
|
"revised": "2016-05-23T11:23:20Z",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"url": "",
|
||||||
|
"domain": "",
|
||||||
|
"email": "brizdigital@gmail.com",
|
||||||
|
"allowAnonymousAccess": false
|
||||||
|
});
|
|
@ -1,19 +1,19 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import Mirage, { faker } from 'ember-cli-mirage';
|
import Mirage, { faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
export default Mirage.Factory.extend({
|
export default Mirage.Factory.extend({
|
||||||
"folderId": faker.list.cycle('V0Vy5Uw_3QeDAMW9', 'VzMuyEw_3WqiafcG', 'VzMygEw_3WrtFzto', 'VzMygEw_3WrtFzto'),
|
"folderId": faker.list.cycle('V0Vy5Uw_3QeDAMW9', 'VzMuyEw_3WqiafcG', 'VzMygEw_3WrtFzto', 'VzMygEw_3WrtFzto', "VzMygEw_3WrtFzto"),
|
||||||
"userId": faker.list.cycle('VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', ''),
|
"userId": faker.list.cycle('VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', 'VzMuyEw_3WqiafcE', '', 0),
|
||||||
"canView": true,
|
"canView": true,
|
||||||
"canEdit": faker.list.cycle(true, true, true, false)
|
"canEdit": faker.list.cycle(true, true, true, false, false)
|
||||||
});
|
});
|
||||||
|
|
38
app/mirage/factories/user.js
Normal file
38
app/mirage/factories/user.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// 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 { Factory, faker } from 'ember-cli-mirage';
|
||||||
|
|
||||||
|
export default Factory.extend({
|
||||||
|
"id": faker.list.cycle("VzMyp0w_3WrtFztq", "VzMuyEw_3WqiafcE"),
|
||||||
|
"created": faker.list.cycle("2016-05-11T13:24:55Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"revised": faker.list.cycle("2016-05-11T13:33:47Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"firstname": faker.list.cycle("Len", "Lennex"),
|
||||||
|
"lastname": faker.list.cycle("Random", "Zinyando"),
|
||||||
|
"email": faker.list.cycle("zinyando@gmail.com", "brizdigital@gmail.com"),
|
||||||
|
"initials": faker.list.cycle("LR", "LZ"),
|
||||||
|
"active": true,
|
||||||
|
"editor": true,
|
||||||
|
"admin": faker.list.cycle(false, true),
|
||||||
|
"accounts": [{
|
||||||
|
"id": faker.list.cycle("VzMyp0w_3WrtFztr", "VzMuyEw_3WqiafcF"),
|
||||||
|
"created": faker.list.cycle("2016-05-11T13:24:55Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"revised": faker.list.cycle("2016-05-11T13:24:55Z", "2016-05-11T15:08:24Z"),
|
||||||
|
"admin": faker.list.cycle(false, true),
|
||||||
|
"editor": faker.list.cycle(true, true),
|
||||||
|
"userId": faker.list.cycle("VzMyp0w_3WrtFztq", "VzMuyEw_3WqiafcE"),
|
||||||
|
"orgId": faker.list.cycle("VzMuyEw_3WqiafcD", "VzMuyEw_3WqiafcD"),
|
||||||
|
"company": "EmberSherpa",
|
||||||
|
"title": "EmberSherpa",
|
||||||
|
"message": "This Documize instance contains all our team documentation",
|
||||||
|
"domain": ""
|
||||||
|
}]
|
||||||
|
});
|
|
@ -32,7 +32,8 @@
|
||||||
"waitToAppear",
|
"waitToAppear",
|
||||||
"stubUserNotification",
|
"stubUserNotification",
|
||||||
"is",
|
"is",
|
||||||
"authenticateUser"
|
"authenticateUser",
|
||||||
|
"localStorage"
|
||||||
],
|
],
|
||||||
"node": false,
|
"node": false,
|
||||||
"browser": false,
|
"browser": false,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Anon access disabled');
|
||||||
|
|
||||||
test('visiting / when not authenticated and with { allowAnonymousAccess: false } takes user to login', function (assert) {
|
test('visiting / when not authenticated and with { allowAnonymousAccess: false } takes user to login', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
@ -25,4 +24,4 @@ test('visiting / when not authenticated and with { allowAnonymousAccess: false }
|
||||||
findWithAssert('#authPassword');
|
findWithAssert('#authPassword');
|
||||||
findWithAssert('button');
|
findWithAssert('button');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Anon access enabled');
|
||||||
|
|
||||||
test('visiting / when not authenticated and with { allowAnonymousAccess: true } takes user to folder view', function (assert) {
|
test('visiting / when not authenticated and with { allowAnonymousAccess: true } takes user to folder view', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: true });
|
server.create('meta', { allowAnonymousAccess: true });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
@ -28,7 +27,6 @@ test('visiting / when not authenticated and with { allowAnonymousAccess: true }
|
||||||
|
|
||||||
test('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function (assert) {
|
test('visiting / when authenticated and with { allowAnonymousAccess: true } takes user to dashboard', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: true });
|
server.create('meta', { allowAnonymousAccess: true });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
@ -42,4 +40,4 @@ test('visiting / when authenticated and with { allowAnonymousAccess: true } take
|
||||||
assert.equal(find('.login').length, 0, 'Login button is not displayed');
|
assert.equal(find('.login').length, 0, 'Login button is not displayed');
|
||||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Dashboard is displayed after user is signed in');
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project', 'Dashboard is displayed after user is signed in');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ moduleForAcceptance('Acceptance | Authentication');
|
||||||
|
|
||||||
test('visiting /auth/login and logging in', function (assert) {
|
test('visiting /auth/login and logging in', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
visit('/auth/login');
|
visit('/auth/login');
|
||||||
|
|
||||||
fillIn('#authEmail', 'brizdigital@gmail.com');
|
fillIn('#authEmail', 'brizdigital@gmail.com');
|
||||||
|
@ -30,10 +29,8 @@ test('visiting /auth/login and logging in', function (assert) {
|
||||||
|
|
||||||
test('logging out a user', function (assert) {
|
test('logging out a user', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
userLogin();
|
userLogin();
|
||||||
|
click('.dropdown-menu a:contains(Logout)');
|
||||||
visit('/auth/logout');
|
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
assert.equal(currentURL(), '/auth/login', 'Logging out successful');
|
assert.equal(currentURL(), '/auth/login', 'Logging out successful');
|
||||||
|
@ -42,7 +39,6 @@ test('logging out a user', function (assert) {
|
||||||
|
|
||||||
test('successful sso login authenticates redirects to dashboard', function (assert) {
|
test('successful sso login authenticates redirects to dashboard', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
|
|
||||||
visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
|
visit('/auth/sso/OmJyaXpkaWdpdGFsQGdtYWlsLmNvbTp6aW55YW5kbzEyMw==');
|
||||||
|
|
||||||
|
@ -53,11 +49,10 @@ test('successful sso login authenticates redirects to dashboard', function (asse
|
||||||
|
|
||||||
test('sso login with bad token should redirect to login', function (assert) {
|
test('sso login with bad token should redirect to login', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
|
|
||||||
visit('/auth/sso/randomToken1234567890');
|
visit('/auth/sso/randomToken1234567890');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
assert.equal(currentURL(), '/auth/login', 'SSO login unsuccessful');
|
assert.equal(currentURL(), '/auth/login', 'SSO login unsuccessful');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,47 +1,46 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { test, skip } from 'qunit';
|
import { test } from 'qunit';
|
||||||
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
|
|
||||||
moduleForAcceptance('Acceptance | Documents space');
|
moduleForAcceptance('Acceptance | Documents space');
|
||||||
|
|
||||||
skip('Adding a new folder space', function (assert) {
|
test('Adding a new folder space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let personalSpaces = find('.section div:contains(PERSONAL)').length;
|
let personalSpaces = find('.folders-list div:contains(PERSONAL) .list a').length;
|
||||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
assert.equal(personalSpaces, 1, '1 personal space is listed');
|
assert.equal(personalSpaces, 1, '1 personal space is listed');
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#add-folder-button');
|
click('#add-folder-button');
|
||||||
|
|
||||||
fillIn('#new-folder-name', 'body', 'Test Folder');
|
fillIn('#new-folder-name', 'Test Folder');
|
||||||
|
|
||||||
click('.actions div:contains(Add)', 'body');
|
click('.actions div:contains(Add)');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
|
let folderCount = find('.folders-list div:contains(PERSONAL) .list a').length;
|
||||||
|
assert.equal(folderCount, 2, 'New folder has been added');
|
||||||
assert.equal(currentURL(), '/s/V0Vy5Uw_3QeDAMW9/test-folder');
|
assert.equal(currentURL(), '/s/V0Vy5Uw_3QeDAMW9/test-folder');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
skip('Adding a document to a space', function (assert) {
|
test('Adding a document to a space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -52,20 +51,22 @@ skip('Adding a document to a space', function (assert) {
|
||||||
assert.equal(numberOfDocuments, 2, '2 documents listed');
|
assert.equal(numberOfDocuments, 2, '2 documents listed');
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#start-document-button');
|
click('.actions div:contains(Start) .flat-green');
|
||||||
click('.actions div:contains(Add)', 'body');
|
|
||||||
|
andThen(function () {
|
||||||
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project/d/V4y7jkw_3QvCDSeS/new-document', 'New document displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
click('a div:contains(My Project) .space-name');
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let numberOfDocuments = find('.documents-list li').length;
|
let numberOfDocuments = find('.documents-list li').length;
|
||||||
assert.equal(numberOfDocuments, 3, '3 documents listed');
|
assert.equal(numberOfDocuments, 3, '3 documents listed');
|
||||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('visiting space settings page', function (assert) {
|
test('visiting space settings page', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -80,8 +81,6 @@ test('visiting space settings page', function (assert) {
|
||||||
|
|
||||||
test('changing space name', function (assert) {
|
test('changing space name', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -100,8 +99,6 @@ test('changing space name', function (assert) {
|
||||||
|
|
||||||
test('sharing a space', function (assert) {
|
test('sharing a space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -117,11 +114,8 @@ test('sharing a space', function (assert) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Test will pass after moving to factories
|
|
||||||
test('changing space permissions', function (assert) {
|
test('changing space permissions', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
|
|
||||||
visit('/s/VzMygEw_3WrtFzto/test');
|
visit('/s/VzMygEw_3WrtFzto/test');
|
||||||
|
@ -150,8 +144,6 @@ test('changing space permissions', function (assert) {
|
||||||
|
|
||||||
test('deleting a space', function (assert) {
|
test('deleting a space', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -165,10 +157,8 @@ test('deleting a space', function (assert) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
skip('deleting a document', function (assert) {
|
test('deleting a document', function (assert) {
|
||||||
server.create('meta', { allowAnonymousAccess: false });
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
server.createList('folder', 2);
|
|
||||||
server.createList('permission', 4);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
visit('/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
|
|
||||||
|
@ -186,10 +176,7 @@ skip('deleting a document', function (assert) {
|
||||||
assert.equal(deleteButton.length, 1, 'Delete button displayed after selecting document');
|
assert.equal(deleteButton.length, 1, 'Delete button displayed after selecting document');
|
||||||
});
|
});
|
||||||
|
|
||||||
click('#delete-documents-button');
|
click('.actions div:contains(Delete) .flat-red');
|
||||||
|
|
||||||
waitToAppear('.drop-content');
|
|
||||||
click('.actions div:contains(Delete)', 'body');
|
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let numberOfDocuments = find('.documents-list li');
|
let numberOfDocuments = find('.documents-list li');
|
||||||
|
@ -197,10 +184,32 @@ skip('deleting a document', function (assert) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('clicking a document title displays the document', function (assert) {
|
||||||
|
server.create('meta', { allowAnonymousAccess: false });
|
||||||
|
authenticateUser();
|
||||||
|
visit('/s/VzMygEw_3WrtFzto/test');
|
||||||
|
|
||||||
|
click('a .title:contains(README)');
|
||||||
|
|
||||||
|
andThen(function () {
|
||||||
|
findWithAssert('#add-section-button');
|
||||||
|
findWithAssert('#delete-document-button');
|
||||||
|
findWithAssert('#print-document-button');
|
||||||
|
findWithAssert('#save-template-button');
|
||||||
|
findWithAssert('#attachment-button');
|
||||||
|
findWithAssert('#set-meta-button');
|
||||||
|
findWithAssert('.name.space-name');
|
||||||
|
findWithAssert('.document-sidebar');
|
||||||
|
let title = find('.zone-header .title').text().trim();
|
||||||
|
assert.equal(title, 'README', 'document displayed correctly');
|
||||||
|
assert.equal(currentURL(), '/s/VzMygEw_3WrtFzto/test/d/VzMvJEw_3WqiafcI/readme');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function checkForCommonAsserts() {
|
function checkForCommonAsserts() {
|
||||||
findWithAssert('.sidebar-menu');
|
findWithAssert('.sidebar-menu');
|
||||||
findWithAssert('.options li:contains(General)');
|
findWithAssert('.options li:contains(General)');
|
||||||
findWithAssert('.options li:contains(Share)');
|
findWithAssert('.options li:contains(Share)');
|
||||||
findWithAssert('.options li:contains(Permissions)');
|
findWithAssert('.options li:contains(Permissions)');
|
||||||
findWithAssert('.options li:contains(Delete)');
|
findWithAssert('.options li:contains(Delete)');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
|
||||||
moduleForAcceptance('Acceptance | user profile');
|
moduleForAcceptance('Acceptance | user profile');
|
||||||
|
|
||||||
test('visiting /profile', function (assert) {
|
test('visiting /profile', function (assert) {
|
||||||
server.createList('folder', 2);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/profile');
|
visit('/profile');
|
||||||
|
|
||||||
|
@ -28,7 +27,6 @@ test('visiting /profile', function (assert) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('changing user details and email ', function (assert) {
|
test('changing user details and email ', function (assert) {
|
||||||
server.createList('folder', 2);
|
|
||||||
authenticateUser();
|
authenticateUser();
|
||||||
visit('/profile');
|
visit('/profile');
|
||||||
|
|
||||||
|
@ -49,4 +47,4 @@ test('changing user details and email ', function (assert) {
|
||||||
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
|
||||||
assert.equal(find('.content .name').text().trim(), 'Test User', 'Profile name displayed');
|
assert.equal(find('.content .name').text().trim(), 'Test User', 'Profile name displayed');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
// 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
|
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
//
|
//
|
||||||
// You can operate outside the AGPL restrictions by purchasing
|
// You can operate outside the AGPL restrictions by purchasing
|
||||||
// Documize Enterprise Edition and obtaining a commercial license
|
// Documize Enterprise Edition and obtaining a commercial license
|
||||||
// by contacting <sales@documize.com>.
|
// by contacting <sales@documize.com>.
|
||||||
//
|
//
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
|
@ -91,9 +91,6 @@ test('add a new user', function (assert) {
|
||||||
fillIn('#newUserEmail', 'test.user@domain.com');
|
fillIn('#newUserEmail', 'test.user@domain.com');
|
||||||
click('.button-blue');
|
click('.button-blue');
|
||||||
|
|
||||||
// waitToAppear('.user-notification:contains(Added)');
|
|
||||||
// waitToDisappear('.user-notification:contains(Added)');
|
|
||||||
|
|
||||||
andThen(function () {
|
andThen(function () {
|
||||||
let numberOfUsers = find('.user-list tr').length;
|
let numberOfUsers = find('.user-list tr').length;
|
||||||
assert.equal(numberOfUsers, 4, '3 Users listed');
|
assert.equal(numberOfUsers, 4, '3 Users listed');
|
||||||
|
@ -107,4 +104,4 @@ function checkForCommonAsserts() {
|
||||||
findWithAssert('#user-button');
|
findWithAssert('#user-button');
|
||||||
findWithAssert('#accounts-button');
|
findWithAssert('#accounts-button');
|
||||||
findWithAssert('.info .title');
|
findWithAssert('.info .title');
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,31 +2,38 @@ import { module } from 'qunit';
|
||||||
import startApp from '../helpers/start-app';
|
import startApp from '../helpers/start-app';
|
||||||
import destroyApp from '../helpers/destroy-app';
|
import destroyApp from '../helpers/destroy-app';
|
||||||
|
|
||||||
export default function(name, options = {}) {
|
export default function (name, options = {}) {
|
||||||
module(name, {
|
module(name, {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
this.application = startApp();
|
this.application = startApp();
|
||||||
stubAudit(this);
|
localStorage.setItem('folder', 'VzMuyEw_3WqiafcG');
|
||||||
stubUserNotification(this);
|
stubAudit(this);
|
||||||
|
stubUserNotification(this);
|
||||||
|
server.createList('folder', 2);
|
||||||
|
server.createList('user', 2);
|
||||||
|
server.createList('document', 2);
|
||||||
|
server.createList('permission', 4);
|
||||||
|
server.createList('folder-permission', 2);
|
||||||
|
server.createList('organization', 1);
|
||||||
|
|
||||||
if (options.beforeEach) {
|
if (options.beforeEach) {
|
||||||
options.beforeEach.apply(this, arguments);
|
options.beforeEach.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.register = (fullName, Factory) => {
|
this.register = (fullName, Factory) => {
|
||||||
let instance = this.application.__deprecatedInstance__;
|
let instance = this.application.__deprecatedInstance__;
|
||||||
let registry = instance.register ? instance : instance.registry;
|
let registry = instance.register ? instance : instance.registry;
|
||||||
|
|
||||||
return registry.register(fullName, Factory);
|
return registry.register(fullName, Factory);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
afterEach() {
|
afterEach() {
|
||||||
destroyApp(this.application);
|
destroyApp(this.application);
|
||||||
|
|
||||||
if (options.afterEach) {
|
if (options.afterEach) {
|
||||||
options.afterEach.apply(this, arguments);
|
options.afterEach.apply(this, arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,16 +9,16 @@ import './stub-user-notification';
|
||||||
import './authenticate-user';
|
import './authenticate-user';
|
||||||
|
|
||||||
export default function startApp(attrs) {
|
export default function startApp(attrs) {
|
||||||
let application;
|
let application;
|
||||||
|
|
||||||
let attributes = Ember.merge({}, config.APP);
|
let attributes = Ember.merge({}, config.APP);
|
||||||
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
||||||
|
|
||||||
Ember.run(() => {
|
Ember.run(() => {
|
||||||
application = Application.create(attributes);
|
application = Application.create(attributes);
|
||||||
application.setupForTesting();
|
application.setupForTesting();
|
||||||
application.injectTestHelpers();
|
application.injectTestHelpers();
|
||||||
});
|
});
|
||||||
|
|
||||||
return application;
|
return application;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,16 @@
|
||||||
<meta property="dbname" content="{{.DBname}}" />
|
<meta property="dbname" content="{{.DBname}}" />
|
||||||
<meta property="dbhash" content="{{.DBhash}}" />
|
<meta property="dbhash" content="{{.DBhash}}" />
|
||||||
<meta name="author" content="Documize" />
|
<meta name="author" content="Documize" />
|
||||||
|
<style>
|
||||||
<style>
|
#ember-testing {
|
||||||
#ember-testing-container, #ember-testing-container * {
|
zoom: 100% !important;
|
||||||
/* Set position static to short-circuit Hubspot Tether's positioning */
|
}
|
||||||
/* https://github.com/HubSpot/tether/pull/98/ */
|
#ember-testing-container {
|
||||||
position: static !important;
|
/* Set position static to short-circuit Hubspot Tether's positioning */
|
||||||
}
|
/* https://github.com/HubSpot/tether/pull/98/ */
|
||||||
.tether-container * {
|
position: static !important;
|
||||||
z-index: 9999;
|
}
|
||||||
}
|
</style>
|
||||||
</style>
|
|
||||||
|
|
||||||
{{content-for "head"}}
|
{{content-for "head"}}
|
||||||
{{content-for "test-head"}}
|
{{content-for "test-head"}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue