Skip to content

Commit

Permalink
I love this song so much! <3
Browse files Browse the repository at this point in the history
  • Loading branch information
TangentFoxy committed Jan 6, 2018
1 parent 81819e5 commit bea1534
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions applications/posts.moon
Expand Up @@ -150,14 +150,15 @@ class extends lapis.Application
}

[delete: "/delete/:id[%d]"]: =>
if is_admin @
if post = Posts\find id: @params.id
if post\delete!
@session.info = "Post deleted."
else
@session.info = "Error while deleting post!"
return redirect_to: @url_for "posts_edit", id: @params.id
unless is_admin @ return redirect_to: @url_for "posts_index"

if post = Posts\find id: @params.id
if post\delete!
@session.info = "Post deleted."
else
@session.info = "A post with ID #{@params.id} does not exist. (Perhaps it was already deleted?)"
@session.info = "Error while deleting post!"
return redirect_to: @url_for "posts_edit", id: @params.id
else
@session.info = "A post with ID #{@params.id} does not exist. (Perhaps it was already deleted?)"

return redirect_to: @url_for "posts_index"
return redirect_to: @url_for "posts_admin_index"

0 comments on commit bea1534

Please sign in to comment.