[ja] apply patch]
This commit is contained in:
@@ -24,15 +24,15 @@
|
||||
ブログの主なルーティング規則は以下のようになります:
|
||||
|
||||
//ブログのトップページを表示
|
||||
beego.RegisterController("/", &controllers.IndexController{})
|
||||
beego.Router("/", &controllers.IndexController{})
|
||||
//ブログの詳細な情報を検索
|
||||
beego.RegisterController("/view/:id([0-9]+)", &controllers.ViewController{})
|
||||
beego.Router("/view/:id([0-9]+)", &controllers.ViewController{})
|
||||
//ブログの文章を作成
|
||||
beego.RegisterController("/new", &controllers.NewController{})
|
||||
beego.Router("/new", &controllers.NewController{})
|
||||
//ブログの削除
|
||||
beego.RegisterController("/delete/:id([0-9]+)", &controllers.DeleteController{})
|
||||
beego.Router("/delete/:id([0-9]+)", &controllers.DeleteController{})
|
||||
//ブログの編集
|
||||
beego.RegisterController("/edit/:id([0-9]+)", &controllers.EditController{})
|
||||
beego.Router("/edit/:id([0-9]+)", &controllers.EditController{})
|
||||
|
||||
|
||||
## データベーススキーマ
|
||||
@@ -66,8 +66,7 @@ ViewController:
|
||||
}
|
||||
|
||||
func (this *ViewController) Get() {
|
||||
inputs := this.Input()
|
||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||
this.Data["Post"] = models.GetBlog(id)
|
||||
this.Layout = "layout.tpl"
|
||||
this.TplNames = "view.tpl"
|
||||
@@ -101,8 +100,7 @@ EditController
|
||||
}
|
||||
|
||||
func (this *EditController) Get() {
|
||||
inputs := this.Input()
|
||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||
this.Data["Post"] = models.GetBlog(id)
|
||||
this.Layout = "layout.tpl"
|
||||
this.TplNames = "new.tpl"
|
||||
@@ -127,7 +125,9 @@ DeleteController
|
||||
|
||||
func (this *DeleteController) Get() {
|
||||
id, _ := strconv.Atoi(this.Ctx.Params[":id"])
|
||||
this.Data["Post"] = models.DelBlog(id)
|
||||
blog := GetBlog(id int)
|
||||
this.Data["Post"] = blog
|
||||
models.DelBlog(blog)
|
||||
this.Ctx.Redirect(302, "/")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user