use of views.HtmlBundle in project civiform by seattle-uat.
the class ProgramEditView method render.
public Content render(Request request, long id, ProgramForm program, String message) {
ContainerTag formTag = ProgramFormBuilder.buildProgramForm(program, /* editExistingProgram = */
true).with(makeCsrfTokenInputTag(request)).with(buildManageQuestionLink(id)).withAction(controllers.admin.routes.AdminProgramController.update(id).url());
String title = String.format("Edit program: %s", program.getAdminName());
HtmlBundle htmlBundle = layout.getBundle().setTitle(title).addMainContent(renderHeader(title), formTag);
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 ProgramIndexView method render.
public Content render(ActiveAndDraftPrograms programs, Http.Request request, Optional<CiviFormProfile> profile) {
if (profile.isPresent() && profile.get().isProgramAdmin() && !profile.get().isCiviFormAdmin()) {
layout.setOnlyProgramAdminType();
}
String pageTitle = "All programs";
ContainerTag publishAllModalContent = div().withClasses(Styles.FLEX, Styles.FLEX_COL, Styles.GAP_4).with(p("Are you sure you want to publish all programs?").withClasses(Styles.P_2)).with(maybeRenderPublishButton(programs, request));
Modal publishAllModal = Modal.builder("publish-all-programs-modal", publishAllModalContent).setModalTitle("Confirmation").setTriggerButtonText("Publish all programs").build();
Tag contentDiv = div().withClasses(Styles.PX_20).with(h1(pageTitle).withClasses(Styles.MY_4), div().withClasses(Styles.FLEX, Styles.ITEMS_CENTER).with(renderNewProgramButton()).with(div().withClass(Styles.FLEX_GROW)).condWith(programs.anyDraft(), publishAllModal.getButton()), each(programs.getProgramNames(), name -> this.renderProgramListItem(programs.getActiveProgramDefinition(name), programs.getDraftProgramDefinition(name), request, profile))).with(renderDownloadExportCsvButton());
HtmlBundle htmlBundle = layout.getBundle().setTitle(pageTitle).addMainContent(contentDiv).addModals(publishAllModal);
return layout.renderCentered(htmlBundle);
}
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 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);
}
Aggregations