Skip to content

Commit

Permalink
form dynamic links new add
Browse files Browse the repository at this point in the history
  • Loading branch information
commel committed Dec 8, 2023
1 parent 66bc36a commit aacff7d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/de/holarse/web/controller/WikiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
Expand Down Expand Up @@ -176,6 +175,8 @@ public ModelAndView edit(@PathVariable("nodeId") final Integer nodeId, final Mod
@Transactional
@PostMapping("{nodeId}")
public ModelAndView update(@PathVariable("nodeId") final int nodeId, @ModelAttribute("form") final ArticleForm form, final ModelAndView mv, final Principal principal) {
logger.debug("Updating by form {}", form);

final Article article = articleRepository.findByNodeId(nodeId).orElseThrow(EntityNotFoundException::new);

// Aktualisieren und als neue Revision speichern
Expand Down
24 changes: 22 additions & 2 deletions src/main/webapp/WEB-INF/templates/sites/shared/articles/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,44 @@

<!-- Tab Links -->
<div class="tab-pane fade show" id="article-edit-tab-links" role="tabpanel">

<ul data-th-each="websiteLink,iter : *{websiteLinks}">
<!-- Website Link -->
<div class="form-group g-mb-20 block-title block-title7">

<span th:text="Link + ' ' + |${iter.count}|"></span>
<input data-th-field="*{websiteLinks[__${iter.index}__].id}" type="hidden">

<input data-th-field="*{websiteLinks[__${iter.index}__].weight}" type="hidden">
<input data-th-field="*{websiteLinks[__${iter.index}__].markAsDeleted}" type="hidden">

<label class="col-sm-3 col-form-label g-mb-10" th:for="${'websiteLinks[__${iter.index}__].description'}">Beschreibung</label>
<input data-th-field="*{websiteLinks[__${iter.index}__].description}" class="form-control form-control-md rounded-0" type="text" placeholder="Link zum Projekt/Webseite">

<label class="col-sm-3 col-form-label g-mb-10" th:for="${'websiteLinks[__${iter.index}__].data'}">URL</label>
<input data-th-field="*{websiteLinks[__${iter.index}__].data}" class="form-control form-control-md rounded-0" type="text" placeholder="Link zum Projekt/Webseite">



</div>
<!-- End Website Link -->
</ul>

<!-- Neuer Eintrag -->
<div class="form-group g-mb-20 block-title block-title7">

<span>Neuer Link</span>
<input name="form.websiteLinks[][id]" type="hidden">
<input name="form.websiteLinks[][weight]" type="hidden" value="0">
<input name="form.websiteLinks[][markAsDeleted]" type="hidden" value="0">

<label class="col-sm-3 col-form-label g-mb-10" for="form.websiteLinks[][description]">Beschreibung</label>
<input name="form.websiteLinks[][description]" class="form-control form-control-md rounded-0" type="text" placeholder="Link zum Projekt/Webseite">

<label class="col-sm-3 col-form-label g-mb-10" for="form.websiteLinks[][data]">URL</label>
<input name="form.websiteLinks[][data]" class="form-control form-control-md rounded-0" type="text" placeholder="Link zum Projekt/Webseite">

</div>

</div>

<!-- Tab Einstellungen -->
Expand Down

0 comments on commit aacff7d

Please sign in to comment.