Skip to content

Commit

Permalink
fixing the post editing hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
TangentFoxy committed Jan 5, 2018
1 parent d8f670a commit 1a94e64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions applications/posts.moon
Expand Up @@ -14,7 +14,7 @@ class extends lapis.Application
[index: "s(/:page[%d])"]: =>
return "Temporarily out of order."

[post: "/:slug"]: =>
[render: "/:slug"]: =>
return "To be written."

[new: "/new"]: respond_to {
Expand Down Expand Up @@ -57,7 +57,7 @@ class extends lapis.Application
post, err = Posts\create fields
if post
if fields.status == Posts.statuses.published
return redirect_to: @url_for "posts_post", slug: post.slug
return redirect_to: @url_for "posts_render", slug: post.slug
else
return redirect_to: @url_for "posts_edit", id: post.id
else
Expand Down
2 changes: 1 addition & 1 deletion static/js/posts/edit.js
Expand Up @@ -23,7 +23,7 @@ $(function() {
// textarea only by default, so it works
autosave: {
enabled: true,
uniqueId: '/post/new'
uniqueId: uniqueID || '/post/new'
},
indentWithTabs: false,
insertTexts: {
Expand Down
2 changes: 2 additions & 0 deletions views/posts/edit.moon
Expand Up @@ -10,6 +10,8 @@ class EditPost extends Widget
script src: "/static/highlight/highlight.pack.js"
script src: "/static/js/marked.min.js"
script src: "/static/js/jquery-3.1.0.min.js"
if @post
script -> raw "var uniqueID = '#{@url_for "posts_render"}';"
script src: "/static/js/posts/edit.js"
local action
if @post
Expand Down

0 comments on commit 1a94e64

Please sign in to comment.