parent
22ff2665d1
commit
5ab74a5fde
1
app.moon
1
app.moon
|
@ -11,6 +11,7 @@ class extends lapis.Application
|
||||||
@include "controllers.blog"
|
@include "controllers.blog"
|
||||||
|
|
||||||
[contact: "/contact"]: =>
|
[contact: "/contact"]: =>
|
||||||
|
@page = "contact"
|
||||||
@title = "Contact"
|
@title = "Contact"
|
||||||
render: true
|
render: true
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,9 @@ class Blog extends lapis.Application
|
||||||
data = \read "*a"
|
data = \read "*a"
|
||||||
data
|
data
|
||||||
|
|
||||||
|
@title = "Blog"
|
||||||
|
@page = "blog"
|
||||||
|
|
||||||
render: true
|
render: true
|
||||||
|
|
||||||
["blog.post": "/blog/:name"]: =>
|
["blog.post": "/blog/:name"]: =>
|
||||||
|
@ -39,4 +42,6 @@ class Blog extends lapis.Application
|
||||||
@title = \read "*l"
|
@title = \read "*l"
|
||||||
\close!
|
\close!
|
||||||
|
|
||||||
|
@page = "blog"
|
||||||
|
|
||||||
render: true
|
render: true
|
||||||
|
|
|
@ -10,12 +10,15 @@ class Email extends lapis.Application
|
||||||
[email: "/contact/email"]: respond_to {
|
[email: "/contact/email"]: respond_to {
|
||||||
GET: =>
|
GET: =>
|
||||||
@title = "Contact Me"
|
@title = "Contact Me"
|
||||||
|
@page = "contact"
|
||||||
@csrf_token = csrf.generate_token @
|
@csrf_token = csrf.generate_token @
|
||||||
return render: true
|
return render: true
|
||||||
|
|
||||||
POST: =>
|
POST: =>
|
||||||
csrf.assert_token @
|
csrf.assert_token @
|
||||||
|
|
||||||
|
@page = "contact"
|
||||||
|
|
||||||
assert_valid @params, {
|
assert_valid @params, {
|
||||||
{ "name", exists: true, min_length: 3 }
|
{ "name", exists: true, min_length: 3 }
|
||||||
{ "message", exists: true, min_length: 15 }
|
{ "message", exists: true, min_length: 15 }
|
||||||
|
@ -40,5 +43,7 @@ class Email extends lapis.Application
|
||||||
@err = res
|
@err = res
|
||||||
return render: "error", status: 500
|
return render: "error", status: 500
|
||||||
|
|
||||||
|
@title = "Success"
|
||||||
|
|
||||||
return render: "success"
|
return render: "success"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,13 @@ gh = require('github').new({access_token: os.getenv "GITHUB_TOKEN", httpclient_d
|
||||||
class Projects extends lapis.Application
|
class Projects extends lapis.Application
|
||||||
[projects: "/projects"]: =>
|
[projects: "/projects"]: =>
|
||||||
@title = "Projects"
|
@title = "Projects"
|
||||||
|
@page = "projects"
|
||||||
render: true
|
render: true
|
||||||
|
|
||||||
[readme: "/projects/:name"]: =>
|
[readme: "/projects/:name"]: =>
|
||||||
@title = "Readme for #{@params.name}"
|
@title = "Readme for #{@params.name}"
|
||||||
@name = @params.name
|
@name = @params.name
|
||||||
|
@page = "projects"
|
||||||
|
|
||||||
@doc = oleg.cache "readmes", @params.name, ->
|
@doc = oleg.cache "readmes", @params.name, ->
|
||||||
reply, err = gh\authed_request "/repos/Xe/#{@params.name}/contents/README.md"
|
reply, err = gh\authed_request "/repos/Xe/#{@params.name}/contents/README.md"
|
||||||
|
|
|
@ -5,6 +5,7 @@ oleg = require "lib/oleg"
|
||||||
class Projects extends lapis.Application
|
class Projects extends lapis.Application
|
||||||
[resume: "/resume"]: =>
|
[resume: "/resume"]: =>
|
||||||
@title = "Resume"
|
@title = "Resume"
|
||||||
|
@page = "resume"
|
||||||
|
|
||||||
@doc = oleg.cache "caches", "resume", ->
|
@doc = oleg.cache "caches", "resume", ->
|
||||||
local data
|
local data
|
||||||
|
|
|
@ -44,14 +44,32 @@ class Layout extends Widget
|
||||||
|
|
||||||
div id: "navbar", class: "collapse navbar-collapse", ->
|
div id: "navbar", class: "collapse navbar-collapse", ->
|
||||||
ul class: "nav navbar-nav", ->
|
ul class: "nav navbar-nav", ->
|
||||||
|
if @page == "blog"
|
||||||
|
li class: "active", ->
|
||||||
|
a href: "/blog", "Blog"
|
||||||
|
else
|
||||||
li ->
|
li ->
|
||||||
a href: "/blog", "Blog"
|
a href: "/blog", "Blog"
|
||||||
|
|
||||||
|
if @page == "projects"
|
||||||
|
li class: "active", ->
|
||||||
|
a href: "/projects", "Projects"
|
||||||
|
else
|
||||||
li ->
|
li ->
|
||||||
a href: "/projects", "Projects"
|
a href: "/projects", "Projects"
|
||||||
|
|
||||||
|
if @page == "resume"
|
||||||
|
li class: "active", ->
|
||||||
|
a href: "/resume", "Resume"
|
||||||
|
else
|
||||||
li ->
|
li ->
|
||||||
a href: "/resume", "Resume"
|
a href: "/resume", "Resume"
|
||||||
|
|
||||||
ul class: "nav navbar-nav navbar-right", ->
|
ul class: "nav navbar-nav navbar-right", ->
|
||||||
|
if @page == "contact"
|
||||||
|
li class: "active", ->
|
||||||
|
a href: "/contact", "Contact"
|
||||||
|
else
|
||||||
li ->
|
li ->
|
||||||
a href: "/contact", "Contact"
|
a href: "/contact", "Contact"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue