Skip to content

Commit

Permalink
session info stuff all set up woo
Browse files Browse the repository at this point in the history
  • Loading branch information
TangentFoxy committed Sep 5, 2016
1 parent e19960e commit c7f04ef
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
12 changes: 8 additions & 4 deletions blog.moon
Expand Up @@ -164,7 +164,8 @@ class extends lapis.Application
if post = Posts\create fields
return redirect_to: @url_for "blog_edit", slug: post.slug
else
return "Failed to create post.", status: 500
@session.info = "Failed to create post."
return redirect_to: @url_for "blog_new"
}

[edit: "/edit/:slug"]: respond_to {
Expand Down Expand Up @@ -220,7 +221,8 @@ class extends lapis.Application
a class: "pure-button", href: @url_for("blog_drafts"), "Drafts"
a class: "pure-button", href: @url_for("blog_new"), "New Post"
else
return "That post does not exist."
@session.info = "That post does not exist."
return redirect_to: @url_for "blog_drafts"

POST: =>
unless @session.id and (Users\find id: @session.id).admin
Expand All @@ -243,10 +245,12 @@ class extends lapis.Application
if success
return redirect_to: @url_for "blog_edit", slug: fields.slug or post.slug
else
return "Error updating post: #{errMsg}", status: 500 --TODO fix other errors to be like this one
@session.id = "Error updating post: #{errMsg}"
return redirect_to: @url_for "blog_edit", slug: @params.slug

else
return "That post does not exist."
@session.info = "That post does not exist."
return redirect_to: @url_for "blog_drafts"
}

[drafts: "/drafts"]: =>
Expand Down
12 changes: 8 additions & 4 deletions ksp.moon
Expand Up @@ -88,7 +88,8 @@ class extends lapis.Application
if craft
return redirect_to: @url_for "ksp_craft", id: craft.id
else
return errMsg
@session.info = "Craft submission failed: #{errMsg}"
return redirect_to: @url_for "ksp_submit_crafts"
}

[craft_list: "/crafts(/:page[%d])"]: =>
Expand Down Expand Up @@ -270,6 +271,7 @@ class extends lapis.Application
})();"

else
@session.info = "That craft does not exist."
return redirect_to: @url_for "ksp_craft_list"

POST: =>
Expand Down Expand Up @@ -310,13 +312,15 @@ class extends lapis.Application

if @params.delete
if craft\delete!
return "Craft deleted." --shitty prompt whatever, TODO replace with better!
@session.info = "Craft deleted."
return redirect_to: @url_for "ksp_craft_list"
else
return status: 500, "Error deleting craft!"
@session.info = "Error deleting craft!"
--return redirect_to: @url_for "ksp_craft", id: @params.id

if next fields
craft\update fields
--TODO should have a prompt about successful update
@session.info = "Craft updated."

return redirect_to: @url_for("ksp_craft", id: @params.id)
}
4 changes: 2 additions & 2 deletions misc.moon
Expand Up @@ -9,7 +9,7 @@ class extends lapis.Application
iframe src: "https://discordapp.com/widget?id=98612945000345600&theme=dark", width: 350, height: 500, allowtransparency: true, frameborder: 0
h2 "YouTuber Gamers"
p ->
text "Kind of ghost town right now, but "
text "Kind of a ghost town right now, but "
em "you"
text " can fix that."
div ->
Expand Down Expand Up @@ -38,7 +38,7 @@ class extends lapis.Application
li "#roleplay .. some of our users like to roleplay .. I made this so they'd get out of #general .."
li "#bot-abuse is for playing with BoomBot, developed by Lomeli. :P"
li "#boomtest is a testing channel for Lomeli's use on BoomBot development."
hr! --no idea if this will be valid syntax lol
hr!
li "More rules may be added as needed, obviously."
li title: "If you don't like it, see http://xkcd.com/1357/", "And finally, if you are causing significant annoyance to several members, especially if they are friends of mine, I may ban you."

Expand Down
1 change: 1 addition & 0 deletions static/css/site.css
Expand Up @@ -54,6 +54,7 @@ h1, h2 {
padding: 8px;
border-radius: 6px;
background: lightblue;
margin-bottom: 1em; /* will look good on /blog, might look terrible on /ksp */
}

.info > button {
Expand Down
2 changes: 1 addition & 1 deletion users
Submodule users updated 2 files
+5 −2 ReadMe.md
+28 −14 users.moon

0 comments on commit c7f04ef

Please sign in to comment.