show target filepath

This commit is contained in:
AJ ONeal 2015-01-12 14:26:59 -07:00
parent 9c2e43a8c7
commit 3d3db61995
2 changed files with 51 additions and 28 deletions

View File

@ -1,11 +1,12 @@
<div class="container">
<form ng-submit="Post.upsert()" class="form-horizontal">
<div class="row">
<div class="page-header">
<h1>Write a Post</h1>
<h3><span ng-bind="Post.selected.abspath" ></span></h3>
</div>
</div>
<form ng-submit="Post.upsert()" class="form-horizontal">
<div class="row">
<div class="col-lg-12">
<div class="well bs-component">
@ -104,6 +105,22 @@
</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">
<label for="select" class="col-lg-2 control-label">Selects</label>

View File

@ -19,20 +19,24 @@ angular.module('myApp.post', ['ngRoute'])
Desirae.meta().then(function (desi) {
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
scope.site = desi.site;
newPost();
updateDate();
}).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.");
console.error(e);
throw e;
});
}
scope.extensions = ['md', 'html'];
}
function newPost() {
scope.selected = {
format: 'md'
, permalink: "/article/new.md"
, uuid: window.uuid.v4()
, abspath: scope.blogdir
, post: {
yml: {
title: ""
@ -50,6 +54,7 @@ angular.module('myApp.post', ['ngRoute'])
};
scope.selected.date = scope.selected.post.yml.date;
scope.selected.post.frontmatter = window.jsyaml.dump(scope.selected.post.yml).trim();
}
scope.onChange = function () {
var post = scope.selected.post
@ -79,6 +84,7 @@ angular.module('myApp.post', ['ngRoute'])
// 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.abspath = window.path.join(scope.blogdir, selected.path);
};
scope.onFrontmatterChange = function () {
var data