Skip to content

Commit 72916ed

Browse files
Merge pull request #41 from documize/doc-toolbar-ux
Doc toolbar ux
2 parents 20f9272 + 6d9abb7 commit 72916ed

File tree

103 files changed

+1895
-474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1895
-474
lines changed

.gitattributes

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22
* text=auto
33

44
# These files are text and should be normalized (convert crlf > lf)
5-
*.hbs text
5+
*.hbs text eol=lf
6+
*.js text eol=lf
7+
*.html text eol=lf
8+
*.go text eol=lf
9+
*.sql text eol=lf
10+
*.scss text eol=lf
11+
*.js text eol=lf
12+
*.json text eol=lf

app/.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ end_of_line = lf
1010
charset = utf-8
1111
trim_trailing_whitespace = true
1212
insert_final_newline = true
13-
indent_style = space
14-
indent_size = 2
13+
indent_style = tab
14+
indent_size = 4
1515

1616
[*.hbs]
1717
insert_final_newline = false

app/.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"Drop",
1919
"Dropzone",
2020
"dragula",
21-
"datetimepicker"
21+
"datetimepicker",
22+
"Waypoint"
2223
],
2324
"browser": true,
2425
"boss": true,
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111

1212
import Ember from 'ember';
1313

14-
export default Ember.Component.extend({});
14+
export default Ember.Component.extend({
15+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2016 Documize Inc. <[email protected]>. All rights reserved.
2+
//
3+
// This software (Documize Community Edition) is licensed under
4+
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
5+
//
6+
// You can operate outside the AGPL restrictions by purchasing
7+
// Documize Enterprise Edition and obtaining a commercial license
8+
// by contacting <[email protected]>.
9+
//
10+
// https://documize.com
11+
12+
import Ember from 'ember';
13+
14+
export default Ember.Component.extend({
15+
});

app/app/components/document/document-sidebar-toc.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,29 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
4545

4646
didInsertElement() {
4747
this.eventBus.subscribe('documentPageAdded', this, 'onDocumentPageAdded');
48-
49-
var s = $(".document-structure");
50-
var pos = s.position();
51-
52-
$(window).scroll(function() {
53-
var windowpos = $(window).scrollTop();
54-
if (windowpos - 200 >= pos.top) {
55-
s.addClass("stick");
56-
s.css('width', s.parent().width());
57-
} else {
58-
s.removeClass("stick");
59-
s.css('width', 'auto');
60-
}
61-
});
62-
},
48+
},
6349

6450
willDestroyElement() {
6551
this.eventBus.unsubscribe('documentPageAdded');
6652
this.destroyTooltips();
6753
},
6854

55+
// positionToc() {
56+
// let s = $(".document-structure");
57+
// let pos = s.position();
58+
//
59+
// $(window).scroll(_.throttle(function() {
60+
// let windowpos = $(window).scrollTop();
61+
// if (windowpos - 200 >= pos.top) {
62+
// s.addClass("stuck-toc");
63+
// s.css('width', s.parent().width());
64+
// } else {
65+
// s.removeClass("stuck-toc");
66+
// s.css('width', 'auto');
67+
// }
68+
// }, 50));
69+
// },
70+
6971
onDocumentPageAdded(pageId) {
7072
this.send('onEntryClick', pageId);
7173
},

app/app/components/document/document-sidebar.js

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,51 @@
1111

1212
import Ember from 'ember';
1313
import TooltipMixin from '../../mixins/tooltip';
14+
import NotifierMixin from '../../mixins/notifier';
1415

15-
export default Ember.Component.extend(TooltipMixin, {
16+
export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
1617
documentService: Ember.inject.service('document'),
1718
document: {},
1819
folder: {},
1920
showToc: true,
2021
showViews: false,
2122
showContributions: false,
23+
showSections: false,
24+
showScrollTool: false,
25+
showingSections: false,
2226

2327
didRender() {
2428
if (this.session.authenticated) {
2529
this.addTooltip(document.getElementById("owner-avatar"));
30+
this.addTooltip(document.getElementById("section-tool"));
2631
}
2732
},
2833

29-
willDestroyElements() {
30-
this.destroyElements();
34+
didInsertElement() {
35+
this.eventBus.subscribe('resized', this, 'positionTool');
36+
this.eventBus.subscribe('scrolled', this, 'positionTool');
37+
},
38+
39+
willDestroyElement() {
40+
this.destroyTooltips();
41+
},
42+
43+
positionTool() {
44+
if (this.get('isDestroyed') || this.get('isDestroying')) {
45+
return;
46+
}
47+
48+
let s = $(".scroll-tool");
49+
let windowpos = $(window).scrollTop();
50+
51+
if (windowpos >= 300) {
52+
this.set('showScrollTool', true);
53+
s.addClass("stuck-tool");
54+
s.css('left', parseInt($(".zone-sidebar").css('width')) - 18 + 'px');
55+
} else {
56+
this.set('showScrollTool', false);
57+
s.removeClass("stuck-tool");
58+
}
3159
},
3260

3361
actions: {
@@ -45,27 +73,55 @@ export default Ember.Component.extend(TooltipMixin, {
4573
return this.attrs.gotoPage(id);
4674
},
4775

48-
// close dialog
49-
close() {
50-
return true;
51-
},
52-
5376
showToc() {
5477
this.set('showToc', true);
5578
this.set('showViews', false);
5679
this.set('showContributions', false);
80+
this.set('showSections', false);
81+
this.set('showingSections', false);
5782
},
5883

5984
showViews() {
6085
this.set('showToc', false);
6186
this.set('showViews', true);
6287
this.set('showContributions', false);
88+
this.set('showSections', false);
89+
this.set('showingSections', false);
6390
},
6491

6592
showContributions() {
6693
this.set('showToc', false);
6794
this.set('showViews', false);
6895
this.set('showContributions', true);
96+
this.set('showSections', false);
97+
this.set('showingSections', false);
98+
},
99+
100+
showSections() {
101+
this.set('showToc', false);
102+
this.set('showViews', false);
103+
this.set('showContributions', false);
104+
this.set('showSections', true);
105+
this.set('showingSections', true);
106+
},
107+
108+
onCancel() {
109+
this.send('showToc');
110+
this.set('showingSections', false);
111+
},
112+
113+
onAddSection(section) {
114+
this.attrs.onAddSection(section);
115+
116+
this.set('showingSections', false);
117+
},
118+
119+
scrollTop() {
120+
this.set('showScrollTool', false);
121+
122+
$("html,body").animate({
123+
scrollTop: 0
124+
}, 500, "linear");
69125
}
70126
}
71127
});

app/app/components/document/document-toolbar.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
3535
this.addTooltip(document.getElementById("save-template-button"));
3636
this.addTooltip(document.getElementById("set-meta-button"));
3737
this.addTooltip(document.getElementById("delete-document-button"));
38-
this.addTooltip(document.getElementById("add-section-button"));
3938
}
4039

4140
this.addTooltip(document.getElementById("print-document-button"));
@@ -139,4 +138,4 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
139138
return true;
140139
},
141140
}
142-
});
141+
});

app/app/components/document/document-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
133133
this.get('documentService').save(doc);
134134
}
135135
}
136-
});
136+
});

app/app/components/document/page-wizard.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,18 @@ import Ember from 'ember';
1313
import NotifierMixin from '../../mixins/notifier';
1414

1515
export default Ember.Component.extend(NotifierMixin, {
16+
sectionService: Ember.inject.service('section'),
17+
18+
didReceiveAttrs() {
19+
let self = this;
20+
this.get('sectionService').getAll().then(function(sections) {
21+
self.set('sections', sections);
22+
});
23+
},
1624

1725
didRender() {
1826
let self = this;
27+
1928
Mousetrap.bind('esc', function() {
2029
self.send('onCancel');
2130
return false;
@@ -28,12 +37,6 @@ export default Ember.Component.extend(NotifierMixin, {
2837
},
2938

3039
addSection(section) {
31-
32-
if (section.preview) {
33-
this.showNotification("Coming soon!");
34-
return;
35-
}
36-
3740
this.attrs.onAction(section);
3841
}
3942
}

0 commit comments

Comments
 (0)