switched to web safe fonts for now, streamline file uploads, now tracking upload progress.

This commit is contained in:
Ro 2019-11-24 12:23:01 -08:00
parent 018bfc410b
commit 849c5e2ac0
14 changed files with 71 additions and 55 deletions

View file

@ -40,7 +40,11 @@ router.post('/login', function(req, res) {
let session = req.session;
session.user = found;
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 {
res.json({
type: DataEvent.REQUEST_LAME,

View file

@ -15,11 +15,10 @@ const fs = require('fs-extra');
const moment = require('moment');
const rightsManager = new RightsManager();
const book = new Book();
const uploadPath = './public/assets/images/blog/' + moment().format('YYYY');
'/' + moment().format('MM');
const uploadPath =
'./public/assets/images/blog/' + moment().format('YYYY') + '/' + moment().format('MM');
const _ = require('lodash');
fs.ensureDir(uploadPath, () => {
//console.log(err) // => null
// dir has now been created, including the directory it is to be placed in
});
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;

View file

@ -17,6 +17,7 @@ block main-content
-post_date = date
-post_status = status
form#test-form
#post-edit-index(data-index=id)
#post-edit-index-wrapper
//h2 EDIT

View file

@ -21,7 +21,7 @@ export default class Base {
.getElementById('login-btn')
.addEventListener('click', e => this.handleLogin(e));
} else {
//let dm = new DashManager();
let manager = new DashManager();
}
}
//--------------------------

View file

@ -1,13 +1,11 @@
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../../../src/com/utils/DataUtils';
import * as DataEvent from '../../../src/com/events/DataEvent';
import DBUtils from '../../../src/com/utils/DBUtils';
export default class NavActions {
//--------------------------
// constructor
//--------------------------
constructor() {
this.dataUtils = new DataUtils();
this.dbutils = new DBUtils();
}
//--------------------------
// methods

View file

@ -1,16 +1,13 @@
import DataUtils, { REQUEST_TYPE_POST, CONTENT_TYPE_JSON } from '../utils/DataUtils';
import StringUtils from '../utils/StringUtils';
import DBUtils from '../utils/DBUtils';
var uuidv4 = require('uuid/v4');
import * as DataEvent from '../events/DataEvent';
var uuidv4 = require('uuid/v4');
export default class PostActions {
//--------------------------
// constructor
//--------------------------
constructor() {
this.dataUtils = new DataUtils();
this.dateUtils = new DateUtils();
this.dbUtils = new DBUtils();
}
//--------------------------
// methods

View file

@ -1,5 +1,4 @@
import NavActions from '../actions/NavActions';
import DBUtils from '../../../src/com/utils/DBUtils';
export default class NavIndex {
//--------------------------
// constructor
@ -7,7 +6,6 @@ export default class NavIndex {
constructor() {
this.start();
//this.dataUtils = new DataUtils();
this.dbutils = new DBUtils();
}
//--------------------------
// methods

View file

@ -5,6 +5,7 @@ import PostActions from '../actions/PostActions';
import * as EditorEvent from '../../../src/com/events/EditorEvent';
import TinyDatePicker from 'tiny-date-picker';
import TextEditor from '../../../src/com/ui/TextEditor';
const data = new DataUtils();
export default class PostEditor {
//TODO - FIX POST FEATURE URLS IN DB
@ -130,6 +131,27 @@ export default class PostEditor {
});
break;
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()
.update(this.postID, this.post, PostEditor.uploadFiles, FINAL_KEY)
.then(() => {
@ -138,6 +160,7 @@ export default class PostEditor {
.catch(() => {
//console.log("ERRORZ", err)
});
*/
break;
case EditorEvent.EDITOR_DELETE:
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.
reader.readAsDataURL(f);
}
/**
if (e.target.id == 'featured-image-upload')
this.handleImageUpload(e.target.id, PostEditor.uploadFiles);
break;
*/
}
}
handleImageUpload(type, files) {
@ -224,8 +249,7 @@ export default class PostEditor {
? imageData.append('feature_image', file, file.name)
: imageData.append('post_image', file, file.name);
}
this.dataUtils
.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData)
data.request(url, eventType, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData)
.then(response => {
let r = JSON.parse(response.request['response']);
if (r.message == DataEvent.POST_IMAGE_ADDED)

View file

@ -2,14 +2,7 @@ export const REQUEST_GOOD = 'requestGood';
export const REQUEST_LAME = 'requestLame';
export const IMG_REQUEST_GOOD = 'imgRequestGood';
export const IMG_REQUEST_LAME = 'imgRequestLame';
export const SETTINGS_LOADED = 'dataLoaded';
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 SETTINGS_LOADED = 'settingsLoaded';
export const POST_IMAGE_ADDED = 'postImageAdded';
export const FEATURE_IMAGE_ADDED = 'featureImageAdded';
export const POST_ERROR = 'postError';
@ -17,21 +10,16 @@ export const POST_ADDED = 'postAdded';
export const POST_UPDATED = 'postUpdated';
export const POST_DELETED = 'postImageAdded';
export const POSTS_SYNCED = 'postsSynced';
export const LOCAL_DB_READY = 'localDBReady';
export const SETTINGS_UPDATED = 'settingsUpdated';
export const AVATAR_UPLOADED = 'avatarUploaded';
export const SITE_BACKGROUND_UPLOADED = 'siteBackgroundUploaded';
class DataEvent
{
export const API_PAGE_WRITE = 'writingItDown';
class DataEvent {
//--------------------------
// methods
//--------------------------
//--------------------------
// event handlers
//--------------------------
}
export default new DataEvent
export default new DataEvent();

View file

@ -137,8 +137,7 @@ export default class DataUtils extends EventEmitter {
//--------------------------
// event handlers
//--------------------------
handleLoadProgress() {
handleLoadProgress(e) {
//var percentComplete = Math.ceil((e.loaded / e.total) * 100);
//console.log(percentComplete);
}
}

View file

@ -5,7 +5,7 @@ input[type=email], input[type=password], input[type=text]
border 0
border-radius 3px
padding 5px
font 1em 'Apercu-Mono'
font 1em $monoType
display inline-block
background-color $primary - 60%
color $secondary
@ -14,19 +14,19 @@ textarea
border 0
border-radius 3px
color $type02
font 15px 'Apercu-Mono'
font 15px $monoType
button, input[type=submit]
background $highlight
color $primary - 60%
font 1em 'Apercu-Mono'
font 1em $monoType
border-radius 3px
position relative
cursor pointer
border 0
select
font 1em 'Apercu-Mono'
font 1em $monoType
border 1px solid $secondary
-webkit-appearance none
-moz-appearance none
@ -35,19 +35,19 @@ select
color $primary
::-webkit-input-placeholder
font 1em 'Apercu-Mono'
font 1em $monoType
color $secondary
:-moz-placeholder
/* Firefox 18- */
font 1em 'Apercu-Mono'
font 1em $monoType
color $secondary
::-moz-placeholder
/* Firefox 19+ */
font 1em 'Apercu-Mono'
font 1em $monoType
color $secondary
:-ms-input-placeholder
font 1em 'Apercu-Mono'
font 1em $monoType
color $secondary

View file

@ -117,7 +117,7 @@
float right
vertical-align top
display inline-block
font-family 'Apercu-mono'
font-family $monoType
font-size 0.5em
padding 7px
color $primary - 60%

View file

@ -53,7 +53,7 @@
display inline-block
vertical-align top
font-size 0.8em
font-family 'Apercu-Mono'
font-family $monoType
width 50%
padding 0 0 0 10px
@ -83,7 +83,7 @@
#post-title
#post_title
background $primary - 4%
font-family 'Apercu'
font-family $baseType
width 97.6%
height 140px
font-size 1.5em
@ -95,7 +95,7 @@
background $primary - 10%
border-radius 0 3px 3px 0
width 39.5%
font-family 'Apercu'
font-family $baseType
color $highlight
height 30px
vertical-align top
@ -145,7 +145,7 @@
#post-meta
#post_tags
background $primary - 4%
font-family 'Apercu'
font-family $baseType
width 97.6%
height 140px
color $secondary
@ -167,7 +167,7 @@
background $primary - 50%
color $primary
vertical-align middle
font-family 'Apercu-Mono'
font-family $monoType
label
cursor pointer
@ -202,7 +202,7 @@
pre
code
font-family 'Apercu-Mono'
font-family $monoType
padding 5px
border-radius 5px
line-height 1.6em

View file

@ -99,7 +99,8 @@
url('fonts/Apercu-Mono.ttf') format('truetype'),
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
color $white