Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/documents/Design.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export default class Design extends Component {
const { loading } = this.global;
let openBracket = "{{";
let closedBracket = "}}";
let tripleOpenBracket = "{{{";
let tripleClosedBracket = "}}}";
if(this.state.post === true) {
return(
<Container style={{marginTop: "25px"}}>
Expand All @@ -88,7 +90,7 @@ export default class Design extends Component {
<ul>
<li>{openBracket}title{closedBracket}</li>
<li>{openBracket}author{closedBracket}</li>
<li>{openBracket}featureImg{closedBracket}</li>
<li>{tripleOpenBracket}featureImg{tripleClosedBracket} - Note the triple brackets</li>
<li>{openBracket}published{closedBracket}</li>
</ul>
<p>Graphite Publishing supports full Handlebars syntax, including conditionals. Here is an example that uses all variables and a conditional if block: </p>
Expand Down Expand Up @@ -148,7 +150,7 @@ export default class Design extends Component {
<ul>
<li>{openBracket}title{closedBracket}</li>
<li>{openBracket}author{closedBracket}</li>
<li>{openBracket}featuredImg{closedBracket}</li>
<li>{tripleOpenBracket}featureImg{tripleClosedBracket} - Note the triple brackets</li>
<li>{openBracket}lastUpdated{closedBracket}</li>
<li>{openBracket}link{closedBracket}</li>
</ul>
Expand Down
6 changes: 3 additions & 3 deletions src/components/documents/SinglePost.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class SinglePost extends Component {

render() {
let postUrl = `${window.location.origin}/sites/${loadUserData().username}/public/${window.location.href.split('posts/')[1]}`;
const { save, onboardingComplete, status, loading, content, featuredImg, publishPost, initialLoad, title } = this.global;
const { save, onboardingComplete, status, loading, content, featureImg, publishPost, initialLoad, title } = this.global;
const dropzoneStyle = {};
let saveBtn;
let saveBtnClass;
Expand Down Expand Up @@ -109,7 +109,7 @@ export default class SinglePost extends Component {
<Divider />
<Menu.Item as='a'>
<SemanticHeader id='side-nav-image-heading' as='h3'>Featured Image</SemanticHeader>
{featuredImg === "" ?
{featureImg === "" ?
<div className="center">
<Dropzone
style={dropzoneStyle}
Expand All @@ -121,7 +121,7 @@ export default class SinglePost extends Component {
</Dropzone>
</div> :
<div>
<Image className="post-featured" src={featuredImg} alt="featured"/>
<Image className="post-featured" src={featureImg} alt="featured"/>
<div className="center">
<Dropzone
style={dropzoneStyle}
Expand Down
6 changes: 3 additions & 3 deletions src/components/documents/marketplace.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/components/helpers/design.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ let html;

export function setTheme(name) {
if(name === 'card') {
setGlobal({ pageHTML: "<div>\n<nav>\n<div class='nav-wrapper'>\n<h3><a href='#' className='brand-logo'>Your Name or Image</a></h3>\n</div>\n</nav>\n<div class='row'>\n{{#posts}}\n<div class='col s6 m4'>\n<div class='card small'>\n<div class='card-image'>\n{{#if featureImg}}\n<img src={{featureImg}} />\n{{/if}}\n<span style='color:#000;' class='card-title'>\n{{title}}\n</span>\n</div>\n<div class='card-content'>\n<p>Published: {{lastUpdated}}</p>\n<p>By: {{author}}</p>\n</div>\n<div class='card-action'>\n<a style='color: #000' href={{link}}>Read It</a>\n</div>\n</div>\n</div>\n{{/posts}}\n</div>\n</div>" })
setGlobal({ pageHTML: "<div>\n<nav>\n<div class='nav-wrapper'>\n<h3><a href='#' className='brand-logo'>Your Name or Image</a></h3>\n</div>\n</nav>\n<div class='row'>\n{{#posts}}\n<div class='col s6 m4'>\n<div class='card small'>\n<div class='card-image'>\n{{#if featureImg}}\n<img src={{{featureImg}}} />\n{{/if}}\n<span style='color:#000;' class='card-title'>\n{{title}}\n</span>\n</div>\n<div class='card-content'>\n<p>Published: {{lastUpdated}}</p>\n<p>By: {{author}}</p>\n</div>\n<div class='card-action'>\n<a style='color: #000' href={{link}}>Read It</a>\n</div>\n</div>\n</div>\n{{/posts}}\n</div>\n</div>" })
} else if(name === 'clean') {
setGlobal({ pageHTML: "<div><nav style='text-align: center;'>\n<div class='nav-wrapper'>\n<h1><a href='#' style='text-align: center;'>YOUR SITE NAME</a></h1>\n<p style='text-align: center'>The best words on the internet</p>\n</div>\n</nav>\n<div style='max-width: 75%;margin: auto;margin-bottom: 25px;margin-top:50px;padding-top:25px;'>\n{{#posts}}\n<h3>{{title}}</h3>\n{{#if featureImg}}\n<img style='max-width:50%;margin:auto;' src={{featureImg}} alt={{title}} />\n{{/if}}\n<h5>{{author}}</h5>\n<h5>{{lastUpdated}}</h5>\n<a style='color:#fff' href={{link}}><button class='btn black'>Read More</button></a>\n<hr />\n{{/posts}}\n</div>\n</div>" })
setGlobal({ pageHTML: "<div><nav style='text-align: center;'>\n<div class='nav-wrapper'>\n<h1><a href='#' style='text-align: center;'>YOUR SITE NAME</a></h1>\n<p style='text-align: center'>The best words on the internet</p>\n</div>\n</nav>\n<div style='max-width: 75%;margin: auto;margin-bottom: 25px;margin-top:50px;padding-top:25px;'>\n{{#posts}}\n<h3>{{title}}</h3>\n{{#if featureImg}}\n<img style='max-width:50%;margin:auto;' src={{{featureImg}}} alt={{title}} />\n{{/if}}\n<h5>{{author}}</h5>\n<h5>{{lastUpdated}}</h5>\n<a style='color:#fff' href={{link}}><button class='btn black'>Read More</button></a>\n<hr />\n{{/posts}}\n</div>\n</div>" })
} else if(name === 'night') {
setGlobal({ pageHTML: "<div style='background: #282828;color:#eee;padding-bottom:45px;'>\n<div style='background: #000;width:100%;padding:10px;'>\n<h1>Your Site Name</h1>\n</div>\n<div style='margin:auto;margin-top: 65px; max-width: 85%;margin-bottom:45px;'>\n{{#posts}}\n<div style='margin-top:25px;'>\n</div>\n<p>{{lastUpdated}}</p>\n<h3>{{title}}</h3>\n{{#if featureImg}}\n<img src={{featureImg}} style='max-width:50%;margin:auto;' alt={{title}} />\n{{/if}}\n<p>Written by {{author}}</p>\n<a href={{link}} style='color:#000'><button style='color:#000;background: #eee;' class='btn'>Read</button></a>\n{{/posts}}\n</div>\n</div>\n</div>" })
setGlobal({ pageHTML: "<div style='background: #282828;color:#eee;padding-bottom:45px;'>\n<div style='background: #000;width:100%;padding:10px;'>\n<h1>Your Site Name</h1>\n</div>\n<div style='margin:auto;margin-top: 65px; max-width: 85%;margin-bottom:45px;'>\n{{#posts}}\n<div style='margin-top:25px;'>\n</div>\n<p>{{lastUpdated}}</p>\n<h3>{{title}}</h3>\n{{#if featureImg}}\n<img src={{{featureImg}}} style='max-width:50%;margin:auto;' alt={{title}} />\n{{/if}}\n<p>Written by {{author}}</p>\n<a href={{link}} style='color:#000'><button style='color:#000;background: #eee;' class='btn'>Read</button></a>\n{{/posts}}\n</div>\n</div>\n</div>" })
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ export async function publicLoadMainHtml() {
} else {
await setGlobal({
pageHTML: `<style>@import url("https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css");</style><div style="max-width:75%;margin:auto;text-align:center;">\n<h1 style="margin-bottom:25px;padding: 15px;">Your Blog Title (Don't forget to update this on the Design page</h1>\n{{#posts}}\n<div style="padding:15px;margin:20px;" class="card">\n<h3>{{title}}</h3>\n<p>A post by {{author}}</p>\n<p>Published {{lastUpdated}}</p>\n<a style="color: #000" href={{link}}><button style="color:#000" class="btn black">Read it</button></a>\n</div>\n{{/posts}}\n</div>`,
postHTML: `<style>@import url("https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css");</style><div style='max-width:80%;margin: auto;margin-top: 45px;'>\n<h3 style='text-align:center;'>{{title}}</h3>\n<h5>Published: {{published}}</h5>\n{{#if featuredImg}}\n<img class='responsive-img' src={{featuredImg}} alt='post feature'/>\n{{/if}}\n<div>\n<div style="font-size: 18px;" id="designed-post-content"></div>\n</div>\n</div>`,
postHTML: `<style>@import url("https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css");</style><div style='max-width:80%;margin: auto;margin-top: 45px;'>\n<h3 style='text-align:center;'>{{title}}</h3>\n<h5>Published: {{published}}</h5>\n{{#if featureImg}}\n<img class='responsive-img' src={{{featureImg}}} alt='post feature'/>\n{{/if}}\n<div>\n<div style="font-size: 18px;" id="designed-post-content"></div>\n</div>\n</div>`,
loading: false
})
loadPublicSitePosts();
Expand All @@ -133,7 +133,7 @@ export async function loadMainHtml() {
console.log(getGlobal().accountName)
setGlobal({
pageHTML: `<div style="max-width:75%;margin:auto;text-align:center;">\n<h1>${getGlobal().accountName}</h1>\n{{#posts}}\n<div style="padding:15px;margin:20px;" class="card">\n<h3>{{title}}</h3>\n<p>A post by {{author}}</p>\n<p>Published {{lastUpdated}}</p>\n<a style="color: #000" href={{link}}><button style="color:#000" class="btn black">Read it</button></a>\n</div>\n{{/posts}}\n</div>`,
postHTML: `<div style='max-width:80%;margin: auto;'>\n<h3 style='text-align:center;'>{{title}}</h3>\n<h5>Published: {{published}}</h5>\n{{#if featuredImg}}\n<img class='responsive-img' src={{featuredImg}} alt='post feature'/>\n{{/if}}\n<div>\n<div id='designed-post-content'></div>\n</div>\n</div>`,
postHTML: `<div style='max-width:80%;margin: auto;'>\n<h3 style='text-align:center;'>{{title}}</h3>\n<h5>Published: {{published}}</h5>\n{{#if featureImg}}\n<img class='responsive-img' src={{{featureImg}}} alt='post feature'/>\n{{/if}}\n<div>\n<div id='designed-post-content'></div>\n</div>\n</div>`,
loading: false
})
}
Expand Down Expand Up @@ -230,7 +230,7 @@ export function loadPostHtml() {
console.log(getGlobal().postHTML)
if(getGlobal().postHTML === undefined || getGlobal().postHTML === "") {
setGlobal({
postHTML: "<div style='max-width:80%;margin: auto;'>\n<h3 style='text-align:center;'>{{title}}</h3>\n<h5>Published: {{published}}</h5>\n{{#if featuredImg}}\n<img class='responsive-img' src={{featuredImg}} alt='post feature'/>\n{{/if}}\n<div>\n<div id='designed-post-content'></div>\n</div>\n</div>"
postHTML: "<div style='max-width:80%;margin: auto;'>\n<h3 style='text-align:center;'>{{title}}</h3>\n<h5>Published: {{published}}</h5>\n{{#if featureImg}}\n<img class='responsive-img' src={{{featureImg}}} alt='post feature'/>\n{{/if}}\n<div>\n<div id='designed-post-content'></div>\n</div>\n</div>"
})
}
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/helpers/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export async function loadPostPreview() {
author: thisPost.author,
published: thisPost.lastUpdated ,
postURL: thisPost.url,
featuredImg: thisPost.featureImg
featureImg: thisPost.featureImg
}
}

Expand Down Expand Up @@ -323,7 +323,7 @@ export async function loadPublicPostsCollection() {
// "content" : JSON.parse(fileContents).content || "",
// "author" : JSON.parse(fileContents).author || "",
// "published" : JSON.parse(fileContents).lastUpdated || "",
// "featuredImg" : JSON.parse(fileContents).featureImg || "",
// "featureImg" : JSON.parse(fileContents).featureImg || "",
// "link" : window.location.origin + '/public/' + getGlobal().ownerBlockstackId + '/posts/' + JSON.parse(fileContents).id
// }
// })
Expand Down
14 changes: 7 additions & 7 deletions src/components/helpers/singlepost.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function loadSingle() {
content: thisPost.content || "",
createdDate: thisPost.createdAt || "",
postURL: thisPost.url || "",
featuredImg: thisPost.featureImg || "",
featureImg: thisPost.featureImg || "",
publishPost: thisPost.publishPost || false,
status: thisPost.status || "Draft",
convergence: thisPost.convergence
Expand Down Expand Up @@ -91,7 +91,7 @@ export function handleFeaturedDrop(files) {
this.handleDropRejected();
console.log("file too large")
}else {
setGlobal({featuredImg: object.link, editing: true});
setGlobal({featureImg: object.link, editing: true});
}
};
reader.readAsDataURL(file);
Expand All @@ -110,7 +110,7 @@ export async function handleSavePost() {
content: getGlobal().content,
tags: getGlobal().tags,
lastUpdated: getDate(),
featureImg: getGlobal().featuredImg,
featureImg: getGlobal().featureImg,
status: getGlobal().publishPost ? "Published" : "Draft",
convergence: getGlobal().convergence
}
Expand All @@ -134,7 +134,7 @@ export async function handleSavePost() {
link: `${window.location.origin}/sites/${loadUserData().username}/public/${window.location.href.split('posts/')[1]}`,
lastUpdated: getDate(),
publishedDate: getDate(),
featureImg: getGlobal().featuredImg,
featureImg: getGlobal().featureImg,
convergence: getGlobal().convergence
}
await thisPublic.update(newPublicAttrs)
Expand All @@ -149,7 +149,7 @@ export async function handleSavePost() {
link: `${window.location.origin}/sites/${loadUserData().username}/public/${window.location.href.split('posts/')[1]}`,
lastUpdated: getDate(),
publishedDate: getDate(),
featureImg: getGlobal().featuredImg,
featureImg: getGlobal().featureImg,
convergence: getGlobal().convergence
})
await publicPost.save();
Expand Down Expand Up @@ -179,7 +179,7 @@ export async function loadSinglePublic() {
content: post.attrs.content,
author: post.attrs.author,
createdDate: post.attrs.createdDate,
featuredImg: post.attrs.featureImg || "",
featureImg: post.attrs.featureImg || "",
lastUpdated: post.attrs.lastUpdated
})
var data, template;
Expand All @@ -189,7 +189,7 @@ export async function loadSinglePublic() {
"content" : getGlobal().content,
"author" : getGlobal().author,
"published" : getGlobal().lastUpdated,
"featuredImg" : getGlobal().featuredImg
"featureImg" : getGlobal().featureImg
}
console.log(data)
template = await window.Handlebars.compile(getGlobal().postHTML);
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ setGlobal({
redirect: false,
index: 0,
postLoadingDone: false,
featuredImg: "",
featureImg: "",
postURL: "",
postLoading: false,
publishPost: false,
Expand Down