Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polish-community-beth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Beth Davies
polish-community-beth
Commits
e2ef9341
Commit
e2ef9341
authored
9 months ago
by
Marnuri Nitish -
Browse files
Options
Downloads
Patches
Plain Diff
Add success message for create event
parent
3ebe19bb
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/polish_community_group_11/polish_community/event/controllers/EventController.java
+3
-1
3 additions, 1 deletion
...1/polish_community/event/controllers/EventController.java
src/main/resources/templates/event/event.html
+3
-0
3 additions, 0 deletions
src/main/resources/templates/event/event.html
with
6 additions
and
1 deletion
src/main/java/polish_community_group_11/polish_community/event/controllers/EventController.java
+
3
−
1
View file @
e2ef9341
...
...
@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
polish_community_group_11.polish_community.event.models.viewmodel.EventForm
;
import
org.springframework.web.bind.annotation.*
;
import
polish_community_group_11.polish_community.event.models.Event
;
...
...
@@ -83,7 +84,7 @@ public class EventController {
@PostMapping
(
"event/add"
)
public
ModelAndView
addEvent
(
@Valid
@ModelAttribute
(
"event"
)
EventForm
event
,
BindingResult
bindingResult
,
Model
model
,
Principal
principal
)
throws
SQLException
{
Principal
principal
,
RedirectAttributes
redirectAttributes
)
throws
SQLException
{
ModelAndView
modelAndView
=
new
ModelAndView
(
"event/add-event"
);
if
(
bindingResult
.
hasErrors
())
{
modelAndView
.
addObject
(
model
.
asMap
());
...
...
@@ -97,6 +98,7 @@ public class EventController {
throw
new
NullPointerException
(
"New event is empty or null"
);
}
eventService
.
addNewEvent
(
event
.
processEventForm
(),
principal
.
getName
());
redirectAttributes
.
addFlashAttribute
(
"successMessage"
,
"Event created successfully!"
);
modelAndView
.
setViewName
(
"redirect:/event"
);
}
return
modelAndView
;
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/event/event.html
+
3
−
0
View file @
e2ef9341
...
...
@@ -36,5 +36,8 @@
</div>
</div>
<script
src=
"/js/event/event.js"
></script>
<script
th:if=
"${successMessage}"
>
alert
(
"
Event created successfully
"
);
</script>
</section>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment