Compare commits
	
		
			2 Commits
		
	
	
		
			bff5d1e54f
			...
			0999d41d64
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 0999d41d64 | ||
|  | 5356e51f09 | 
| @@ -1,2 +1,13 @@ | ||||
| arguments= | ||||
| auto.sync=false | ||||
| build.scans.enabled=false | ||||
| connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||||
| connection.project.dir= | ||||
| eclipse.preferences.version=1 | ||||
| gradle.user.home= | ||||
| java.home= | ||||
| jvm.arguments= | ||||
| offline.mode=false | ||||
| override.workspace.settings=false | ||||
| show.console.view=false | ||||
| show.executions.view=false | ||||
|   | ||||
| @@ -8,7 +8,7 @@ plugins { | ||||
| } | ||||
|  | ||||
| group = 'de.jottyfan.bico' | ||||
| version = '0.0.3' | ||||
| version = '0.0.4' | ||||
|  | ||||
| description = """BibleClassOrganizer""" | ||||
|  | ||||
| @@ -41,7 +41,7 @@ war { | ||||
| } | ||||
|  | ||||
| dependencies { | ||||
|   implementation 'de.jottyfan:bicolib:3' | ||||
|   implementation 'de.jottyfan:bicolib:4' | ||||
|  | ||||
| 	implementation 'org.springframework.boot:spring-boot-starter-jooq' | ||||
| 	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' | ||||
|   | ||||
| @@ -1,8 +1,14 @@ | ||||
| package de.jottyfan.bico.modules.subject; | ||||
|  | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.ui.Model; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.ModelAttribute; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
|  | ||||
| import de.jottyfan.bico.db.tables.records.TSubjectRecord; | ||||
| import de.jottyfan.bico.modules.CommonController; | ||||
|  | ||||
| /** | ||||
| @@ -13,8 +19,44 @@ import de.jottyfan.bico.modules.CommonController; | ||||
| @Controller | ||||
| public class SubjectController extends CommonController { | ||||
|  | ||||
| 	@Autowired | ||||
| 	private SubjectService service; | ||||
|  | ||||
| 	@GetMapping("/subject/list") | ||||
| 	public String getSubjectList(Model model) { | ||||
| 		model.addAttribute("list", service.getSubjects()); | ||||
| 		return "/subject/list"; | ||||
| 	} | ||||
|  | ||||
| 	@GetMapping("/subject/{id}") | ||||
| 	public String getSubject(@PathVariable("id") Integer pkSubject, Model model) { | ||||
| 		model.addAttribute("bean", service.getSubject(pkSubject)); | ||||
| 		model.addAttribute("sources", service.getSources()); | ||||
| 		return "/subject/item"; | ||||
| 	} | ||||
|  | ||||
| 	@PostMapping("/subject/save") | ||||
| 	public String saveSubject(@ModelAttribute("bean") TSubjectRecord bean) { | ||||
| 		service.save(bean); | ||||
| 		return "redirect:/subject/list"; | ||||
| 	} | ||||
|  | ||||
| 	@GetMapping("/subject/{id}/delete") | ||||
| 	public String checkDeletionOfSubject(@PathVariable("id") Integer pkSubject, Model model) { | ||||
| 		model.addAttribute("bean", service.getBeanIfDeletable(pkSubject)); | ||||
| 		return "/subject/delete"; | ||||
| 	} | ||||
|  | ||||
| 	@GetMapping("/subject/{id}/remove") | ||||
| 	public String removeSubject(@PathVariable("id") Integer pkSubject, Model model) { | ||||
| 		service.removeSubject(pkSubject); | ||||
| 		return "redirect:/subject/list"; | ||||
| 	} | ||||
|  | ||||
| 	@GetMapping("/subject/new") | ||||
| 	public String loadNewSubjectForm() { | ||||
| 		return "/subject/new"; | ||||
| 	public String loadNewSubjectForm(Model model) { | ||||
| 		model.addAttribute("bean", new TSubjectRecord()); | ||||
| 		model.addAttribute("sources", service.getSources()); | ||||
| 		return "/subject/item"; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,115 @@ | ||||
| package de.jottyfan.bico.modules.subject; | ||||
|  | ||||
| import static de.jottyfan.bico.db.Tables.T_LESSON_SUBJECT; | ||||
| import static de.jottyfan.bico.db.Tables.T_SOURCE; | ||||
| import static de.jottyfan.bico.db.Tables.T_SUBJECT; | ||||
| import static de.jottyfan.bico.db.Tables.V_LESSON; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import org.apache.logging.log4j.LogManager; | ||||
| import org.apache.logging.log4j.Logger; | ||||
| import org.jooq.DSLContext; | ||||
| import org.jooq.DeleteConditionStep; | ||||
| import org.jooq.InsertValuesStep8; | ||||
| import org.jooq.SelectConditionStep; | ||||
| import org.jooq.SelectOrderByStep; | ||||
| import org.jooq.SelectWhereStep; | ||||
| import org.jooq.UpdateConditionStep; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Repository; | ||||
|  | ||||
| import de.jottyfan.bico.db.tables.records.TSourceRecord; | ||||
| import de.jottyfan.bico.db.tables.records.TSubjectRecord; | ||||
| import de.jottyfan.bico.db.tables.records.VLessonRecord; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author jotty | ||||
|  * | ||||
|  */ | ||||
| @Repository | ||||
| public class SubjectRepository { | ||||
| 	private static final Logger LOGGER = LogManager.getLogger(SubjectRepository.class); | ||||
|  | ||||
| 	@Autowired | ||||
| 	private DSLContext jooq; | ||||
|  | ||||
| 	public List<VLessonRecord> getSubjects() { | ||||
| 		SelectWhereStep<VLessonRecord> sql = jooq.selectFrom(V_LESSON); | ||||
| 		LOGGER.trace(sql); | ||||
| 		return sql.fetch().stream().toList(); | ||||
| 	} | ||||
|  | ||||
| 	public List<TSourceRecord> getSources() { | ||||
| 		SelectWhereStep<TSourceRecord> sql = jooq.selectFrom(T_SOURCE); | ||||
| 		LOGGER.trace(sql); | ||||
| 		return sql.fetch().stream().toList(); | ||||
| 	} | ||||
|  | ||||
| 	public TSubjectRecord getSubject(Integer pkSubject) { | ||||
| 		SelectConditionStep<TSubjectRecord> sql = jooq | ||||
| 		// @formatter:off | ||||
| 			.selectFrom(T_SUBJECT) | ||||
| 			.where(T_SUBJECT.PK_SUBJECT.eq(pkSubject)); | ||||
| 		// @formatter:on | ||||
| 		LOGGER.trace(sql); | ||||
| 		return sql.fetchOne(); | ||||
| 	} | ||||
|  | ||||
| 	public void addSubject(TSubjectRecord bean) { | ||||
| 		InsertValuesStep8<TSubjectRecord, Integer, String, String, String, String, String, String, Integer> sql = jooq | ||||
| 		// @formatter:off | ||||
| 			.insertInto(T_SUBJECT, | ||||
| 									T_SUBJECT.FK_SOURCE, | ||||
| 									T_SUBJECT.THEME, | ||||
| 									T_SUBJECT.SUBTHEME, | ||||
| 									T_SUBJECT.BOOK_PAGES, | ||||
| 									T_SUBJECT.WORKSHEETS, | ||||
| 									T_SUBJECT.BIBLEVERSE, | ||||
| 									T_SUBJECT.NOTES, | ||||
| 									T_SUBJECT.ORDER_NR) | ||||
| 			.values(bean.getFkSource(), bean.getTheme(), bean.getSubtheme(), bean.getBookPages(), bean.getWorksheets(), | ||||
| 					    bean.getBibleverse(), bean.getNotes(), bean.getOrderNr()); | ||||
| 		// @formatter:on | ||||
| 		LOGGER.trace(sql); | ||||
| 		sql.execute(); | ||||
| 	} | ||||
|  | ||||
| 	public void updateSubject(TSubjectRecord bean) { | ||||
| 		UpdateConditionStep<TSubjectRecord> sql = jooq | ||||
| 		// @formatter:off | ||||
| 			.update(T_SUBJECT) | ||||
| 			.set(T_SUBJECT.FK_SOURCE, bean.getFkSource()) | ||||
| 			.set(T_SUBJECT.THEME, bean.getTheme()) | ||||
| 			.set(T_SUBJECT.SUBTHEME, bean.getSubtheme()) | ||||
| 			.set(T_SUBJECT.BOOK_PAGES, bean.getBookPages()) | ||||
| 			.set(T_SUBJECT.WORKSHEETS, bean.getWorksheets()) | ||||
| 			.set(T_SUBJECT.BIBLEVERSE, bean.getBibleverse()) | ||||
| 			.set(T_SUBJECT.NOTES, bean.getNotes()) | ||||
| 			.set(T_SUBJECT.ORDER_NR, bean.getOrderNr()) | ||||
| 			.where(T_SUBJECT.PK_SUBJECT.eq(bean.getPkSubject())); | ||||
| 		// @formatter:on | ||||
| 		LOGGER.trace(sql); | ||||
| 		sql.execute(); | ||||
| 	} | ||||
|  | ||||
| 	public TSubjectRecord getBeanIfDeletable(Integer pkSubject) { | ||||
| 		SelectOrderByStep<TSubjectRecord> sql = jooq | ||||
| 		// @formatter:off | ||||
| 			.selectFrom(T_SUBJECT) | ||||
| 			.where(T_SUBJECT.PK_SUBJECT.notIn(jooq | ||||
| 				.select(T_LESSON_SUBJECT.FK_SUBJECT) | ||||
| 				.from(T_LESSON_SUBJECT))) | ||||
| 			.and(T_SUBJECT.PK_SUBJECT.eq(pkSubject)); | ||||
| 		// @formatter:off | ||||
| 		LOGGER.trace(sql); | ||||
| 		return sql.fetchOne(); | ||||
| 	} | ||||
|  | ||||
| 	public void removeSubject(Integer pkSubject) { | ||||
| 		DeleteConditionStep<TSubjectRecord> sql = jooq.deleteFrom(T_SUBJECT).where(T_SUBJECT.PK_SUBJECT.eq(pkSubject)); | ||||
| 		LOGGER.trace(sql); | ||||
| 		sql.execute(); | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,50 @@ | ||||
| package de.jottyfan.bico.modules.subject; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
|  | ||||
| import de.jottyfan.bico.db.tables.records.TSourceRecord; | ||||
| import de.jottyfan.bico.db.tables.records.TSubjectRecord; | ||||
| import de.jottyfan.bico.db.tables.records.VLessonRecord; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author jotty | ||||
|  * | ||||
|  */ | ||||
| @Service | ||||
| public class SubjectService { | ||||
|  | ||||
| 	@Autowired | ||||
| 	private SubjectRepository repository; | ||||
|  | ||||
| 	public List<VLessonRecord> getSubjects() { | ||||
| 		return repository.getSubjects(); | ||||
| 	} | ||||
|  | ||||
| 	public TSubjectRecord getSubject(Integer pkSubject) { | ||||
| 		return repository.getSubject(pkSubject); | ||||
| 	} | ||||
|  | ||||
| 	public List<TSourceRecord> getSources() { | ||||
| 		return repository.getSources(); | ||||
| 	} | ||||
|  | ||||
| 	public void save(TSubjectRecord bean) { | ||||
| 		if (bean.getPkSubject() == null) { | ||||
| 			repository.addSubject(bean); | ||||
| 		} else { | ||||
| 			repository.updateSubject(bean); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public TSubjectRecord getBeanIfDeletable(Integer pkSubject) { | ||||
| 		return repository.getBeanIfDeletable(pkSubject); | ||||
| 	} | ||||
|  | ||||
| 	public void removeSubject(Integer pkSubject) { | ||||
| 		repository.removeSubject(pkSubject); | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,164 @@ | ||||
| package de.jottyfan.bico.modules.subject.model; | ||||
|  | ||||
| import java.io.Serializable; | ||||
|  | ||||
| import de.jottyfan.bico.db.tables.records.TSubjectRecord; | ||||
|  | ||||
| /** | ||||
|  * | ||||
|  * @author jotty | ||||
|  * | ||||
|  */ | ||||
| public class SubjectBean implements Serializable { | ||||
| 	private static final long serialVersionUID = 1L; | ||||
|  | ||||
| 	private Integer pkSubject; | ||||
| 	private Integer fkSource; | ||||
| 	private String theme; | ||||
| 	private String subtheme; | ||||
| 	private String bookPages; | ||||
| 	private String worksheets; | ||||
| 	private String bibleverse; | ||||
| 	private String notes; | ||||
| 	private Integer orderNr; | ||||
|  | ||||
| 	public static final SubjectBean of(TSubjectRecord r) { | ||||
| 		SubjectBean bean = new SubjectBean(); | ||||
| 		bean.setPkSubject(r.getPkSubject()); | ||||
| 		bean.setFkSource(r.getFkSource()); | ||||
| 		bean.setTheme(r.getTheme()); | ||||
| 		bean.setSubtheme(r.getSubtheme()); | ||||
| 		bean.setBookPages(r.getBookPages()); | ||||
| 		bean.setWorksheets(r.getWorksheets()); | ||||
| 		bean.setBibleverse(r.getBibleverse()); | ||||
| 		bean.setNotes(r.getNotes()); | ||||
| 		bean.setOrderNr(r.getOrderNr()); | ||||
| 		return bean; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the pkSubject | ||||
| 	 */ | ||||
| 	public Integer getPkSubject() { | ||||
| 		return pkSubject; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param pkSubject the pkSubject to set | ||||
| 	 */ | ||||
| 	public void setPkSubject(Integer pkSubject) { | ||||
| 		this.pkSubject = pkSubject; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the fkSource | ||||
| 	 */ | ||||
| 	public Integer getFkSource() { | ||||
| 		return fkSource; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param fkSource the fkSource to set | ||||
| 	 */ | ||||
| 	public void setFkSource(Integer fkSource) { | ||||
| 		this.fkSource = fkSource; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the theme | ||||
| 	 */ | ||||
| 	public String getTheme() { | ||||
| 		return theme; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param theme the theme to set | ||||
| 	 */ | ||||
| 	public void setTheme(String theme) { | ||||
| 		this.theme = theme; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the subtheme | ||||
| 	 */ | ||||
| 	public String getSubtheme() { | ||||
| 		return subtheme; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param subtheme the subtheme to set | ||||
| 	 */ | ||||
| 	public void setSubtheme(String subtheme) { | ||||
| 		this.subtheme = subtheme; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the bookPages | ||||
| 	 */ | ||||
| 	public String getBookPages() { | ||||
| 		return bookPages; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param bookPages the bookPages to set | ||||
| 	 */ | ||||
| 	public void setBookPages(String bookPages) { | ||||
| 		this.bookPages = bookPages; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the worksheets | ||||
| 	 */ | ||||
| 	public String getWorksheets() { | ||||
| 		return worksheets; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param worksheets the worksheets to set | ||||
| 	 */ | ||||
| 	public void setWorksheets(String worksheets) { | ||||
| 		this.worksheets = worksheets; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the bibleverse | ||||
| 	 */ | ||||
| 	public String getBibleverse() { | ||||
| 		return bibleverse; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param bibleverse the bibleverse to set | ||||
| 	 */ | ||||
| 	public void setBibleverse(String bibleverse) { | ||||
| 		this.bibleverse = bibleverse; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the notes | ||||
| 	 */ | ||||
| 	public String getNotes() { | ||||
| 		return notes; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param notes the notes to set | ||||
| 	 */ | ||||
| 	public void setNotes(String notes) { | ||||
| 		this.notes = notes; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @return the orderNr | ||||
| 	 */ | ||||
| 	public Integer getOrderNr() { | ||||
| 		return orderNr; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * @param orderNr the orderNr to set | ||||
| 	 */ | ||||
| 	public void setOrderNr(Integer orderNr) { | ||||
| 		this.orderNr = orderNr; | ||||
| 	} | ||||
| } | ||||
| @@ -26,6 +26,7 @@ public class ThemeController extends CommonController { | ||||
| 	@GetMapping("/theme") | ||||
| 	public String getThemeManipulationBySlotId(@RequestParam("slotId") Integer slotId, Model model) { | ||||
| 		model.addAttribute("slotId", slotId); | ||||
| 		model.addAttribute("day", service.getSlotDay(slotId)); | ||||
| 		model.addAttribute("list", service.getThemeManipulation(slotId)); | ||||
| 		model.addAttribute("themes", service.getAllThemes()); | ||||
| 		model.addAttribute("lesson", service.getLesson(slotId)); | ||||
| @@ -49,6 +50,6 @@ public class ThemeController extends CommonController { | ||||
| 	@PostMapping("/theme/update") | ||||
| 	public String updateLesson(@RequestParam("slotId") Integer slotId, @ModelAttribute("lesson") TLessonRecord bean) { | ||||
| 		service.updateLesson(bean); | ||||
| 		return "redirect:/theme?slotId=" + bean.getFkSlot(); | ||||
| 		return "redirect:/theme?slotId=" + slotId; | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -2,9 +2,11 @@ package de.jottyfan.bico.modules.theme; | ||||
|  | ||||
| import static de.jottyfan.bico.db.Tables.T_LESSON; | ||||
| import static de.jottyfan.bico.db.Tables.T_LESSON_SUBJECT; | ||||
| import static de.jottyfan.bico.db.Tables.T_SLOT; | ||||
| import static de.jottyfan.bico.db.Tables.T_SOURCE; | ||||
| import static de.jottyfan.bico.db.Tables.T_SUBJECT; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
| @@ -13,6 +15,7 @@ import org.jboss.logging.Logger; | ||||
| import org.jooq.DSLContext; | ||||
| import org.jooq.DeleteConditionStep; | ||||
| import org.jooq.InsertOnDuplicateStep; | ||||
| import org.jooq.Record1; | ||||
| import org.jooq.Record10; | ||||
| import org.jooq.Record4; | ||||
| import org.jooq.SelectConditionStep; | ||||
| @@ -138,4 +141,15 @@ public class ThemeRepository { | ||||
| 		sql.execute(); | ||||
| 	} | ||||
|  | ||||
| 	public LocalDate getSlotDay(Integer slotId) { | ||||
| 		SelectConditionStep<Record1<LocalDate>> sql = jooq | ||||
| 		// @formatter:off | ||||
| 			.select(T_SLOT.SLOT_DAY) | ||||
| 			.from(T_SLOT) | ||||
| 			.where(T_SLOT.PK_SLOT.eq(slotId)); | ||||
| 		// @formatter:on | ||||
| 		LOGGER.trace(sql); | ||||
| 		return sql.fetchOne().get(T_SLOT.SLOT_DAY); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| package de.jottyfan.bico.modules.theme; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.List; | ||||
|  | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -44,4 +45,7 @@ public class ThemeService { | ||||
| 		repository.updateLesson(bean); | ||||
| 	} | ||||
|  | ||||
| 	public LocalDate getSlotDay(Integer slotId) { | ||||
| 		return repository.getSlotDay(slotId); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -45,4 +45,9 @@ body { | ||||
| 	padding: 4px; | ||||
| 	margin: 4px; | ||||
| 	border-radius: 4px; | ||||
| } | ||||
|  | ||||
| .centeredalert { | ||||
| 	width: 400px; | ||||
| 	margin: auto; | ||||
| } | ||||
| @@ -32,15 +32,14 @@ | ||||
| 						  	</div> | ||||
| 						  </div> | ||||
| 						</td> | ||||
| 						<td><span th:text="${s.slotNotes}" class="rightpadding64"></span><a th:href="@{/slot/{id}(id=${s.pkSlot})}" class="btn btn-outline-secondary rightaligned"><i | ||||
| 								class="bi bi-pencil"></i></a></td> | ||||
| 						<td><a th:href="@{/slot/{id}(id=${s.pkSlot})}" class="btn btn-outline-secondary rightaligned"><i class="bi bi-pencil"></i></a> | ||||
| 						    <span th:text="${s.slotNotes}" class="rightpadding64"></span></td> | ||||
| 					</tr> | ||||
| 				</tbody> | ||||
| 				<tfoot> | ||||
| 					<tr> | ||||
| 						<td colspan="4"> | ||||
| 							<a th:href="@{/slot}" class="btn btn-outline-success">ein neues Datum anlegen</a> | ||||
| 							<a th:href="@{/subject/new}" class="btn btn-outline-primary">ein neues Thema anlegen</a> | ||||
| 						</td> | ||||
| 					</tr> | ||||
| 				</tfoot> | ||||
|   | ||||
							
								
								
									
										18
									
								
								src/main/resources/templates/subject/delete.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/main/resources/templates/subject/delete.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| <!DOCTYPE html> | ||||
| <html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"> | ||||
| <body> | ||||
| 	<th:block layout:fragment="content"> | ||||
| 		<div class="borderdist"> | ||||
| 			<div class="alert alert-danger centeredalert" th:if="${bean}"> | ||||
| 				Soll das Thema <span th:text="${bean.theme}" style="font-weight: bolder"></span> wirklich gelöscht werden? | ||||
| 				<br /> | ||||
| 				<br /> | ||||
| 				<a th:href="@{/subject/{id}/remove(id=${bean.pkSubject})}" class="btn btn-outline-danger">Ja, wirklich löschen</a> | ||||
| 			</div> | ||||
| 			<div class="alert alert-warning centeredalert" th:unless="${bean}"> | ||||
| 				Dieses Thema kann nicht gelöscht werden. Möglicherweise wurde es bereits in der Vergangenheit gehalten. | ||||
| 			</div> | ||||
| 		</div> | ||||
| 	</th:block> | ||||
| </body> | ||||
| </html> | ||||
							
								
								
									
										40
									
								
								src/main/resources/templates/subject/item.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/main/resources/templates/subject/item.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| <!DOCTYPE html> | ||||
| <html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"> | ||||
| <body> | ||||
| 	<th:block layout:fragment="content"> | ||||
| 		<div class="borderdist"> | ||||
| 			<form th:action="@{/subject/save}" method="post" th:object="${bean}"> | ||||
| 				<input type="hidden" th:field="*{pkSubject}" /> | ||||
| 				<div class="container"> | ||||
| 					<div class="row g-2"> | ||||
| 						<div class="col-sm-3">Quelle</div> | ||||
| 						<div class="col-sm-9"><select th:field="*{fkSource}" class="form-select"> | ||||
| 							<option th:each="o : ${sources}" th:value="${o.pkSource}" th:text="${o.name}"></option> | ||||
| 						</select></div> | ||||
| 						<div class="col-sm-3">Thema</div> | ||||
| 						<div class="col-sm-9"><input type="text" th:field="*{theme}" class="form-control" /></div> | ||||
| 						<div class="col-sm-3">Unterthema</div> | ||||
| 						<div class="col-sm-9"><input type="text" th:field="*{subtheme}" class="form-control" /></div> | ||||
| 						<div class="col-sm-3">Buchseiten</div> | ||||
| 						<div class="col-sm-9"><input type="text" th:field="*{bookPages}" class="form-control" /></div> | ||||
| 						<div class="col-sm-3">Arbeitsblätter</div> | ||||
| 						<div class="col-sm-9"><input type="text" th:field="*{worksheets}" class="form-control" /></div> | ||||
| 						<div class="col-sm-3">Bibelvers / Lernvers</div> | ||||
| 						<div class="col-sm-9"><input type="text" th:field="*{bibleverse}" class="form-control" /></div> | ||||
| 						<div class="col-sm-3">Anmerkungen</div> | ||||
| 						<div class="col-sm-9"><input type="text" th:field="*{notes}" class="form-control" /></div> | ||||
| 						<div class="col-sm-3">Reihenfolge</div> | ||||
| 						<div class="col-sm-9"><input type="number" th:field="*{orderNr}" class="form-control" /></div> | ||||
| 						<div class="col-sm-3"> </div> | ||||
| 						<div class="col-sm-9"> | ||||
| 							<button type="submit" class="btn btn-outline-primary">Übernehmen</button> | ||||
| 							<a th:href="@{/subject/list}" class="btn btn-outline-secondary">Abbrechen</a> | ||||
| 							<a th:href="@{/subject/{id}/delete(id=${bean.pkSubject})}" class="btn btn-outline-danger" th:if="${bean.pkSubject}">Löschen</a> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 				</div> | ||||
| 			</form> | ||||
| 		</div> | ||||
| 	</th:block> | ||||
| </body> | ||||
| </html> | ||||
							
								
								
									
										52
									
								
								src/main/resources/templates/subject/list.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/main/resources/templates/subject/list.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| <!DOCTYPE html> | ||||
| <html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"> | ||||
| <body> | ||||
| 	<th:block layout:fragment="content"> | ||||
| 		<div class="borderdist"> | ||||
| 			<table id="table" class="table table-striped"> | ||||
| 				<thead> | ||||
| 					<tr> | ||||
| 						<th>Quelle</th> | ||||
| 						<th>Thema</th> | ||||
| 						<th>gehalten</th> | ||||
| 						<th>Reihenfolge</th> | ||||
| 						<th></th> | ||||
| 					</tr> | ||||
| 				</thead> | ||||
| 				<tbody> | ||||
| 					<tr th:each="s : ${list}"> | ||||
| 						<td th:text="${s.sourceName}"></td> | ||||
| 						<td> | ||||
| 						  <div><span th:text="${s.theme}" style="font-weight: bolder"></span></div> | ||||
| 							<div th:text="${s.subtheme}"></div> | ||||
| 						</td> | ||||
| 						<td><div th:text="${#temporals.format(d, 'dd.MM.yyyy')}" th:each="d : ${s.slots}"></div></td> | ||||
| 						<td th:text="${s.orderNr}"></td> | ||||
| 						<td> | ||||
| 						  <a th:href="@{/subject/{id}(id=${s.pkSubject})}" class="btn btn-outline-secondary"><i class="bi bi-pencil"></i></a> | ||||
| 						  <a th:href="@{/subject/{id}/delete(id=${s.pkSubject})}" class="btn btn-outline-danger" th:if="${s.slots.length < 1}"><i class="bi bi-trash"></i></a> | ||||
| 						</td> | ||||
| 					</tr> | ||||
| 				</tbody> | ||||
| 				<tfoot> | ||||
| 					<tr> | ||||
| 						<td colspan="5"> | ||||
| 							<a th:href="@{/subject/new}" class="btn btn-outline-primary">ein neues Thema anlegen</a> | ||||
| 						</td> | ||||
| 					</tr> | ||||
| 				</tfoot> | ||||
| 			</table> | ||||
| 			<script th:inline="javascript"> | ||||
| 				/*<![CDATA[*/ | ||||
| 				$(document).ready(function() { | ||||
| 					$("#table").DataTable({ | ||||
| 						"order" : [ [ 3, 'asc' ] ], | ||||
| 						"language" : locale_de | ||||
| 					}); | ||||
| 				}); | ||||
| 				/*]]>*/ | ||||
| 			</script> | ||||
| 		</div> | ||||
| 	</th:block> | ||||
| </body> | ||||
| </html> | ||||
| @@ -1,21 +0,0 @@ | ||||
| <!DOCTYPE html> | ||||
| <html xmlns:th="http://www.thymeleaf.org" layout:decorate="~{template}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:sec="http://www.thymeleaf.org/extras/spring-security"> | ||||
| <body> | ||||
| 	<th:block layout:fragment="content"> | ||||
| 		<div class="borderdist"> | ||||
| 			TODO: implement | ||||
| 			<pre> | ||||
| 			fields: | ||||
| 				fk_source | ||||
| 				theme | ||||
| 				subtheme | ||||
| 				book_pages | ||||
| 				worksheets | ||||
| 				bibleverse | ||||
| 				notes | ||||
| 				order_nr | ||||
| 			</pre> | ||||
| 		</div> | ||||
| 	</th:block> | ||||
| </body> | ||||
| </html> | ||||
| @@ -22,7 +22,8 @@ | ||||
| 		</button> | ||||
| 		<div class="collapse navbar-collapse" id="navbarSupportedContent" style="margin-right: 20px"> | ||||
| 			<ul class="navbar-nav mb-2 mb-lg-0"> | ||||
| 				<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/}" style="margin-left: 12px">Startseite</a></li> | ||||
| 				<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/}" style="margin-left: 12px">Einteilung</a></li> | ||||
| 				<li class="nav-item"><a class="btn btn-outline-secondary" th:href="@{/subject/list}" style="margin-left: 12px">Themen</a></li> | ||||
| 			</ul> | ||||
| 			<ul layout:fragment="header"></ul> | ||||
| 			<ul class="nav navbar-nav ms-auto"> | ||||
|   | ||||
| @@ -4,32 +4,51 @@ | ||||
| 	<th:block layout:fragment="content"> | ||||
| 		<div class="borderdist"> | ||||
| 			<div class="container"> | ||||
| 				<div class="row g-2"> | ||||
| 					<h1> | ||||
| 						Themen für den <span th:text="${#temporals.format(day, 'dd.MM.yyyy')}"></span> | ||||
| 					</h1> | ||||
| 				</div> | ||||
| 				<th:block th:each="b : ${list}" th:if="${list.size() > 0}"> | ||||
| 					<div class="row g-2 blockframe"> | ||||
| 						<div class="col-sm-3">Thema:</div> | ||||
| 						<div class="col-sm-8"><span th:text="${b.theme}"></span></div> | ||||
| 						<div class="col-sm-8"> | ||||
| 							<span th:text="${b.theme}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-1"> | ||||
| 							<div class="dropdown"> | ||||
|   							<button class="btn btn-outline-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> | ||||
|     							<i class="bi bi-trash"></i> | ||||
|   							</button> | ||||
|   							<ul class="dropdown-menu"> | ||||
|     							<li><a class="dropdown-item" th:href="@{/theme/delete?lessonSubjectId={id}&slotId={s}(id=${b.pkLessonSubject},s=${slotId})}">ja, endgültig verwerfen</a></li> | ||||
|   							</ul> | ||||
| 								<button class="btn btn-outline-danger dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"> | ||||
| 									<i class="bi bi-trash"></i> | ||||
| 								</button> | ||||
| 								<ul class="dropdown-menu"> | ||||
| 									<li><a class="dropdown-item" th:href="@{/theme/delete?lessonSubjectId={id}&slotId={s}(id=${b.pkLessonSubject},s=${slotId})}">ja, endgültig verwerfen</a></li> | ||||
| 								</ul> | ||||
| 							</div> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3">Unterthema:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.subtheme}"></span></div> | ||||
| 						<div class="col-sm-3">Buchseiten:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.bookPages}"></span></div> | ||||
| 						<div class="col-sm-3">Arbeitsblätter:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.worksheets}"></span></div> | ||||
| 						<div class="col-sm-3">Bibelvers (Lernvers):</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.bibleverse}"></span></div> | ||||
| 						<div class="col-sm-3">Anmerkungen zum Thema:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.notes}"></span></div> | ||||
| 						<div class="col-sm-3" th:if="${b.subtheme}">Unterthema:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.subtheme}"> | ||||
| 							<span th:text="${b.subtheme}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.bookPages}">Buchseiten:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.bookPages}"> | ||||
| 							<span th:text="${b.bookPages}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.worksheets}">Arbeitsblätter:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.worksheets}"> | ||||
| 							<span th:text="${b.worksheets}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.bibleverse}">Bibelvers (Lernvers):</div> | ||||
| 						<div class="col-sm-9" th:if="${b.bibleverse}"> | ||||
| 							<span th:text="${b.bibleverse}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3" th:if="${b.notes}">Anmerkungen zum Thema:</div> | ||||
| 						<div class="col-sm-9" th:if="${b.notes}"> | ||||
| 							<span th:text="${b.notes}"></span> | ||||
| 						</div> | ||||
| 						<div class="col-sm-3">Quelle:</div> | ||||
| 						<div class="col-sm-9"><span th:text="${b.sourceName}"></span></div> | ||||
| 						<div class="col-sm-9"> | ||||
| 							<span th:text="${b.sourceName}"></span> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 				</th:block> | ||||
| 				<form th:action="@{/theme/update?slotId={id}(id=${slotId})}" method="post" th:object="${lesson}"> | ||||
| @@ -50,11 +69,13 @@ | ||||
| 					<div class="row g-2"> | ||||
| 						<div class="col-sm-3">ein Thema hinzufügen</div> | ||||
| 						<div class="col-sm-7"> | ||||
| 						  <select name="pkSubject" class="form-select"> | ||||
| 							<select name="pkSubject" class="form-select"> | ||||
| 								<option th:each="t : ${themes}" th:value="${t.key}" th:text="${t.value}"></option> | ||||
| 						  </select> | ||||
| 						 </div> | ||||
| 						<div class="col-sm-2"><button type="submit" class="btn btn-outline-primary">hinzufügen</button></div> | ||||
| 							</select> | ||||
| 						</div> | ||||
| 						<div class="col-sm-2"> | ||||
| 							<button type="submit" class="btn btn-outline-primary">hinzufügen</button> | ||||
| 						</div> | ||||
| 					</div> | ||||
| 				</form> | ||||
| 			</div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user