-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
2,313 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
type baseController struct { | ||
beego.Controller | ||
i18n.Locale | ||
user models.User | ||
isLogin bool | ||
} | ||
|
||
// Prepare implemented Prepare method for baseRouter. | ||
func (this *baseController) Prepare() { | ||
// page start time | ||
this.Data["PageStartTime"] = time.Now() | ||
// Setting properties. | ||
this.Data["AppDescription"] = utils.AppDescription | ||
this.Data["AppKeywords"] = utils.AppKeywords | ||
this.Data["AppName"] = utils.AppName | ||
this.Data["AppVer"] = utils.AppVer | ||
this.Data["AppUrl"] = utils.AppUrl | ||
this.Data["AppLogo"] = utils.AppLogo | ||
this.Data["AvatarURL"] = utils.AvatarURL | ||
this.Data["IsProMode"] = utils.IsProMode | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type NestPreparer interface { | ||
NestPrepare() | ||
} | ||
|
||
func (this *baseController) Prepare() { | ||
|
||
// page start time | ||
this.Data["PageStartTime"] = time.Now() | ||
|
||
// Setting properties. | ||
this.Data["AppDescription"] = utils.AppDescription | ||
this.Data["AppKeywords"] = utils.AppKeywords | ||
this.Data["AppName"] = utils.AppName | ||
this.Data["AppVer"] = utils.AppVer | ||
this.Data["AppUrl"] = utils.AppUrl | ||
this.Data["AppLogo"] = utils.AppLogo | ||
this.Data["AvatarURL"] = utils.AvatarURL | ||
this.Data["IsProMode"] = utils.IsProMode | ||
|
||
if app, ok := this.AppController.(NestPreparer); ok { | ||
app.NestPrepare() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
type AddController struct { | ||
beego.Controller | ||
} | ||
|
||
func (this *AddController) Get() { | ||
this.Data["content"] = "value" | ||
this.Layout = "admin/layout.html" | ||
this.TplNames = "admin/add.tpl" | ||
} | ||
|
||
func (this *AddController) Post() { | ||
pkgname := this.GetString("pkgname") | ||
content := this.GetString("content") | ||
pk := models.GetCruPkg(pkgname) | ||
if pk.Id == 0 { | ||
var pp models.PkgEntity | ||
pp.Pid = 0 | ||
pp.Pathname = pkgname | ||
pp.Intro = pkgname | ||
models.InsertPkg(pp) | ||
pk = models.GetCruPkg(pkgname) | ||
} | ||
var at models.Article | ||
at.Pkgid = pk.Id | ||
at.Content = content | ||
models.InsertArticle(at) | ||
this.Ctx.Redirect(302, "/admin/index") | ||
} |
Oops, something went wrong.