use of views.HtmlBundle in project civiform by seattle-uat.
the class ProgramEditView method render.
public Content render(Request request, ProgramDefinition program) {
ContainerTag formTag = ProgramFormBuilder.buildProgramForm(program, /* editExistingProgram = */
true).with(makeCsrfTokenInputTag(request)).with(buildManageQuestionLink(program.id())).withAction(controllers.admin.routes.AdminProgramController.update(program.id()).url());
String title = String.format("Edit program: %s", program.adminName());
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(renderHeader(title), formTag);
return layout.renderCentered(htmlBundle);
}
use of views.HtmlBundle in project civiform by seattle-uat.
the class ProgramNewOneView method render.
public Content render(Request request, ProgramForm programForm, String message) {
String title = "New program information";
ContainerTag contentDiv = div(ProgramFormBuilder.buildProgramForm(programForm, /* editExistingProgram = */
false).with(makeCsrfTokenInputTag(request)).withAction(controllers.admin.routes.AdminProgramController.create().url()));
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(renderHeader(title), contentDiv);
if (!message.isEmpty()) {
htmlBundle.addToastMessages(ToastMessage.error(message).setDismissible(false));
}
return layout.renderCentered(htmlBundle);
}
use of views.HtmlBundle in project civiform by seattle-uat.
the class QuestionTranslationView method render.
private Content render(Http.Request request, Locale locale, QuestionDefinition question, Optional<String> errors) {
String formAction = controllers.admin.routes.AdminQuestionTranslationsController.update(question.getId(), locale.toLanguageTag()).url();
// Add form fields for questions.
ImmutableList.Builder<FieldWithLabel> inputFields = ImmutableList.builder();
inputFields.addAll(questionTextFields(locale, question.getQuestionText(), question.getQuestionHelpText()));
inputFields.addAll(getQuestionTypeSpecificFields(question, locale));
ContainerTag form = renderTranslationForm(request, locale, formAction, inputFields.build());
String title = "Manage Question Translations";
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(renderHeader(title), renderLanguageLinks(question.getId(), 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 VersionListView method render.
public Content render(List<Version> allVersions, Http.Request request) {
Optional<Version> draftVersion = allVersions.stream().filter(version -> version.getLifecycleStage().equals(LifecycleStage.DRAFT)).findAny();
Optional<Version> activeVersion = allVersions.stream().filter(version -> version.getLifecycleStage().equals(LifecycleStage.ACTIVE)).findAny();
ImmutableList<Version> olderVersions = allVersions.stream().filter(version -> version.getLifecycleStage().equals(LifecycleStage.OBSOLETE)).sorted((a, b) -> a.id.compareTo(b.id)).collect(ImmutableList.toImmutableList()).reverse();
String title = "Program Versions";
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(renderHeader("Current Versions"), renderVersionCard(draftVersion), renderVersionCard(activeVersion), renderHeader("Older Versions"), renderPastVersionTable(olderVersions, request));
return layout.renderCentered(htmlBundle);
}
use of views.HtmlBundle in project civiform by seattle-uat.
the class ApplicantProgramInfoView method render.
public Content render(Messages messages, ProgramDefinition program, Http.Request request, long applicantId, Optional<String> userName) {
Locale preferredLocale = messages.lang().toLocale();
String programTitle = program.localizedName().getOrDefault(preferredLocale);
String programInfo = program.localizedDescription().getOrDefault(preferredLocale);
HtmlBundle bundle = layout.getBundle().addMainStyles(Styles.MX_12, Styles.MY_8).addMainContent(topContent(programTitle, programInfo, messages)).addMainContent(createButtons(applicantId, program.id(), messages));
return layout.renderWithNav(request, userName, messages, bundle);
}
Aggregations