Пример #1
0
		if err != nil {
			errs = err.Error()
		}
		r := map[string]interface{}{
			"success": ok,
			"errors":  errs,
		}
		return ctx.Json(r)

	}).Filters(filters.NewRequireLoginFilter(), filters.NewAjaxFilter()).

	/**
	 * 上传话题图片
	 */
	Post("upimg", actionUpimg).
	Filters(filters.NewRequireAdminFilter(), filters.NewAjaxFilter()).

	/**
	 * 获取用户信息
	 * 用于浮动层
	 */
	Get("pbox-info", actionPopupBoxInfo).
	Filters(filters.NewAjaxFilter()).

	/**
	 * 模糊搜索话题列表
	 */
	Get("autocomplete", func(ctx *goku.HttpContext) goku.ActionResulter {

		var name string = ctx.Get("term")
		topics, _ := models.Topic_SearchByName(name)
Пример #2
0
package admin

import (
	"github.com/QLeelulu/goku"
	"github.com/QLeelulu/ohlala/golink/filters"
)

var adminController *goku.ControllerBuilder = goku.Controller("_golink_admin").
	Filters(filters.NewRequireAdminFilter())

	// render the view and return a *ViewResult
	// it will find the view in these rules:
	//      1. /{ViewPath}/{Controller}/{action}
	//      2. /{ViewPath}/shared/{action}
	// func adminView(ctx *goku.HttpContext, viewData interface{}) *goku.ViewResult {
	//     return ctx.RenderWithLayout("", "adminLayout", viewModel)
	// }