Commit 96980237 authored by Matija Obreza's avatar Matija Obreza
Browse files

Entities have auto-generated id < 0

parent f0155e8c
......@@ -76,8 +76,11 @@ public class ActivityPostController extends BaseController {
@PreAuthorize("hasRole('ADMINISTRATOR')")
@RequestMapping(value = "/update", params = { "id" }, method = { RequestMethod.POST })
public String updatePost(ModelMap model, @RequestParam("id") long id, @RequestParam("title") String title, @RequestParam("body") String body) {
contentService.updateActivityPost(id, title, body);
if (id<0) {
contentService.createActivityPost(title, body);
} else {
contentService.updateActivityPost(id, title, body);
}
return "redirect:/";
}
......
......@@ -12,7 +12,7 @@
</h1>
<form role="form" class="form-horizontal validate" action="<c:url value="/admin/oauth-clients/save-client" />" method="post">
<c:if test="${clientDetails != null}">
<c:if test="${clientDetails.id gt 0}">
<input type="hidden" name="id" value="${clientDetails.id}" />
</c:if>
<c:if test="${clientDetails == null}">
......
......@@ -12,7 +12,7 @@
</h1>
<form role="form" class="form-horizontal" action="<c:url value="/content/activitypost/update" />" method="post">
<c:if test="${activityPost.id ne null}">
<c:if test="${activityPost.id gt 0}">
<input type="hidden" name="id" value="${activityPost.id}" />
</c:if>
<div class="form-group">
......
......@@ -36,7 +36,7 @@
<form dir="${article.lang=='fa' || article.lang=='ar' ? 'rtl' : 'ltr'}" role="form" id="editForm" class="form-horizontal" action="<c:url value="${url}" />" method="post">
<c:choose>
<c:when test="${article.id ne null}">
<c:when test="${article.id gt 0}">
<input type="hidden" name="id" value="${article.id}" />
</c:when>
<c:when test="${article.targetId ne null}">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment