Search in sources :

Example 21 with ContainerTag

use of j2html.tags.ContainerTag in project midpoint by Evolveum.

the class HtmlReportDataWriter method formatColumn.

private ContainerTag formatColumn(List<String> values) {
    ContainerTag div = TagCreator.div().withStyle("white-space: pre-wrap");
    values.forEach((value) -> {
        if (div.getNumChildren() != 0) {
            div.with(TagCreator.br());
        }
        div.withText(value);
    });
    return div;
}
Also used : ContainerTag(j2html.tags.ContainerTag)

Example 22 with ContainerTag

use of j2html.tags.ContainerTag in project civiform by seattle-uat.

the class AwsFileUploadViewStrategy method renderFileUploadBottomNavButtons.

Tag renderFileUploadBottomNavButtons(Params params) {
    Optional<Tag> maybeContinueButton = maybeRenderContinueButton(params);
    Optional<ContainerTag> maybeSkipOrDeleteButton = maybeRenderSkipOrDeleteButton(params);
    ContainerTag ret = div().withClasses(ApplicantStyles.APPLICATION_NAV_BAR).with(div().withClasses(Styles.FLEX_GROW)).with(renderReviewButton(params));
    if (maybeSkipOrDeleteButton.isPresent()) {
        ret.with(maybeSkipOrDeleteButton.get());
    }
    ret.with(renderUploadButton(params));
    if (maybeContinueButton.isPresent()) {
        ret.with(maybeContinueButton.get());
    }
    return ret;
}
Also used : ContainerTag(j2html.tags.ContainerTag) Tag(j2html.tags.Tag) ContainerTag(j2html.tags.ContainerTag)

Example 23 with ContainerTag

use of j2html.tags.ContainerTag in project civiform by seattle-uat.

the class AzureFileUploadViewStrategy method maybeRenderSkipOrDeleteButton.

@Override
protected Optional<ContainerTag> maybeRenderSkipOrDeleteButton(Params params) {
    String buttonText = params.messages().at(MessageKey.BUTTON_SKIP_FILEUPLOAD.getKeyName());
    String buttonId = FILEUPLOAD_SKIP_BUTTON_ID;
    Optional<ContainerTag> footer = Optional.empty();
    if (hasUploadedFile(params)) {
        buttonText = params.messages().at(MessageKey.BUTTON_DELETE_FILE.getKeyName());
        buttonId = FILEUPLOAD_DELETE_BUTTON_ID;
        footer = Optional.of(footer().with(viewUtils.makeLocalJsTag("azure_delete")));
    }
    ContainerTag button = button(buttonText).attr(FORM, FILEUPLOAD_DELETE_FORM_ID).withClasses(ApplicantStyles.BUTTON_REVIEW).withId(buttonId);
    footer.ifPresent(button::with);
    return Optional.of(button);
}
Also used : TagCreator.button(j2html.TagCreator.button) ContainerTag(j2html.tags.ContainerTag)

Example 24 with ContainerTag

use of j2html.tags.ContainerTag in project civiform by seattle-uat.

the class AzureFileUploadViewStrategy method renderFileUploadBlockSubmitForms.

