work on setup wizard

This commit is contained in:
AJ ONeal 2015-01-11 12:45:05 -07:00
parent 31cd11ad60
commit 970bc1e33d
6 changed files with 257 additions and 74 deletions

1
app.js
View File

@ -7,6 +7,7 @@ angular.module('myApp', [
'myApp.authors',
'myApp.site',
'myApp.build',
'myApp.configure',
'myApp.create',
'myApp.version',
'myApp.services'

View File

@ -109,6 +109,7 @@
<script src="./views/about/about.js"></script>
<script src="./views/authors/authors.js"></script>
<script src="./views/site/site.js"></script>
<script src="./views/configure/configure.js"></script>
<script src="./views/build/build.js"></script>
<script src="./views/create/create.js"></script>
<script src="components/desirae/desirae.js"></script>

View File

@ -0,0 +1,72 @@
<div class="container">
<div class="row">
<div class="page-header">
<h1>Site Configuration</h1>
<h3><span ng-bind="Site.blogdir"></span></h3>
</div>
</div>
<form class="form-horizontal">
<div class="row">
<div class="col-lg-12">
<div class="well bs-component">
<fieldset>
<legend>Advanced</legend>
<div class="form-group">
<label for="inputRootConf" class="col-lg-2 control-label">Root Pages</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputRootConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
</div>
</div>
<div class="form-group">
<label for="inputThemesConf" class="col-lg-2 control-label">Themes</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputThemesConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
</div>
</div>
<div class="form-group">
<label for="inputCollectionsConf" class="col-lg-2 control-label">Collections</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputCollectionsConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
</div>
</div>
<div class="form-group">
<label for="inputAssetsConf" class="col-lg-2 control-label">Assets</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputAssetsConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
</div>
</div>
<div class="form-group">
<label for="inputWidgetsConf" class="col-lg-2 control-label">Widgets</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputWidgetsConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
</div>
</div>
</fieldset>
</div>
</div>
</div>
</form>
</div>

View File

@ -0,0 +1,13 @@
'use strict';
angular.module('myApp.configure', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/configure', {
templateUrl: 'views/configure/configure.html',
controller: 'ConfigureCtrl as Configure'
});
}])
.controller('ConfigureCtrl', [function() {
}]);

View File

