use of views.HtmlBundle in project civiform by seattle-uat.
the class ProgramTranslationView method render.
public Content render(Http.Request request, Locale locale, long programId, Optional<String> localizedName, Optional<String> localizedDescription, Optional<String> errors) {
String formAction = controllers.admin.routes.AdminProgramTranslationsController.update(programId, locale.toLanguageTag()).url();
ContainerTag form = renderTranslationForm(request, locale, formAction, formFields(localizedName, localizedDescription));
String title = "Manage program translations";
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(renderHeader(title), renderLanguageLinks(programId, locale), form);
errors.ifPresent(s -> htmlBundle.addToastMessages(ToastMessage.error(s).setDismissible(false)));
return layout.renderCentered(htmlBundle);
}
use of views.HtmlBundle in project civiform by seattle-uat.
the class QuestionEditView method renderWithPreview.
private Content renderWithPreview(ContainerTag formContent, QuestionType type, String title) {
ContainerTag previewContent = QuestionPreview.renderQuestionPreview(type, messages, fileUploadViewStrategy);
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(formContent, previewContent);
return layout.render(htmlBundle);
}
use of views.HtmlBundle in project civiform by seattle-uat.
the class ApplicantUpsellCreateAccountView method render.
/**
* Renders a sign-up page with a baked-in redirect.
*/
public Content render(Http.Request request, String redirectTo, Account account, String programTitle, Optional<String> applicantName, Long applicationId, Messages messages, Optional<String> banner) {
String title = messages.at(MessageKey.TITLE_APPLICATION_CONFIRMATION.getKeyName());
HtmlBundle bundle = layout.getBundle().setTitle(title);
ContainerTag createAccountBox = div().withClasses(Styles.BORDER, Styles.BORDER_GRAY_200, Styles.ROUNDED_2XL, Styles.SHADOW_MD, Styles.BG_WHITE, Styles.P_4, StyleUtils.responsiveSmall(Styles.P_6), Styles.MY_6).with(h2(messages.at(MessageKey.TITLE_CREATE_AN_ACCOUNT.getKeyName())).withClasses(Styles.MB_4)).with(div(messages.at(MessageKey.CONTENT_PLEASE_CREATE_ACCOUNT.getKeyName())).withClasses(Styles.MB_4)).with(div().withClasses(Styles.FLEX, Styles.FLEX_COL, Styles.GAP_4, StyleUtils.responsiveSmall(Styles.FLEX_ROW)).with(div().withClasses(Styles.FLEX_GROW)).with(new LinkElement().setHref(redirectTo).setText(messages.at(MessageKey.LINK_APPLY_TO_ANOTHER_PROGRAM.getKeyName())).asButton().withClasses(ApplicantStyles.BUTTON_NOT_RIGHT_NOW)).with(new LinkElement().setHref(org.pac4j.play.routes.LogoutController.logout().url()).setText(messages.at(MessageKey.LINK_ALL_DONE.getKeyName())).asButton().withClasses(ApplicantStyles.BUTTON_NOT_RIGHT_NOW)).with(new LinkElement().setHref(routes.LoginController.applicantLogin(Optional.of(redirectTo)).url()).setText(messages.at(MessageKey.LINK_CREATE_ACCOUNT_OR_SIGN_IN.getKeyName())).asButton().withClasses(ApplicantStyles.BUTTON_CREATE_ACCOUNT)));
ContainerTag content = div().with(div(messages.at(MessageKey.CONTENT_CONFIRMED.getKeyName(), programTitle, applicationId)).withClasses(Styles.TEXT_LG));
// Don't show "create an account" upsell box to TIs, or anyone with an email address already.
if (Strings.isNullOrEmpty(account.getEmailAddress()) && account.getMemberOfGroup().isEmpty()) {
content.with(createAccountBox);
} else {
content.with(new LinkElement().setHref(redirectTo).setText(messages.at(MessageKey.LINK_APPLY_TO_ANOTHER_PROGRAM.getKeyName())).asAnchorText());
}
if (banner.isPresent()) {
bundle.addToastMessages(ToastMessage.error(banner.get()));
}
bundle.addMainStyles(ApplicantStyles.MAIN_PROGRAM_APPLICATION).addMainContent(h1(title).withClasses(ApplicantStyles.H1_PROGRAM_APPLICATION), content);
return layout.renderWithNav(request, applicantName, messages, bundle);
}
use of views.HtmlBundle in project civiform by seattle-uat.
the class QuestionsListView method render.
/**
* Renders a page with a table view of all questions.
*/
public Content render(ActiveAndDraftQuestions activeAndDraftQuestions, Optional<String> maybeFlash, Http.Request request) {
String title = "All Questions";
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(renderHeader(title), renderAddQuestionLink(), div(renderQuestionTable(activeAndDraftQuestions, request)).withClasses(Styles.M_4), renderSummary(activeAndDraftQuestions));
if (maybeFlash.isPresent()) {
// Right now, we only show success messages when this page is rendered with maybeFlash set,
// so we use the success ToastMessage type by default.
htmlBundle.addToastMessages(ToastMessage.success(maybeFlash.get()).setDismissible(false));
}
return layout.renderCentered(htmlBundle);
}
use of views.HtmlBundle in project civiform by seattle-uat.
the class EditTrustedIntermediaryGroupView method render.
public Content render(TrustedIntermediaryGroup tiGroup, Http.Request request) {
String title = "Trusted Intermediary Groups";
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(div().withClasses(Styles.MY_5).with(renderAddNewButton(tiGroup, request)), div(table().withClasses(Styles.BORDER, Styles.BORDER_GRAY_300, Styles.SHADOW_MD, Styles.W_FULL).with(renderGroupTableHeader()).with(tbody(each(tiGroup.getTrustedIntermediaries(), account -> renderTIRow(tiGroup, account, request))))));
return layout.renderCentered(htmlBundle);
}
Aggregations