示例#1
0
func Index(w http.ResponseWriter, r *http.Request) {
	params := r.URL.Query()
	error := params.Get("error")

	server := plate.NewServer()

	albums, err := albums_help.GetAll(r)
	if err != nil {
		albums = nil
	}

	photos, err := photos_help.NoAlbum(r)

	mux := menuMux.New()
	mux.AdminMenu("Albums")

	t, _ := server.Template(w)
	t.Bag["MenuItems"] = mux.GetItems()
	t.Bag["Albums"] = albums
	t.Bag["AlbumError"] = error
	t.Bag["Photos"] = photos
	t.Layout = "templates/admin/layout.html"
	files := []string{"templates/admin/sidebar.html", "templates/admin/albums/index.html"}
	t.DisplayMultiple(files)
}
示例#2
0
func Index(w http.ResponseWriter, r *http.Request) {
	server := plate.NewServer()

	photos, err := photos_help.GetAll(r)
	if err != nil {
		photos = nil
	}

	albums, err := albums_help.GetAll(r)
	if err != nil {
		albums = nil
	}

	c := appengine.NewContext(r)
	uploadURL, _ := blobstore.UploadURL(c, "/admin/photos", nil)

	mux := menuMux.New()
	mux.AdminMenu("Photos")

	t, _ := server.Template(w)
	t.Bag["MenuItems"] = mux.GetItems()
	t.Bag["Photos"] = photos
	t.Bag["Albums"] = albums
	t.Bag["UploadURL"] = uploadURL
	t.Layout = "templates/admin/layout.html"
	files := []string{"templates/admin/sidebar.html", "templates/admin/photos/index.html"}
	t.DisplayMultiple(files)

}
示例#3
0
func Index(w http.ResponseWriter, r *http.Request) {

	server := plate.NewServer()
	t, _ := server.Template(w)

	t.SinglePage("templates/resume/index.html")
}
示例#4
0
func Index(w http.ResponseWriter, r *http.Request) {

	server := plate.NewServer()

	query := r.URL.Query()
	tmpl, _ := server.Template(w)

	tmpl.Bag["Full"] = true
	tmpl.Bag["Error"] = query.Get("error")
	tmpl.Template = "templates/auth/index.html"

	tmpl.DisplayTemplate()
}
示例#5
0
func Index(w http.ResponseWriter, r *http.Request) {

	//plate.Serve404(w, "")

	server := plate.NewServer()

	templ, _ := server.Template(w)

	templ.Bag["Homepage"] = true

	templ.Template = "templates/home/index.html"
	templ.DisplayTemplate()
}
示例#6
0
func Index(w http.ResponseWriter, r *http.Request) {
	server := plate.NewServer()

	mux := menuMux.New()
	mux.AdminMenu("")

	tmpl, _ := server.Template(w)

	tmpl.Bag["MenuItems"] = mux.GetItems()

	tmpl.Layout = "templates/admin/layout.html"
	tmpl_arr := []string{"templates/admin/sidebar.html", "templates/admin/index.html"}
	_ = tmpl.DisplayMultiple(tmpl_arr)
}
示例#7
0
func Gists(w http.ResponseWriter, r *http.Request) {
	gists, err := gh.Public("ninnemana", r)
	if err != nil {
		gists = make([]gh.Gist, 0)
	}

	log.Println(err)

	server := plate.NewServer()

	t, _ := server.Template(w)
	t.Bag["Full"] = true
	t.Bag["Gists"] = gists
	t.Template = "templates/github/gists.html"

	t.DisplayTemplate()
}
示例#8
0
func init() {
	server := plate.NewServer("doughboy")
	plate.DefaultAuthHandler = auth.AuthHandler

	server.Get("/", controllers.Index)

	server.Get("/resume", resume.Index)
	server.Get("/cv", resume.Index)
	server.Get("/AlexNinneman.pdf", resume.Pdf)

	server.Get("/photos", photos.Index)
	server.Get("/album/:album", photos.ByAlbum).Sensitive()

	server.Get("/gists", github.Gists)

	server.Get("/contact", contact.Index)
	server.Post("/contact", contact.Send)

	server.Get("/auth", auth.Index)
	server.Post("/auth", auth.In)
	server.Get("/auth/create", auth.Create)
	server.Get("/auth/out", auth.Out)

	server.Get("/admin", admin.Index).Secure()

	server.Get("/admin/albums", albums_admin.Index).Secure()
	server.Post("/admin/album", albums_admin.Add).Secure()
	server.Post("/admin/album/:albumId/delete", albums_admin.Delete).Secure()
	server.Get("/admin/album/addphoto", albums_admin.AddPhoto).Secure()

	server.Get("/admin/photos", photos_admin.Index).Secure()
	server.Post("/admin/photos", photos_admin.Upload).Secure()
	server.Get("/admin/photos/:key/delete", photos_admin.Delete).Secure()

	session_key := "your key here"
	http.Handle("/", server.NewSessionHandler(session_key, nil))

	http.HandleFunc("/photo", photos.Serve)
}