mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
activity tab completed
This commit is contained in:
parent
c09e23a0da
commit
26bca3bc40
13 changed files with 189 additions and 171 deletions
|
@ -38,8 +38,10 @@
|
|||
"brace_style": "collapse-preserve-inline",
|
||||
"keep_function_indentation": false,
|
||||
"space_after_anon_function": false,
|
||||
"space_before_anon_function": false,
|
||||
"space_before_conditional": true,
|
||||
"space_in_empty_paren": false,
|
||||
"space_before_func_paren": false,
|
||||
"space_in_paren": false
|
||||
},
|
||||
"sql": {
|
||||
|
@ -47,4 +49,4 @@
|
|||
"indent_level": 0,
|
||||
"indent_with_tabs": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,18 +12,28 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
document: {},
|
||||
meta: [],
|
||||
pages: [],
|
||||
sortedItems: [],
|
||||
|
||||
didReceiveAttrs() {
|
||||
let editors = this.get('meta.editors');
|
||||
let editors = this.get('activity.editors');
|
||||
let viewers = this.get('activity.viewers');
|
||||
let toc = this.get('pages');
|
||||
let sorted = [];
|
||||
|
||||
if (is.null(editors)) {
|
||||
return;
|
||||
editors = [];
|
||||
}
|
||||
|
||||
if (is.null(viewers)) {
|
||||
viewers = [];
|
||||
}
|
||||
|
||||
viewers.forEach((item) => {
|
||||
Ember.set(item, 'changeLabel', "viewed");
|
||||
Ember.set(item, "viewed", true);
|
||||
sorted.pushObject({ date: item.created, item: item });
|
||||
});
|
||||
|
||||
editors.forEach(function (item) {
|
||||
Ember.set(item, "added", item.action === "add-page");
|
||||
Ember.set(item, "changed", item.action === "update-page");
|
||||
|
@ -32,6 +42,7 @@ export default Ember.Component.extend({
|
|||
let page = _.findWhere(toc, {
|
||||
id: item.pageId
|
||||
});
|
||||
|
||||
let title = "";
|
||||
|
||||
if (is.not.undefined(page)) {
|
||||
|
@ -59,6 +70,10 @@ export default Ember.Component.extend({
|
|||
Ember.set(item, 'changeLabel', "removed section");
|
||||
}
|
||||
}
|
||||
|
||||
sorted.pushObject({ date: item.created, item: item });
|
||||
});
|
||||
|
||||
this.set('sortedItems', _.sortBy(sorted, 'date').reverse());
|
||||
}
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
// 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({
|
||||
actions: {
|
||||
close() {
|
||||
this.attrs.close();
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
// 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({
|
||||
document: {},
|
||||
meta: [],
|
||||
});
|
|
@ -16,17 +16,43 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
documentService: Ember.inject.service('document'),
|
||||
folderService: Ember.inject.service('folder'),
|
||||
userService: Ember.inject.service('user'),
|
||||
|
||||
beforeModel(transition) {
|
||||
},
|
||||
pages: [],
|
||||
|
||||
model() {
|
||||
this.audit.record("viewed-document-activity");
|
||||
|
||||
let folders = this.get('store').peekAll('folder');
|
||||
let folder = this.get('store').peekRecord('folder', this.paramsFor('document').folder_id);
|
||||
|
||||
this.set('folders', folders);
|
||||
this.set('folder', folder);
|
||||
|
||||
return this.modelFor('document');
|
||||
},
|
||||
|
||||
afterModel(model) {
|
||||
let self = this;
|
||||
|
||||
let pages = this.get('store').peekAll('page').filter((page) => {
|
||||
return page.get('documentId') === model.get('id');
|
||||
});
|
||||
|
||||
this.set('pages', pages);
|
||||
|
||||
return new Ember.RSVP.Promise(function (resolve) {
|
||||
self.get('documentService').getMeta(model.get('id')).then(function (activity) {
|
||||
self.set('activity', activity);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('folder', this.get('folder'));
|
||||
controller.set('folders', this.get('folders').rejectBy('id', 0));
|
||||
controller.set('isEditor', this.get('folderService').get('canEditCurrentFolder'));
|
||||
controller.set('activity', this.get('activity'));
|
||||
controller.set('pages', this.get('pages'));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
activity
|
||||
{{document/document-activity document=model pages=pages activity=activity}}
|
||||
|
|
108
app/app/styles/view/document/activity.scss
Normal file
108
app/app/styles/view/document/activity.scss
Normal file
|
@ -0,0 +1,108 @@
|
|||
.document-activity {
|
||||
> .items {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
> .item {
|
||||
padding: 20px 0;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid $color-border;
|
||||
|
||||
> .avatar-box {
|
||||
display: inline-block;
|
||||
margin: 3px 10px 0 0;
|
||||
width: 5%;
|
||||
}
|
||||
|
||||
> .name {
|
||||
display: inline-block;
|
||||
font-size: 1rem;
|
||||
font-family: $font-light;
|
||||
color: $color-off-black;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
> .detail {
|
||||
display: inline-block;
|
||||
font-size: 1rem;
|
||||
font-family: $font-regular;
|
||||
color: $color-off-black;
|
||||
width: 45%;
|
||||
|
||||
.viewed {
|
||||
color: $color-goldy;
|
||||
}
|
||||
|
||||
.added {
|
||||
color: $color-green;
|
||||
}
|
||||
|
||||
.changed {
|
||||
color: $color-blue;
|
||||
}
|
||||
|
||||
.deleted {
|
||||
color: $color-red;
|
||||
}
|
||||
}
|
||||
|
||||
> .date {
|
||||
display: inline-block;
|
||||
font-family: $font-light;
|
||||
font-size: 1rem;
|
||||
float: right;
|
||||
width: 15%;
|
||||
padding-top: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.meta-editors {
|
||||
position: relative;
|
||||
|
||||
> .items {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
> .item {
|
||||
margin: 15px 0;
|
||||
overflow-x: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
width: 90%;
|
||||
|
||||
.avatar-box {
|
||||
display: inline-block;
|
||||
margin: 3px 10px 0 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.detail {
|
||||
display: inline-block;
|
||||
|
||||
.name {
|
||||
font-size: 1rem;
|
||||
color: $color-off-black;
|
||||
}
|
||||
|
||||
.changed {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.deleted {
|
||||
font-size: 0.9rem;
|
||||
color: $color-red;
|
||||
}
|
||||
|
||||
.date {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
@import "activity.scss";
|
||||
@import "content.scss";
|
||||
@import "edit-tools.scss";
|
||||
@import "editor.scss";
|
||||
|
|
|
@ -113,86 +113,3 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.meta-viewers {
|
||||
> .items {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
> .item {
|
||||
margin: 15px 0;
|
||||
overflow-x: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
width: 90%;
|
||||
|
||||
> .avatar-box {
|
||||
display: inline-block;
|
||||
margin: 3px 10px 0 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
> .detail {
|
||||
display: inline-block;
|
||||
|
||||
> .name {
|
||||
font-size: 1rem;
|
||||
color: $color-off-black;
|
||||
}
|
||||
|
||||
> .date {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.meta-editors {
|
||||
position: relative;
|
||||
|
||||
> .items {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
|
||||
> .item {
|
||||
margin: 15px 0;
|
||||
overflow-x: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
width: 90%;
|
||||
|
||||
.avatar-box {
|
||||
display: inline-block;
|
||||
margin: 3px 10px 0 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.detail {
|
||||
display: inline-block;
|
||||
|
||||
.name {
|
||||
font-size: 1rem;
|
||||
color: $color-off-black;
|
||||
}
|
||||
|
||||
.changed {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.deleted {
|
||||
font-size: 0.9rem;
|
||||
color: $color-red;
|
||||
}
|
||||
|
||||
.date {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
27
app/app/templates/components/document/document-activity.hbs
Normal file
27
app/app/templates/components/document/document-activity.hbs
Normal file
|
@ -0,0 +1,27 @@
|
|||
<div class="document-activity">
|
||||
<ul class="items">
|
||||
{{#each sortedItems as |e|}}
|
||||
<li class="item">
|
||||
<div class="avatar-box">
|
||||
<div class="avatar">{{user-initials e.item.firstname e.item.lastname}}</div>
|
||||
</div>
|
||||
<div class="name">{{e.item.firstname}} {{e.item.lastname}}</div>
|
||||
<div class="detail">
|
||||
{{#if e.item.deleted}}
|
||||
<div class="deleted">{{e.item.changeLabel}}</div>
|
||||
{{/if}}
|
||||
{{#if e.item.changed}}
|
||||
<div class="changed">{{e.item.changeLabel}}</div>
|
||||
{{/if}}
|
||||
{{#if e.item.added}}
|
||||
<div class="added">{{e.item.changeLabel}}</div>
|
||||
{{/if}}
|
||||
{{#if e.item.viewed}}
|
||||
<div class="viewed">{{e.item.changeLabel}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="date">{{time-ago e.date}}</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
|
@ -1,6 +0,0 @@
|
|||
<div class="close-action">
|
||||
<div class="round-button-mono" {{action 'close'}}>
|
||||
<i class="material-icons">clear</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
|
@ -1,20 +0,0 @@
|
|||
<div class="meta-editors">
|
||||
<ul class="items">
|
||||
{{#each meta.editors as |edit|}}
|
||||
<li class="item">
|
||||
<div class="avatar-box">
|
||||
<div class="avatar">{{user-initials edit.firstname edit.lastname}}</div>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<div class="name">{{edit.firstname}} {{edit.lastname}}</div>
|
||||
{{#if edit.deleted}}
|
||||
<div class="deleted">{{edit.changeLabel}}</div>
|
||||
{{else}}
|
||||
<a class="changed">{{edit.changeLabel}}</a>
|
||||
{{/if}}
|
||||
<div class="date">{{time-ago edit.created}}</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
|
@ -1,15 +0,0 @@
|
|||
<div class="meta-viewers">
|
||||
<ul class="items">
|
||||
{{#each meta.viewers as |viewer|}}
|
||||
<li class="item">
|
||||
<div class="avatar-box">
|
||||
<div class="avatar">{{user-initials viewer.firstname viewer.lastname}}</div>
|
||||
</div>
|
||||
<div class="detail">
|
||||
<div class="name">{{viewer.firstname}} {{viewer.lastname}}</div>
|
||||
<div class="date">{{time-ago viewer.created}}</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue