show target filepath

Tento commit je obsažen v:
AJ ONeal 2015-01-12 14:26:59 -07:00
rodič 9c2e43a8c7
revize 3d3db61995
2 změnil soubory, kde provedl 51 přidání a 28 odebrání

Zobrazit soubor

@ -1,11 +1,12 @@
<div class="container"> <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"> <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="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>

Zobrazit soubor

@ -19,37 +19,42 @@ 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: ""
, permalink: "/article/new.md" , permalink: "/article/new.md"
, date: Desirae.toDesiDate(new Date())// "YYYY-MM-DD HH:MM pm" // TODO desirae , date: Desirae.toDesiDate(new Date())// "YYYY-MM-DD HH:MM pm" // TODO desirae
, updated: null , updated: null
, description: "" , description: ""
, categories: [] , categories: []
, tags: [] , tags: []
, theme: null , theme: null
, layout: null , layout: null
, swatch: null , swatch: null
}
} }
} };
}; 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