switched to web safe fonts for now, streamline file uploads, now tracking upload progress.
This commit is contained in:
parent
018bfc410b
commit
849c5e2ac0
14 changed files with 71 additions and 55 deletions
|
@ -40,7 +40,11 @@ router.post('/login', function(req, res) {
|
||||||
let session = req.session;
|
let session = req.session;
|
||||||
session.user = found;
|
session.user = found;
|
||||||
session.token = token;
|
session.token = token;
|
||||||
res.json({ type: DataEvent.REQUEST_GOOD, message: 'Yes', token: session.token });
|
res.json({
|
||||||
|
type: DataEvent.REQUEST_GOOD,
|
||||||
|
message: 'Welcome Back',
|
||||||
|
token: session.token
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
res.json({
|
res.json({
|
||||||
type: DataEvent.REQUEST_LAME,
|
type: DataEvent.REQUEST_LAME,
|
||||||
|
|
|
@ -15,11 +15,10 @@ const fs = require('fs-extra');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const rightsManager = new RightsManager();
|
const rightsManager = new RightsManager();
|
||||||
const book = new Book();
|
const book = new Book();
|
||||||
const uploadPath = './public/assets/images/blog/' + moment().format('YYYY');
|
const uploadPath =
|
||||||
'/' + moment().format('MM');
|
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
fs.ensureDir(uploadPath, () => {
|
fs.ensureDir(uploadPath, () => {
|
||||||
//console.log(err) // => null
|
|
||||||
// dir has now been created, including the directory it is to be placed in
|
// dir has now been created, including the directory it is to be placed in
|
||||||
});
|
});
|
||||||
var storage = multer.diskStorage({
|
var storage = multer.diskStorage({
|
||||||
|
@ -48,4 +47,11 @@ router.get('/', (req, res) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/***
|
||||||
|
Update Page
|
||||||
|
*/
|
||||||
|
router.post('/write', feature_upload, (req, res) => {
|
||||||
|
console.log('FILEZ BRAH', req.files);
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|
|
@ -17,6 +17,7 @@ block main-content
|
||||||
-post_date = date
|
-post_date = date
|
||||||
-post_status = status
|
-post_status = status
|
||||||
|
|
||||||
|
form#test-form
|
||||||
#post-edit-index(data-index=id)
|
#post-edit-index(data-index=id)
|
||||||
#post-edit-index-wrapper
|
#post-edit-index-wrapper
|
||||||
//h2 EDIT
|
//h2 EDIT
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default class Base {
|
||||||
.getElementById('login-btn')
|
.getElementById('login-btn')
|
||||||
.addEventListener('click', e => this.handleLogin(e));
|
.addEventListener('click', e => this.handleLogin(e));
|
||||||
} else {
|
} else {
|
||||||
//let dm = new DashManager();
|
let manager = new DashManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../../../src/com/utils/DataUtils';
|
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../../../src/com/utils/DataUtils';
|
||||||
import * as DataEvent from '../../../src/com/events/DataEvent';
|
import * as DataEvent from '../../../src/com/events/DataEvent';
|
||||||
import DBUtils from '../../../src/com/utils/DBUtils';
|
|
||||||
export default class NavActions {
|
export default class NavActions {
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// constructor
|
// constructor
|
||||||
//--------------------------
|
//--------------------------
|
||||||
constructor() {
|
constructor() {
|
||||||
this.dataUtils = new DataUtils();
|
this.dataUtils = new DataUtils();
|
||||||
this.dbutils = new DBUtils();
|
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// methods
|
// methods
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../utils/DataUtils';
|
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../utils/DataUtils';
|
||||||
import StringUtils from '../utils/StringUtils';
|
import StringUtils from '../utils/StringUtils';
|
||||||
import DBUtils from '../utils/DBUtils';
|
|
||||||
var uuidv4 = require('uuid/v4');
|
|
||||||
import * as DataEvent from '../events/DataEvent';
|
import * as DataEvent from '../events/DataEvent';
|
||||||
|
var uuidv4 = require('uuid/v4');
|
||||||
export default class PostActions {
|
export default class PostActions {
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// constructor
|
// constructor
|
||||||
//--------------------------
|
//--------------------------
|
||||||
constructor() {
|
constructor() {
|
||||||
this.dataUtils = new DataUtils();
|
this.dataUtils = new DataUtils();
|
||||||
this.dateUtils = new DateUtils();
|
|
||||||
this.dbUtils = new DBUtils();
|
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// methods
|
// methods
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import NavActions from '../actions/NavActions';
|
import NavActions from '../actions/NavActions';
|
||||||
import DBUtils from '../../../src/com/utils/DBUtils';
|
|
||||||
export default class NavIndex {
|
export default class NavIndex {
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// constructor
|
// constructor
|
||||||
|
@ -7,7 +6,6 @@ export default class NavIndex {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.start();
|
this.start();
|
||||||
//this.dataUtils = new DataUtils();
|
//this.dataUtils = new DataUtils();
|
||||||
this.dbutils = new DBUtils();
|
|
||||||
}
|
}
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// methods
|
// methods
|
||||||
|
|
|
@ -5,6 +5,7 @@ import PostActions from '../actions/PostActions';
|
||||||
import * as EditorEvent from '../../../src/com/events/EditorEvent';
|
import * as EditorEvent from '../../../src/com/events/EditorEvent';
|
||||||
import TinyDatePicker from 'tiny-date-picker';
|
import TinyDatePicker from 'tiny-date-picker';
|
||||||
import TextEditor from '../../../src/com/ui/TextEditor';
|
import TextEditor from '../../../src/com/ui/TextEditor';
|
||||||
|
const data = new DataUtils();
|
||||||
export default class PostEditor {
|
export default class PostEditor {
|
||||||
//TODO - FIX POST FEATURE URLS IN DB
|
//TODO - FIX POST FEATURE URLS IN DB
|
||||||
|
|
||||||
|
@ -130,6 +131,27 @@ export default class PostEditor {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case EditorEvent.EDITOR_UPDATE:
|
case EditorEvent.EDITOR_UPDATE:
|
||||||
|
var pageData = new FormData();
|
||||||
|
pageData.append('name', 'HAMMOCK LANSING');
|
||||||
|
var image = document.getElementById('featured-image-upload').files[0];
|
||||||
|
if (image != null || image != undefined) {
|
||||||
|
pageData.append('feature_image', image, image.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.request(
|
||||||
|
'/api/v1/page/write',
|
||||||
|
DataEvent.API_PAGE_WRITE,
|
||||||
|
REQUEST_TYPE_POST,
|
||||||
|
CONTENT_TYPE_FORM,
|
||||||
|
pageData
|
||||||
|
)
|
||||||
|
.then(r => {
|
||||||
|
console.log('RESPONSE', r);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log('ERROR', err);
|
||||||
|
});
|
||||||
|
/**
|
||||||
new PostActions()
|
new PostActions()
|
||||||
.update(this.postID, this.post, PostEditor.uploadFiles, FINAL_KEY)
|
.update(this.postID, this.post, PostEditor.uploadFiles, FINAL_KEY)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -138,6 +160,7 @@ export default class PostEditor {
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
//console.log("ERRORZ", err)
|
//console.log("ERRORZ", err)
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
case EditorEvent.EDITOR_DELETE:
|
case EditorEvent.EDITOR_DELETE:
|
||||||
if (confirm("Aye! You know you're deleting this post, right?")) {
|
if (confirm("Aye! You know you're deleting this post, right?")) {
|
||||||
|
@ -198,9 +221,11 @@ export default class PostEditor {
|
||||||
// Read in the image file as a data URL.
|
// Read in the image file as a data URL.
|
||||||
reader.readAsDataURL(f);
|
reader.readAsDataURL(f);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
if (e.target.id == 'featured-image-upload')
|
if (e.target.id == 'featured-image-upload')
|
||||||
this.handleImageUpload(e.target.id, PostEditor.uploadFiles);
|
this.handleImageUpload(e.target.id, PostEditor.uploadFiles);
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handleImageUpload(type, files) {
|
handleImageUpload(type, files) {
|
||||||
|
@ -224,8 +249,7 @@ export default class PostEditor {
|
||||||
? imageData.append('feature_image', file, file.name)
|
? imageData.append('feature_image', file, file.name)
|
||||||
: imageData.append('post_image', file, file.name);
|
: imageData.append('post_image', file, file.name);
|
||||||
}
|
}
|
||||||
this.dataUtils
|
data.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData)
|
||||||
.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData)
|
|
||||||
.then(response => {
|
.then(response => {
|
||||||
let r = JSON.parse(response.request['response']);
|
let r = JSON.parse(response.request['response']);
|
||||||
if (r.message == DataEvent.POST_IMAGE_ADDED)
|
if (r.message == DataEvent.POST_IMAGE_ADDED)
|
||||||
|
|
|
@ -2,14 +2,7 @@ export const REQUEST_GOOD = 'requestGood';
|
||||||
export const REQUEST_LAME = 'requestLame';
|
export const REQUEST_LAME = 'requestLame';
|
||||||
export const IMG_REQUEST_GOOD = 'imgRequestGood';
|
export const IMG_REQUEST_GOOD = 'imgRequestGood';
|
||||||
export const IMG_REQUEST_LAME = 'imgRequestLame';
|
export const IMG_REQUEST_LAME = 'imgRequestLame';
|
||||||
export const SETTINGS_LOADED = 'dataLoaded';
|
export const SETTINGS_LOADED = 'settingsLoaded';
|
||||||
export const HTML_LOADED = 'htmlLoaded';
|
|
||||||
export const ARCHIVES_JSON_LOADED = 'archivesJSONLoaded';
|
|
||||||
export const ARCHIVES_PAGE_LOADED = 'archivesPAGELoaded';
|
|
||||||
export const ARCHIVES_ENTRY_LOADED = 'archivesEntryLoaded';
|
|
||||||
export const PROJECT_UPDATED = 'projectUpdated';
|
|
||||||
export const PROJECT_ADDED = 'projectAdded';
|
|
||||||
export const PROJECTS_SORTED = 'projectsSorted';
|
|
||||||
export const POST_IMAGE_ADDED = 'postImageAdded';
|
export const POST_IMAGE_ADDED = 'postImageAdded';
|
||||||
export const FEATURE_IMAGE_ADDED = 'featureImageAdded';
|
export const FEATURE_IMAGE_ADDED = 'featureImageAdded';
|
||||||
export const POST_ERROR = 'postError';
|
export const POST_ERROR = 'postError';
|
||||||
|
@ -17,21 +10,16 @@ export const POST_ADDED = 'postAdded';
|
||||||
export const POST_UPDATED = 'postUpdated';
|
export const POST_UPDATED = 'postUpdated';
|
||||||
export const POST_DELETED = 'postImageAdded';
|
export const POST_DELETED = 'postImageAdded';
|
||||||
export const POSTS_SYNCED = 'postsSynced';
|
export const POSTS_SYNCED = 'postsSynced';
|
||||||
export const LOCAL_DB_READY = 'localDBReady';
|
|
||||||
export const SETTINGS_UPDATED = 'settingsUpdated';
|
export const SETTINGS_UPDATED = 'settingsUpdated';
|
||||||
export const AVATAR_UPLOADED = 'avatarUploaded';
|
export const AVATAR_UPLOADED = 'avatarUploaded';
|
||||||
export const SITE_BACKGROUND_UPLOADED = 'siteBackgroundUploaded';
|
export const SITE_BACKGROUND_UPLOADED = 'siteBackgroundUploaded';
|
||||||
class DataEvent
|
export const API_PAGE_WRITE = 'writingItDown';
|
||||||
{
|
class DataEvent {
|
||||||
|
//--------------------------
|
||||||
//--------------------------
|
// methods
|
||||||
// methods
|
//--------------------------
|
||||||
//--------------------------
|
//--------------------------
|
||||||
|
// event handlers
|
||||||
|
//--------------------------
|
||||||
|
|
||||||
//--------------------------
|
|
||||||
// event handlers
|
|
||||||
//--------------------------
|
|
||||||
}
|
}
|
||||||
export default new DataEvent
|
export default new DataEvent();
|
||||||
|
|
|
@ -137,8 +137,7 @@ export default class DataUtils extends EventEmitter {
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// event handlers
|
// event handlers
|
||||||
//--------------------------
|
//--------------------------
|
||||||
handleLoadProgress() {
|
handleLoadProgress(e) {
|
||||||
//var percentComplete = Math.ceil((e.loaded / e.total) * 100);
|
//var percentComplete = Math.ceil((e.loaded / e.total) * 100);
|
||||||
//console.log(percentComplete);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ input[type=email], input[type=password], input[type=text]
|
||||||
border 0
|
border 0
|
||||||
border-radius 3px
|
border-radius 3px
|
||||||
padding 5px
|
padding 5px
|
||||||
font 1em 'Apercu-Mono'
|
font 1em $monoType
|
||||||
display inline-block
|
display inline-block
|
||||||
background-color $primary - 60%
|
background-color $primary - 60%
|
||||||
color $secondary
|
color $secondary
|
||||||
|
@ -14,19 +14,19 @@ textarea
|
||||||
border 0
|
border 0
|
||||||
border-radius 3px
|
border-radius 3px
|
||||||
color $type02
|
color $type02
|
||||||
font 15px 'Apercu-Mono'
|
font 15px $monoType
|
||||||
|
|
||||||
button, input[type=submit]
|
button, input[type=submit]
|
||||||
background $highlight
|
background $highlight
|
||||||
color $primary - 60%
|
color $primary - 60%
|
||||||
font 1em 'Apercu-Mono'
|
font 1em $monoType
|
||||||
border-radius 3px
|
border-radius 3px
|
||||||
position relative
|
position relative
|
||||||
cursor pointer
|
cursor pointer
|
||||||
border 0
|
border 0
|
||||||
|
|
||||||
select
|
select
|
||||||
font 1em 'Apercu-Mono'
|
font 1em $monoType
|
||||||
border 1px solid $secondary
|
border 1px solid $secondary
|
||||||
-webkit-appearance none
|
-webkit-appearance none
|
||||||
-moz-appearance none
|
-moz-appearance none
|
||||||
|
@ -35,19 +35,19 @@ select
|
||||||
color $primary
|
color $primary
|
||||||
|
|
||||||
::-webkit-input-placeholder
|
::-webkit-input-placeholder
|
||||||
font 1em 'Apercu-Mono'
|
font 1em $monoType
|
||||||
color $secondary
|
color $secondary
|
||||||
|
|
||||||
:-moz-placeholder
|
:-moz-placeholder
|
||||||
/* Firefox 18- */
|
/* Firefox 18- */
|
||||||
font 1em 'Apercu-Mono'
|
font 1em $monoType
|
||||||
color $secondary
|
color $secondary
|
||||||
|
|
||||||
::-moz-placeholder
|
::-moz-placeholder
|
||||||
/* Firefox 19+ */
|
/* Firefox 19+ */
|
||||||
font 1em 'Apercu-Mono'
|
font 1em $monoType
|
||||||
color $secondary
|
color $secondary
|
||||||
|
|
||||||
:-ms-input-placeholder
|
:-ms-input-placeholder
|
||||||
font 1em 'Apercu-Mono'
|
font 1em $monoType
|
||||||
color $secondary
|
color $secondary
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
float right
|
float right
|
||||||
vertical-align top
|
vertical-align top
|
||||||
display inline-block
|
display inline-block
|
||||||
font-family 'Apercu-mono'
|
font-family $monoType
|
||||||
font-size 0.5em
|
font-size 0.5em
|
||||||
padding 7px
|
padding 7px
|
||||||
color $primary - 60%
|
color $primary - 60%
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
display inline-block
|
display inline-block
|
||||||
vertical-align top
|
vertical-align top
|
||||||
font-size 0.8em
|
font-size 0.8em
|
||||||
font-family 'Apercu-Mono'
|
font-family $monoType
|
||||||
width 50%
|
width 50%
|
||||||
padding 0 0 0 10px
|
padding 0 0 0 10px
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
#post-title
|
#post-title
|
||||||
#post_title
|
#post_title
|
||||||
background $primary - 4%
|
background $primary - 4%
|
||||||
font-family 'Apercu'
|
font-family $baseType
|
||||||
width 97.6%
|
width 97.6%
|
||||||
height 140px
|
height 140px
|
||||||
font-size 1.5em
|
font-size 1.5em
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
background $primary - 10%
|
background $primary - 10%
|
||||||
border-radius 0 3px 3px 0
|
border-radius 0 3px 3px 0
|
||||||
width 39.5%
|
width 39.5%
|
||||||
font-family 'Apercu'
|
font-family $baseType
|
||||||
color $highlight
|
color $highlight
|
||||||
height 30px
|
height 30px
|
||||||
vertical-align top
|
vertical-align top
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
#post-meta
|
#post-meta
|
||||||
#post_tags
|
#post_tags
|
||||||
background $primary - 4%
|
background $primary - 4%
|
||||||
font-family 'Apercu'
|
font-family $baseType
|
||||||
width 97.6%
|
width 97.6%
|
||||||
height 140px
|
height 140px
|
||||||
color $secondary
|
color $secondary
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
background $primary - 50%
|
background $primary - 50%
|
||||||
color $primary
|
color $primary
|
||||||
vertical-align middle
|
vertical-align middle
|
||||||
font-family 'Apercu-Mono'
|
font-family $monoType
|
||||||
|
|
||||||
label
|
label
|
||||||
cursor pointer
|
cursor pointer
|
||||||
|
@ -202,7 +202,7 @@
|
||||||
|
|
||||||
pre
|
pre
|
||||||
code
|
code
|
||||||
font-family 'Apercu-Mono'
|
font-family $monoType
|
||||||
padding 5px
|
padding 5px
|
||||||
border-radius 5px
|
border-radius 5px
|
||||||
line-height 1.6em
|
line-height 1.6em
|
||||||
|
|
|
@ -99,7 +99,8 @@
|
||||||
url('fonts/Apercu-Mono.ttf') format('truetype'),
|
url('fonts/Apercu-Mono.ttf') format('truetype'),
|
||||||
url('fonts/Apercu-Mono.svg?#Apercu') format('svg')
|
url('fonts/Apercu-Mono.svg?#Apercu') format('svg')
|
||||||
|
|
||||||
$baseType = 'Apercu', Helvetica, Arial, sans-serif;
|
$baseType = Helvetica, Arial, sans-serif;
|
||||||
|
$monoType = 'Andale Mono'
|
||||||
|
|
||||||
h1, h2, h3
|
h1, h2, h3
|
||||||
color $white
|
color $white
|
||||||
|
|
Loading…
Reference in a new issue