Skip to content

Commit

Permalink
Dynamic form binding article links (without new/remove button yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
commel committed Dec 8, 2023
1 parent 7634651 commit 66bc36a
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 57 deletions.
2 changes: 0 additions & 2 deletions src/main/java/de/holarse/backend/db/Article.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Table(name = "articles")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ public interface ArticleRepository extends JpaRepository<Article, Integer>, Node

@Query(value = "FROM Article a " +
"JOIN FETCH a.articleRevision " +
"JOIN FETCH a.nodeStatus as ns " +
"LEFT JOIN FETCH a.websiteLinks as link_web " +
"LEFT JOIN FETCH a.screenshots as link_scr " +
"JOIN FETCH a.nodeStatus as ns " +
"JOIN a.nodeSlugs as sl " +
"LEFT JOIN FETCH a.tags " +
"WHERE NOT ns.deleted " +
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/de/holarse/backend/view/AttachmentView.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ public boolean isMarkAsDeleted() {
public void setMarkAsDeleted(boolean markAsDeleted) {
this.markAsDeleted = markAsDeleted;
}



@Override
public String toString() {
return "AttachmentView{" + "id=" + id + ", description=" + description + ", data=" + data + ", weight=" + weight + ", markAsDeleted=" + markAsDeleted + '}';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public SecurityFilterChain webFormSecurityFilterChain(final HttpSecurity http, f
antMatcher("/search/**"),
antMatcher("/tags/**"),
antMatcher("/wiki/**"),
antMatcher("/help/**"),
antMatcher("/spielefinder/**"),
antMatcher("/category/*/*"), // Legacy-Tag-URLs
antMatcher("/datenschutz"),
Expand Down
35 changes: 21 additions & 14 deletions src/main/java/de/holarse/web/controller/StaticController.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,37 @@

@Controller
public class StaticController {

@GetMapping("/datenschutz")
public ModelAndView datenschutz(final ModelAndView mv) {
mv.setViewName("layouts/bare");
mv.addObject(WebDefines.DEFAULT_VIEW_ATTRIBUTE_NAME, "sites/static/datenschutz");

return mv;
}
}

@GetMapping("/community-regeln")
public ModelAndView community_regeln(final ModelAndView mv) {
mv.setViewName("layouts/bare");
mv.addObject(WebDefines.DEFAULT_VIEW_ATTRIBUTE_NAME, "sites/static/community-regeln");
return mv;
}

return mv;
}

@GetMapping("/impressum")
public ModelAndView impressum(final ModelAndView mv) {
mv.setViewName("layouts/bare");
mv.setViewName("layouts/bare");
mv.addObject(WebDefines.DEFAULT_VIEW_ATTRIBUTE_NAME, "sites/static/impressum");

return mv;
}



return mv;
}

@GetMapping("/help/wiki-syntax")
public ModelAndView wikiSyntax(final ModelAndView mv) {
mv.setViewName("layouts/bare");
mv.addObject(WebDefines.DEFAULT_VIEW_ATTRIBUTE_NAME, "sites/static/wiki-syntax");

return mv;
}

}
51 changes: 15 additions & 36 deletions src/main/webapp/WEB-INF/templates/sites/shared/articles/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<label class="col-sm-3 col-form-label g-mb-10" for="content">Inhalt</label>
<textarea data-th-field="*{content}" class="form-control form-control-md rounded-0" rows="10" placeholder="Text area"></textarea>
<small class="form-text text-muted g-font-size-default g-mt-10">
<strong>Note:</strong> expands on focus.
<strong>Hinweis:</strong> Die Hilfeseite zur Wiki-Syntax findet ihr <a href="#" th:href="@{/help/wiki-syntax}" target="_blank">hier</a>.
</small>
</div>
<!-- End Textarea Expandable -->
Expand Down Expand Up @@ -93,45 +93,24 @@

<!-- Tab Links -->
<div class="tab-pane fade show" id="article-edit-tab-links" role="tabpanel">
<!-- Website Link 1 -->
<div class="form-group g-mb-20 block-title block-title7">

<input data-th-field="*{websiteLinks.link1.id}" type="hidden">

<label class="col-sm-3 col-form-label g-mb-10" for="title7">Beschreibung</label>
<input data-th-field="*{websiteLinks.link1.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="title7">URL</label>
<input data-th-field="*{websiteLinks.link1.data}" class="form-control form-control-md rounded-0" type="text" placeholder="Link zum Projekt/Webseite">

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

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

<!-- Website Link 2 -->
<div class="form-group g-mb-20 block-title block-title7">
<input data-th-field="*{websiteLinks.link2.id}" type="hidden">
<span th:text="Link + ' ' + |${iter.count}|"></span>
<input data-th-field="*{websiteLinks[__${iter.index}__].id}" type="hidden">

<label class="col-sm-3 col-form-label g-mb-10" for="title7">Beschreibung</label>
<input data-th-field="*{websiteLinks.link2.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="title7">URL</label>
<input data-th-field="*{websiteLinks.link2.data}" class="form-control form-control-md rounded-0" type="text" placeholder="Link zum Projekt/Webseite">
</div>
<!-- End Website Link 2 -->

<!-- Website Link 3 -->
<div class="form-group g-mb-20 block-title g-brd-around">
<input data-th-field="*{websiteLinks.link3.id}" type="hidden">

<label class="col-sm-3 col-form-label g-mb-10" for="title7">Beschreibung</label>
<input data-th-field="*{websiteLinks.link3.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="title7">URL</label>
<input data-th-field="*{websiteLinks.link3.data}" class="form-control form-control-md rounded-0" type="text" placeholder="Link zum Projekt/Webseite">
</div>
<!-- End Website Link 3 -->
<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>

</div>

<!-- Tab Einstellungen -->
Expand Down
13 changes: 13 additions & 0 deletions src/main/webapp/WEB-INF/templates/sites/static/wiki-syntax.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Login -->
<div class="row justify-content-center">
<div class="col-sm-8 col-lg-5">
<div class="u-shadow-v21 g-bg-white rounded g-py-40 g-px-30">
<header class="text-center mb-4">
<h2 class="h2 g-color-black g-font-weight-600">Wiki-Syntax</h2>
</header>

Die Anleitung zur Nutzung der Wiki-Syntax auf Holarse!

</div>
</div>
</div>

0 comments on commit 66bc36a

Please sign in to comment.