allow app menu items to be selectivly pinned to the left nav menu

This commit is contained in:
woodsaj
2015-12-18 15:10:52 +08:00
parent 48cf56b69a
commit 3d15ee6d74
10 changed files with 73 additions and 54 deletions
+9 -6
View File
@@ -25,20 +25,23 @@ func UpdateAppPlugin(cmd *m.UpdateAppPluginCmd) error {
exists, err := sess.Where("org_id=? and type=?", cmd.OrgId, cmd.Type).Get(&app)
sess.UseBool("enabled")
sess.UseBool("pin_nav_links")
if !exists {
app = m.AppPlugin{
Type: cmd.Type,
OrgId: cmd.OrgId,
Enabled: cmd.Enabled,
JsonData: cmd.JsonData,
Created: time.Now(),
Updated: time.Now(),
Type: cmd.Type,
OrgId: cmd.OrgId,
Enabled: cmd.Enabled,
PinNavLinks: cmd.PinNavLinks,
JsonData: cmd.JsonData,
Created: time.Now(),
Updated: time.Now(),
}
_, err = sess.Insert(&app)
return err
} else {
app.Enabled = cmd.Enabled
app.JsonData = cmd.JsonData
app.PinNavLinks = cmd.PinNavLinks
_, err = sess.Id(app.Id).Update(&app)
return err
}
@@ -11,6 +11,7 @@ func addAppPluginMigration(mg *Migrator) {
{Name: "org_id", Type: DB_BigInt, Nullable: true},
{Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false},
{Name: "enabled", Type: DB_Bool, Nullable: false},
{Name: "pin_nav_links", Type: DB_Bool, Nullable: false},
{Name: "json_data", Type: DB_Text, Nullable: true},
{Name: "created", Type: DB_DateTime, Nullable: false},
{Name: "updated", Type: DB_DateTime, Nullable: false},