use of com.google.gwt.safehtml.shared.SafeUri in project blogwt by billy1380.
the class HeaderPart method configureNavBar.
private void configureNavBar(boolean login) {
if (login) {
elNavRight.appendChild(elAccount);
} else {
elAccount.removeFromParent();
}
if (PropertyController.get().booleanProperty(PropertyHelper.DOWNLOAD_ENABLED, false) && login) {
elNavRight.appendChild(elDownloads);
} else {
elDownloads.removeFromParent();
}
SafeUri href;
if (PropertyController.get().booleanProperty(PropertyHelper.ALLOW_USER_REGISTRATION, false)) {
if (login) {
removeItem(PageTypeHelper.asHref(PageType.RegisterPageType));
} else {
href = PageTypeHelper.asHref(PageType.RegisterPageType);
addItem(elNavRight, HeaderTemplates.INSTANCE.glyphItem("user", "Sign Up"), href);
}
}
removeItem(PageTypeHelper.asHref(login ? PageType.LoginPageType : PageType.LogoutPageType));
if (login || PropertyController.get().booleanProperty(PropertyHelper.SHOW_SIGN_IN, true)) {
href = PageTypeHelper.asHref(login ? PageType.LogoutPageType : PageType.LoginPageType);
addItem(elNavRight, HeaderTemplates.INSTANCE.glyphItem(login ? "log-out" : "log-in", login ? "Sign Out" : "Sign In"), href);
}
addAdminNav(login);
}
use of com.google.gwt.safehtml.shared.SafeUri in project blogwt by billy1380.
the class PostSummaryCell method render.
@Override
public void render(Context context, Post value, SafeHtmlBuilder builder) {
SafeUri link = PageTypeHelper.asHref(PageType.PostDetailPageType, PostHelper.getSlug(value));
SafeHtml published = Templates.INSTANCE.notPublished(DateTimeHelper.ago(value.created));
if (value.published != null) {
published = Templates.INSTANCE.publishedDate(DateTimeHelper.ago(value.published));
}
String body = "Empty... :imp:";
if (value.summary != null && value.summary.length() > 0) {
body = value.summary;
} else if (value.content != null && value.content.body != null && value.content.body.length() > 0) {
body = value.content.body;
}
SafeHtml author = SafeHtmlUtils.EMPTY_SAFE_HTML;
if (PropertyController.get().booleanProperty(PropertyHelper.POST_SHOW_AUTHOR, false)) {
author = Templates.INSTANCE.author(UriUtils.fromString(value.author.avatar + "?s=" + UserHelper.AVATAR_HEADER_SIZE + "&default=retro"), UserHelper.handle(value.author));
}
RENDERER.render(builder, link, SafeHtmlUtils.fromTrustedString(PostHelper.makeHeading2(value.title)), SafeHtmlUtils.fromTrustedString(PostHelper.makeMarkup(body)), author, published, value.listed.booleanValue() ? SafeHtmlUtils.EMPTY_SAFE_HTML : Templates.INSTANCE.notVisible());
}
Aggregations