perf:创建项目时增加默认项目空间

pull/425/head
lifei6671 2018-11-21 18:15:48 +08:00
parent bf5ec20eaa
commit 6a7f902e81
2 changed files with 11 additions and 4 deletions

View File

@ -61,6 +61,9 @@ func (c *BookController) Index() {
} else { } else {
c.Data["Result"] = template.JS(string(b)) c.Data["Result"] = template.JS(string(b))
} }
if itemsets, err := models.NewItemsets().First(1); err == nil {
c.Data["Item"] = itemsets
}
} }
// Dashboard 项目概要 . // Dashboard 项目概要 .
@ -144,7 +147,7 @@ func (c *BookController) SaveBook() {
enableShare := strings.TrimSpace(c.GetString("enable_share")) == "on" enableShare := strings.TrimSpace(c.GetString("enable_share")) == "on"
isUseFirstDocument := strings.TrimSpace(c.GetString("is_use_first_document")) == "on" isUseFirstDocument := strings.TrimSpace(c.GetString("is_use_first_document")) == "on"
autoSave := strings.TrimSpace(c.GetString("auto_save")) == "on" autoSave := strings.TrimSpace(c.GetString("auto_save")) == "on"
itemId,_ := c.GetInt("itemId") itemId, _ := c.GetInt("itemId")
if strings.Count(description, "") > 500 { if strings.Count(description, "") > 500 {
c.JsonResult(6004, "项目描述不能大于500字") c.JsonResult(6004, "项目描述不能大于500字")
@ -159,7 +162,7 @@ func (c *BookController) SaveBook() {
} }
} }
if !models.NewItemsets().Exist(itemId) { if !models.NewItemsets().Exist(itemId) {
c.JsonResult(6006,"项目空间不存在") c.JsonResult(6006, "项目空间不存在")
} }
if editor != "markdown" && editor != "html" { if editor != "markdown" && editor != "html" {
editor = "markdown" editor = "markdown"

View File

@ -141,7 +141,9 @@
<div class="form-group required"> <div class="form-group required">
<label class="text-label col-sm-2">项目空间</label> <label class="text-label col-sm-2">项目空间</label>
<div class="col-sm-10"> <div class="col-sm-10">
<select class="js-data-example-ajax-add form-control" multiple="multiple" name="itemId" id="itemId"></select> <select class="js-data-example-ajax-add form-control" multiple="multiple" name="itemId" id="itemId">
{{if .Item}}<option value="{{.Item.ItemId}}" selected>{{.Item.ItemName}}</option> {{end}}
</select>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
@ -208,7 +210,9 @@
<div class="form-group"> <div class="form-group">
<div class="form-group required"> <div class="form-group required">
<label class="text-label">项目空间</label> <label class="text-label">项目空间</label>
<select class="js-data-example-ajax-import form-control" multiple="multiple" name="itemId"></select> <select class="js-data-example-ajax-import form-control" multiple="multiple" name="itemId">
{{if .Item}}<option value="{{.Item.ItemId}}" selected>{{.Item.ItemName}}</option> {{end}}
</select>
</div> </div>
<div class="form-group required"> <div class="form-group required">
<label class="text-label">项目标题</label> <label class="text-label">项目标题</label>