parent
22ff2665d1
commit
5ab74a5fde
1
app.moon
1
app.moon
|
@ -11,6 +11,7 @@ class extends lapis.Application
|
|||
@include "controllers.blog"
|
||||
|
||||
[contact: "/contact"]: =>
|
||||
@page = "contact"
|
||||
@title = "Contact"
|
||||
render: true
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ class Blog extends lapis.Application
|
|||
data = \read "*a"
|
||||
data
|
||||
|
||||
@title = "Blog"
|
||||
@page = "blog"
|
||||
|
||||
render: true
|
||||
|
||||
["blog.post": "/blog/:name"]: =>
|
||||
|
@ -39,4 +42,6 @@ class Blog extends lapis.Application
|
|||
@title = \read "*l"
|
||||
\close!
|
||||
|
||||
@page = "blog"
|
||||
|
||||
render: true
|
||||
|
|
|
@ -10,12 +10,15 @@ class Email extends lapis.Application
|
|||
[email: "/contact/email"]: respond_to {
|
||||
GET: =>
|
||||
@title = "Contact Me"
|
||||
@page = "contact"
|
||||
@csrf_token = csrf.generate_token @
|
||||
return render: true
|
||||
|
||||
POST: =>
|
||||
csrf.assert_token @
|
||||
|
||||
@page = "contact"
|
||||
|
||||
assert_valid @params, {
|
||||
{ "name", exists: true, min_length: 3 }
|
||||
{ "message", exists: true, min_length: 15 }
|
||||
|
@ -40,5 +43,7 @@ class Email extends lapis.Application
|
|||
@err = res
|
||||
return render: "error", status: 500
|
||||
|
||||
@title = "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
|
||||
[projects: "/projects"]: =>
|
||||
@title = "Projects"
|
||||
@page = "projects"
|
||||
render: true
|
||||
|
||||
[readme: "/projects/:name"]: =>
|
||||
@title = "Readme for #{@params.name}"
|
||||
@name = @params.name
|
||||
@page = "projects"
|
||||
|
||||
@doc = oleg.cache "readmes", @params.name, ->
|
||||
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
|
||||
[resume: "/resume"]: =>
|
||||
@title = "Resume"
|
||||
@page = "resume"
|
||||
|
||||
@doc = oleg.cache "caches", "resume", ->
|
||||
local data
|
||||
|
|
|
@ -44,16 +44,34 @@ class Layout extends Widget
|
|||
|
||||
div id: "navbar", class: "collapse navbar-collapse", ->
|
||||
ul class: "nav navbar-nav", ->
|
||||
li ->
|
||||
a href: "/blog", "Blog"
|
||||
li ->
|
||||
a href: "/projects", "Projects"
|
||||
li ->
|
||||
a href: "/resume", "Resume"
|
||||
if @page == "blog"
|
||||
li class: "active", ->
|
||||
a href: "/blog", "Blog"
|
||||
else
|
||||
li ->
|
||||
a href: "/blog", "Blog"
|
||||
|
||||
if @page == "projects"
|
||||
li class: "active", ->
|
||||
a href: "/projects", "Projects"
|
||||
else
|
||||
li ->
|
||||
a href: "/projects", "Projects"
|
||||
|
||||
if @page == "resume"
|
||||
li class: "active", ->
|
||||
a href: "/resume", "Resume"
|
||||
else
|
||||
li ->
|
||||
a href: "/resume", "Resume"
|
||||
|
||||
ul class: "nav navbar-nav navbar-right", ->
|
||||
li ->
|
||||
a href: "/contact", "Contact"
|
||||
if @page == "contact"
|
||||
li class: "active", ->
|
||||
a href: "/contact", "Contact"
|
||||
else
|
||||
li ->
|
||||
a href: "/contact", "Contact"
|
||||
|
||||
footer: =>
|
||||
footer ->
|
||||
|
|
Loading…
Reference in New Issue