added favorite usage
This commit is contained in:
@ -7,7 +7,7 @@ plugins {
|
|||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
|
|
||||||
group = 'de.jottyfan'
|
group = 'de.jottyfan'
|
||||||
version = '1.4.0'
|
version = '1.4.1'
|
||||||
|
|
||||||
description = """timetrack"""
|
description = """timetrack"""
|
||||||
|
|
||||||
|
@ -174,4 +174,11 @@ public class DoneController extends CommonController {
|
|||||||
doneService.unfavorize(id);
|
doneService.unfavorize(id);
|
||||||
return "redirect:/done/list";
|
return "redirect:/done/list";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RolesAllowed("timetrack_user")
|
||||||
|
@GetMapping(value = "/done/usefav/{id}")
|
||||||
|
public String usefavorite(@PathVariable Integer id) {
|
||||||
|
doneService.usefavorite(id);
|
||||||
|
return "redirect:/done/list";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.jooq.DSLContext;
|
import org.jooq.DSLContext;
|
||||||
import org.jooq.DeleteConditionStep;
|
import org.jooq.DeleteConditionStep;
|
||||||
|
import org.jooq.InsertOnDuplicateStep;
|
||||||
import org.jooq.InsertReturningStep;
|
import org.jooq.InsertReturningStep;
|
||||||
import org.jooq.InsertValuesStep7;
|
import org.jooq.InsertValuesStep7;
|
||||||
import org.jooq.Record5;
|
import org.jooq.Record5;
|
||||||
@ -517,4 +518,22 @@ public class DoneGateway {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a new entry as the favorite tells
|
||||||
|
*
|
||||||
|
* @param fkFavorite the id of the favorite
|
||||||
|
*/
|
||||||
|
public void useFav(Integer fkFavorite) {
|
||||||
|
InsertOnDuplicateStep<TDoneRecord> sql = getJooq()
|
||||||
|
// @formatter:off
|
||||||
|
.insertInto(T_DONE, T_DONE.FK_LOGIN, T_DONE.FK_PROJECT, T_DONE.FK_MODULE, T_DONE.FK_JOB, T_DONE.FK_BILLING)
|
||||||
|
.select(getJooq()
|
||||||
|
.select(T_FAVORITE.FK_LOGIN, T_FAVORITE.FK_PROJECT, T_FAVORITE.FK_MODULE, T_FAVORITE.FK_JOB, T_FAVORITE.FK_BILLING)
|
||||||
|
.from(T_FAVORITE)
|
||||||
|
.where(T_FAVORITE.PK_FAVORITE.eq(fkFavorite)));
|
||||||
|
// @formatter:on
|
||||||
|
LOGGER.trace(sql);
|
||||||
|
sql.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,4 +219,11 @@ public class DoneService {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void usefavorite(Integer fkFavorite) {
|
||||||
|
try {
|
||||||
|
new DoneGateway(dsl).useFav(fkFavorite);
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Favoriten</button>
|
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Favoriten</button>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li th:each="f : ${favorites}">
|
<li th:each="f : ${favorites}">
|
||||||
<a class="dropdown-item" href="#"><span th:text="${f.project} + ' ' + ${f.module} + ' ' + ${f.job}"></span></a>
|
<a class="dropdown-item" th:href="@{/done/usefav/{id}(id=${f.fkFavorite})}"><span th:text="${f.project} + ' ' + ${f.module} + ' ' + ${f.job}"></span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user