Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar #687

Merged
merged 22 commits into from
Mar 1, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/editor-mode-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Component from '@ember/component';

export default Component.extend({
tagName: 'li',
classNames: ['dropdown'],
classNames: ['dropdown', 'dropup'],

actions: {
setKeyMap(keyMap) {
Expand Down
4 changes: 0 additions & 4 deletions app/components/file-editor-column.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ export default Component.extend({

isFirstColumn: equal('col', '1'),

showFileTreeOpenIcon: computed('isFirstColumn', 'fileTreeShown', function() {
return this.isFirstColumn && !this.fileTreeShown;
}),

focusIn () {
this.focusEditor(this);
},
Expand Down
2 changes: 1 addition & 1 deletion app/components/file-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DropdownSubmenuFixMixin from "../mixins/dropdown-submenu-fix";

export default Component.extend(DropdownSubmenuFixMixin, {
tagName: 'li',
classNames: ['dropdown'],
classNames: ['dropdown', 'dropup'],

// show fork option only if does not belong to user and is not a revision, otherwise show copy
// Github api does not permit forking if you own the gist already
Expand Down
8 changes: 2 additions & 6 deletions app/components/file-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,18 @@ export default Component.extend({
this.jsTreeActionReceiver.send('toggleNode', node.id);
},

didBecomeReady() {
didBecomeReadyOptional() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh. Can't believe I wrote this. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We all have these moments :D

if(this.didBecomeReady) {
this.didBecomeReady();
}
},

didChange() {
didChangeOptional() {
if (this.didChange) {
this.didChange();
}
},

hideFileTree() {
this.hideFileTree();
},

expandAll() {
this.jsTreeActionReceiver.send('openAll');
},
Expand Down
1 change: 1 addition & 0 deletions app/components/twiddle-panes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { run } from '@ember/runloop';
export default Component.extend({
resizeableColumns: service(),
classNames: ['row', 'twiddle-panes'],
classNameBindings: ['fileTreeShown'],

init() {
this._super(...arguments);
Expand Down
2 changes: 1 addition & 1 deletion app/components/user-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import config from '../config/environment';

export default Component.extend({
tagName: 'ul',
classNames: ['nav', 'nav-pills', 'user-menu'],
classNames: ['user-menu', 'dropup'],

userName: readOnly('session.currentUser.login'),

Expand Down
2 changes: 1 addition & 1 deletion app/components/versions-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import DropdownSubmenuFixMixin from "../mixins/dropdown-submenu-fix";
export default Component.extend(DropdownSubmenuFixMixin, {
dependencyResolver: service(),
tagName: 'li',
classNames: ['dropdown', 'versions-menu'],
classNames: ['dropdown', 'dropup', 'versions-menu'],

versions: readOnly('dependencyResolver.emberVersions'),
dataVersions: readOnly('dependencyResolver.emberDataVersions')
Expand Down
144 changes: 51 additions & 93 deletions app/styles/_toolbar.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
.toolbar {

hr {
display: none;
}

.nav-pills > li > a {
display: block;
text-decoration: none;
Expand All @@ -14,70 +9,36 @@
height: $topbar-height;
}

@media (max-width: $screen-md-min) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still responsive?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that is my next task haha.

position: relative;
z-index: 100;
opacity: 1;

>div, >ul {
margin-top: 0;
margin-bottom: 0;
}

.nav-pills > li {
float: none;
}

.nav-pills > li + li {
margin-left: 0;
}

.dropdown-toggle {
display: block;
border-radius: 0;
box-shadow: none;
}

.dropdown-menu {
position: static;
float: none;
border: 0;
border-radius: 0;
box-shadow: none;
background: inherit;

.dropdown-submenu > .dropdown-menu {
margin-left: 1em;
margin-top: 0;
}

.divider {
background-color: lighten($burnt-orange, 10%);
}
.dropdown .caret {
position: absolute;
right: 10px;
top: 13px;
}

a {
color: #fff;

&:hover {
background-color: lighten($burnt-orange, 10%);
}
}
}

hr {
display: block;
border-color: $burnt-orange;
margin: 1em 0;
.dropdown-menu {
.dropdown-submenu > .dropdown-menu {
top: auto;
margin-bottom: -31px;
}
}

color: #fff;
font-size: $font-size;
background: $header-bg;
background-image: url(/images/header.svg);
background-position: top center;
background-repeat: no-repeat;
background-size: cover;
padding: 1rem 0;

hr {
display: block;
border-color: $burnt-orange;
margin: 1em 0;
position: absolute;
bottom: 82px;
width: 250px;
}

@media (max-width: $screen-md-min) {
padding: 0;
Expand Down Expand Up @@ -109,22 +70,31 @@
padding-left: 0;
}

.user-menu {
text-align: right;
.file-tree {
position: absolute;
top: 70px;
bottom: 207px;
width: 250px;
overflow: auto;

@media (min-width: $screen-md-min) {
position: absolute;
right: 0;
top: ($topbar-height - $topbar-control-height) / 2;
.jstree-default .jstree-hovered {
background: rgba(0, 0, 0, 0.13);
box-shadow: none;
}

@media (max-width: $screen-md-min) {
float: none;
text-align: left;
.jstree-default .jstree-clicked {
background: #b95252;
box-shadow: none;
}
}

.user-dropdown > .dropdown-toggle {
padding-left: 1em;
}
.user-menu {
position: absolute;
bottom: 5px;
width: 250px;

a {
display: block;
}

.user-avatar {
Expand All @@ -133,7 +103,7 @@
height: 100%;
overflow: hidden;
float: left;
margin-right: 10px;
margin-right: 5px;
line-height: normal;
border-radius: 3px;

Expand All @@ -144,22 +114,19 @@

&.unauthenticated {
background: url("../images/github32-inverse-faf2ee.svg");
height: 32px;
}
}
}

.main-menu {
text-align: left;
height: 60px;
bottom: 100px;
position: absolute;
width: 250px;

@media (min-width: $screen-md-min) {
position: absolute;
left: 0;
top: ($topbar-height - $topbar-control-height) / 2;
}

@media (max-width: $screen-md-min) {
height: auto;
a {
display: block;
}
}

Expand All @@ -169,18 +136,9 @@
display: inline-block;
margin-left: auto;
margin-right: auto;

@media (min-width: $screen-md-min) {
position: absolute;
top: 6px;
left: 50%;
margin-left: -400px;
width: 800px;
}

@media (max-width: $screen-md-min) {
margin-left: 15px;
}
position: absolute;
top: 6px;
width: 250px;

h1 {
margin: 10px;
Expand Down Expand Up @@ -276,7 +234,7 @@

.sign-in {
cursor: pointer;
padding: 0 .5em 0 0;
padding: 0 .5em;
}

.signing-in {
Expand Down
26 changes: 20 additions & 6 deletions app/styles/_twiddle-panes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
margin: 0;
margin-left: 0;
position: absolute;
top: $topbar-height;
top: 0;
bottom: 0;
left: 0;
right: 0;
transition: left 0.2s;

&.file-tree-shown {
left: 250px;
}

@media (min-width: $screen-md-min) {
display: -webkit-flex;
Expand Down Expand Up @@ -185,12 +190,21 @@
}

.gist-header {
position: relative;
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 250px;

@media (min-width: $screen-md-min) {
bottom: $footer-height;
}

@media (max-width: $screen-md-min) {
top: $footer-height;
}

> .visible-toolbar {
height: 60px;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
}
10 changes: 7 additions & 3 deletions app/templates/components/file-editor-column.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<div class="header">
{{#if showFileTreeOpenIcon}}
{{#if this.isFirstColumn}}
<span class="nav-left">
<span class="hint--bottom hint--rounded" data-hint="Show project files" >
<span class="glyphicon glyphicon-chevron-right" {{action 'showFileTree'}}></span>
<span class="hint--bottom hint--rounded" data-hint="{{if @fileTreeShown "Hide" "Show"}} project files and settings" >
{{#if @fileTreeShown}}
<button class="glyphicon glyphicon-chevron-left" aria-label="Hide Sidebar" {{action @hideFileTree}}></button>
{{else}}
<button class="glyphicon glyphicon-chevron-right" aria-label="Show Sidebar" {{action @showFileTree}}></button>
{{/if}}
</span>
</span>
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/file-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
File <b class="caret"></b>
</a>

<ul class="dropdown-menu">
<ul class="dropdown-menu dropdown-menu-right">
<li>{{#link-to 'gist.new' class="test-new-twiddle" }}New Twiddle{{/link-to}}</li>
{{#if model}}
<li role="presentation" class="divider"></li>
Expand Down
19 changes: 8 additions & 11 deletions app/templates/components/file-tree.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
<span class="twiddlicon twiddlicon-collapse-all" {{action 'collapseAll'}}></span>
</span>
</div>
<div class="nav-right">
<span class="hint--bottom hint--rounded" data-hint="Hide project files">
<span class="glyphicon glyphicon-chevron-left" {{action 'hideFileTree'}}></span>
</span>
</div>
</div>
{{ember-jstree data=fileTreeData
actionReceiver=jsTreeActionReceiver
eventDidSelectNode=(action "handleSelectTreeNode")
eventDidBecomeReady=(action "didBecomeReady")
eventDidChange=(action "didChange")
}}

<EmberJstree
@data={{this.fileTreeData}}
@actionReceiver={{this.jsTreeActionReceiver}}
@eventDidSelectNode={{action "handleSelectTreeNode"}}
@eventDidBecomeReady={{action "didBecomeReadyOptional"}}
@eventDidChange={{action "didChangeOptional"}}
/>
Loading