use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class StaticPage method appendPage.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.page.StaticTemplate#appendPage(java.lang.
* StringBuffer) */
@Override
protected void appendPage(StringBuffer markup) {
Page page = ensurePage();
if (page != null && page.posts != null) {
for (Post post : page.posts) {
if (post.content != null && post.content.body != null) {
markup.append("<a name=\"!");
markup.append(page.slug);
markup.append("/");
markup.append(post.slug);
markup.append("\"></a>");
markup.append("<section><div>");
markup.append(process(post.content.body));
markup.append("</div></section>");
}
}
} else {
markup.append("Page not found.");
}
}
use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class StaticPost method lookupPost.
private void lookupPost() {
GetPostRequest input = input(GetPostRequest.class).post(new Post().slug(stack.getAction()));
output = (new GetPostActionHandler()).handle(input);
}
use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class StaticPosts method showPosts.
protected void showPosts(List<Post> posts, StringBuffer markup) {
MarkdownProcessor processor = new MarkdownProcessor();
processor.registerPlugins(new IncludePlugin());
String link, body;
for (Post post : posts) {
body = "Empty... :imp:";
if (post.summary != null && post.summary.length() > 0) {
body = post.summary;
}
link = "/#" + PageType.PostDetailPageType.asTargetHistoryToken(PostHelper.getSlug(post));
markup.append("<div><a href=\"");
markup.append(link);
markup.append("\">");
markup.append(process("##" + post.title));
markup.append("</a><div><span>");
markup.append(DateTimeHelper.ago(post.published));
markup.append("</span> by <img src=\"");
markup.append(post.author.avatar);
markup.append("?s=");
markup.append(UserHelper.AVATAR_HEADER_SIZE);
markup.append("&default=retro\" /> ");
markup.append(UserHelper.handle(post.author));
markup.append("</div><div>");
markup.append(process(body));
markup.append("</div><a href=\"");
markup.append(link);
markup.append("\">Read More</a></div>");
}
}
use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class ArchiveEntryService method addArchiveEntry.
/* (non-Javadoc)
*
* @see com.willshex.blogwt.server.service.archiveentry.IArchiveEntryService
* #addArchiveEntry(com.willshex.blogwt.shared.api.datatype.ArchiveEntry) */
@Override
public ArchiveEntry addArchiveEntry(ArchiveEntry archiveEntry) {
if (archiveEntry.created == null) {
archiveEntry.created = new Date();
}
archiveEntry.postKeys = new ArrayList<Key<Post>>();
for (Post post : archiveEntry.posts) {
archiveEntry.postKeys.add(Key.create(post));
}
Key<ArchiveEntry> key = provide().save().entity(archiveEntry).now();
archiveEntry.id = keyToId(key);
return archiveEntry;
}
use of com.willshex.blogwt.shared.api.datatype.Post in project blogwt by billy1380.
the class PageService method updatePage.
@Override
public Page updatePage(Page page) {
page.postKeys = new ArrayList<Key<Post>>();
for (Post post : page.posts) {
page.postKeys.add(Key.create(post));
}
if (page.parent != null) {
page.parentKey = Key.create(page.parent);
} else {
page.parentKey = null;
}
provide().save().entity(page).now();
SearchHelper.queueToIndex(getName(), page.id);
return page;
}
Aggregations