show target filepath

This commit is contained in:
AJ ONeal 2015-01-12 14:26:59 -07:00
父節點 9c2e43a8c7
當前提交 3d3db61995
共有 2 個文件被更改,包括 51 次插入28 次删除

查看文件

@ -1,11 +1,12 @@
<div class="container">
<div class="row">
<div class="page-header">
<h1>Write a Post</h1>
</div>
</div>
<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>
<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>

查看文件

@ -19,37 +19,42 @@ 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'];
}
scope.extensions = ['md', 'html'];
scope.selected = {
format: 'md'
, permalink: "/article/new.md"
, uuid: window.uuid.v4()
, post: {
yml: {
title: ""
, permalink: "/article/new.md"
, date: Desirae.toDesiDate(new Date())// "YYYY-MM-DD HH:MM pm" // TODO desirae
, updated: null
, description: ""
, categories: []
, tags: []
, theme: null
, layout: null
, swatch: null
function newPost() {
scope.selected = {
format: 'md'
, permalink: "/article/new.md"
, uuid: window.uuid.v4()
, abspath: scope.blogdir
, post: {
yml: {
title: ""
, permalink: "/article/new.md"
, date: Desirae.toDesiDate(new Date())// "YYYY-MM-DD HH:MM pm" // TODO desirae
, updated: null
, description: ""
, categories: []
, tags: []
, theme: null
, layout: null
, swatch: null
}
}
}
};
scope.selected.date = scope.selected.post.yml.date;
scope.selected.post.frontmatter = window.jsyaml.dump(scope.selected.post.yml).trim();
};
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