Skip to content
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.

Feature options in project menu #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions app/components/projects-list/project/menu/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@ const { Component, inject } = Ember;

export default Component.extend({
notify: inject.service(),
terminal: inject.service(),
ideName: 'code',
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, hardcoded :/ I will push my changes related with settings but is still need to be tested. If you would like to practice, go ahead.


actions: {
remove() {
this.get('project').destroyRecord().then(() => {
this.get('notify').success('notify.projects.remove.success');
});
},

openInEditor() {
Copy link
Member

Choose a reason for hiding this comment

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

You can move these methods to terminal service and just pass them the path :)

let projectPath = this.get('project.path')
let ideName = this.get('ideName');
return this.get('terminal').execute(`${ideName} ${projectPath}`);
},

openInDirectory() {
let projectPath = this.get('project.path')
return this.get('terminal').execute(`nautilus ${projectPath}`)
Copy link
Member

Choose a reason for hiding this comment

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

nautilus?
Rather than using 3rd parties try to use official electron API:
https://github.com/electron/electron/blob/master/docs/api/shell.md

}
}
});
4 changes: 2 additions & 2 deletions app/components/projects-list/project/menu/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<span>{{t "projects.actions.remove"}}</span>
{{/content.menu-item}}

{{#content.menu-item onClick="openSomething" disabled=true}}
{{#content.menu-item onClick="openInDirectory"}}
Copy link
Member

Choose a reason for hiding this comment

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

always use closure actions (action "openInDirectory") :)

{{paper-icon "folder-open"}}
<span>{{t "projects.actions.showInFolder"}}</span>
{{/content.menu-item}}

{{#content.menu-item onClick="openSomething" disabled=true}}
{{#content.menu-item onClick="openInEditor"}}
{{paper-icon "code"}}
<span>{{t "projects.actions.openInEditor"}}</span>
{{/content.menu-item}}
Expand Down
6 changes: 3 additions & 3 deletions app/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ body {
}
}

.project-list {
.project {
.project {
text-overflow: ellipsis;
}
white-space: nowrap;
overflow: hidden;
}