show target filepath
This commit is contained in:
parent
9c2e43a8c7
commit
3d3db61995
|
@ -1,11 +1,12 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<form ng-submit="Post.upsert()" class="form-horizontal">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>Write a Post</h1>
|
<h1>Write a Post</h1>
|
||||||
|
<h3><span ng-bind="Post.selected.abspath" ></span></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form ng-submit="Post.upsert()" class="form-horizontal">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="well bs-component">
|
<div class="well bs-component">
|
||||||
|
@ -104,6 +105,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="inputPostAbsPath" class="col-lg-2 control-label">Filepath</label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<input
|
||||||
|
required="required"
|
||||||
|
disabled
|
||||||
|
ng-model="Post.selected.abspath"
|
||||||
|
ng-change="Post.onChange()"
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
id="inputPostAbsPath"
|
||||||
|
placeholder="i.e. ~/blog.me.co/posts/my-first-post.md"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="select" class="col-lg-2 control-label">Selects</label>
|
<label for="select" class="col-lg-2 control-label">Selects</label>
|
||||||
|
|
|
@ -19,20 +19,24 @@ angular.module('myApp.post', ['ngRoute'])
|
||||||
Desirae.meta().then(function (desi) {
|
Desirae.meta().then(function (desi) {
|
||||||
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
|
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
|
||||||
scope.site = desi.site;
|
scope.site = desi.site;
|
||||||
|
newPost();
|
||||||
|
|
||||||
updateDate();
|
updateDate();
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
window.alert("An Error Occured. Most errors that occur in the init phase are parse errors in the config files or permissions errors on files or directories, but check the error console for details.");
|
window.alert("An Error Occured. Most errors that occur in the init phase are parse errors in the config files or permissions errors on files or directories, but check the error console for details.");
|
||||||
console.error(e);
|
console.error(e);
|
||||||
throw e;
|
throw e;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
scope.extensions = ['md', 'html'];
|
scope.extensions = ['md', 'html'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function newPost() {
|
||||||
scope.selected = {
|
scope.selected = {
|
||||||
format: 'md'
|
format: 'md'
|
||||||
, permalink: "/article/new.md"
|
, permalink: "/article/new.md"
|
||||||
, uuid: window.uuid.v4()
|
, uuid: window.uuid.v4()
|
||||||
|
, abspath: scope.blogdir
|
||||||
, post: {
|
, post: {
|
||||||
yml: {
|
yml: {
|
||||||
title: ""
|
title: ""
|
||||||
|
@ -50,6 +54,7 @@ angular.module('myApp.post', ['ngRoute'])
|
||||||
};
|
};
|
||||||
scope.selected.date = scope.selected.post.yml.date;
|
scope.selected.date = scope.selected.post.yml.date;
|
||||||
scope.selected.post.frontmatter = window.jsyaml.dump(scope.selected.post.yml).trim();
|
scope.selected.post.frontmatter = window.jsyaml.dump(scope.selected.post.yml).trim();
|
||||||
|
}
|
||||||
|
|
||||||
scope.onChange = function () {
|
scope.onChange = function () {
|
||||||
var post = scope.selected.post
|
var post = scope.selected.post
|
||||||
|
@ -79,6 +84,7 @@ angular.module('myApp.post', ['ngRoute'])
|
||||||
|
|
||||||
// TODO use some sort of filepath pattern in config.yml
|
// TODO use some sort of filepath pattern in config.yml
|
||||||
selected.path = window.path.join((selected.collection || 'posts'), window.path.basename(post.yml.permalink));
|
selected.path = window.path.join((selected.collection || 'posts'), window.path.basename(post.yml.permalink));
|
||||||
|
selected.abspath = window.path.join(scope.blogdir, selected.path);
|
||||||
};
|
};
|
||||||
scope.onFrontmatterChange = function () {
|
scope.onFrontmatterChange = function () {
|
||||||
var data
|
var data
|
||||||
|
|
Loading…
Reference in New Issue