Skip to content
This repository has been archived by the owner on Apr 1, 2021. It is now read-only.

Commit

Permalink
Added an “Open Sublime Text” button
Browse files Browse the repository at this point in the history
  • Loading branch information
phppirate committed Feb 6, 2017
1 parent 4936bd3 commit 99a4af0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
21 changes: 19 additions & 2 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
//
//
//
//
//
//
//
//

/* harmony default export */ __webpack_exports__["default"] = {
data: function data() {
Expand Down Expand Up @@ -613,6 +618,9 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
window.location.reload();
});
}
},
openInSublime: function openInSublime() {
open_sublime(this.activeSite.path);
}
},
components: {
Expand Down Expand Up @@ -1240,7 +1248,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "content"
}, [_c('div', [_vm._v("Path: " + _vm._s(_vm.activeSite.path))]), _vm._v(" "), (_vm.getDriver(_vm.activeSite.path)) ? _c('div', [_vm._v("Driver: " + _vm._s(_vm.driver))]) : _vm._e()]), _vm._v(" "), _c('div', {
staticClass: "footer"
}, [_c('button', {
}, [_c('div', [_c('button', {
staticClass: "btn",
on: {
"click": _vm.openSite
Expand All @@ -1257,7 +1265,16 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
_vm.forgetOrUnlink()
}
}
}, [(_vm.isLinked()) ? _c('span', [_vm._v("Un-link")]) : _vm._e(), _vm._v(" "), (_vm.isParked()) ? _c('span', [_vm._v("Forget")]) : _vm._e()])])], 1) : _vm._e()
}, [(_vm.isLinked()) ? _c('span', [_vm._v("Un-link")]) : _vm._e(), _vm._v(" "), (_vm.isParked()) ? _c('span', [_vm._v("Forget")]) : _vm._e()])]), _vm._v(" "), _c('div', {
staticStyle: {
"margin-top": "10px"
}
}, [_c('button', {
staticClass: "btn is-green",
on: {
"click": _vm.openInSublime
}
}, [_vm._v("Open Sublime Text")])])])], 1) : _vm._e()
},staticRenderFns: []}
module.exports.render._withStripped = true
if (false) {
Expand Down
9 changes: 9 additions & 0 deletions app/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,13 @@ function valet_forget(path){
function valet_running(){
console.log(process.env.HOME + "/.valet/valet.sock");
return fs.existsSync(process.env.HOME + "/.valet/valet.sock") ? true : false;
}

function open_sublime(path){
return new Promise(function(resolve, reject) {
exec('subl .', {cwd: path}, function(error, stdout, stderr) {
console.log(error);
resolve(stdout);
});
});
}
20 changes: 14 additions & 6 deletions src/js/components/SiteDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
</div>

<div class="footer">
<button class="btn" @click="openSite">Open</button>
<button class="btn" @click="openFolder">Reveal</button>
<button class="btn is-red" @click="forgetOrUnlink()">
<span v-if="isLinked()">Un-link</span>
<span v-if="isParked()">Forget</span>
</button>
<div>
<button class="btn" @click="openSite">Open</button>
<button class="btn" @click="openFolder">Reveal</button>
<button class="btn is-red" @click="forgetOrUnlink()">
<span v-if="isLinked()">Un-link</span>
<span v-if="isParked()">Forget</span>
</button>
</div>
<div style="margin-top: 10px;">
<button class="btn is-green" @click="openInSublime">Open Sublime Text</button>
</div>
</div>
</div>
</template>
Expand Down Expand Up @@ -76,6 +81,9 @@
window.location.reload();
});
}
},
openInSublime(){
open_sublime(this.activeSite.path);
}
},
components: {
Expand Down

0 comments on commit 99a4af0

Please sign in to comment.