Exemple #1
0
// Sets the ParameterContext which contains GET/POST data.
// Also sets up the template rendering for this application.
func (ac *App) SetContext(context *filters.DevContext) error {
	if context == nil {
		return errors.New("No context was supplied to this controller!")
	}

	ac.Out = web.NewMustacheRenderer("app/admin/views")
	ac.Dev = context

	return nil
}
Exemple #2
0
package controllers

import (
	"github.com/drbawb/babou/app/filters"
	"github.com/drbawb/babou/app/models"

	"errors"
	"fmt"
	"github.com/drbawb/babou/lib/web"
	"strconv"
)

var renderer web.Renderer = web.NewMustacheRenderer("app/admin/views")

type UsersController struct {
	*App
	Auth *filters.AuthContext
}

func (au *UsersController) Dispatch(action, accept string) (web.Controller, web.Action) {
	newAu := &UsersController{}
	newAu.App = &App{}

	switch action {
	case "index":
		return newAu, newAu.Index
	case "delete":
		return newAu, newAu.Delete
	}

	panic("unreachable")