mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
fixes
This commit is contained in:
parent
0d9400965d
commit
9f7585e2a5
18 changed files with 126 additions and 103 deletions
|
@ -37,13 +37,13 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
didRender() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.contentLinkHandler();
|
||||
|
||||
let self = this;
|
||||
$(".tooltipped").each(function(i, el) {
|
||||
self.addTooltip(el);
|
||||
});
|
||||
let jumpTo = this.get('pageId');
|
||||
if (is.not.empty(jumpTo) && is.not.undefined(jumpTo) && !$("#page-" + jumpTo).inView()) {
|
||||
$("#page-" + jumpTo).velocity("scroll", { duration: 250, offset: -100 });
|
||||
}
|
||||
|
||||
this.contentLinkHandler();
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
|
@ -57,15 +57,10 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
$(this).find('.start-button').velocity("transition.slideUpOut", {duration: 300});
|
||||
} });
|
||||
|
||||
let jumpTo = this.get('pageId');
|
||||
if (is.not.empty(jumpTo)) {
|
||||
let self = this;
|
||||
$("#page-" + jumpTo).velocity("scroll", { duration: 250, offset: -100, complete:
|
||||
function() {
|
||||
self.set('pageId', '');
|
||||
}
|
||||
});
|
||||
}
|
||||
let self = this;
|
||||
$(".tooltipped").each(function(i, el) {
|
||||
self.addTooltip(el);
|
||||
});
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
|
|
|
@ -18,7 +18,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
document: {},
|
||||
folder: {},
|
||||
pages: [],
|
||||
page: "",
|
||||
currentPageId: "",
|
||||
state: {
|
||||
actionablePage: false,
|
||||
upDisabled: true,
|
||||
|
@ -35,8 +35,8 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
this.set('showToc', is.not.undefined(this.get('pages')) && this.get('pages').get('length') > 0);
|
||||
|
||||
if (is.not.null(this.get('page'))) {
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
if (is.not.null(this.get('currentPageId'))) {
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -71,7 +71,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
// Controls what user can do with the toc (left sidebar).
|
||||
// Identifies the target pages.
|
||||
setState(pageId) {
|
||||
this.set('page', pageId);
|
||||
this.set('currentPageId', pageId);
|
||||
|
||||
let toc = this.get('pages');
|
||||
let page = _.findWhere(toc, { id: pageId });
|
||||
|
@ -94,13 +94,13 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
let state = this.get('state');
|
||||
let pages = this.get('pages');
|
||||
let page = _.findWhere(pages, { id: this.get('page') });
|
||||
let page = _.findWhere(pages, { id: this.get('currentPageId') });
|
||||
let pendingChanges = tocUtil.moveUp(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
this.attrs.onPageSequenceChange(pendingChanges);
|
||||
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
this.audit.record("moved-page-up");
|
||||
this.showNotification("Moved up");
|
||||
}
|
||||
|
@ -114,13 +114,13 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
let state = this.get('state');
|
||||
var pages = this.get('pages');
|
||||
var page = _.findWhere(pages, { id: this.get('page') });
|
||||
var page = _.findWhere(pages, { id: this.get('currentPageId') });
|
||||
let pendingChanges = tocUtil.moveDown(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
this.attrs.onPageSequenceChange(pendingChanges);
|
||||
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
this.audit.record("moved-page-down");
|
||||
this.showNotification("Moved down");
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
let state = this.get('state');
|
||||
var pages = this.get('pages');
|
||||
var page = _.findWhere(pages, { id: this.get('page') });
|
||||
var page = _.findWhere(pages, { id: this.get('currentPageId') });
|
||||
let pendingChanges = tocUtil.indent(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
|
@ -142,7 +142,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
this.showNotification("Indent");
|
||||
this.audit.record("changed-page-sequence");
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -154,7 +154,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
let state = this.get('state');
|
||||
var pages = this.get('pages');
|
||||
var page = _.findWhere(pages, { id: this.get('page') });
|
||||
var page = _.findWhere(pages, { id: this.get('currentPageId') });
|
||||
let pendingChanges = tocUtil.outdent(state, pages, page);
|
||||
|
||||
if (pendingChanges.length > 0) {
|
||||
|
@ -162,7 +162,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
this.showNotification("Outdent");
|
||||
this.audit.record("changed-page-sequence");
|
||||
this.send('onEntryClick', this.get('page'));
|
||||
this.send('onEntryClick', this.get('currentPageId'));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ export default Ember.Component.extend(SectionMixin, NotifierMixin, TooltipMixin,
|
|||
self.set('authenticated', true);
|
||||
self.set('items', response);
|
||||
self.set('config.APIToken', '********'); // reset the api token once it has been sent to the host
|
||||
console.log("auth token OK");
|
||||
|
||||
self.get('sectionService').fetch(page, "options", config)
|
||||
.then(function (response) {
|
||||
|
|
|
@ -17,11 +17,11 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
this.audit.record("restored-page");
|
||||
|
||||
this.get('documentService').rollbackPage(this.get('model.document.id'), pageId, revisionId).then(() => {
|
||||
this.transitionToRoute('document', {
|
||||
queryParams: {
|
||||
page: pageId
|
||||
}
|
||||
});
|
||||
this.transitionToRoute('document.index',
|
||||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
folder: {},
|
||||
pages: [],
|
||||
toggled: false,
|
||||
queryParams: ['pageId', 'tab'],
|
||||
pageId: '',
|
||||
tab: 'index',
|
||||
|
||||
actions: {
|
||||
toggleSidebar() {
|
||||
|
@ -212,7 +215,6 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
});
|
||||
},
|
||||
|
||||
// tbd
|
||||
onGotoPage(id) {
|
||||
this.set('pageId', id);
|
||||
}
|
||||
|
|
|
@ -17,18 +17,10 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
linkService: Ember.inject.service('link'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
userService: Ember.inject.service('user'),
|
||||
queryParams: {
|
||||
pageId: {
|
||||
refreshModel: true
|
||||
},
|
||||
tab: {
|
||||
refreshModel: false
|
||||
}
|
||||
},
|
||||
|
||||
beforeModel(transition) {
|
||||
this.set('pageId', is.not.undefined(transition.queryParams.pageId) ? transition.queryParams.pageId : '');
|
||||
this.set('tab', is.not.undefined(transition.queryParams.tab) ? transition.queryParams.tab : '');
|
||||
this.set('tab', is.not.undefined(transition.queryParams.tab) ? transition.queryParams.tab : 'index');
|
||||
},
|
||||
|
||||
model() {
|
||||
|
@ -40,11 +32,12 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
folders: this.modelFor('document').folders,
|
||||
folder: this.modelFor('document').folder,
|
||||
document: this.modelFor('document').document,
|
||||
pageId: this.get('pageId'),
|
||||
isEditor: this.get('folderService').get('canEditCurrentFolder'),
|
||||
pages: this.get('documentService').getPages(this.modelFor('document').document.get('id')),
|
||||
links: this.modelFor('document').links,
|
||||
sections: this.modelFor('document').sections
|
||||
sections: this.modelFor('document').sections,
|
||||
pageId: this.get('pageId'),
|
||||
tab: this.get('tab'),
|
||||
isEditor: this.get('folderService').get('canEditCurrentFolder')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,11 +21,12 @@ export default Ember.Controller.extend(NotifierMixin, {
|
|||
this.get('model.folder.id'),
|
||||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'));
|
||||
this.get('model.document.slug'),
|
||||
{ queryParams: { pageId: this.get('model.page.id') }});
|
||||
},
|
||||
|
||||
onAction(page, meta) {
|
||||
this.showNotification("Saving");
|
||||
this.showNotification("Saved");
|
||||
|
||||
let model = {
|
||||
page: page.toJSON({ includeId: true }),
|
||||
|
|
|
@ -21,6 +21,7 @@ export default Ember.Service.extend({
|
|||
appMeta: service(),
|
||||
store: service(),
|
||||
pins: [],
|
||||
initialized: false,
|
||||
|
||||
getUserPins() {
|
||||
let userId = this.get('session.user.id');
|
||||
|
@ -41,6 +42,7 @@ export default Ember.Service.extend({
|
|||
});
|
||||
|
||||
this.set('pins', pins);
|
||||
this.set('initialized', true);
|
||||
|
||||
return pins;
|
||||
});
|
||||
|
@ -102,16 +104,32 @@ export default Ember.Service.extend({
|
|||
|
||||
isDocumentPinned(documentId) {
|
||||
let userId = this.get('session.user.id');
|
||||
let pins = this.get('pins');
|
||||
let pinId = '';
|
||||
|
||||
pins.forEach((pin) => {
|
||||
if (pin.get('userId') === userId && pin.get('documentId') === documentId) {
|
||||
pinId = pin.get('id');
|
||||
}
|
||||
});
|
||||
if (this.get('initialized') === false) {
|
||||
this.getUserPins().then(() => {
|
||||
let pins = this.get('pins');
|
||||
let pinId = '';
|
||||
|
||||
return pinId;
|
||||
pins.forEach((pin) => {
|
||||
if (pin.get('userId') === userId && pin.get('documentId') === documentId) {
|
||||
pinId = pin.get('id');
|
||||
}
|
||||
});
|
||||
|
||||
return pinId;
|
||||
});
|
||||
} else {
|
||||
let pins = this.get('pins');
|
||||
let pinId = '';
|
||||
|
||||
pins.forEach((pin) => {
|
||||
if (pin.get('userId') === userId && pin.get('documentId') === documentId) {
|
||||
pinId = pin.get('id');
|
||||
}
|
||||
});
|
||||
|
||||
return pinId;
|
||||
}
|
||||
},
|
||||
|
||||
isSpacePinned(spaceId) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.table-editor-wrapper {
|
||||
margin-top: 7px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.fr-element,
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
> .canvas {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.revision-picker {
|
||||
width: 300px;
|
||||
float: left;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.revision-picker {
|
||||
width: 300px;
|
||||
float: left;
|
||||
margin-top: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
{{ui-select tagName="span" class="revision-picker" content=revisions action=(action 'onSelectRevision') optionValuePath="id" optionLabelPath="label"}}
|
||||
|
||||
<div id="restore-history-button" class="regular-button button-green pull-right">Restore</div>
|
||||
{{#dropdown-dialog target="restore-history-button" position="bottom right" button="Restore" color="flat-green" onAction=(action 'onRollback')}}
|
||||
<p>Are you sure you want to roll back to this version?</p>
|
||||
{{/dropdown-dialog}}
|
||||
<div class="clearfix" />
|
||||
<div class="margin-bottom-50" />
|
||||
|
||||
<div class="diff-zone">
|
||||
{{ui-select tagName="div" class="revision-picker" content=revisions action=(action 'onSelectRevision') optionValuePath="id" optionLabelPath="label"}}
|
||||
{{#if hasDiff}}
|
||||
<div id="restore-history-button" class="regular-button button-green pull-right">Restore</div>
|
||||
{{#dropdown-dialog target="restore-history-button" position="bottom right" button="Restore" color="flat-green" onAction=(action 'onRollback')}}
|
||||
<p>Are you sure you want to roll back to this version?</p>
|
||||
{{/dropdown-dialog}}
|
||||
<div class="clearfix" />
|
||||
<div class="is-a-page wysiwyg">
|
||||
{{{diff}}}
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
<ul class="index-list">
|
||||
{{#each pages key="id" as |p index|}}
|
||||
{{document/index-entry page=p index=index onClick=(action 'onEntryClick')}}
|
||||
{{document/sidebar-view-index-entry page=p index=index onClick=(action 'onEntryClick')}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -15,18 +15,6 @@
|
|||
<div class="round-button-mono {{if (is-equal tab 'activity') 'selected'}}" {{action 'onChangeTab' 'activity'}}>
|
||||
<i class="material-icons">timeline</i>
|
||||
</div>
|
||||
<div class="margin-top-20"></div>
|
||||
<div class="round-button-mono {{if (is-equal tab 'feedback') 'feedback'}}" {{action 'onChangeTab' 'feedback'}}>
|
||||
<i class="material-icons">chat_bubble</i>
|
||||
</div>
|
||||
<div class="margin-top-20"></div>
|
||||
<div class="round-button-mono {{if (is-equal tab 'actions') 'selected'}}" {{action 'onChangeTab' 'actions'}}>
|
||||
<i class="material-icons">person</i>
|
||||
</div>
|
||||
<div class="margin-top-20"></div>
|
||||
<div class="round-button-mono {{if (is-equal tab 'share') 'selected'}}" {{action 'onChangeTab' 'share'}}>
|
||||
<i class="material-icons">share</i>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
|
@ -50,18 +38,6 @@
|
|||
{{#if (is-equal tab 'activity')}}
|
||||
{{document/sidebar-view-activity document=document pages=pages isEditor=isEditor}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (is-equal tab 'feedback')}}
|
||||
{{enterprise/sidebar-view-feedback document=document isEditor=isEditor}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (is-equal tab 'actions')}}
|
||||
{{enterprise/sidebar-view-actions document=document folder=folder isEditor=isEditor}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (is-equal tab 'share')}}
|
||||
{{enterprise/sidebar-view-share document=document isEditor=isEditor}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{#dropdown-menu target="sidebar-zone-more-button" position="bottom right" open="click" onOpenCallback=(action 'onMenuOpen') onCloseCallback=(action 'onMenuOpen')}}
|
||||
|
@ -93,6 +69,18 @@
|
|||
{{/dropdown-menu}}
|
||||
|
||||
{{#if session.authenticated}}
|
||||
{{#if menuOpen}}
|
||||
{{#unless pinState.isPinned}}
|
||||
{{#dropdown-dialog target="pin-document-button" position="bottom right" button="Pin" color="flat-green" onAction=(action 'onPin') focusOn="pin-document-name" }}
|
||||
<div class="input-control">
|
||||
<label>Pin Document</label>
|
||||
<div class="tip">A 3 or 4 character name</div>
|
||||
{{input type='text' id="pin-document-name" value=pinState.newName}}
|
||||
</div>
|
||||
{{/dropdown-dialog}}
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isEditor}}
|
||||
{{#if menuOpen}}
|
||||
{{#dropdown-dialog target="delete-document-button" position="bottom right" button="Delete" color="flat-red" onAction=(action 'onDeleteDocument')}}
|
||||
|
@ -100,16 +88,6 @@
|
|||
<p>There is no undo, so be careful.</p>
|
||||
{{/dropdown-dialog}}
|
||||
|
||||
{{#unless pinState.isPinned}}
|
||||
{{#dropdown-dialog target="pin-document-button" position="bottom right" button="Pin" color="flat-green" onAction=(action 'onPin') focusOn="pin-document-name" }}
|
||||
<div class="input-control">
|
||||
<label>Pin Document</label>
|
||||
<div class="tip">A 3 or 4 character name</div>
|
||||
{{input type='text' id="pin-document-name" value=pinState.newName}}
|
||||
</div>
|
||||
{{/dropdown-dialog}}
|
||||
{{/unless}}
|
||||
|
||||
{{#dropdown-dialog target="save-template-button" position="bottom right" button="Save as Template" color="flat-green" onAction=(action 'onSaveTemplate') focusOn="new-template-name" }}
|
||||
<div class="input-control">
|
||||
<label>Name</label>
|
||||
|
|
|
@ -41,6 +41,7 @@ module.exports = function (defaults) {
|
|||
}
|
||||
});
|
||||
|
||||
app.import('vendor/documize.js');
|
||||
app.import('vendor/dropzone.js');
|
||||
app.import('vendor/is.js');
|
||||
app.import('vendor/md5.js');
|
||||
|
|
31
app/vendor/documize.js
vendored
Normal file
31
app/vendor/documize.js
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
$.fn.inView = function(){
|
||||
let win = $(window);
|
||||
let obj = $(this);
|
||||
|
||||
// trap for no object
|
||||
if (obj.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// the top Scroll Position in the page
|
||||
let scrollPosition = win.scrollTop();
|
||||
|
||||
// the end of the visible area in the page, starting from the scroll position
|
||||
let visibleArea = win.scrollTop() + win.height();
|
||||
|
||||
// we check to see if the start of object is in view
|
||||
let objPos = obj.offset().top;// + obj.outerHeight();
|
||||
|
||||
return(visibleArea >= objPos && scrollPosition <= objPos ? true : false);
|
||||
};
|
|
@ -1090,6 +1090,7 @@ func CopyPage(w http.ResponseWriter, r *http.Request) {
|
|||
newPageID := util.UniqueID()
|
||||
page.RefID = newPageID
|
||||
page.Level = 1
|
||||
page.Sequence = 0
|
||||
page.DocumentID = targetID
|
||||
page.UserID = p.Context.UserID
|
||||
pageMeta.DocumentID = targetID
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue