This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
// Log into the Gentics Mesh backend to retrieve session cookie | |
MeshLogin(USERNAME, PASSWORD) | |
// Set up router handling incoming requests | |
router := mux.NewRouter() | |
router.HandleFunc("/", IndexHandler) | |
router.HandleFunc("/{path:.*}", PathHandler) | |
loggedRouter := handlers.LoggingHandler(os.Stdout, router) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// templateData is the struct that we pass to our HTML templates, containing | |
// necessary data to render pages | |
type templateData struct { | |
Breadcrumb []gjson.Result | |
Category *gjson.Result | |
Products *[]gjson.Result | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css"> | |
<meta charset="UTF-8"> | |
<title>Gentics Mesh Demo</title> | |
<style> | |
.row.products > div { | |
height: 500px | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{define "content"}} | |
<div class="jumbotron"> | |
<div class="row"> | |
<div class="col-sm-3 text-right"> | |
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" style="max-width: 150px;" viewBox="0 0 500.000000 579.000000" preserveAspectRatio="xMidYMid meet"> | |
<g transform="translate(0.000000,579.000000) scale(0.100000,-0.100000)" fill="#00a0d2" stroke="none"> | |
<path class="gtx-logo-main" d="M2417 5780 c-21 -6 -52 -17 -70 -26 -24 -13 -2014 -1184 -2183 -1285 -43 -26 -108 -98 -136 -151 l-23 -43 -3 -1362 -2 -1362 21 -56 c44 -119 20 -102 1213 -805 598 -353 1109 -652 1135 -663 65 -30 197 -30 262 0 34 15 1874 1096 2205 1294 43 26 108 98 136 151 l23 43 3 1362 c2 1355 2 1362 -18 1417 -61 163 -257 260 -425 211 -41 -12 -278 -145 -765 -432 -774 -455 -786 -463 -829 -578 -28 -75 -28 -184 0 -260 27 -72 104 -156 176 -191 75 -37 185 -44 263 -17 30 10 240 127 466 261 227 133 414 242 418 242 3 0 5 -383 4 -851 l-3 -851 -888 -524 c-488 -288 -892 -524 -897 -524 -5 0 -409 236 -897 524 l-888 524 0 1067 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{define "content"}} | |
{{with $product := index .Products 0}} | |
<div> | |
<h1>{{ $product.Get "fields.name" }}</h1> | |
<div class="row"> | |
<div class="col-md-6"> | |
<form name="productForm"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{define "content"}} | |
<div> | |
<h1>{{ .Category.Get "fields.name" }}</h1> | |
<div class="row products"> | |
{{range $product := .Products}} | |
<div class="col-xs-12 col-sm-6 col-md-4"> | |
<div class="panel panel-default"> | |
<div class="panel-body"> | |
<h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LoadChildren takes a nodes uuid and returns its children. | |
func LoadChildren(uuid string) *[]gjson.Result { | |
r := MeshGetRequest("demo/nodes/" + uuid + "/children?expandAll=true&resolveLinks=short") | |
defer r.Body.Close() | |
bytes, _ := ioutil.ReadAll(r.Body) | |
json := gjson.ParseBytes(bytes).Get("data").Array() | |
return &json | |
} |
OlderNewer