Skip to content

Commit

Permalink
record pin event, remove uppercase CSS, reduce AJAX calls
Browse files Browse the repository at this point in the history
  • Loading branch information
HarveyKandola committed Nov 22, 2016
1 parent 532a807 commit b2769ef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/app/components/document/document-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
},

unpin() {
this.audit.record('unpinned-document');

this.get('pinned').unpinItem(this.get('pinState.pinId')).then(() => {
this.set('pinState.isPinned', false);
this.set('pinState.pinId', '');
Expand All @@ -137,6 +139,8 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
return false;
}

this.audit.record('pinned-document');

this.get('pinned').pinItem(pin).then((pin) => {
this.set('pinState.isPinned', true);
this.set('pinState.pinId', pin.get('id'));
Expand Down
6 changes: 5 additions & 1 deletion app/app/components/folder/folder-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
},

unpin() {
this.audit.record('unpinned-space');

this.get('pinned').unpinItem(this.get('pinState.pinId')).then(() => {
this.set('pinState.isPinned', false);
this.set('pinState.pinId', '');
Expand All @@ -119,13 +121,15 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
return false;
}

this.audit.record('pinned-space');

this.get('pinned').pinItem(pin).then((pin) => {
this.set('pinState.isPinned', true);
this.set('pinState.pinId', pin.get('id'));
this.eventBus.publish('pinChange');
});

return true;
}
}
}
});
10 changes: 10 additions & 0 deletions app/app/components/layout/zone-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export default Ember.Component.extend(TooltipMixin, {
var sortable = Sortable.create(document.getElementById('pinned-zone'), {
animation: 150,
onEnd: function () {
self.audit.record('reorganized-pins');

self.get('pinned').updateSequence(this.toArray()).then((pins) => {
self.set('pins', pins);
});
Expand All @@ -94,7 +96,15 @@ export default Ember.Component.extend(TooltipMixin, {
},

setupPins() {
if (this.get('isDestroyed') || this.get('isDestroying')) {
return;
}

this.get('pinned').getUserPins().then((pins) => {
if (this.get('isDestroyed') || this.get('isDestroying')) {
return;
}

this.set('pins', pins);

pins.forEach((pin) => {
Expand Down
1 change: 0 additions & 1 deletion app/app/styles/view/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
width: 40px;
text-align: center;
overflow: hidden;
text-transform: uppercase;
@include ease-in();
@include border-radius(3px);
font-family: $font-semibold;
Expand Down

0 comments on commit b2769ef

Please sign in to comment.