Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

moving from gin to echo

goenninge0a30ec1ccfe
diff --git a/handler/index.go b/handler/index.go
index 824d22445..121c7de23 100644
--- a/handler/index.go
+++ b/handler/index.go
@@ -1,9 +1,11 @@
package handler
import (
+ "net/http"
+
"github.com/WeCanHearYou/wchy/context"
"github.com/WeCanHearYou/wchy/model"
- "github.com/gin-gonic/gin"
+ "github.com/labstack/echo"
)
type indexHandlder struct {
@@ -11,15 +13,15 @@ type indexHandlder struct {
}
// Index handles initial page
-func Index(ctx *context.WchyContext) gin.HandlerFunc {
+func Index(ctx *context.WchyContext) echo.HandlerFunc {
return indexHandlder{ctx: ctx}.get()
}
-func (h indexHandlder) get() gin.HandlerFunc {
- return func(c *gin.Context) {
- tenant := c.MustGet("Tenant").(*model.Tenant)
+func (h indexHandlder) get() echo.HandlerFunc {
+ return func(c echo.Context) error {
+ tenant := c.Get("Tenant").(*model.Tenant)
ideas, _ := h.ctx.Idea.GetAll(tenant.ID)
- c.HTML(200, "index", gin.H{
+ return c.Render(http.StatusOK, "index.html", map[string]interface{}{
"Tenant": tenant,
"Ideas": ideas,
})
diff --git a/handler/index_test.go b/handler/index_test.go
index f8b1507d9..acfcbb91b 100644
--- a/handler/index_test.go
+++ b/handler/index_test.go
@@ -1,12 +1,18 @@
package handler_test
import (
+ "html/template"
+ "net/http"
+ "net/http/httptest"
+ "os"
"testing"
"github.com/WeCanHearYou/wchy/context"
+ "github.com/WeCanHearYou/wchy/env"
"github.com/WeCanHearYou/wchy/handler"
- "github.com/WeCanHearYou/wchy/mock"
"github.com/WeCanHearYou/wchy/model"
+ "github.com/WeCanHearYou/wchy/router"
+ "github.com/labstack/echo"
. "github.com/onsi/gomega"
)
@@ -23,10 +29,23 @@ func TestIndexHandler(t *testing.T) {
Idea: &mockIdeaService{},
}
- server := mock.NewServer()
- server.Set("Tenant", &model.Tenant{Name: "Any Tenant"})
- server.Register(handler.Index(ctx))
- status, _ := server.Request()
+ e := echo.New()
- Expect(status).To(Equal(200))
+ path := "views/*.html"
+ if env.IsTest() {
+ path = os.Getenv("GOPATH") + "/src/github.com/WeCanHearYou/wchy/" + path
+ }
+
+ e.Renderer = &router.HTMLRenderer{
+ Templates: template.Must(template.ParseGlob(path)),
+ }
+
+ req, _ := http.NewRequest(echo.GET, "/", nil)
+ rec := httptest.NewRecorder()
+ c := e.NewContext(req, rec)
+ c.Set("Tenant", &model.Tenant{ID: 2, Name: "Any Tenant"})
+
+ handler.Index(ctx)(c)
+
+ Expect(rec.Code).To(Equal(200))
}
diff --git a/handler/status.go b/handler/status.go
index d927cbdb1..67fa32f91 100644
--- a/handler/status.go
+++ b/handler/status.go
@@ -6,7 +6,7 @@ import (
"time"
"github.com/WeCanHearYou/wchy/context"
- "github.com/gin-gonic/gin"
+ "github.com/labstack/echo"
)
type statusHandler struct {
@@ -14,15 +14,15 @@ type statusHandler struct {
}
// Status creates a new Status HTTP handler
-func Status(ctx *context.WchyContext) gin.HandlerFunc {
+func Status(ctx *context.WchyContext) echo.HandlerFunc {
return statusHandler{ctx: ctx}.get()
}
-func (h statusHandler) get() gin.HandlerFunc {
- return func(c *gin.Context) {
- c.JSON(http.StatusOK, gin.H{
+func (h statusHandler) get() echo.HandlerFunc {
+ return func(c echo.Context) error {
+ return c.JSON(http.StatusOK, map[string]interface{}{
"build": h.ctx.Settings.BuildTime,
- "healthy": gin.H{
+ "healthy": map[string]interface{}{
"database": h.ctx.Health.IsDatabaseOnline(),
},
"version": runtime.Version(),
diff --git a/handler/tenant.go b/handler/tenant.go
index 9d346302a..6cd74fc42 100644
--- a/handler/tenant.go
+++ b/handler/tenant.go
@@ -5,7 +5,7 @@ import (
"github.com/WeCanHearYou/wchy/context"
"github.com/WeCanHearYou/wchy/service"
- "github.com/gin-gonic/gin"
+ "github.com/labstack/echo"
)
type tenantHandlers struct {
@@ -13,17 +13,18 @@ type tenantHandlers struct {
}
// TenantByDomain creates a new TenantByDomain HTTP handler
-func TenantByDomain(ctx *context.WchyContext) gin.HandlerFunc {
+func TenantByDomain(ctx *context.WchyContext) echo.HandlerFunc {
return tenantHandlers{ctx: ctx}.byDomain()
}
-func (h tenantHandlers) byDomain() gin.HandlerFunc {
- return func(c *gin.Context) {
+func (h tenantHandlers) byDomain() echo.HandlerFunc {
+ return func(c echo.Context) error {
tenant, err := h.ctx.Tenant.GetByDomain(c.Param("domain"))
+
if err == service.ErrNotFound {
- c.Status(http.StatusNotFound)
- } else {
- c.JSON(http.StatusOK, tenant)
+ return c.NoContent(http.StatusNotFound)
}
+
+ return c.JSON(http.StatusOK, tenant)
}
}
diff --git a/handler/tenant_test.go b/handler/tenant_test.go
index bce112c90..57d7a68de 100644
--- a/handler/tenant_test.go
+++ b/handler/tenant_test.go
@@ -1,13 +1,17 @@
package handler_test
import (
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
"testing"
"github.com/WeCanHearYou/wchy/context"
"github.com/WeCanHearYou/wchy/handler"
- "github.com/WeCanHearYou/wchy/mock"
"github.com/WeCanHearYou/wchy/model"
"github.com/WeCanHearYou/wchy/service"
+ "github.com/jmoiron/jsonq"
+ "github.com/labstack/echo"
. "github.com/onsi/gomega"
)
@@ -27,24 +31,35 @@ var ctx *context.WchyContext = &context.WchyContext{
func TestTenantHandler_404(t *testing.T) {
RegisterTestingT(t)
- server := mock.NewServer()
- server.Param("domain", "unknown")
- server.Register(handler.TenantByDomain(ctx))
- status, _ := server.Request()
+ e := echo.New()
+ req, _ := http.NewRequest(echo.GET, "/", nil)
+ rec := httptest.NewRecorder()
+ c := e.NewContext(req, rec)
+ c.SetParamNames("domain")
+ c.SetParamValues("unknown")
+ handler.TenantByDomain(ctx)(c)
- Expect(status).To(Equal(404))
+ Expect(rec.Code).To(Equal(404))
}
func TestTenantHandler_200(t *testing.T) {
RegisterTestingT(t)
- server := mock.NewServer()
- server.Param("domain", "trishop")
- server.Register(handler.TenantByDomain(ctx))
- status, query := server.Request()
+ e := echo.New()
+ req, _ := http.NewRequest(echo.GET, "/", nil)
+ rec := httptest.NewRecorder()
+ c := e.NewContext(req, rec)
+ c.SetParamNames("domain")
+ c.SetParamValues("trishop")
+ handler.TenantByDomain(ctx)(c)
+
+ var data interface{}
+ decoder := json.NewDecoder(rec.Body)
+ decoder.Decode(&data)
+ query := jsonq.NewQuery(data)
Expect(query.Int("id")).To(Equal(2))
Expect(query.String("name")).To(Equal("The Triathlon Shop"))
Expect(query.String("domain")).To(Equal("trishop"))
- Expect(status).To(Equal(200))
+ Expect(rec.Code).To(Equal(200))
}
diff --git a/main.go b/main.go
index 9a1d03e25..a8e1e511e 100644
--- a/main.go
+++ b/main.go
@@ -35,5 +35,6 @@ func init() {
}
func main() {
- router.GetMainEngine(ctx).Run(":" + env.GetEnvOrDefault("PORT", "3000"))
+ e := router.GetMainEngine(ctx)
+ e.Logger.Fatal(e.Start(":" + env.GetEnvOrDefault("PORT", "3000")))
}
diff --git a/mock/server.go b/mock/server.go
index 2ad5fa439..3abbeb381 100644
--- a/mock/server.go
+++ b/mock/server.go
@@ -7,20 +7,20 @@ import (
"strings"
- "github.com/WeCanHearYou/wchy/router"
- "github.com/gin-gonic/gin"
"github.com/jmoiron/jsonq"
+ "github.com/labstack/echo"
)
// Server is a HTTP server wrapper for testing purpose
type Server struct {
- engine *gin.Engine
+ engine *echo.Echo
+ handler echo.HandlerFunc
}
// NewServer creates a new test server
func NewServer() *Server {
- engine := gin.New()
- engine.HTMLRender = router.CreateTemplateRender()
+ engine := echo.New()
+ //TODO: engine.HTMLRender = router.CreateTemplateRender()
return &Server{
engine: engine,
@@ -28,40 +28,52 @@ func NewServer() *Server {
}
// Use to register new middlewares
-func (s *Server) Use(f gin.HandlerFunc) {
- s.engine.Use(f)
+func (s *Server) Use(mw echo.MiddlewareFunc) {
+ s.engine.Use(mw)
+}
+
+// UseFunc to register new middlewares based on HandlerFunc
+func (s *Server) UseFunc(f echo.HandlerFunc) {
+ s.engine.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
+ return f
+ })
}
// Param can be used to set request parameters
func (s *Server) Param(key, value string) {
- s.Use(func(c *gin.Context) {
- c.Params = append(c.Params, gin.Param{Key: key, Value: value})
+ s.UseFunc(func(c echo.Context) error {
+ c.SetParamNames(key)
+ c.SetParamValues(value)
+ return nil
})
}
// Set can be used to set context values
func (s *Server) Set(key string, value interface{}) {
- s.Use(func(c *gin.Context) {
+ s.UseFunc(func(c echo.Context) error {
c.Set(key, value)
+ return nil
})
}
// Register given handler
-func (s *Server) Register(handler gin.HandlerFunc) {
- s.engine.Handle("GET", "/", handler)
+func (s *Server) Register(handler echo.HandlerFunc) {
+ s.handler = handler
}
// Request registered handler
func (s *Server) Request() (int, *jsonq.JsonQuery) {
- request, _ := http.NewRequest("GET", "/", nil)
- response := httptest.NewRecorder()
- s.engine.ServeHTTP(response, request)
+ req, _ := http.NewRequest(echo.GET, "/", nil)
+ rec := httptest.NewRecorder()
+
+ c := s.engine.NewContext(req, rec)
+ s.handler(c)
- status := response.Result().StatusCode
+ status := rec.Code
- if status == 200 && hasJSON(response) {
+ if status == 200 && hasJSON(rec) {
var data interface{}
- decoder := json.NewDecoder(response.Body)
+ decoder := json.NewDecoder(rec.Body)
decoder.Decode(&data)
query := jsonq.NewQuery(data)
return status, query
@@ -71,7 +83,7 @@ func (s *Server) Request() (int, *jsonq.JsonQuery) {
}
func hasJSON(r *httptest.ResponseRecorder) bool {
- isJSONContentType := strings.Contains(r.Result().Header.Get("Content-Type"), gin.MIMEJSON)
+ isJSONContentType := strings.Contains(r.Result().Header.Get("Content-Type"), "application/json")
if r.Body.Len() > 0 && isJSONContentType {
return true
diff --git a/router/multitenant.go b/router/multitenant.go
index 47c8118f4..73e7f75a3 100644
--- a/router/multitenant.go
+++ b/router/multitenant.go
@@ -1,22 +1,25 @@
package router
import (
+ "net/http"
"strings"
"github.com/WeCanHearYou/wchy/context"
- "github.com/gin-gonic/gin"
+ "github.com/labstack/echo"
)
// MultiTenant extract tenant information from hostname and inject it into current context
-func MultiTenant(ctx *context.WchyContext) gin.HandlerFunc {
- return func(c *gin.Context) {
- hostname := stripPort(c.Request.Host)
- tenant, err := ctx.Tenant.GetByDomain(hostname)
- if err == nil {
- c.Set("Tenant", tenant)
- c.Next()
- } else {
- c.AbortWithStatus(404)
+func MultiTenant(ctx *context.WchyContext) echo.MiddlewareFunc {
+ return func(next echo.HandlerFunc) echo.HandlerFunc {
+ return func(c echo.Context) error {
+ hostname := stripPort(c.Request().Host)
+ tenant, err := ctx.Tenant.GetByDomain(hostname)
+ if err == nil {
+ c.Set("Tenant", tenant)
+ return next(c)
+ }
+
+ return c.NoContent(http.StatusNotFound)
}
}
}
diff --git a/router/multitenant_test.go b/router/multitenant_test.go
index 0b8fd3824..ae4698445 100644
--- a/router/multitenant_test.go
+++ b/router/multitenant_test.go
@@ -1,14 +1,15 @@
package router_test
import (
+ "net/http"
+ "net/http/httptest"
"testing"
"github.com/WeCanHearYou/wchy/context"
- "github.com/WeCanHearYou/wchy/mock"
"github.com/WeCanHearYou/wchy/model"
"github.com/WeCanHearYou/wchy/router"
"github.com/WeCanHearYou/wchy/service"
- "github.com/gin-gonic/gin"
+ "github.com/labstack/echo"
. "github.com/onsi/gomega"
)
@@ -56,21 +57,21 @@ func TestMultiTenant(t *testing.T) {
for _, testCase := range testCases {
for _, host := range testCase.hosts {
- var name interface{}
-
- server := mock.NewServer()
- server.Use(func(c *gin.Context) {
- c.Request.Host = host
- })
- server.Use(router.MultiTenant(ctx))
- server.Register(func(c *gin.Context) {
- c.Status(200)
- name = c.MustGet("Tenant")
- })
- status, _ := server.Request()
-
- Expect(status).To(Equal(200))
- Expect(name).To(Equal(testCase.tenant))
+
+ e := echo.New()
+ req, _ := http.NewRequest(echo.GET, "/", nil)
+ rec := httptest.NewRecorder()
+ c := e.NewContext(req, rec)
+ c.Request().Host = host
+
+ cors := router.MultiTenant(ctx)
+ cors(echo.HandlerFunc(func(c echo.Context) error {
+ return c.String(http.StatusOK, c.Get("Tenant").(*model.Tenant).Name)
+ }))(c)
+
+ Expect(rec.Code).To(Equal(200))
+ Expect(rec.Body.String()).To(Equal(testCase.tenant.Name))
+
}
}
@@ -79,15 +80,16 @@ func TestMultiTenant(t *testing.T) {
func TestMultiTenant_UnknownDomain(t *testing.T) {
RegisterTestingT(t)
- server := mock.NewServer()
- server.Use(func(c *gin.Context) {
- c.Request.Host = "somedomain.com"
- })
- server.Use(router.MultiTenant(ctx))
- server.Register(func(c *gin.Context) {
- c.Status(200)
- })
- status, _ := server.Request()
-
- Expect(status).To(Equal(404))
+ e := echo.New()
+ req, _ := http.NewRequest(echo.GET, "/", nil)
+ rec := httptest.NewRecorder()
+ c := e.NewContext(req, rec)
+ c.Request().Host = "somedomain.com"
+
+ cors := router.MultiTenant(ctx)
+ cors(echo.HandlerFunc(func(c echo.Context) error {
+ return c.String(http.StatusOK, c.Get("Tenant").(*model.Tenant).Name)
+ }))(c)
+
+ Expect(rec.Code).To(Equal(404))
}
diff --git a/router/renderer.go b/router/renderer.go
index 711a8a60d..bb3ff9e4e 100644
--- a/router/renderer.go
+++ b/router/renderer.go
@@ -1,21 +1,18 @@
package router
import (
- "os"
- "path/filepath"
+ "html/template"
+ "io"
- "github.com/WeCanHearYou/wchy/env"
- "github.com/gin-contrib/multitemplate"
+ "github.com/labstack/echo"
)
-func CreateTemplateRender() multitemplate.Render {
- r := multitemplate.New()
-
- path := filepath.Join(os.Getenv("GOPATH"), "src/github.com/WeCanHearYou/wchy/views")
- if !env.IsTest() {
- path = "views"
- }
+//HTMLRenderer renderer
+type HTMLRenderer struct {
+ Templates *template.Template
+}
- r.AddFromFiles("index", path+"/base.html", path+"/index.html")
- return r
+//Render a template based on parameters
+func (t *HTMLRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
+ return t.Templates.ExecuteTemplate(w, name, data)
}
diff --git a/router/router.go b/router/router.go
index d12e3be3b..1716c66ca 100644
--- a/router/router.go
+++ b/router/router.go
@@ -1,26 +1,37 @@
package router
import (
+ "html/template"
+
+ "os"
+
+ "fmt"
+
"net/http"
"github.com/WeCanHearYou/wchy/context"
- "github.com/WeCanHearYou/wchy/handler"
-
"github.com/WeCanHearYou/wchy/env"
- "github.com/gin-gonic/gin"
+ "github.com/WeCanHearYou/wchy/handler"
+ "github.com/labstack/echo"
)
// GetMainEngine returns main HTTP engine
-func GetMainEngine(ctx *context.WchyContext) *gin.Engine {
- router := gin.New()
- router.HTMLRender = CreateTemplateRender()
-
- if env.IsDevelopment() {
- gin.SetMode(gin.DebugMode)
- } else {
- gin.SetMode(gin.ReleaseMode)
+func GetMainEngine(ctx *context.WchyContext) *echo.Echo {
+ router := echo.New()
+
+ path := "views/*.html"
+ if env.IsTest() {
+ path = os.Getenv("GOPATH") + "/src/github.com/WeCanHearYou/wchy/" + path
}
+ router.Renderer = &HTMLRenderer{
+ Templates: template.Must(template.ParseGlob(path)),
+ }
+
+ router.HTTPErrorHandler = func(e error, c echo.Context) {
+ fmt.Println(e)
+ c.NoContent(http.StatusInternalServerError)
+ }
router.Use(MultiTenant(ctx))
router.GET("/", handler.Index(ctx))
@@ -30,7 +41,7 @@ func GetMainEngine(ctx *context.WchyContext) *gin.Engine {
api.GET("/tenants/:domain", handler.TenantByDomain(ctx))
}
- router.StaticFS("/assets", http.Dir("node_modules"))
+ router.Static("/assets", "node_modules")
return router
}
diff --git a/vendor/vendor.json b/vendor/vendor.json
index d1dc2e1a9..b207664cf 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -246,6 +246,24 @@
"revision": "7cafcd837844e784b526369c9bce262804aebc60",
"revisionTime": "2016-05-04T02:26:26Z"
},
+ {
+ "checksumSHA1": "qUd2AA/+1E7WacQ/2pNaSiU8azM=",
+ "path": "github.com/labstack/echo",
+ "revision": "a8b6864be328fcb5c2d96d32c75b750f84e0e4be",
+ "revisionTime": "2017-02-02T19:50:17Z"
+ },
+ {
+ "checksumSHA1": "R6DzcBLEP0BONPpsyr+11N7xh5w=",
+ "path": "github.com/labstack/gommon/color",
+ "revision": "f72d3c883f8ea180da8f085dd320804c41332ad1",
+ "revisionTime": "2017-01-12T04:03:50Z"
+ },
+ {
+ "checksumSHA1": "uHA6zbtxzJce4r+6uk8zu11qkuk=",
+ "path": "github.com/labstack/gommon/log",
+ "revision": "f72d3c883f8ea180da8f085dd320804c41332ad1",
+ "revisionTime": "2017-01-12T04:03:50Z"
+ },
{
"checksumSHA1": "dm3g5P1ezW+aOMZgOkJ//57zRxA=",
"path": "github.com/lib/pq",
@@ -468,12 +486,42 @@
"revision": "4d4bfba8f1d1027c4fdbe371823030df51419987",
"revisionTime": "2017-01-30T11:31:45Z"
},
+ {
+ "checksumSHA1": "LTOa3BADhwvT0wFCknPueQALm8I=",
+ "path": "github.com/valyala/bytebufferpool",
+ "revision": "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7",
+ "revisionTime": "2016-08-17T18:16:52Z"
+ },
+ {
+ "checksumSHA1": "j7lWhgAteszPecjIkS12+tjXE2E=",
+ "path": "github.com/valyala/fasttemplate",
+ "revision": "d090d65668a286d9a180d43a19dfdc5dcad8fe88",
+ "revisionTime": "2017-01-12T11:45:30Z"
+ },
+ {
+ "checksumSHA1": "D1l731k467E5E4Uau+cQKEYkaVY=",
+ "path": "golang.org/x/crypto/acme",
+ "revision": "453249f01cfeb54c3d549ddb75ff152ca243f9d8",
+ "revisionTime": "2017-02-08T20:51:15Z"
+ },
+ {
+ "checksumSHA1": "MG1frAM4p4lg1ioOhUa7rjN3xm0=",
+ "path": "golang.org/x/crypto/acme/autocert",
+ "revision": "453249f01cfeb54c3d549ddb75ff152ca243f9d8",
+ "revisionTime": "2017-02-08T20:51:15Z"
+ },
{
"checksumSHA1": "Y+HGqEkYM15ir+J93MEaHdyFy0c=",
"path": "golang.org/x/net/context",
"revision": "41bba8d80bbfab43231ffdf4c210037baae5f6a3",
"revisionTime": "2017-01-27T14:21:26Z"
},
+ {
+ "checksumSHA1": "WHc3uByvGaMcnSoI21fhzYgbOgg=",
+ "path": "golang.org/x/net/context/ctxhttp",
+ "revision": "61557ac0112b576429a0df080e1c2cef5dfbb642",
+ "revisionTime": "2017-01-26T11:54:58Z"
+ },
{
"checksumSHA1": "uTQtOqR0ePMMcvuvAIksiIZxhqU=",
"path": "golang.org/x/sys/unix",
diff --git a/views/base.html b/views/base.html
deleted file mode 100644
index 8d20b4ab6..000000000
--- a/views/base.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8"/>
- <meta name="viewport" content="width=device-width,initial-scale=1">
- <link rel="stylesheet" type="text/css" href="/assets/semantic-ui-css/semantic.min.css">
- <style type="text/css">
- .ui.dividing.header,.first {
- margin-top: 5em;
- }
- </style>
- <title>{{block "title" .}}Default Title{{end}}</title>
-</head>
-<body>
- <body>{{block "content" .}}This is the default body.{{end}}</body>
-</body>
-</html>
diff --git a/views/index.html b/views/index.html
index 6447d48e7..45545c58e 100644
--- a/views/index.html
+++ b/views/index.html
@@ -1,25 +1,114 @@
-{{define "title"}}
- {{ .Tenant.Name }}
-{{end}}
-
-{{define "content"}}
- <div class="ui text container">
- <h1 class="ui dividing header">{{ .Tenant.Name }}</h1>
- <p>Welcome to our feedback forum.</p>
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8"/>
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <link rel="stylesheet" type="text/css" href="/assets/semantic-ui-css/semantic.min.css">
+ <title>{{block "title" .}}{{end}}</title>
+ <style>
+ .ideas-list .vote-col {
+ text-align: center;
+ width: 140px;
+ }
+ .ideas-list .vote-col div {
+ display: block;
+ }
+ #footer {
+ margin-top: 50px;
+ }
+ </style>
+</head>
+<body>
+ <div class="ui menu">
+ <div class="ui container">
+ <div class="header item">
+ {{ .Tenant.Name }}
+ </div>
+ </div>
+ </div>
+ <div class="ui container">
+ <h1 class="ui header">Welcome to our feedback forum</h1>
+ <p>This is a basic fixed menu template using fixed size containers.</p>
+ <p>A text container is used for the main container, which is useful for single column layouts</p>
</div>
- <div class="ui text container">
- <h3>Ideas</h3>
+ <div class="ui container">
<ul>
- {{ range $value := .Ideas }}
- <li><strong>{{ $value.ID }}</strong>: {{ $value.Title }}</li>
- {{ end }}
</ul>
</div>
- <div class="ui text container">
- <div class="ui one column grid">
- <div class="column"></div>
+ <div class="ui container ideas-list">
+ <h3>All Ideas</h3>
+ <div class="ui divided items">
+
+ {{ range $value := .Ideas }}
+ <div class="item">
+ <div class="vote-col">
+ <div class="ui statistic">
+ <div class="value">
+ 82
+ </div>
+ <div class="label">
+ Votes
+ </div>
+ </div>
+ <button class="mini ui green button">
+ Vote
+ </button>
+ </div>
+ <div class="content">
+ <a class="header">{{ $value.Title }}</a>
+ <div class="meta">
+ <span class="cinema">Union Square 14</span>
+ </div>
+ <div class="description">
+ <p>{{ $value.Title }} {{ $value.Title }} {{ $value.Title }} {{ $value.Title }}</p>
+ </div>
+ <div class="extra">
+ <div class="ui label">IMAX</div>
+ <div class="ui label">Additional Languages</div>
+ </div>
+ </div>
+ </div>
+ {{ end }}
+
+ </div>
+ </div>
+
+ <div id="footer" class="ui inverted vertical footer segment">
+ <div class="ui center aligned container">
+ <div class="ui stackable inverted divided grid">
+ <div class="six wide column">
+ <h4 class="ui inverted header">Trending ideas</h4>
+ <div class="ui inverted link list">
+ <a href="#" class="item">Link #1</a>
+ <a href="#" class="item">Link #2</a>
+ <a href="#" class="item">Link #3</a>
+ <a href="#" class="item">Link $3</a>
+ </div>
+ </div>
+ <div class="six wide column">
+ <h4 class="ui inverted header">Latest activity</h4>
+ <div class="ui inverted link list">
+ <a href="#" class="item">Someone did something</a>
+ <a href="#" class="item">New idea was posted</a>
+ <a href="#" class="item">Someone commented on idea #1</a>
+ <a href="#" class="item">Idea #2 changed to Shipped</a>
+ </div>
+ </div>
+ <div class="four wide column">
+ <h4 class="ui inverted header">Footer Header</h4>
+ <p>Extra space for a call to action inside the footer that could help re-engage users.</p>
+ </div>
+ </div>
+ <div class="ui inverted section divider"></div>
+ <div class="ui horizontal inverted small divided link list">
+ <a class="item" href="#">Site Map</a>
+ <a class="item" href="#">Contact Us</a>
+ <a class="item" href="#">Terms and Conditions</a>
+ <a class="item" href="#">Privacy Policy</a>
+ </div>
</div>
</div>
-{{end}}
\ No newline at end of file
+</body>
+</html>