@Override
public Tag renderFileUploadBlockSubmitForms(Params params, ApplicantQuestionRendererFactory applicantQuestionRendererFactory) {
    String key = FileNameFormatter.formatFileUploadQuestionFilename(params);
    String onSuccessRedirectUrl = params.baseUrl() + routes.ApplicantProgramBlocksController.updateFile(params.applicantId(), params.programId(), params.block().getId(), params.inReview()).url();
    StorageUploadRequest request = params.storageClient().getSignedUploadRequest(key, onSuccessRedirectUrl);
    BlobStorageUploadRequest blobStorageUploadRequest = castStorageRequest(request);
    ApplicantQuestionRendererParams rendererParams = ApplicantQuestionRendererParams.builder().setMessages(params.messages()).setSignedFileUploadRequest(blobStorageUploadRequest).build();
    ContainerTag formTag = form().withId(BLOCK_FORM_ID).attr(ENCTYPE, "multipart/form-data").with(each(params.block().getQuestions(), question -> renderQuestion(question, rendererParams, applicantQuestionRendererFactory)));
    Tag skipForms = renderDeleteAndContinueFileUploadForms(params);
    Tag buttons = renderFileUploadBottomNavButtons(params);
    return div(formTag, skipForms, buttons).withId("azure-upload-form-component").with(footer(viewUtils.makeWebJarsTag(WebJarJsPaths.AZURE_STORAGE_BLOB)), footer(viewUtils.makeLocalJsTag("azure_upload")));
}
Also used : controllers.applicant.routes(controllers.applicant.routes) TagCreator.footer(j2html.TagCreator.footer) FORM(j2html.attributes.Attr.FORM) Styles(views.style.Styles) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) ENCTYPE(j2html.attributes.Attr.ENCTYPE) TagCreator.each(j2html.TagCreator.each) TagCreator.form(j2html.TagCreator.form) TagCreator.button(j2html.TagCreator.button) ContainerTag(j2html.tags.ContainerTag) ApplicantStyles(views.style.ApplicantStyles) Inject(javax.inject.Inject) FileNameFormatter(services.cloud.FileNameFormatter) Params(views.applicant.ApplicantProgramBlockEditView.Params) MessageKey(services.MessageKey) ApplicantQuestionRendererParams(views.questiontypes.ApplicantQuestionRendererParams) Optional(java.util.Optional) FileUploadQuestion(services.applicant.question.FileUploadQuestion) ApplicantQuestionRendererFactory(views.questiontypes.ApplicantQuestionRendererFactory) StorageUploadRequest(services.cloud.StorageUploadRequest) BlobStorageUploadRequest(services.cloud.azure.BlobStorageUploadRequest) TagCreator.div(j2html.TagCreator.div) TagCreator.input(j2html.TagCreator.input) Tag(j2html.tags.Tag) BlobStorageUploadRequest(services.cloud.azure.BlobStorageUploadRequest) ApplicantQuestionRendererParams(views.questiontypes.ApplicantQuestionRendererParams) StorageUploadRequest(services.cloud.StorageUploadRequest) BlobStorageUploadRequest(services.cloud.azure.BlobStorageUploadRequest) ContainerTag(j2html.tags.ContainerTag) ContainerTag(j2html.tags.ContainerTag) Tag(j2html.tags.Tag)

Example 25 with ContainerTag

use of j2html.tags.ContainerTag in project civiform by seattle-uat.

the class AzureFileUploadViewStrategy method renderFileUploadBottomNavButtons.

private Tag renderFileUploadBottomNavButtons(Params params) {
    Optional<Tag> maybeContinueButton = maybeRenderContinueButton(params);
    Optional<ContainerTag> maybeSkipOrDeleteButton = maybeRenderSkipOrDeleteButton(params);
    ContainerTag ret = div().withClasses(ApplicantStyles.APPLICATION_NAV_BAR).with(div().withClasses(Styles.FLEX_GROW)).with(renderReviewButton(params));
    if (maybeSkipOrDeleteButton.isPresent()) {
        ret.with(maybeSkipOrDeleteButton.get());
    }
    ret.with(renderUploadButton(params));
    if (maybeContinueButton.isPresent()) {
        ret.with(maybeContinueButton.get());
    }
    return ret;
}
Also used : ContainerTag(j2html.tags.ContainerTag) Tag(j2html.tags.Tag) ContainerTag(j2html.tags.ContainerTag)

Aggregations

ContainerTag (j2html.tags.ContainerTag)125 Tag (j2html.tags.Tag)22 TagCreator.div (j2html.TagCreator.div)17 Inject (javax.inject.Inject)17 HtmlBundle (views.HtmlBundle)14 DomContent (j2html.tags.DomContent)12 List (java.util.List)12 Mav (io.datarouter.web.handler.mav.Mav)11 J2HtmlTable (io.datarouter.web.html.j2html.J2HtmlTable)10 DatarouterWebRequireJsV2 (io.datarouter.web.requirejs.DatarouterWebRequireJsV2)10 TagCreator (j2html.TagCreator)10 TagCreator.a (j2html.TagCreator.a)10 BaseHandler (io.datarouter.web.handler.BaseHandler)9 Bootstrap4PageFactory (io.datarouter.web.html.j2html.bootstrap4.Bootstrap4PageFactory)8 TagCreator.td (j2html.TagCreator.td)8 ArrayList (java.util.ArrayList)8 Scanner (io.datarouter.scanner.Scanner)7 LinkElement (views.components.LinkElement)7 Collectors (java.util.stream.Collectors)6 ClientId (io.datarouter.storage.client.ClientId)5