示例#1
0
// Create a goal
func createGoal(action *goldorak.Action, name string, public bool) {
	g := goal.Create(name)
	g.Set("name", name)
	g.Set("current", "0")
	g.Set("longest", "0")
	action.Redirect("/" + g.Param)
}
示例#2
0
// Home Page
func homepage(action *goldorak.Action) {
	action.Template("homepage")
}
示例#3
0
// Form for creating a new goal
func newGoal(action *goldorak.Action, param string, public bool) {
	action.Assign("name", param)
	action.Assign("public", "") // FIXME
	action.Template("new_goal")
}
示例#4
0
// Show the calendar
func showCalendar(action *goldorak.Action, cal *Calendar) {
	action.Assign("name", cal.Title())
	action.Assign("year", fmt.Sprint(cal.Year))
	action.Assign("month", cal.MonthAsText())
	action.Assign("prev_url", "/"+cal.Goal.Param+"/"+cal.PrevMonth().String())
	action.Assign("next_url", "/"+cal.Goal.Param+"/"+cal.NextMonth().String())
	action.Assign("current", goldorak.Pluralize(cal.CurrentStreak(), "jour"))
	action.Assign("longest", goldorak.Pluralize(cal.LongestStreak(), "jour"))
	action.Assign("rows", "") // FIXME
	action.Template("calendar")
}