@ -1,12 +1,13 @@
<div class="container">
<div class="row">
<div class="page-header">
<h1>Blog Configuration</h1>
<h3><span ng-bind="Site.blogdir"></span></h3>
<h1>Site Configuration</h1>
<h3><span ng-bind="Site.blogdir"></span><button class="btn btn-primary pull-right" type="submit" form="formSiteConf">Save &amp; Continue</button></h3>
</div>
</div>
<form class="form-horizontal">
<form id="formSiteConf" class="form-horizontal" ng-submit="Site.upsert()">
<div class="row">
<div class="col-lg-12">
<div class="well bs-component">
@ -14,55 +15,91 @@
<legend>General</legend>
<div class="form-group">
<label for="inputBlogTitle" class="col-lg-2 control-label">Title</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="inputBlogTitle" placeholder="My Awesome Blog" ng-model="Site.title">
<label for="inputBlogTitle" class="col-lg-3 control-label">Title</label>
<div class="col-lg-9">
<input
ng-model="Site.site.title"
type="text" class="form-control" id="inputBlogTitle" placeholder="My Awesome Blog">
</div>
</div>
<div class="form-group">
<label for="inputBlogTagline" class="col-lg-2 control-label">Tagline</label>
<div class="col-lg-10">
<input type="text" class="form-control" id="inputBlogTagline" placeholder="For try-hard ethical master cleanse, 3 wolf moon Tumblr, disrupt lo-fi, narwhals and kale chips. YOLO." ng-model="Site.tagline">
</div>
</div>
</fieldset>
</div>
<label for="inputBlogTagline" class="col-lg-3 control-label">Tagline</label>
<div class="col-lg-9">
<input
ng-model="Site.site.tagline"
type="text" class="form-control" id="inputBlogTagline"
placeholder="i.e. I have not failed, I've just found 10,000 ways that do not work.">
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="well bs-component">
<fieldset>
<legend>Production</legend>
<div class="form-group">
<label for="inputSiteDesc" class="col-lg-3 control-label">Description
<small>(<span ng-bind="Site.site.description.length || 0"></span>/140)</small></label>
<div class="col-lg-9">
<textarea ng-model="Site.site.description"
class="form-control" id="inputSiteDesc" placeholder="i.e. For tips and tricks for try-hard ethical master cleanses, 3 wolf moons on Tumblr, disruptive lo-fi, preserving narwhals and eating kale chips, etc. YOLO."></textarea>
</div>
</div>
</div>
</div>
<!-- TODO -->
<!--
<div class="form-group">
<label for="inputProdUrl" class="col-lg-3 control-label">URL</label>
<div class="col-lg-9">
<input
ng-model="Site.site.url"
ng-change="Site.updateUrls()"
placeholder="i.e. https://example.com/myblog"
type="url"
class="form-control"
id="inputProdUrl">
<br/>
</div>
</div>
-->
<div class="form-group">
<label for="inputProdHost" class="col-lg-3 control-label">Base URL</label>
<div class="col-lg-9">
<input ng-model="Site.base_url"
<input ng-model="Site.site.base_url"
placeholder="i.e. https://example.com in https://example.com/myblog"
type="text" class="form-control" id="inputProdHost">
</div>
</div>
<div class="form-group">
<label for="inputProdBase" class="col-lg-3 control-label">Base Path</label>
<div class="col-lg-9">
<input ng-model="Site.base_path"
placeholder="i.e. /blog in https://example.com/blog"
type="text" class="form-control" id="inputProdBase">
</div>
</div>
<div class="form-group">
<label for="inputProdOutput" class="col-lg-3 control-label">Output Path</label>
<div class="col-lg-9">
<input type="text" class="form-control" id="inputProdOutput" disabled placeholder="./compiled">
</div>
</div>
</fieldset>
type="url"
class="form-control"
id="inputProdHost">
<br/>
</div>
</div>
<div class="form-group">
<label for="inputProdBase" class="col-lg-3 control-label">Base Path</label>
<div class="col-lg-9">
<input ng-model="Site.site.base_path"
placeholder="i.e. /blog in https://example.com/blog"
type="text"
class="form-control"
id="inputProdBase">
</div>
</div>
<div class="form-group">
<label for="inputProdOutput" class="col-lg-3 control-label">Output Path</label>
<div class="col-lg-9">
<input
ng-value="Site.blogdir + '/compiled'"
type="text" class="form-control" id="inputProdOutput" disabled>
</div>
</div>
</fieldset>
</div>
</div>
</div>
@ -70,55 +107,41 @@
<div class="col-lg-12">
<div class="well bs-component">
<fieldset>
<legend>Advanced</legend>
<legend>Development</legend>
<div class="form-group">
<label for="inputRootConf" class="col-lg-2 control-label">Root Pages</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputRootConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
<label for="inputDevHost" class="col-lg-3 control-label">Base URL</label>
<div class="col-lg-9">
<input
value="https://local.dear.desi:65080"
type="url"
class="form-control"
id="inputDevHost"
disabled>
<br/>
</div>
</div>
<div class="form-group">
<label for="inputThemesConf" class="col-lg-2 control-label">Themes</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputThemesConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
<label for="inputDevBase" class="col-lg-3 control-label">Base Path</label>
<div class="col-lg-9">
<input
value="/compiled_dev"
placeholder="i.e. /blog in https://example.com/blog"
type="text" class="form-control" id="inputDevBase"
disabled>
</div>
</div>
<div class="form-group">
<label for="inputCollectionsConf" class="col-lg-2 control-label">Collections</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputCollectionsConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
</div>
</div>
<div class="form-group">
<label for="inputAssetsConf" class="col-lg-2 control-label">Assets</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputAssetsConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
</div>
</div>
<div class="form-group">
<label for="inputWidgetsConf" class="col-lg-2 control-label">Widgets</label>
<div class="col-lg-8">
<input type="text" class="form-control" id="inputWidgetsConf" placeholder="i.e. images">
</div>
<div class="col-lg-2">
<button class="btn" type="button">Add</button>
<label for="inputDevOutput" class="col-lg-3 control-label">Output Path</label>
<div class="col-lg-9">
<input
ng-value="Site.blogdir + '/compiled_dev'"
type="text"
class="form-control"
id="inputDevOutput"
disabled>
</div>
</div>
@ -126,5 +149,47 @@
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="well bs-component">
<fieldset>
<legend>Plugins</legend>
<div class="form-group">
<label for="inputGoogleAnalyticsId" class="col-lg-3 control-label">Google Analytics ID</label>
<div class="col-lg-9">
<input
ng-model="Site.site.google_analytics_tracking_id"
placeholder="i.e. UA-XXXYYYZZ-1"
type="text"
class="form-control"
id="inputGoogleAnalyticsId"
>
<br/>
<small>Found in the Admin section of Google Analytics</small>
</div>
</div>
<div class="form-group">
<label for="inputDisqusShortname" class="col-lg-3 control-label">Disqus Shortname</label>
<div class="col-lg-9">
<input
ng-model="Site.site.disqus_shortname"
placeholder="i.e. johndoe-blog"
type="text" class="form-control" id="inputDisqusShortname"
>
<br/>
<small>Found under Admin &gt; Settings in Disqus</small>
</div>
</div>
</fieldset>
</div>
</div>
</div>
<button class="btn btn-primary pull-right" type="submit">Save &amp; Continue</button>
</form>
</div>

View File

@ -13,14 +13,45 @@ angular.module('myApp.site', ['ngRoute'])
var scope = this
;
function init() {
console.log('desi loading');
Desirae.meta().then(function (desi) {
console.log('desi loaded');
console.log(desi);
scope.blogdir = desi.blogdir.path.replace(/^\/(Users|home)\/[^\/]+\//, '~/');
scope.site = desi.site;
}).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.upsert = function () {
console.log('yolo!');
return;
var author = scope.selectedAuthor
, files = []
, filename = author.filename
;
delete author.filename;
if ('new' !== filename && filename !== author.handle) {
files.push({ path: 'authors/' + filename + '.yml', contents: '', delete: true });
}
files.push({ path: 'authors/' + author.handle + '.yml', contents: window.jsyaml.dump(author) });
console.log(files);
Desirae.putFiles(files).then(function (results) {
console.log('updated author', results);
$location.path('/post');
}).catch(function (e) {
author.filename = filename;
console.error(e);
window.alert("Error Nation! :/");
throw e;
});
};
init();
}]);