1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-07 14:35:28 +02:00

Merge pull request #4 from documize/smart-section-trello

Smart section trello
This commit is contained in:
Harvey Kandola 2016-05-22 13:28:51 -07:00
commit 2c526ed304
153 changed files with 3320 additions and 902 deletions

View file

@ -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 Ember from 'ember';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
@ -13,11 +24,11 @@ Ember.RSVP.on('error', function(error) {
});
App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver
});
loadInitializers(App, config.modulePrefix);
export default App;
export default App;

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({

View file

@ -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 Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
import TooltipMixin from '../../mixins/tooltip';
@ -8,7 +19,12 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
pages: [],
page: "",
showToc: false,
tocTools: { UpTarget: "", DownTarget: "", AllowIndent: false, AllowOutdent: false },
tocTools: {
UpTarget: "",
DownTarget: "",
AllowIndent: false,
AllowOutdent: false
},
actionablePage: false,
upDisabled: true,
downDisabled: true,
@ -17,36 +33,36 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
didReceiveAttrs: function() {
this.set('showToc', is.not.undefined(this.get('pages')) && this.get('pages').get('length') > 2);
if (is.not.null(this.get('page'))) {
if (is.not.null(this.get('page'))) {
this.send('clickGotoPage', this.get('page'));
}
},
didRender: function() {
if (this.session.authenticated) {
this.addTooltip(document.getElementById("toc-up-button"));
this.addTooltip(document.getElementById("toc-down-button"));
this.addTooltip(document.getElementById("toc-outdent-button"));
this.addTooltip(document.getElementById("toc-indent-button"));
}
if (this.session.authenticated) {
this.addTooltip(document.getElementById("toc-up-button"));
this.addTooltip(document.getElementById("toc-down-button"));
this.addTooltip(document.getElementById("toc-outdent-button"));
this.addTooltip(document.getElementById("toc-indent-button"));
}
},
didInsertElement() {
this.eventBus.subscribe('documentPageAdded', this, 'onDocumentPageAdded');
didInsertElement() {
this.eventBus.subscribe('documentPageAdded', this, 'onDocumentPageAdded');
var s = $(".document-structure");
var pos = s.position();
$(window).scroll(function() {
var windowpos = $(window).scrollTop();
if (windowpos - 200 >= pos.top) {
s.addClass("stick");
s.css('width', s.parent().width());
} else {
s.removeClass("stick");
s.css('width', 'auto');
}
});
},
var s = $(".document-structure");
var pos = s.position();
$(window).scroll(function() {
var windowpos = $(window).scrollTop();
if (windowpos - 200 >= pos.top) {
s.addClass("stick");
s.css('width', s.parent().width());
} else {
s.removeClass("stick");
s.css('width', 'auto');
}
});
},
willDestroyElement() {
this.eventBus.unsubscribe('documentPageAdded');
@ -77,9 +93,11 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.set('page', pageId);
var toc = this.get('pages');
var page = _.findWhere(toc, {id: pageId});
var page = _.findWhere(toc, {
id: pageId
});
// handle root node
// handle root node
if (is.undefined(page) || page.level === 1) {
return;
}
@ -90,8 +108,8 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
return;
}
var upPage = toc[index-1];
var downPage = toc[index+1];
var upPage = toc[index - 1];
var downPage = toc[index + 1];
if (_.isUndefined(upPage)) {
this.set('tocTools.UpTarget', "");
@ -103,39 +121,31 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
// can we go up?
// can we indent?
if (!_.isUndefined(upPage))
{
if (!_.isUndefined(upPage)) {
// can only go up if someone is same or higher level?
var index2 = _.indexOf(toc, upPage, false);
if (index2 !== -1)
{
if (index2 !== -1) {
// up
for (var i = index2; i > 0; i--)
{
if (page.level > toc[i].level)
{
for (var i = index2; i > 0; i--) {
if (page.level > toc[i].level) {
break;
}
if (page.level === toc[i].level)
{
if (page.level === toc[i].level) {
this.set('tocTools.UpTarget', toc[i].id);
break;
}
}
// indent?
for (var i2 = index2; i2 > 0; i2--)
{
if (toc[i2].level < page.level)
{
for (var i2 = index2; i2 > 0; i2--) {
if (toc[i2].level < page.level) {
this.set('tocTools.AllowIndent', false);
break;
}
if (page.level === toc[i2].level)
{
if (page.level === toc[i2].level) {
this.set('tocTools.AllowIndent', true);
break;
}
@ -143,30 +153,24 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
}
// if page above is root node then some things you can't do
if (upPage.level === 1)
{
if (upPage.level === 1) {
this.set('tocTools.AllowIndent', false);
this.set('tocTools.UpTarget', "");
}
}
// can we go down?
if (!_.isUndefined(downPage))
{
if (!_.isUndefined(downPage)) {
// can only go down if someone below is at our level or higher
var index3 = _.indexOf(toc, downPage, false);
if (index3 !== -1)
{
for (var i3 = index3; i3 < toc.length; i3++)
{
if (toc[i3].level < page.level)
{
if (index3 !== -1) {
for (var i3 = index3; i3 < toc.length; i3++) {
if (toc[i3].level < page.level) {
break;
}
if (page.level === toc[i3].level)
{
if (page.level === toc[i3].level) {
this.set('tocTools.DownTarget', toc[i3].id);
break;
}
@ -201,8 +205,12 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
}
var pages = this.get('pages');
var current = _.findWhere(pages, {id: this.get('page')});
var page1 = _.findWhere(pages, {id: this.tocTools.UpTarget});
var current = _.findWhere(pages, {
id: this.get('page')
});
var page1 = _.findWhere(pages, {
id: this.tocTools.UpTarget
});
var page2 = null;
var pendingChanges = [];
@ -221,30 +229,33 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
var index = _.indexOf(pages, current, false);
if (index !== -1)
{
if (index !== -1) {
var sequence = (sequence1 + sequence2) / 2;
pendingChanges.push({ pageId: current.id, sequence: sequence });
pendingChanges.push({
pageId: current.id,
sequence: sequence
});
for (var i = index + 1; i < pages.length; i++)
{
if (pages[i].level <= current.level)
{
for (var i = index + 1; i < pages.length; i++) {
if (pages[i].level <= current.level) {
break;
}
sequence = (sequence + page1.sequence) / 2;
pendingChanges.push({ pageId: pages[i].id, sequence: sequence });
pendingChanges.push({
pageId: pages[i].id,
sequence: sequence
});
}
}
this.attrs.changePageSequence(pendingChanges);
this.send('clickGotoPage', this.get('page'));
this.send('clickGotoPage', this.get('page'));
this.audit.record("moved-page-up");
this.showNotification("Moved up");
this.showNotification("Moved up");
},
// Move down -- pages below shift up.
@ -254,9 +265,13 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
}
var pages = this.get('pages');
var current = _.findWhere(pages, {id: this.get('page')});
var current = _.findWhere(pages, {
id: this.get('page')
});
var pageIndex = _.indexOf(pages, current, false);
var downTarget = _.findWhere(pages, {id: this.tocTools.DownTarget});
var downTarget = _.findWhere(pages, {
id: this.tocTools.DownTarget
});
var downTargetIndex = _.indexOf(pages, downTarget, false);
var pendingChanges = [];
@ -267,53 +282,53 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
var startingSequence = 0;
var upperSequence = 0;
var cutOff = _.rest(pages, downTargetIndex);
var siblings = _.reject(cutOff, function(p){ return p.level !== current.level || p.id === current.id || p.id === downTarget.id; });
var siblings = _.reject(cutOff, function(p) {
return p.level !== current.level || p.id === current.id || p.id === downTarget.id;
});
if (siblings.length > 0)
{
if (siblings.length > 0) {
var aboveThisGuy = siblings[0];
var belowThisGuy = pages[_.indexOf(pages, aboveThisGuy, false) - 1];
if (is.not.null(belowThisGuy) && belowThisGuy.level > current.level)
{
if (is.not.null(belowThisGuy) && belowThisGuy.level > current.level) {
startingSequence = (aboveThisGuy.sequence + belowThisGuy.sequence) / 2;
upperSequence = aboveThisGuy.sequence;
}
else
{
} else {
var otherGuy = pages[downTargetIndex + 1];
startingSequence = (otherGuy.sequence + downTarget.sequence) / 2;
upperSequence = otherGuy.sequence;
}
}
else
{
} else {
startingSequence = downTarget.sequence * 2;
upperSequence = startingSequence * 2;
}
pendingChanges.push({ pageId: current.id, sequence: startingSequence });
pendingChanges.push({
pageId: current.id,
sequence: startingSequence
});
var sequence = (startingSequence + upperSequence) / 2;
for (var i = pageIndex + 1; i < pages.length; i++)
{
if (pages[i].level <= current.level)
{
for (var i = pageIndex + 1; i < pages.length; i++) {
if (pages[i].level <= current.level) {
break;
}
var sequence2 = (sequence + upperSequence) / 2;
pendingChanges.push({ pageId: pages[i].id, sequence: sequence2 });
pendingChanges.push({
pageId: pages[i].id,
sequence: sequence2
});
}
this.attrs.changePageSequence(pendingChanges);
this.send('clickGotoPage', this.get('page'));
this.send('clickGotoPage', this.get('page'));
this.audit.record("moved-page-down");
this.showNotification("Moved down");
this.showNotification("Moved down");
},
// Indent - changes a page from H2 to H3, etc.
@ -323,27 +338,33 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
}
var pages = this.get('pages');
var current = _.findWhere(pages, {id: this.get('page')});
var current = _.findWhere(pages, {
id: this.get('page')
});
var pageIndex = _.indexOf(pages, current, false);
var pendingChanges = [];
pendingChanges.push({ pageId: current.id, level: current.level + 1 });
pendingChanges.push({
pageId: current.id,
level: current.level + 1
});
for (var i = pageIndex + 1; i < pages.length; i++)
{
if (pages[i].level <= current.level)
{
for (var i = pageIndex + 1; i < pages.length; i++) {
if (pages[i].level <= current.level) {
break;
}
pendingChanges.push({ pageId: pages[i].id, level: pages[i].level + 1 });
pendingChanges.push({
pageId: pages[i].id,
level: pages[i].level + 1
});
}
this.attrs.changePageLevel(pendingChanges);
this.send('clickGotoPage', this.get('page'));
this.send('clickGotoPage', this.get('page'));
this.audit.record("changed-page-sequence");
this.showNotification("Indent");
this.showNotification("Indent");
},
// Outdent - changes a page from H3 to H2, etc.
@ -353,26 +374,32 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
}
var pages = this.get('pages');
var current = _.findWhere(pages, {id: this.get('page')});
var current = _.findWhere(pages, {
id: this.get('page')
});
var pageIndex = _.indexOf(pages, current, false);
var pendingChanges = [];
pendingChanges.push({ pageId: current.id, level: current.level - 1 });
pendingChanges.push({
pageId: current.id,
level: current.level - 1
});
for (var i = pageIndex + 1; i < pages.length; i++)
{
if (pages[i].level <= current.level)
{
for (var i = pageIndex + 1; i < pages.length; i++) {
if (pages[i].level <= current.level) {
break;
}
pendingChanges.push({ pageId: pages[i].id, level: pages[i].level - 1 });
pendingChanges.push({
pageId: pages[i].id,
level: pages[i].level - 1
});
}
this.attrs.changePageLevel(pendingChanges);
this.audit.record("changed-page-sequence");
this.showNotification("Outdent");
this.send('clickGotoPage', this.get('page'));
this.showNotification("Outdent");
this.send('clickGotoPage', this.get('page'));
},
clickGotoPage(id) {
@ -380,4 +407,4 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.attrs.gotoPage(id);
},
},
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({

View file

@ -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 Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
import TooltipMixin from '../../mixins/tooltip';

View file

@ -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 Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
import TooltipMixin from '../../mixins/tooltip';

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({
@ -27,8 +38,11 @@ export default Ember.Component.extend({
didRender() {
let self = this;
Ember.run.schedule('afterRender', function(){
Mousetrap.bind('esc', function() { self.send('cancelAction'); return false;});
Ember.run.schedule('afterRender', function() {
Mousetrap.bind('esc', function() {
self.send('cancelAction');
return false;
});
});
},
@ -45,15 +59,17 @@ export default Ember.Component.extend({
Ember.set(revision, 'selected', false);
});
let revision = _.findWhere(revisions, { id: revisionId});
let revision = _.findWhere(revisions, {
id: revisionId
});
Ember.set(revision, 'selected', true);
let self = this;
this.get('documentService').getPageRevisionDiff(this.get('model.documentId'),
this.get('model.pageId'), revisionId).then(function(response) {
self.set('busy', false);
self.set('diffReport', Ember.String.htmlSafe(response));
self.set('busy', false);
self.set('diffReport', Ember.String.htmlSafe(response));
});
},
@ -67,4 +83,4 @@ export default Ember.Component.extend({
}
}
}
});
});

View file

@ -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 Ember from 'ember';
import TooltipMixin from '../../mixins/tooltip';

View file

@ -1,43 +1,67 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
export default Ember.Component.extend({
title: "",
contentType: "",
export default Ember.Component.extend(NotifierMixin, {
title: "New Section",
contentType: "",
didReceiveAttrs() {
let section = this.get("sections").get('firstObject');
section.set("selected", true);
},
didReceiveAttrs() {
let section = this.get("sections").get('firstObject');
section.set("selected", true);
},
didInsertElement() {
$("#page-title").removeClass("error").focus();
},
didInsertElement() {
$("#page-title").removeClass("error").focus();
},
actions: {
setOption(id) {
let sections = this.get("sections");
actions: {
setOption(id) {
let sections = this.get("sections");
sections.forEach(function(option) {
Ember.set(option, 'selected', option.id === id);
});
sections.forEach(function(option) {
Ember.set(option, 'selected', option.id === id);
});
this.set("sections", sections);
},
this.set("sections", sections);
onCancel() {
this.attrs.onCancel();
},
if (this.session.get('popupBlocked')) {
this.showNotification("Hmm, looks like your browser is blocking popups...");
}
},
onAction() {
let title = this.get("title");
let contentType = this.get("sections").findBy("selected", true).contentType;
onCancel() {
this.attrs.onCancel();
},
if (is.empty(title)) {
$("#page-title").addClass("error").focus();
onAction() {
let title = this.get("title");
let section = this.get("sections").findBy("selected", true);
let contentType = section.contentType;
if (section.preview) {
this.showNotification("Coming soon!");
return;
}
this.attrs.onAction(title, contentType);
}
}
if (is.empty(title)) {
$("#page-title").addClass("error").focus();
return;
}
this.audit.record('added section' + section.contentType);
this.attrs.onAction(title, contentType);
}
}
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({
@ -6,7 +17,7 @@ export default Ember.Component.extend({
isEditor: false,
newTag: "",
maxTags: 3,
canAdd: false,
canAdd: false,
didInitAttrs() {
let tagz = [];
@ -21,61 +32,61 @@ export default Ember.Component.extend({
}
this.set('tagz', tagz);
this.set('canAdd', this.get('isEditor') && this.get('tagz').get('length') < 3);
this.set('canAdd', this.get('isEditor') && this.get('tagz').get('length') < 3);
},
didUpdateAttrs() {
this.set('canAdd', this.get('isEditor') && this.get('tagz').get('length') < 3);
},
didUpdateAttrs() {
this.set('canAdd', this.get('isEditor') && this.get('tagz').get('length') < 3);
},
didInsertElement() {
didInsertElement() {
},
},
willDestroyElement() {
$("#add-tag-field").off("keydown");
},
willDestroyElement() {
$("#add-tag-field").off("keydown");
},
actions: {
onTagEditor() {
$("#add-tag-field").off("keydown").on("keydown", function(e) {
if (e.shiftKey) {
return false;
}
onTagEditor() {
$("#add-tag-field").off("keydown").on("keydown", function(e) {
if (e.shiftKey) {
return false;
}
if (e.which === 13 || e.which === 45 || e.which === 189 || e.which === 8 || e.which === 127 || (e.which >= 65 && e.which <= 90) || (e.which >= 97 && e.which <= 122) || (e.which >= 48 && e.which <= 57)) {
return true;
}
if (e.which === 13 || e.which === 45 || e.which === 189 || e.which === 8 || e.which === 127 || (e.which >= 65 && e.which <= 90) || (e.which >= 97 && e.which <= 122) || (e.which >= 48 && e.which <= 57)) {
return true;
}
return false;
});
},
return false;
});
},
addTag() {
let tags = this.get("tagz");
let tag = this.get('newTag');
tag = tag.toLowerCase().trim();
addTag() {
let tags = this.get("tagz");
let tag = this.get('newTag');
tag = tag.toLowerCase().trim();
// empty or dupe?
if (tag.length === 0 || _.contains(tags, tag) || tags.length >= this.get('maxTags') || tag.startsWith('-')) {
return false;
}
// empty or dupe?
if (tag.length === 0 || _.contains(tags, tag) || tags.length >= this.get('maxTags') || tag.startsWith('-')) {
return false;
}
tags.pushObject(tag);
this.set('tagz', tags);
this.set('newTag', '');
tags.pushObject(tag);
this.set('tagz', tags);
this.set('newTag', '');
let save = "#";
_.each(tags, function(tag) {
save = save + tag + "#";
});
let save = "#";
_.each(tags, function(tag) {
save = save + tag + "#";
});
this.get('onChange')(save);
this.get('onChange')(save);
this.audit.record('added-tag');
this.audit.record('added-tag');
return true;
},
return true;
},
// removeTag removes specified tag from the list of tags associated with this document.
removeTag(tagToRemove) {
@ -97,4 +108,4 @@ export default Ember.Component.extend({
this.audit.record('removed tag');
},
}
});
});

View file

@ -1,29 +1,39 @@
// Copyright (c) 2015 Documize Inc.
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import stringUtil from '../utils/string';
export default Ember.Component.extend({
drop: null,
drop: null,
target: null,
button: "Delete",
color: "flat-red",
button2: "",
color2: "2",
color: "flat-red",
button2: "",
color2: "2",
open: "click",
position: 'bottom right',
showCancel: true,
contentId: "",
focusOn: null, // is there an input field we need to focus?
selectOn: null, // is there an input field we need to select?
onOpenCallback: null, // callback when opened
onAction: null,
onAction2: null,
offset: "5px 0",
targetOffset: "10px 0",
focusOn: null, // is there an input field we need to focus?
selectOn: null, // is there an input field we need to select?
onOpenCallback: null, // callback when opened
onAction: null,
onAction2: null,
offset: "5px 0",
targetOffset: "10px 0",
hasSecondButton: Ember.computed('button2', 'color2', function() {
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
}),
hasSecondButton: Ember.computed('button2', 'color2', function() {
return is.not.empty(this.get('button2')) && is.not.empty(this.get('color2'));
}),
didReceiveAttrs() {
this.set("contentId", 'dropdown-dialog-' + stringUtil.makeId(10));
@ -37,35 +47,35 @@ export default Ember.Component.extend({
target: document.getElementById(self.get('target')),
content: self.$(".dropdown-dialog")[0],
classes: 'drop-theme-basic',
position: self.get('position'),
position: self.get('position'),
openOn: self.get('open'),
tetherOptions: {
tetherOptions: {
offset: self.offset,
targetOffset: self.targetOffset
},
remove: true
remove: true
});
self.set('drop', drop);
self.set('drop', 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("focusOn"))) {
document.getElementById(self.get("focusOn")).focus();
}
if (is.not.null(self.get("selectOn"))) {
document.getElementById(self.get("selectOn")).select();
}
if (is.not.null(self.get("selectOn"))) {
document.getElementById(self.get("selectOn")).select();
}
if (is.not.null(self.get("onOpenCallback"))) {
self.attrs.onOpenCallback(drop);
}
});
if (is.not.null(self.get("onOpenCallback"))) {
self.attrs.onOpenCallback(drop);
}
});
},
willDestroyElement() {
this.get('drop').destroy();
},
willDestroyElement() {
this.get('drop').destroy();
},
actions: {
onCancel() {
@ -73,9 +83,9 @@ export default Ember.Component.extend({
},
onAction() {
if (this.get('onAction') === null) {
return;
}
if (this.get('onAction') === null) {
return;
}
let close = this.attrs.onAction();
@ -84,10 +94,10 @@ export default Ember.Component.extend({
}
},
onAction2() {
if (this.get('onAction2') === null) {
return;
}
onAction2() {
if (this.get('onAction2') === null) {
return;
}
let close = this.attrs.onAction2();
@ -96,4 +106,4 @@ export default Ember.Component.extend({
}
}
}
});
});

View file

@ -1,4 +1,14 @@
// Copyright (c) 2015 Documize Inc.
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import stringUtil from '../utils/string';
@ -12,9 +22,9 @@ export default Ember.Component.extend({
didReceiveAttrs() {
this.set("contentId", 'dropdown-menu-' + stringUtil.makeId(10));
// if (this.session.get('isMobile')) {
// this.set('open', "click");
// }
// if (this.session.get('isMobile')) {
// this.set('open', "click");
// }
},
didInsertElement() {
@ -25,7 +35,7 @@ export default Ember.Component.extend({
target: document.getElementById(self.get('target')),
content: self.$(".dropdown-menu")[0],
classes: 'drop-theme-menu',
position: self.get('position'),
position: self.get('position'),
openOn: self.get('open'),
tetherOptions: {
offset: "5px 0",
@ -36,7 +46,7 @@ export default Ember.Component.extend({
self.set('drop', drop);
},
willDestroyElement() {
this.get('drop').destroy();
}
});
willDestroyElement() {
this.get('drop').destroy();
}
});

View file

@ -1,7 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.TextField.extend({
becomeFocused: function() {
this.$().focus();
}.on('didInsertElement')
});
});

View file

@ -1,7 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.TextArea.extend({
becomeFocused: function() {
this.$().focus();
}.on('didInsertElement')
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({
@ -24,4 +35,4 @@ export default Ember.Component.extend({
this.get('filterByTag')(tag);
}
}
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({
@ -9,22 +20,22 @@ export default Ember.Component.extend({
actions: {
selectDocument(documentId) {
let doc = this.get('documents').findBy('id', documentId);
let list = this.get('selectedDocuments');
let doc = this.get('documents').findBy('id', documentId);
let list = this.get('selectedDocuments');
doc.set('selected', !doc.get('selected'));
doc.set('selected', !doc.get('selected'));
if (doc.get('selected')) {
list.push(documentId);
} else {
var index = list.indexOf(documentId);
if (index > -1) {
list.splice(index, 1);
}
}
if (doc.get('selected')) {
list.push(documentId);
} else {
var index = list.indexOf(documentId);
if (index > -1) {
list.splice(index, 1);
}
}
this.set('selectedDocuments', list);
this.get('onDocumentsChecked')(list);
this.set('selectedDocuments', list);
this.get('onDocumentsChecked')(list);
}
}
});
});

View file

@ -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 Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
import TooltipMixin from '../../mixins/tooltip';
@ -12,9 +23,9 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
hasSelectedDocuments: false,
selectedDocuments: [],
importedDocuments: [],
savedTemplates: [],
savedTemplates: [],
isFolderOwner: false,
moveFolderId: "",
moveFolderId: "",
hasDocuments: function() {
return this.documents.get('length') > 0;
@ -26,38 +37,44 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.set('importedDocuments', []);
this.set('isFolderOwner', this.get('folder.userId') === this.session.user.id);
let self = this;
let self = this;
this.get('templateService').getSavedTemplates().then(function(saved) {
let emptyTemplate = { id: "0", title: "Empty document", selected: true };
saved.unshiftObject(emptyTemplate);
self.set('savedTemplates', saved);
});
this.get('templateService').getSavedTemplates().then(function(saved) {
let emptyTemplate = {
id: "0",
title: "Empty document",
selected: true
};
saved.unshiftObject(emptyTemplate);
self.set('savedTemplates', saved);
});
let targets = _.reject(this.get('folders'), { id: this.get('folder').get('id') });
this.set('movedFolderOptions', targets);
let targets = _.reject(this.get('folders'), {
id: this.get('folder').get('id')
});
this.set('movedFolderOptions', targets);
},
didRender() {
if (this.get('hasSelectedDocuments')) {
this.addTooltip(document.getElementById("move-documents-button"));
this.addTooltip(document.getElementById("delete-documents-button"));
} else {
if (this.get('isFolderOwner')) {
this.addTooltip(document.getElementById("folder-share-button"));
this.addTooltip(document.getElementById("folder-settings-button"));
}
if (this.get('folderService').get('canEditCurrentFolder')) {
this.addTooltip(document.getElementById("start-document-button"));
}
}
},
didRender() {
if (this.get('hasSelectedDocuments')) {
this.addTooltip(document.getElementById("move-documents-button"));
this.addTooltip(document.getElementById("delete-documents-button"));
} else {
if (this.get('isFolderOwner')) {
this.addTooltip(document.getElementById("folder-share-button"));
this.addTooltip(document.getElementById("folder-settings-button"));
}
if (this.get('folderService').get('canEditCurrentFolder')) {
this.addTooltip(document.getElementById("start-document-button"));
}
}
},
willDestroyElement() {
this.destroyTooltips();
},
willDestroyElement() {
this.destroyTooltips();
},
navigateToDocument(document){
navigateToDocument(document) {
this.attrs.showDocument(this.get('folder'), document);
},
@ -67,14 +84,14 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.set('hasSelectedDocuments', documents.length > 0);
},
onEditTemplate(template) {
this.navigateToDocument(template);
},
onEditTemplate(template) {
this.navigateToDocument(template);
},
onDocumentTemplate(id /*, title, type*/) {
onDocumentTemplate(id /*, title, type*/ ) {
let self = this;
this.send("showNotification", "Creating");
this.send("showNotification", "Creating");
this.get('templateService').importSavedTemplate(this.folder.get('id'), id).then(function(document) {
self.navigateToDocument(document);
@ -82,21 +99,21 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
},
onDocumentImporting(filename) {
this.send("showNotification", `Importing ${filename}`);
this.send("showNotification", `Importing ${filename}`);
let documents = this.get('importedDocuments');
documents.push(filename);
this.set('importedDocuments', documents);
},
onDocumentImported(filename/*, document*/) {
this.send("showNotification", `${filename} ready`);
onDocumentImported(filename /*, document*/ ) {
this.send("showNotification", `${filename} ready`);
let documents = this.get('importedDocuments');
documents.pop(filename);
this.set('importedDocuments', documents);
this.attrs.refresh();
this.attrs.refresh();
if (documents.length === 0) {
// this.get('showDocument')(this.get('folder'), document);
@ -115,31 +132,31 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
this.set('selectedDocuments', []);
this.set('hasSelectedDocuments', false);
this.send("showNotification", "Deleted");
this.send("showNotification", "Deleted");
return true;
return true;
},
setMoveFolder(folderId) {
this.set('moveFolderId', folderId);
setMoveFolder(folderId) {
this.set('moveFolderId', folderId);
let folders = this.get('folders');
let folders = this.get('folders');
folders.forEach(folder => {
folder.set('selected', folder.id === folderId);
});
},
folders.forEach(folder => {
folder.set('selected', folder.id === folderId);
});
},
moveDocuments() {
if (this.get("moveFolderId") === "") {
return false;
}
if (this.get("moveFolderId") === "") {
return false;
}
this.get('onMoveDocument')(this.get('selectedDocuments'), this.get('moveFolderId'));
this.set("moveFolderId", "");
this.send("showNotification", "Moved");
this.set("moveFolderId", "");
this.send("showNotification", "Moved");
return true;
return true;
}
}
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({
@ -28,16 +39,16 @@ export default Ember.Component.extend({
actions: {
rename() {
if (is.empty(this.folder.get('name'))) {
$("#folderName").addClass("error").focus();
$("#folderName").addClass("error").focus();
return;
}
this.sendAction("onRename", this.folder);
this.sendAction("onRename", this.folder);
},
remove() {
if (is.null(this.get('moveTarget'))) {
$("#delete-target > select").addClass("error").focus();
$("#delete-target > select").addClass("error").focus();
return;
}
@ -52,10 +63,10 @@ export default Ember.Component.extend({
message = this.getDefaultInvitationMessage();
}
if (email.length === 0) {
$("#inviteEmail").addClass("error").focus();
return;
}
if (email.length === 0) {
$("#inviteEmail").addClass("error").focus();
return;
}
var result = {
Message: message,
@ -75,7 +86,7 @@ export default Ember.Component.extend({
result.Recipients.push(email);
}
this.set('inviteEmail', "");
this.set('inviteEmail', "");
this.sendAction("onShare", result);
},
@ -95,4 +106,4 @@ export default Ember.Component.extend({
this.sendAction("onPermission", this.get('folder'), message, this.get('permissions'));
}
}
});
});

View file

@ -1,62 +1,72 @@
// Copyright (c) 2015 Documize Inc.
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import constants from '../../utils/constants';
import TooltipMixin from '../../mixins/tooltip';
export default Ember.Component.extend(TooltipMixin, {
folderService: Ember.inject.service('folder'),
publicFolders: [],
protectedFolders: [],
privateFolders: [],
hasPublicFolders: false,
hasProtectedFolders: false,
hasPrivateFolders: false,
folderService: Ember.inject.service('folder'),
publicFolders: [],
protectedFolders: [],
privateFolders: [],
hasPublicFolders: false,
hasProtectedFolders: false,
hasPrivateFolders: false,
newFolder: "",
didInsertElement() {
didInsertElement() {
this._super(...arguments);
if (this.session.authenticated) {
this.addTooltip(document.getElementById("add-folder-button"));
}
},
if (this.session.authenticated) {
this.addTooltip(document.getElementById("add-folder-button"));
}
},
didReceiveAttrs() {
let folders = this.get('folders');
let self = this;
didReceiveAttrs() {
let folders = this.get('folders');
let self = this;
// clear out state
this.set('publicFolders', []);
this.set('protectedFolders', []);
this.set('privateFolders', []);
// clear out state
this.set('publicFolders', []);
this.set('protectedFolders', []);
this.set('privateFolders', []);
_.each(folders, folder => {
if (folder.folderType === constants.FolderType.Public) {
let folders = self.get('publicFolders');
folders.pushObject(folder);
self.set('publicFolders', folders);
}
if (folder.folderType === constants.FolderType.Private) {
let folders = self.get('privateFolders');
folders.pushObject(folder);
self.set('privateFolders', folders);
}
if (folder.folderType === constants.FolderType.Protected) {
let folders = self.get('protectedFolders');
folders.pushObject(folder);
self.set('protectedFolders', folders);
}
});
_.each(folders, folder => {
if (folder.folderType === constants.FolderType.Public) {
let folders = self.get('publicFolders');
folders.pushObject(folder);
self.set('publicFolders', folders);
}
if (folder.folderType === constants.FolderType.Private) {
let folders = self.get('privateFolders');
folders.pushObject(folder);
self.set('privateFolders', folders);
}
if (folder.folderType === constants.FolderType.Protected) {
let folders = self.get('protectedFolders');
folders.pushObject(folder);
self.set('protectedFolders', folders);
}
});
this.set('hasPublicFolders', this.get('publicFolders.length') > 0);
this.set('hasPrivateFolders', this.get('privateFolders.length') > 0);
this.set('hasProtectedFolders', this.get('protectedFolders.length') > 0);
},
this.set('hasPublicFolders', this.get('publicFolders.length') > 0);
this.set('hasPrivateFolders', this.get('privateFolders.length') > 0);
this.set('hasProtectedFolders', this.get('protectedFolders.length') > 0);
},
willDestroyElement() {
this.destroyTooltips();
},
willDestroyElement() {
this.destroyTooltips();
},
actions: {
actions: {
addFolder() {
var folderName = this.get('newFolder');
@ -65,10 +75,10 @@ export default Ember.Component.extend(TooltipMixin, {
return false;
}
this.attrs.onFolderAdd(folderName);
this.attrs.onFolderAdd(folderName);
this.set('newFolder', "");
return true;
this.set('newFolder', "");
return true;
}
}
});
});

View file

@ -1,89 +1,103 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import NotifierMixin from '../../mixins/notifier';
export default Ember.Component.extend(NotifierMixin, {
tagName: 'span',
selectedTemplate: { id: "0" },
canEditTemplate: "",
tagName: 'span',
selectedTemplate: {
id: "0"
},
canEditTemplate: "",
didReceiveAttrs() {
this.send('setTemplate', this.get('savedTemplates')[0]);
},
didReceiveAttrs() {
this.send('setTemplate', this.get('savedTemplates')[0]);
},
actions: {
setTemplate(chosen) {
if (is.undefined(chosen)) {
return;
}
setTemplate(chosen) {
if (is.undefined(chosen)) {
return;
}
this.set('selectedTemplate', chosen);
this.set('canEditTemplate', chosen.id !== "0" ? "Edit" : "");
this.set('selectedTemplate', chosen);
this.set('canEditTemplate', chosen.id !== "0" ? "Edit" : "");
let templates = this.get('savedTemplates');
let templates = this.get('savedTemplates');
templates.forEach(template => {
Ember.set(template, 'selected', template.id === chosen.id);
});
},
templates.forEach(template => {
Ember.set(template, 'selected', template.id === chosen.id);
});
},
editTemplate() {
let template = this.get('selectedTemplate');
editTemplate() {
let template = this.get('selectedTemplate');
this.audit.record('edited-saved-template');
this.attrs.onEditTemplate(template);
this.audit.record('edited-saved-template');
this.attrs.onEditTemplate(template);
return true;
},
return true;
},
startDocument() {
let template = this.get('selectedTemplate');
startDocument() {
let template = this.get('selectedTemplate');
this.audit.record('used-saved-template');
this.audit.record('used-saved-template');
this.attrs.onDocumentTemplate(template.id, template.title, "private");
return true;
},
return true;
},
onOpenCallback() {
let self = this;
let folderId = this.get('folder.id');
let importUrl = this.session.appMeta.getUrl('import/folder/' + folderId);
onOpenCallback() {
let self = this;
let folderId = this.get('folder.id');
let importUrl = this.session.appMeta.getUrl('import/folder/' + folderId);
let dzone = new Dropzone("#upload-documents", {
headers: {'Authorization': 'Bearer ' + self.session.getSessionItem('token') },
url: importUrl,
method: "post",
paramName: 'attachment',
acceptedFiles: ".doc,.docx,.txt,.md,.markdown",
clickable: true,
maxFilesize: 10,
parallelUploads: 3,
uploadMultiple: false,
addRemoveLinks: false,
autoProcessQueue: true,
let dzone = new Dropzone("#upload-documents", {
headers: {
'Authorization': 'Bearer ' + self.session.getSessionItem('token')
},
url: importUrl,
method: "post",
paramName: 'attachment',
acceptedFiles: ".doc,.docx,.txt,.md,.markdown",
clickable: true,
maxFilesize: 10,
parallelUploads: 3,
uploadMultiple: false,
addRemoveLinks: false,
autoProcessQueue: true,
init: function() {
this.on("success", function(document) {
init: function() {
this.on("success", function(document) {
self.attrs.onDocumentImported(document.name, document);
});
});
this.on("error", function(x) {
console.log("Conversion failed for ", x.name, " obj ",x); // TODO proper error handling
});
this.on("queuecomplete", function() {
});
console.log("Conversion failed for ", x.name, " obj ", x); // TODO proper error handling
});
this.on("addedfile", function(file) {
self.attrs.onDocumentImporting(file.name);
self.audit.record('converted-document');
});
}
});
this.on("queuecomplete", function() {});
dzone.on("complete", function(file) {
dzone.removeFile(file);
});
}
}
});
this.on("addedfile", function(file) {
self.attrs.onDocumentImporting(file.name);
self.audit.record('converted-document');
});
}
});
dzone.on("complete", function(file) {
dzone.removeFile(file);
});
}
}
});

View file

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

View file

@ -1,13 +1,23 @@
// Copyright (c) 2015 Documize Inc.
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import netUtil from '../../utils/net';
export default Ember.Component.extend({
dashboardMode: false,
searchMode: false,
profileMode: false,
settingsMode: false,
folderMode: false,
dashboardMode: false,
searchMode: false,
profileMode: false,
settingsMode: false,
folderMode: false,
documentMode: false,
didInitAttrs() {
@ -22,7 +32,7 @@ export default Ember.Component.extend({
actions: {
switchAccount(domain) {
this.audit.record('switched-account');
window.location.href = netUtil.getAppUrl(domain);
window.location.href = netUtil.getAppUrl(domain);
}
}
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({
@ -14,4 +25,4 @@ export default Ember.Component.extend({
fetch() {
this.get('onFilter')(this.get('filter'));
},
});
});

View file

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

View file

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

View file

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

View file

@ -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 Ember from 'ember';
import encodingUtil from '../../utils/encoding';
import netUtil from '../../utils/net';
@ -16,31 +27,24 @@ export default Ember.Component.extend({
$("#stage-1-firstname").focus();
// Stage 1 - person name keypress handler
$("#stage-1-firstname, #stage-1-lastname").keyup(function()
{
if (!$("#stage-1-firstname").val() || !$("#stage-1-lastname").val())
{
$("#stage-1-firstname, #stage-1-lastname").keyup(function() {
if (!$("#stage-1-firstname").val() || !$("#stage-1-lastname").val()) {
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
}
else
{
} else {
$(".name-status").attr("src", "assets/img/onboard/person-green.png");
}
});
// Stage 1 - finish
$("#stage-1-next").off('click').on('click', function()
{
if (!$("#stage-1-firstname").val())
{
$("#stage-1-next").off('click').on('click', function() {
if (!$("#stage-1-firstname").val()) {
$("#stage-1-firstname").focus();
$("#stage-1-firstname").addClass("error");
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
return;
}
if (!$("#stage-1-lastname").val())
{
if (!$("#stage-1-lastname").val()) {
$("#stage-1-lastname").focus();
$("#stage-1-lastname").addClass("error");
$(".name-status").attr("src", "assets/img/onboard/person-red.png");
@ -49,8 +53,7 @@ export default Ember.Component.extend({
self.set('processing', false);
$(".stage-1").fadeOut("slow", function()
{
$(".stage-1").fadeOut("slow", function() {
if (self.get('processing')) {
return;
}
@ -61,15 +64,11 @@ export default Ember.Component.extend({
$("#stage-2-password").focus();
// Stage 2 - password keypress handler
$("#stage-2-password-confirm").keyup(function()
{
$("#stage-2-password-confirm").keyup(function() {
if ($("#stage-2-password").val().length < 6 || $("#stage-2-password").val().length > 50 ||
($("#stage-2-password").val() !== $("#stage-2-password-confirm").val()))
{
($("#stage-2-password").val() !== $("#stage-2-password-confirm").val())) {
$(".password-status").attr("src", "assets/img/onboard/lock-red.png");
}
else
{
} else {
$(".password-status").attr("src", "assets/img/onboard/lock-green.png");
}
});
@ -77,24 +76,20 @@ export default Ember.Component.extend({
});
// Stage 2 - finish
$("#stage-2-next").off('click').on('click', function()
{
if (!$("#stage-2-password").val() || $("#stage-2-password").val().length < 6 || $("#stage-2-password").val().length > 50)
{
$("#stage-2-next").off('click').on('click', function() {
if (!$("#stage-2-password").val() || $("#stage-2-password").val().length < 6 || $("#stage-2-password").val().length > 50) {
$("#stage-2-password").focus();
$("#stage-2-password").addClass("error");
return;
}
if (!$("#stage-2-password-confirm").val())
{
if (!$("#stage-2-password-confirm").val()) {
$("#stage-2-password-confirm").focus();
$("#stage-2-password-confirm").addClass("error");
return;
}
if ($("#stage-2-password-confirm").val() !== $("#stage-2-password").val())
{
if ($("#stage-2-password-confirm").val() !== $("#stage-2-password").val()) {
$(".mismatch").show();
$(".password-status").attr("src", "assets/img/onboard/lock-red.png");
return;
@ -102,8 +97,7 @@ export default Ember.Component.extend({
self.set('processing', false);
$(".stage-2").fadeOut("slow", function()
{
$(".stage-2").fadeOut("slow", function() {
if (self.get('processing')) {
return;
}
@ -113,7 +107,7 @@ export default Ember.Component.extend({
$(".stage-3").fadeIn();
$("#spinner-1").show();
var payload = '{ "Password": "' + $("#stage-2-password").val() + '", "Serial": "' + self.serial + '", "Firstname": "' + $("#stage-1-firstname").val() + '", "Lastname": "' + $("#stage-1-lastname").val() + '" }';
var payload = '{ "Password": "' + $("#stage-2-password").val() + '", "Serial": "' + self.serial + '", "Firstname": "' + $("#stage-1-firstname").val() + '", "Lastname": "' + $("#stage-1-lastname").val() + '" }';
var password = $("#stage-2-password").val();
self.get('folderService').onboard(self.folderId, payload).then(function(user) {
@ -127,4 +121,4 @@ export default Ember.Component.extend({
});
});
},
});
});

View file

@ -1,4 +1,14 @@
// Copyright (c) 2015 Documize Inc.
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.Component.extend({
@ -7,7 +17,7 @@ export default Ember.Component.extend({
didReceiveAttrs() {
let count = this.get('results').length;
let self = this;
let self = this;
switch (count) {
case 0:
@ -20,4 +30,4 @@ export default Ember.Component.extend({
self.set("resultPhrase", `${count} references found`);
}
}
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({
@ -18,4 +29,4 @@ export default Ember.Component.extend({
this.set('tagz', tagz);
}
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({

View file

@ -1,7 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.Component.extend({
didReceiveAttrs() {
this.set('rendererType', 'section/' + this.get('page.contentType') + '/type-renderer');
},
});
didReceiveAttrs() {
this.set('rendererType', 'section/' + this.get('page.contentType') + '/type-renderer');
},
});

View file

@ -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 Ember from 'ember';
import TooltipMixin from '../../../mixins/tooltip';

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({

View file

@ -1,8 +1,20 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
import NotifierMixin from '../../../mixins/notifier';
import TooltipMixin from '../../../mixins/tooltip';
import SectionMixin from '../../../mixins/section';
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
sectionService: Ember.inject.service('section'),
isDirty: false,
waiting: false,
@ -11,14 +23,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
workspaces: [],
config: {},
fieldEditable: function() {
if (this.get('page.userId') !== this.session.user.id) {
return "readonly";
} else {
return undefined;
}
}.property('config'),
didReceiveAttrs() {
let config = {};

View file

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

View file

@ -0,0 +1,226 @@
// 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
/*global Trello*/
import Ember from 'ember';
import NotifierMixin from '../../../mixins/notifier';
import TooltipMixin from '../../../mixins/tooltip';
import SectionMixin from '../../../mixins/section';
export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin, {
sectionService: Ember.inject.service('section'),
isDirty: false,
busy: false,
authenticated: false,
config: {},
boards: null,
noBoards: false,
boardStyle: Ember.computed('config.board', function() {
let board = this.get('config.board');
if (is.null(board) || is.undefined(board)) {
return "#4c4c4c";
}
let color = board.prefs.backgroundColor;
return Ember.String.htmlSafe("background-color: " + color);
}),
didReceiveAttrs() {
let config = {};
try {
config = JSON.parse(this.get('meta.config'));
}
catch (e) {}
if (is.empty(config)) {
config = {
appKey: "8e00492ee9a8934cfb8604d3a51f8f70",
token: "",
user: null,
board: null,
lists: []
};
}
this.set('config', config);
if (this.get('config.appKey') !== "" && this.get('config.token') !== "") {
this.send('auth');
}
else {
Ember.$.getScript("https://api.trello.com/1/client.js?key=" + this.get('config.appKey'), function() {
Trello.deauthorize();
});
}
},
willDestroyElement() {
this.destroyTooltips();
},
getBoardLists() {
this.set('busy', true);
let self = this;
let boards = this.get('boards');
let board = this.get('config.board');
let page = this.get('page');
if (is.null(boards) || is.undefined(boards) || boards.length === 0) {
this.set('noBoards', true);
return;
}
this.set('noBoards', false);
if (is.null(board) || is.undefined(board)) {
if (boards.length) {
board = boards[0];
this.set('config.board', board);
}
}
else {
this.set('config.board', boards.findBy('id', board.id));
}
this.get('sectionService').fetch(page, "lists", self.get('config'))
.then(function(lists) {
let savedLists = self.get('config.lists');
if (savedLists === null) {
savedLists = [];
}
lists.forEach(function(list) {
let saved = savedLists.findBy("id", list.id);
let included = true;
if (is.not.undefined(saved)) {
included = saved.included;
}
list.included = included;
});
self.set('config.lists', lists);
self.set('busy', false);
}, function(error) { //jshint ignore: line
self.set('busy', false);
self.set('authenticated', false);
self.showNotification("Unable to fetch board lists");
console.log(error);
});
},
actions: {
isDirty() {
return this.get('isDirty');
},
onListCheckbox(id) {
let lists = this.get('config.lists');
let list = lists.findBy('id', id);
if (list !== null) {
Ember.set(list, 'included', !list.included);
}
},
auth() {
if (this.get('config.appKey') === "") {
$("#trello-appkey").addClass('error').focus();
this.set('authenticated', false);
return;
}
let self = this;
let page = this.get('page');
self.set('busy', true);
Ember.$.getScript("https://api.trello.com/1/client.js?key=" + this.get('config.appKey'), function() {
Trello.authorize({
type: "popup",
// interactive: false,
name: "Documize",
scope: {
read: true,
write: false
},
expiration: "never",
persist: true,
success: function() {
self.set('authenticated', true);
self.set('config.token', Trello.token());
self.set('busy', true);
Trello.members.get("me", function(user) {
self.set('config.user', user);
}, function(error) {
console.log(error);
});
self.get('sectionService').fetch(page, "boards", self.get('config'))
.then(function(boards) {
self.set('busy', false);
self.set('boards', boards);
self.getBoardLists();
}, function(error) { //jshint ignore: line
self.set('busy', false);
self.set('authenticated', false);
self.showNotification("Unable to fetch boards");
console.log(error);
});
},
error: function(error) {
self.set('busy', false);
self.set('authenticated', false);
self.showNotification("Unable to authenticate");
console.log(error);
}
});
});
},
onBoardChange(board) {
this.set('isDirty', true);
this.set('config.board', board);
this.set('config.lists', []);
this.getBoardLists();
},
onCancel() {
this.attrs.onCancel();
},
onAction(title) {
this.set('busy', true);
let self = this;
let page = this.get('page');
let meta = this.get('meta');
page.set('title', title);
meta.set('rawBody', '');
meta.set('config', JSON.stringify(this.get('config')));
meta.set('externalSource', true);
this.get('sectionService').fetch(page, "cards", this.get('config'))
.then(function(response) {
meta.set('rawBody', JSON.stringify(response));
self.set('busy', false);
self.attrs.onAction(page, meta);
}, function(reason) { //jshint ignore: line
self.set('busy', false);
self.attrs.onAction(page, meta);
});
}
}
});

View file

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

View file

@ -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 Ember from 'ember';
export default Ember.Component.extend({

View file

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

View file

@ -1,133 +1,147 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.Component.extend({
editUser: null,
deleteUser: null,
drop: null,
password: {},
editUser: null,
deleteUser: null,
drop: null,
password: {},
didReceiveAttrs() {
this.users.forEach(user => {
user.set('me', user.get('id') === this.session.user.id);
});
},
didReceiveAttrs() {
this.users.forEach(user => {
user.set('me', user.get('id') === this.session.user.id);
});
},
willDestroyElement() {
let drop = this.get('drop');
willDestroyElement() {
let drop = this.get('drop');
if (is.not.null(drop)) {
drop.destroy();
}
},
if (is.not.null(drop)) {
drop.destroy();
}
},
actions: {
toggleActive(id) {
let user = this.users.findBy("id", id);
user.set('active', !user.get('active'));
this.attrs.onSave(user);
},
actions: {
toggleActive(id) {
let user = this.users.findBy("id", id);
user.set('active', !user.get('active'));
this.attrs.onSave(user);
},
toggleEditor(id) {
let user = this.users.findBy("id", id);
user.set('editor', !user.get('editor'));
this.attrs.onSave(user);
},
toggleEditor(id) {
let user = this.users.findBy("id", id);
user.set('editor', !user.get('editor'));
this.attrs.onSave(user);
},
toggleAdmin(id) {
let user = this.users.findBy("id", id);
user.set('admin', !user.get('admin'));
this.attrs.onSave(user);
},
toggleAdmin(id) {
let user = this.users.findBy("id", id);
user.set('admin', !user.get('admin'));
this.attrs.onSave(user);
},
edit(id) {
let self = this;
edit(id) {
let self = this;
let user = this.users.findBy("id", id);
this.set('editUser', user.copy());
this.set('password', { password: "", confirmation: ""});
$(".edit-user-dialog").css("display", "block");
$("input").removeClass("error");
let user = this.users.findBy("id", id);
this.set('editUser', user.copy());
this.set('password', {
password: "",
confirmation: ""
});
$(".edit-user-dialog").css("display", "block");
$("input").removeClass("error");
let drop = new Drop({
target: $(".edit-button-" + id)[0],
content: $(".edit-user-dialog")[0],
classes: 'drop-theme-basic',
position: "bottom right",
openOn: "always",
tetherOptions: {
offset: "5px 0",
targetOffset: "10px 0"
},
remove: false
});
let drop = new Drop({
target: $(".edit-button-" + id)[0],
content: $(".edit-user-dialog")[0],
classes: 'drop-theme-basic',
position: "bottom right",
openOn: "always",
tetherOptions: {
offset: "5px 0",
targetOffset: "10px 0"
},
remove: false
});
self.set('drop', drop);
self.set('drop', drop);
drop.on('open', function() {
self.$("#edit-firstname").focus();
});
},
drop.on('open', function() {
self.$("#edit-firstname").focus();
});
},
confirmDelete(id) {
let user = this.users.findBy("id", id);
this.set('deleteUser', user);
$(".delete-user-dialog").css("display", "block");
confirmDelete(id) {
let user = this.users.findBy("id", id);
this.set('deleteUser', user);
$(".delete-user-dialog").css("display", "block");
let drop = new Drop({
target: $(".delete-button-" + id)[0],
content: $(".delete-user-dialog")[0],
classes: 'drop-theme-basic',
position: "bottom right",
openOn: "always",
tetherOptions: {
offset: "5px 0",
targetOffset: "10px 0"
},
remove: false
});
let drop = new Drop({
target: $(".delete-button-" + id)[0],
content: $(".delete-user-dialog")[0],
classes: 'drop-theme-basic',
position: "bottom right",
openOn: "always",
tetherOptions: {
offset: "5px 0",
targetOffset: "10px 0"
},
remove: false
});
this.set('drop', drop);
},
this.set('drop', drop);
},
cancel() {
let drop = this.get('drop');
drop.close();
},
cancel() {
let drop = this.get('drop');
drop.close();
},
save() {
let user = this.get('editUser');
let password = this.get('password');
save() {
let user = this.get('editUser');
let password = this.get('password');
if (is.empty(user.get('firstname'))) {
$("#edit-firstname").addClass("error").focus();
return;
}
if (is.empty(user.get('lastname'))) {
$("#edit-lastname").addClass("error").focus();
return;
}
if (is.empty(user.get('email'))) {
$("#edit-email").addClass("error").focus();
return;
}
if (is.empty(user.get('firstname'))) {
$("#edit-firstname").addClass("error").focus();
return;
}
if (is.empty(user.get('lastname'))) {
$("#edit-lastname").addClass("error").focus();
return;
}
if (is.empty(user.get('email'))) {
$("#edit-email").addClass("error").focus();
return;
}
let drop = this.get('drop');
drop.close();
let drop = this.get('drop');
drop.close();
this.attrs.onSave(user);
this.attrs.onSave(user);
if (is.not.empty(password.password) && is.not.empty(password.confirmation) &&
password.password === password.confirmation) {
this.attrs.onPassword(user, password.password);
}
},
if (is.not.empty(password.password) && is.not.empty(password.confirmation) &&
password.password === password.confirmation) {
this.attrs.onPassword(user, password.password);
}
},
delete() {
let drop = this.get('drop');
drop.close();
delete() {
let drop = this.get('drop');
drop.close();
let user = this.get('deleteUser');
this.attrs.onDelete(user);
}
}
});
let user = this.get('deleteUser');
this.attrs.onDelete(user);
}
}
});

View file

@ -1,7 +1,18 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.Component.extend({
cssClass: "",
cssClass: "",
content: [],
prompt: null,
optionValuePath: 'id',
@ -32,4 +43,4 @@ export default Ember.Component.extend({
changeCallback(selection);
}
}
});
});

View file

@ -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 Ember from 'ember';
import miscUtil from '../utils/misc';
@ -24,7 +35,7 @@ export default Ember.Component.extend({
self.$(elem).show();
// FIXME: need a more robust solution
miscUtil.interval(function(){
miscUtil.interval(function() {
let notifications = self.get('notifications');
if (notifications.length > 0) {
@ -38,4 +49,4 @@ export default Ember.Component.extend({
}, 2500, self.get('notifications').length);
});
},
});
});

View file

@ -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
// Copyright (c) 2015 Documize Inc.
import Ember from 'ember';
import NotifierMixin from '../mixins/notifier';
@ -7,10 +18,18 @@ export default Ember.Component.extend(NotifierMixin, {
didInsertElement() {
this._super(...arguments);
new Tooltip({target: document.getElementById("sample-1")});
new Tooltip({target: document.getElementById("sample-2")});
new Tooltip({target: document.getElementById("sample-3")});
new Tooltip({target: document.getElementById("sample-4")});
new Tooltip({
target: document.getElementById("sample-1")
});
new Tooltip({
target: document.getElementById("sample-2")
});
new Tooltip({
target: document.getElementById("sample-3")
});
new Tooltip({
target: document.getElementById("sample-4")
});
let drop1 = new Drop({
target: document.getElementById('sample-dropdown-1'),
@ -33,4 +52,4 @@ export default Ember.Component.extend(NotifierMixin, {
return true;
}
}
});
});

View file

@ -1,11 +1,21 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export function documentFileIcon(params) {
let fileExtension = params[0].toLowerCase();
let html = "unknown.png";
switch (fileExtension)
{
switch (fileExtension) {
case "7z":
case "7zip":
case "zipx":
@ -95,4 +105,4 @@ export function documentFileIcon(params) {
return new Ember.Handlebars.SafeString(html);
}
export default Ember.Helper.helper(documentFileIcon);
export default Ember.Helper.helper(documentFileIcon);

View file

@ -1,23 +1,34 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export function documentTocEntry(params) {
let currentPage = params[0];
let currentPage = params[0];
let nodeId = params[1];
let nodeLevel = params[2];
let nodeLevel = params[2];
let html = "";
let indent = (nodeLevel - 1) * 20;
html += "<span style='margin-left: " + indent + "px;'></span>";
if (currentPage === nodeId) {
html += "<span class='selected'><i class='material-icons toc-bullet'>remove</i></span>";
html += "<span class='selected'></span>";
html += "";
} else {
html += "<span class=''><i class='material-icons toc-bullet'>remove</i></span>";
html += "<span class=''></span>";
html += "";
}
return new Ember.Handlebars.SafeString(html);
}
export default Ember.Helper.helper(documentTocEntry);
export default Ember.Helper.helper(documentTocEntry);

View file

@ -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 Ember from 'ember';
import dateUtil from '../utils/date';
@ -5,4 +16,4 @@ export function formattedDate(params) {
return dateUtil.toIsoDate(params[0], params[1]);
}
export default Ember.Helper.helper(formattedDate);
export default Ember.Helper.helper(formattedDate);

View file

@ -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 Ember from 'ember';
// Usage: {{generate-id 'admin-' 123}}
@ -5,4 +16,4 @@ export default Ember.Helper.helper(function(params) {
let prefix = params[0];
let id = params[1];
return prefix + "-" + id;
});
});

View file

@ -1,6 +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 Ember from 'ember';
// Usage: {{is-equal item selection}}
export default Ember.Helper.helper(function([leftSide, rightSide]) {
return leftSide === rightSide;
});
});

View file

@ -1,6 +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 Ember from 'ember';
// Usage: {{is-not selection}}
export default Ember.Helper.helper(function([value]) {
return !value;
});
});

View file

@ -1,5 +1,16 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.Helper.helper(function([object, path]) {
return Ember.get(object, path);
});
});

View file

@ -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 Ember from 'ember';
import dateUtil from '../utils/date';
@ -6,4 +17,4 @@ export function timeAgo(params) {
return dateUtil.timeAgo(params[0]);
}
export default Ember.Helper.helper(timeAgo);
export default Ember.Helper.helper(timeAgo);

View file

@ -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 Ember from 'ember';
// {{user-initials firstname lastname}}
@ -5,7 +16,7 @@ export function userInitials(params) {
let firstname = params[0];
let lastname = params[1];
return (firstname.substring(0, 1) + lastname.substring(0, 1)).toUpperCase();
return (firstname.substring(0, 1) + lastname.substring(0, 1)).toUpperCase();
}
export default Ember.Helper.helper(userInitials);
export default Ember.Helper.helper(userInitials);

View file

@ -1,20 +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
export function initialize( /*application*/ ) {
// address insecure jquery defaults (kudos: @nathanhammond)
$.globalEval = function() {};
$.ajaxSetup({
crossDomain: true,
converters: {
'text script': text => text
}
});
Dropzone.autoDiscover = false;
// global trap for XHR 401
$(document).ajaxError(function(e, xhr /*, settings, exception*/ ) {
if (xhr.status === 401 && is.not.startWith(window.location.pathname, "/auth/")) {
window.location.href = "/auth/login";
}
});
}
export default {

View file

@ -1,3 +1,13 @@
// 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
export function initialize(application) {
application.inject('route', 'audit', 'service:audit');
@ -9,4 +19,4 @@ export default {
name: 'audit',
after: 'session',
initialize: initialize
};
};

View file

@ -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
export function initialize(application) {
application.inject('route', 'browser', 'service:browser');
application.inject('controller', 'browser', 'service:browser');
@ -8,4 +19,4 @@ export default {
name: 'browser',
after: "session",
initialize: initialize
};
};

View file

@ -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
export function initialize(application) {
application.inject('route', 'eventBus', 'service:eventBus');
application.inject('component', 'eventBus', 'service:eventBus');
@ -9,4 +20,4 @@ export default {
name: 'eventBus',
after: 'session',
initialize: initialize
};
};

View file

@ -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
export function initialize(application) {
application.inject('route', 'logger', 'service:logger');
application.inject('component', 'logger', 'service:logger');
@ -8,4 +19,4 @@ export default {
name: 'logger',
after: 'session',
initialize: initialize
};
};

View file

@ -1,7 +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
export function initialize(application) {
application.inject('route', 'session', 'service:session');
application.inject('controller', 'session', 'service:session');
application.inject('component', 'session', 'service:session');
application.inject('mixin', 'session', 'service:session');
}
export default {
@ -9,4 +21,4 @@ export default {
after: 'application',
before: 'audit',
initialize: initialize
};
};

View file

@ -1,13 +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 Ember from 'ember';
export default Ember.Mixin.create({
showNotification(msg) {
this.eventBus.publish('notifyUser', msg);
},
showNotification(msg) {
this.eventBus.publish('notifyUser', msg);
},
actions: {
showNotification(msg) {
this.eventBus.publish('notifyUser', msg);
}
}
});
});

27
app/app/mixins/section.js Normal file
View 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 Ember from 'ember';
export default Ember.Mixin.create({
isReadonly: function() {
if (this.get('page.userId') === this.session.user.id) {
return undefined;
}
else {
return "readonly";
}
}.property('page'),
isMine: function() {
return this.get('page.userId') === this.session.user.id;
}.property('page')
});

View file

@ -1,23 +1,36 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.Mixin.create({
tooltips: [],
tooltips: [],
addTooltip(elem) {
let t = new Tooltip({target: elem});
let tt = this.get('tooltips');
tt.push(t);
},
addTooltip(elem) {
let t = new Tooltip({
target: elem
});
let tt = this.get('tooltips');
tt.push(t);
},
destroyTooltips() {
let tt = this.get('tooltips');
destroyTooltips() {
let tt = this.get('tooltips');
tt.forEach(t => {
t.destroy();
});
tt.forEach(t => {
t.destroy();
});
tt.length = 0;
tt.length = 0;
this.set('tooltips', tt);
}
});
this.set('tooltips', tt);
}
});

View file

@ -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 Resolver from 'ember-resolver';
export default Resolver;
export default Resolver;

View file

@ -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 Ember from 'ember';
import config from './config/environment';

View file

@ -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 Ember from 'ember';
export default Ember.Route.extend({

View file

@ -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 Ember from 'ember';
import netUtil from '../utils/net';
import config from '../config/environment';
@ -45,8 +56,7 @@ export default Ember.Service.extend({
email: session.user.email,
user_id: session.user.id,
"administrator": session.user.admin,
company:
{
company: {
id: session.get('appMeta.orgId'),
name: session.get('appMeta.title').string,
"domain": netUtil.getSubdomain(),
@ -62,4 +72,4 @@ export default Ember.Service.extend({
window.Intercom('boot', window.intercomSettings);
},
});
});

View file

@ -1,15 +1,25 @@
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// This software (Documize Community Edition) is licensed under
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
//
// You can operate outside the AGPL restrictions by purchasing
// Documize Enterprise Edition and obtaining a commercial license
// by contacting <sales@documize.com>.
//
// https://documize.com
import Ember from 'ember';
export default Ember.Service.extend({
interval(func, wait, times) {
var interv = function(w, t){
return function(){
if(typeof t === "undefined" || t-- > 0) {
var interv = function(w, t) {
return function() {
if (typeof t === "undefined" || t-- > 0) {
setTimeout(interv, w);
try {
func.call(null);
}
catch(e) {
} catch (e) {
t = 0;
throw e.toString();
}
@ -19,4 +29,4 @@ export default Ember.Service.extend({
setTimeout(interv, wait);
}
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Service.extend({
@ -30,6 +41,6 @@ export default Ember.Service.extend({
description = this.get('sessionService').appMeta.message;
}
$('head').append( '<meta name="description" content="' + description + '">' );
$('head').append('<meta name="description" content="' + description + '">');
}
});
});

View file

@ -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 Ember from 'ember';
import models from '../utils/model';

View file

@ -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 Ember from 'ember';
export default Ember.Service.extend(Ember.Evented, {
@ -12,4 +23,4 @@ export default Ember.Service.extend(Ember.Evented, {
unsubscribe: function() {
return this.off.apply(this, arguments);
}
});
});

View file

@ -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 Ember from 'ember';
import models from '../utils/model';
import BaseService from '../services/base';
@ -34,15 +45,15 @@ export default BaseService.extend({
getFolder(id) {
let url = this.get('sessionService').appMeta.getUrl(`folders/${id}`);
return new Ember.RSVP.Promise(function(resolve, reject){
return new Ember.RSVP.Promise(function(resolve, reject) {
$.ajax({
url: url,
type: 'GET',
success: function(response){
success: function(response) {
let folder = models.FolderModel.create(response);
resolve(folder);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
@ -54,7 +65,9 @@ export default BaseService.extend({
let self = this;
if (this.get('folders') != null) {
return new Ember.RSVP.Promise(function(resolve) { resolve(self.get('folders')); });
return new Ember.RSVP.Promise(function(resolve) {
resolve(self.get('folders'));
});
} else {
return this.reload();
}
@ -123,11 +136,11 @@ export default BaseService.extend({
getProtectedFolderInfo: function() {
var url = this.get('sessionService').appMeta.getUrl('folders?filter=viewers');
return new Ember.RSVP.Promise(function(resolve, reject){
return new Ember.RSVP.Promise(function(resolve, reject) {
$.ajax({
url: url,
type: 'GET',
success: function(response){
success: function(response) {
let data = [];
_.each(response, function(obj) {
data.pushObject(models.ProtectedFolderParticipant.create(obj));
@ -135,7 +148,7 @@ export default BaseService.extend({
resolve(data);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
@ -146,7 +159,7 @@ export default BaseService.extend({
reload() {
let url = this.get('sessionService').appMeta.getUrl(`folders`);
return new Ember.RSVP.Promise(function(resolve, reject){
return new Ember.RSVP.Promise(function(resolve, reject) {
$.ajax({
url: url,
type: 'GET',
@ -157,7 +170,7 @@ export default BaseService.extend({
});
resolve(data);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
@ -172,14 +185,14 @@ export default BaseService.extend({
$.ajax({
url: self.get('sessionService').appMeta.getUrl(`folders/${folderId}/permissions`),
type: 'GET',
success: function(response){
success: function(response) {
let data = [];
_.each(response, function(obj) {
data.pushObject(models.FolderPermissionModel.create(obj));
});
resolve(data);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
@ -196,10 +209,10 @@ export default BaseService.extend({
type: 'PUT',
contentType: 'json',
data: JSON.stringify(payload),
success: function(response){
success: function(response) {
resolve(response);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
@ -216,10 +229,10 @@ export default BaseService.extend({
type: 'POST',
contentType: 'json',
data: JSON.stringify(invitation),
success: function(response){
success: function(response) {
resolve(response);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
@ -280,4 +293,4 @@ export default BaseService.extend({
}
});
},
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Service.extend({
@ -12,4 +23,4 @@ export default Ember.Service.extend({
info: function(entry) {
console.log(entry);
}
});
});

View file

@ -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 Ember from 'ember';
import models from '../utils/model';
@ -8,15 +19,15 @@ export default Ember.Service.extend({
getOrg(id) {
let url = this.get('sessionService').appMeta.getUrl(`organizations/${id}`);
return new Ember.RSVP.Promise(function(resolve, reject){
return new Ember.RSVP.Promise(function(resolve, reject) {
$.ajax({
url: url,
type: 'GET',
success: function(response){
success: function(response) {
let org = models.OrganizationModel.create(response);
resolve(org);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
@ -47,4 +58,4 @@ export default Ember.Service.extend({
});
});
}
});
});

View file

@ -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 Ember from 'ember';
export default Ember.Service.extend({
@ -7,17 +18,17 @@ export default Ember.Service.extend({
find(keywords) {
let url = this.get('sessionService').appMeta.getUrl("search?keywords=" + encodeURIComponent(keywords));
return new Ember.RSVP.Promise(function(resolve, reject){
return new Ember.RSVP.Promise(function(resolve, reject) {
$.ajax({
url: url,
type: 'GET',
success: function(response) {
resolve(response);
},
error: function(reason){
error: function(reason) {
reject(reason);
}
});
});
},
});
});

View file

@ -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 Ember from 'ember';
import models from '../utils/model';
import BaseService from '../services/base';

View file

@ -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 Ember from 'ember';
import encodingUtil from '../utils/encoding';
import netUtil from '../utils/net';
@ -117,8 +128,13 @@ export default Ember.Service.extend({
this.storeSessionItem('token', token);
this.storeSessionItem('user', JSON.stringify(user));
let self = this;
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
jqXHR.setRequestHeader('Authorization', 'Bearer ' + token);
// We only tack on auth header for Documize API calls
if (is.startWith(options.url, self.get('appMeta.url'))) {
jqXHR.setRequestHeader('Authorization', 'Bearer ' + token);
}
});
},
@ -167,6 +183,15 @@ export default Ember.Service.extend({
});
}
var blockedPopupTest = window.open("http://d27wjpa4h6c9yx.cloudfront.net/", "directories=no,height=1,width=1,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,top=0,location=no");
if (!blockedPopupTest) {
this.set('popupBlocked', true);
} else {
blockedPopupTest.close();
this.set('popupBlocked', false);
}
return new Ember.RSVP.Promise(function(resolve) {
$.ajax({
url: self.get('appMeta').getUrl("public/meta"),
@ -214,4 +239,4 @@ export default Ember.Service.extend({
});
});
}
});
});

View file

@ -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 Ember from 'ember';
import models from '../utils/model';
@ -29,7 +40,7 @@ export default Ember.Service.extend({
url: self.get('sessionService').appMeta.getUrl("templates/" + templateId + "/folder/" + folderId + "?type=saved"),
type: 'POST',
success: function(doc) {
let docModel = models.DocumentModel.create(doc);
let docModel = models.DocumentModel.create(doc);
resolve(docModel);
},
error: function(reason) {
@ -42,15 +53,17 @@ export default Ember.Service.extend({
getSavedTemplates() {
let self = this;
return new Ember.RSVP.Promise(function(resolve, reject){
return new Ember.RSVP.Promise(function(resolve, reject) {
$.ajax({
url: self.get('sessionService').appMeta.getUrl("templates"),
type: 'GET',
success: function(response) {
if (is.not.array(response)) {
response = [];
}
let templates = Ember.ArrayProxy.create({ content: Ember.A([]) });
if (is.not.array(response)) {
response = [];
}
let templates = Ember.ArrayProxy.create({
content: Ember.A([])
});
_.each(response, function(template) {
let templateModel = models.TemplateModel.create(template);
@ -69,7 +82,7 @@ export default Ember.Service.extend({
getStockTemplates() {
let self = this;
return new Ember.RSVP.Promise(function(resolve, reject){
return new Ember.RSVP.Promise(function(resolve, reject) {
$.ajax({
url: self.get('sessionService').appMeta.getUrl("templates/stock"),
type: 'GET',
@ -82,4 +95,4 @@ export default Ember.Service.extend({
});
});
}
});
});

View file

@ -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 Ember from 'ember';
import models from '../utils/model';

View file

@ -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 "color.scss";
@import "font.scss";
@import "functions.scss";

View file

@ -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
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed !important; }
.cursor-auto { cursor: auto; }
@ -60,6 +71,12 @@ $i: 150;
$i: $i - 5;
}
$i: 100;
@while $i > 0 {
.width-#{$i} { width: #{$i}#{"%"}; }
$i: $i - 5;
}
.no-outline
{
outline:none !important;

View file

@ -1,8 +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
$color-off-white: #f5f5f5;
$color-off-black: #4c4c4c;
$color-black: #000000;
$color-white: #ffffff;
$color-primary: #2180cc;
$color-link: #5680de;
$color-red: #d9493c;
@ -16,17 +25,10 @@ $color-chip: #98A2AB;
$color-input: #98A2AB;
$color-stroke: #98A2AB;
$color-card-active: #f7fcff;
$color-border: #dbdbdb;
$color-border2: #e2e2e2;
// FIXME remove/replace below?
// $color-primary: #1b75bb;
$color-primary-light: lighten($color-primary, 30%);
$color-primary-dark: darken($color-primary, 10%);
// $color-green: #79ad30;
// $color-gray: #a0a0a0;
$color-gray2: #f0eeee;
$color-active-state: #e2e2e2;
$color-sidebar: #e7f1f6;
@ -34,16 +36,42 @@ $color-shadow: #dbdbdb;
$color-error: #c23c56;
$color-highlight: #fff8dc;
$color-warning: #990012;
.background-color-white { background-color: $color-white; }
.color-white { color: $color-white; }
.color-off-white { color: $color-off-white; }
.color-black { color: $color-black; }
.color-off-black { color: $color-off-black; }
.background-color-primary { background-color: $color-primary; }
.color-primary { color: $color-primary; }
.color-link { color: $color-link; }
.color-blue { color: $color-blue; }
.color-red { color: $color-red; }
.color-green { color: $color-green; }
.color-gray { color: $color-gray; }
.background-color-white {
background-color: $color-white;
}
.color-white {
color: $color-white;
}
.color-off-white {
color: $color-off-white;
}
.color-black {
color: $color-black;
}
.color-off-black {
color: $color-off-black;
}
.background-color-primary {
background-color: $color-primary;
}
.color-primary {
color: $color-primary;
}
.color-link {
color: $color-link;
}
.color-blue {
color: $color-blue;
}
.color-red {
color: $color-red;
}
.color-green {
color: $color-green;
}
.color-gray {
color: $color-gray;
}
.color-error {
color: $color-error;
}

View file

@ -15,7 +15,7 @@
> .item {
color: $color-off-black;
margin: 10px 5px;
margin: 0px 5px;
padding: 0;
list-style-type: none;

View file

@ -33,13 +33,12 @@
list-style: none;
float: left;
cursor: pointer;
width: 100px;
height: 100px;
width: 400px;
height: 80px;
background-color: $color-white;
border: 1px solid $color-border2;
border-radius: 3px;
margin: 0 30px 30px 0;
font-weight: bold;
&:hover {
@extend .z-depth-half;
@ -48,30 +47,48 @@
transition: 0.2s all ease;
}
> .material-icons {
text-align: center;
margin: 20px 0 0 31px;
font-size: 2.5rem;
color: $color-stroke;
}
> .img {
height: 30px;
width: 30px;
text-align: center;
margin: 23px 0 6px 33px;
margin: 17px 10px 0 20px;
display: inline-block;
height: 45px;
width: 45px;
}
> .title {
font-size: 1rem;
color: $color-stroke;
text-align: center;
margin-top: 5px;
> .details {
vertical-align: top;
display: inline-block;
> .title {
font-size: 1rem;
font-weight: bold;
color: $color-off-black;
margin-top: 18px;
letter-spacing: 0.5px;
.preview {
font-size: 0.7rem;
color: #cc9933;
display: inline-block;
margin-left: 10px;
}
}
> .desc {
color: $color-stroke;
font-size: 0.8rem;
margin-top: 5px;
max-width: 300px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
> .selected {
border-color: $color-link;
background-color: $color-card-active;
border: 1px dotted $color-link;
}
}
}

View file

@ -1,5 +1,7 @@
.wysiwyg {
font-size: 1rem;
// font-size: 1rem;
font-size: 15px;
line-height: 30px;
table
{
@ -16,7 +18,7 @@
p
{
margin: 0 !important;
padding: 0 !important;
padding: 0 !important;
}
}
}

View file

@ -28,7 +28,7 @@
width: 100%;
border: none;
border-bottom: 1px solid $color-input;
height: 2rem;
height: 2.3rem;
outline: none;
&:focus {
@ -53,7 +53,7 @@
padding: 5px;
border: 1px solid $color-input;
border-radius: 2px;
height: 2rem;
height: 2.3rem;
font-size: 1rem;
display: inline-block;
@ -186,3 +186,13 @@
.form-divider {
margin-top: 30px;
}
.widget-checkbox {
color: $color-link;
cursor: pointer;
}
.checkbox-gray {
color: $color-gray !important;
}

View file

@ -17,15 +17,26 @@
<div class="canvas">
<ul class="list">
{{#each sections as |section|}}
<li title="{{section.description}}" class="item {{if section.selected "selected"}}" {{action 'setOption' section.id}}>
{{#if section.hasImage}}
<img class="img" src="{{section.iconFile}}" />
{{else}}
<i class="material-icons">{{section.iconFont}}</i>
{{/if}}
<div class='title'>{{section.title}}</div>
<li class="item {{if section.selected "selected"}}" {{action 'setOption' section.id}}>
<img class="img" src="/sections/{{section.contentType}}.png" srcset="/sections/{{section.contentType}}@2x.png" />
<div class="details">
<div class='title'>
{{section.title}}
{{#if section.preview}}
<div class="preview">coming soon</div>
{{/if}}
</div>
<div class='desc'>{{section.description}}</div>
</div>
</li>
{{/each}}
<li class="item">
<img class="img" src="/sections/suggest.png" />
<div class="details">
<div class='title'>Suggest</div>
<div class='desc'>We'll build the integrations you need - just let us know</div>
</div>
</li>
</ul>
</div>
</div>

View file

@ -47,17 +47,17 @@
<div class="input-control">
<label>Gemini URL</label>
<div class="tip">e.g. http://helpdesk.countersoft.com</div>
{{focus-input id="gemini-url" type="text" value=config.url readonly=fieldEditable}}
{{focus-input id="gemini-url" type="text" value=config.url readonly=isReadonly}}
</div>
<div class="input-control">
<label>Username</label>
<div class="tip">Gemini username</div>
{{input id="gemini-username" type="text" value=config.username readonly=fieldEditable}}
{{input id="gemini-username" type="text" value=config.username readonly=isReadonly}}
</div>
<div class="input-control">
<label>API Key</label>
<div class="tip">Gemini user API key (from user profile)</div>
{{input id="gemini-apikey" type="password" value=config.APIKey readonly=fieldEditable}}
{{input id="gemini-apikey" type="password" value=config.APIKey readonly=isReadonly}}
</div>
<div class="regular-button button-blue" {{ action 'auth' }}>Authenticate</div>
</form>

View file

@ -0,0 +1,95 @@
<style>
.trello-board {
width: 100%;
padding: 10px;
white-space: nowrap;
overflow: auto
}
.trello-board-title {
font-weight: bold;
color: #fff;
font-size: 16px;
}
.trello-list {
background-color: #e2e4e6;
padding: 10px;
border-radius: 3px;
margin: 10px 10px 0 0;
max-width: 300px;
}
.trello-list-title {
font-weight: bold;
color: #4c4c4c;
font-size: 14px;
margin: 5px;
}
.trello-list-checkbox {
vertical-align: text-bottom;
}
</style>
{{#section/base-editor document=document folder=folder page=page busy=busy
tip="Trello is the visual way to manage your projects and organize anything (https://trello.com)"
isDirty=(action 'isDirty') onCancel=(action 'onCancel') onAction=(action 'onAction')}}
{{#if authenticated}}
<div class="pull-left width-50">
<div class="input-form">
<div class="heading">
<div class="title">Select Board & Lists</div>
<div class="tip">Choose lists to include from board</div>
</div>
{{#if noBoards}}
<div class="input-control">
<div class="color-error">You have no team boards to share - personal boards are never shown.</div>
</div>
{{else}}
<div class="input-control">
<label>Board</label>
<div class="tip">Select board</div>
{{ui-select id="boards-dropdown" content=boards action=(action 'onBoardChange') optionValuePath="id" optionLabelPath="name" selection=config.board}}
</div>
<div class="input-control">
<label>Lists</label>
<div class="tip">Select lists to include</div>
<div class="trello-board" style= {{boardStyle}}>
<div class="trello-board-title">{{config.board.name}}</div>
{{#each config.lists as |list|}}
<div class="trello-list" {{action 'onListCheckbox' list.id}}>
{{#if list.included}}
<i class="material-icons widget-checkbox checkbox-gray trello-list-checkbox">check_box</i>
{{else}}
<i class="material-icons widget-checkbox checkbox-gray trello-list-checkbox">check_box_outline_blank</i>
{{/if}}
<span class="trello-list-title">{{list.name}}</span>
</div>
{{/each}}
<div class="clearfix" />
</div>
</div>
{{/if}}
</div>
</div>
{{else}}
<div class="pull-left width-50">
<div class="input-form">
<form>
<div class="heading">
<div class="title">Authentication</div>
<div class="tip">Click to authenticate with Trello</div>
</div>
<div class="regular-button button-blue" {{ action 'auth' }}>Authenticate</div>
</form>
</div>
</div>
{{/if}}
{{/section/base-editor}}

View file

@ -0,0 +1,54 @@
<style>
.trello-board {
width: 100%;
max-height: 600px;
padding: 10px;
white-space: nowrap;
overflow: auto
}
.trello-board-title {
font-weight: bold;
color: #fff;
font-size: 16px;
}
.trello-list {
background-color: #e2e4e6;
padding: 10px;
border-radius: 3px;
margin: 10px 10px 0 0;
width: 300px;
max-height: 500px;
display: inline-block;
white-space: nowrap;
overflow: auto;
vertical-align: top;
}
.trello-list-title {
font-weight: bold;
color: #4c4c4c;
font-size: 14px;
margin: 0 10px 10px 0;
}
.trello-card {
color: #4c4c4c;
border-bottom: 1px solid #CDD2D4;
background-color: #fff;
border-radius: 3px;
padding: 7px 7px;
margin: 5px 0;
font-size: 14px;
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
line-height: 18px;
overflow: hidden;
word-wrap: break-word;
white-space: normal;
cursor: pointer;
vertical-align: top;
}
</style>
{{{page.body}}}

View file

@ -1,4 +1,4 @@
<select {{action 'change' on='change'}} class={{csslass}}>
<select {{action 'change' on='change'}} class={{csslass}} readonly={{readonly}}>
{{#if prompt}}
<option disabled selected={{is-not selection}}>
{{prompt}}

View file

@ -1,7 +1,18 @@
// 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
export default {
FolderType: {
Public: 1,
Private: 2,
Protected: 3
}
};
FolderType: {
Public: 1,
Private: 2,
Protected: 3
}
};

View file

@ -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
// "2014/02/05"
function toShortDate(date) {
return moment(new Date(date)).format('YYYY/MM/DD');
@ -26,4 +37,4 @@ export default {
formatDate,
timeAgo,
timeAgoUTC
};
};

View file

@ -1,8 +1,108 @@
// 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
//*************************************
// Base64 Object
//*************************************
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128);}}return t;},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++;}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2;}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3;}}return t;}}; //jshint ignore:line
var Base64 = {
_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode: function(e) {
var t = "";
var n, r, i, s, o, u, a;
var f = 0;
e = Base64._utf8_encode(e);
while (f < e.length) {
n = e.charCodeAt(f++);
r = e.charCodeAt(f++);
i = e.charCodeAt(f++);
s = n >> 2;
o = (n & 3) << 4 | r >> 4;
u = (r & 15) << 2 | i >> 6;
a = i & 63;
if (isNaN(r)) {
u = a = 64
} else if (isNaN(i)) {
a = 64
}
t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
}
return t
},
decode: function(e) {
var t = "";
var n, r, i;
var s, o, u, a;
var f = 0;
e = e.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (f < e.length) {
s = this._keyStr.indexOf(e.charAt(f++));
o = this._keyStr.indexOf(e.charAt(f++));
u = this._keyStr.indexOf(e.charAt(f++));
a = this._keyStr.indexOf(e.charAt(f++));
n = s << 2 | o >> 4;
r = (o & 15) << 4 | u >> 2;
i = (u & 3) << 6 | a;
t = t + String.fromCharCode(n);
if (u != 64) {
t = t + String.fromCharCode(r)
}
if (a != 64) {
t = t + String.fromCharCode(i)
}
}
t = Base64._utf8_decode(t);
return t
},
_utf8_encode: function(e) {
e = e.replace(/\r\n/g, "\n");
var t = "";
for (var n = 0; n < e.length; n++) {
var r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r)
} else if (r > 127 && r < 2048) {
t += String.fromCharCode(r >> 6 | 192);
t += String.fromCharCode(r & 63 | 128)
} else {
t += String.fromCharCode(r >> 12 | 224);
t += String.fromCharCode(r >> 6 & 63 | 128);
t += String.fromCharCode(r & 63 | 128);
}
}
return t;
},
_utf8_decode: function(e) {
var t = "";
var n = 0;
var r = c1 = c2 = 0;
while (n < e.length) {
r = e.charCodeAt(n);
if (r < 128) {
t += String.fromCharCode(r);
n++;
} else if (r > 191 && r < 224) {
c2 = e.charCodeAt(n + 1);
t += String.fromCharCode((r & 31) << 6 | c2 & 63);
n += 2;
} else {
c2 = e.charCodeAt(n + 1);
c3 = e.charCodeAt(n + 2);
t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
n += 3;
}
}
return t;
}
}; //jshint ignore:line
export default {
Base64
};
};

View file

@ -1,13 +1,23 @@
// http://thecodeship.com/web-development/alternative-to-javascript-evil-setinterval/
// 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
// from http://thecodeship.com/web-development/alternative-to-javascript-evil-setinterval/
function interval(func, wait, times) {
var interv = function(w, t) {
return function() {
if(typeof t === "undefined" || t-- > 0) {
if (typeof t === "undefined" || t-- > 0) {
setTimeout(interv, w);
try {
func.call(null);
}
catch(e) {
} catch (e) {
t = 0;
throw e.toString();
}
@ -33,4 +43,4 @@ function wrapFunction(fn, context, params) {
export default {
interval,
wrapFunction
};
};

View file

@ -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 Ember from 'ember';
import stringUtil from '../utils/string';
import config from '../config/environment';
@ -25,7 +36,7 @@ let AppMeta = BaseModel.extend({
init() {
this.set('host', config.apiHost);
this.set('namespace', config.apiNamespace);
this.set('url', [config.host, config.namespace, ""].join('/'));
this.set('url', [config.apiHost, config.apiNamespace, ""].join('/'));
},
getUrl(endpoint) {

View file

@ -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
function getSubdomain() {
if (is.ipv4(window.location.host)) {
return "";
@ -19,11 +30,11 @@ function getAppUrl(domain) {
let leftOvers = parts.join(".");
if (is.empty(domain)) {
domain = "";
} else {
domain = domain + ".";
}
if (is.empty(domain)) {
domain = "";
} else {
domain = domain + ".";
}
return window.location.protocol + "//" + domain + leftOvers;
}
@ -31,4 +42,4 @@ function getAppUrl(domain) {
export default {
getSubdomain,
getAppUrl
};
};

View file

@ -1,13 +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
// make url friendly slug from specified text.
function makeSlug(text) {
return text.toLowerCase().replace(/[^\w ]+/g,'').replace(/ +/g,'-');
return text.toLowerCase().replace(/[^\w ]+/g, '').replace(/ +/g, '-');
}
function makeId(len) {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < len; i++ ) {
for (var i = 0; i < len; i++) {
text += possible.charAt(Math.floor(Math.random() * possible.length));
}
@ -22,4 +33,4 @@ export default {
makeSlug,
makeId,
endsWith
};
};

View file

@ -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
/* jshint node: true */
module.exports = function(environment) {
@ -9,6 +20,7 @@ module.exports = function(environment) {
baseURL: '/',
apiHost: '',
apiNamespace: '',
contentSecurityPolicyHeader: 'Content-Security-Policy-Report-Only',
EmberENV: {
FEATURES: {}
@ -21,7 +33,7 @@ module.exports = function(environment) {
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.apiHost = "https://localhost:5001";
// ENV.apiHost = "https://demo1.dev:5001";
ENV.apiHost = "https://demo1.dev:5001";
}
if (environment === 'test') {
@ -37,7 +49,8 @@ module.exports = function(environment) {
// ENV.locationType = 'none';
// ENV.APP.rootElement = '#ember-testing';
ENV.apiHost = "https://demo1.dev:5001";
ENV.apiHost = "https://localhost:5001";
// ENV.apiHost = "https://demo1.dev:5001";
}
if (environment === 'production') {
@ -51,6 +64,7 @@ module.exports = function(environment) {
}
ENV.apiNamespace = "api";
ENV.contentSecurityPolicy = null;
// ENV.contentSecurityPolicy = {
// 'img-src': "'self' data: self https://js.intercomcdn.com",
@ -61,14 +75,14 @@ module.exports = function(environment) {
// 'default-src': "none"
// };
// ENV.contentSecurityPolicy = {
// 'img-src': "'self' data: self",
// 'font-src': "'self' *",
// 'style-src': "'self' *",
// 'script-src': "'self' *",
// 'connect-src': "'self' *",
// 'default-src': "*"
// };
return ENV;
};
// contentSecurityPolicy: {
// 'img-src': "'self' data: self",
// 'font-src': "'self' data: fonts.gstatic.com",
// 'style-src': "'self' 'unsafe-inline' fonts.googleapis.com",
// 'script-src': "'self' 'unsafe-inline' 'unsafe-eval' *",
// 'connect-src': "'self'",
// 'default-src': "none"
// },

View file

@ -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
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var isDevelopment = EmberApp.env() === 'development';
@ -44,6 +55,7 @@ module.exports = function(defaults) {
app.import('vendor/tether.js');
app.import('vendor/drop.js');
app.import('vendor/tooltip.js');
app.import('vendor/markdown-it.min.js');
return app.toTree();
};
};

Some files were not shown because too many files have changed in this diff Show more