1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

refresh tabs

This commit is contained in:
Harvey Kandola 2016-11-10 12:01:06 -08:00
parent 876287bc11
commit f2734edfae
5 changed files with 17 additions and 19 deletions

View file

@ -14,6 +14,7 @@ import NotifierMixin from '../../mixins/notifier';
import TooltipMixin from '../../mixins/tooltip';
export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
sectionService: Ember.inject.service('section'),
viewMode: true,
editMode: false,
@ -23,6 +24,20 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
}
},
didInsertElement() {
let self = this;
this.get('sectionService').refresh(this.get('model.document.id')).then(function (changes) {
changes.forEach(function (newPage) {
let oldPage = self.get('model.page');
if (!_.isUndefined(oldPage) && oldPage.get('id') === newPage.get('id')) {
oldPage.set('body', newPage.get('body'));
oldPage.set('revised', newPage.get('revised'));
self.showNotification(`Refreshed ${oldPage.get('title')}`);
}
});
});
},
actions: {
onEdit() {
this.set('viewMode', false);

View file

@ -27,21 +27,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
return this.get('pages.length') === 0;
}),
didInsertElement() {
// let self = this;
// this.get('sectionService').refresh(this.get('document.id')).then(function (changes) {
// changes.forEach(function (newPage) {
// let oldPage = self.get('pages').findBy('id', newPage.get('id'));
// if (is.not.undefined(oldPage)) {
// oldPage.set('body', newPage.get('body'));
// oldPage.set('revised', newPage.get('revised'));
// self.showNotification(`Refreshed ${oldPage.get('title')}`);
// }
// });
// });
},
didRender() {
this.contentLinkHandler();
},

View file

@ -59,7 +59,7 @@ export default Ember.Component.extend({
],
menu: {},
menubar: false,
toolbar1: "bold italic underline strikethrough superscript subscript | outdent indent bullist numlist forecolor backcolor | alignleft aligncenter alignright alignjustify | link unlink | table image media | hr codesample",
toolbar1: "bold italic underline strikethrough superscript subscript | outdent indent bullist numlist forecolor backcolor | alignleft aligncenter alignright alignjustify | link unlink | table image media codesample",
toolbar2: "formatselect fontselect fontsizeselect",
save_onsavecallback: function () {
Mousetrap.trigger('ctrl+s');

View file

@ -19,7 +19,7 @@
{{/if}}
{{#each tabs as |tab|}}
<li class="tab">
{{#link-to 'document.section' tab.id}}{{tab.title}}{{/link-to}}
{{#link-to 'document.section' tab.id (query-params mode='view')}}{{tab.title}}{{/link-to}}
</li>
{{/each}}
{{#if isEditor}}

View file

@ -17,8 +17,6 @@ const tradTemplate = `
<div class="heading">
<p>There are {{ .Detail.CardCount }} cards across {{ .Detail.ListCount }} lists on <a href="{{ .Detail.Board.URL }}">{{.Detail.Board.Name}} Board</a></p>
</div>
<p class="non-printable-message">Non-printable</p>
<div class="section-trello-render non-printable">
<div class="single-trello-board">
<table class="trello-single-board" style="width: 100%;">