diff --git a/app/controllers/NoteController.go b/app/controllers/NoteController.go
index 4ca219d..59c43bb 100644
--- a/app/controllers/NoteController.go
+++ b/app/controllers/NoteController.go
@@ -125,7 +125,7 @@ func (c Note) Index(noteId string) revel.Result {
c.RenderArgs["globalConfigs"] = configService.GetGlobalConfigForUser()
- return c.RenderTemplate("note/note.html")
+// return c.RenderTemplate("note/note.html")
if isDev, _ := revel.Config.Bool("mode.dev"); isDev {
return c.RenderTemplate("note/note-dev.html")
diff --git a/app/controllers/admin/AdminUserController.go b/app/controllers/admin/AdminUserController.go
index e44eb4f..8e2ba65 100644
--- a/app/controllers/admin/AdminUserController.go
+++ b/app/controllers/admin/AdminUserController.go
@@ -44,7 +44,7 @@ func (c AdminUser) Register(email, pwd string) revel.Result {
}
// 注册
- re.Ok, re.Msg = authService.Register(email, pwd)
+ re.Ok, re.Msg = authService.Register(email, pwd, "")
return c.RenderRe(re)
}
diff --git a/app/info/UserInfo.go b/app/info/UserInfo.go
index 7d4e49d..abd06e3 100644
--- a/app/info/UserInfo.go
+++ b/app/info/UserInfo.go
@@ -41,7 +41,7 @@ type User struct {
ImageSize int `bson:"ImageSize" json:"-"` // 图片大小
AttachNum int `bson:"AttachNum" json:"-"` // 附件数量
AttachSize int `bson:"AttachSize" json:"-"` // 附件大小
- PerAttachSize int `bson:"PerAttachSize" json:"-"` // 单个附件大小
+ FromUserId bson.ObjectId `FromUserId,omitempty` // 邀请的用户
AccountType string `bson:"AccountType" json:"-"` // normal(为空), premium
AccountStartTime time.Time `bson:"AccountStartTime" json:"-"` // 开始日期
diff --git a/app/init.go b/app/init.go
index a0cb922..173776d 100644
--- a/app/init.go
+++ b/app/init.go
@@ -111,6 +111,7 @@ func init() {
}
// tags
+ // 2014/12/30 标签添加链接
revel.TemplateFuncs["blogTags"] = func(renderArgs map[string]interface{}, tags []string) template.HTML {
if tags == nil || len(tags) == 0 {
return ""
@@ -118,18 +119,68 @@ func init() {
locale, _ := renderArgs[revel.CurrentLocaleRenderArg].(string)
tagStr := ""
lenTags := len(tags)
+
+ tagPostUrl, _ := renderArgs["tagPostsUrl"].(string)
+
for i, tag := range tags {
str := revel.Message(locale, tag)
+ var classes = "label"
if strings.HasPrefix(str, "???") {
str = tag
}
- tagStr += str
+ if InArray([]string{"red", "blue", "yellow", "green"}, tag) {
+ classes += " label-" + tag
+ } else {
+ classes += " label-default"
+ }
+
+ classes += " label-post"
+ var url = tagPostUrl + "/" + url.QueryEscape(tag)
+ tagStr += "" + str + "";
if i != lenTags - 1 {
- tagStr += ","
+ tagStr += " "
}
}
return template.HTML(tagStr)
}
+
+ // lea++
+ revel.TemplateFuncs["blogTagsLea"] = func(renderArgs map[string]interface{}, tags []string, isRecommend bool) template.HTML {
+ if tags == nil || len(tags) == 0 {
+ return ""
+ }
+ locale, _ := renderArgs[revel.CurrentLocaleRenderArg].(string)
+ tagStr := ""
+ lenTags := len(tags)
+
+ tagPostUrl := "http://lea.leanote.com/"
+ if isRecommend {
+ tagPostUrl += "?tag=";
+ } else {
+ tagPostUrl += "latest?tag=";
+ }
+
+ for i, tag := range tags {
+ str := revel.Message(locale, tag)
+ var classes = "label"
+ if strings.HasPrefix(str, "???") {
+ str = tag
+ }
+ if InArray([]string{"red", "blue", "yellow", "green"}, tag) {
+ classes += " label-" + tag
+ } else {
+ classes += " label-default"
+ }
+ classes += " label-post"
+ var url = tagPostUrl + url.QueryEscape(tag)
+ tagStr += "" + str + "";
+ if i != lenTags - 1 {
+ tagStr += " "
+ }
+ }
+ return template.HTML(tagStr)
+ }
+
/*
revel.TemplateFuncs["blogTags"] = func(tags []string) template.HTML {
if tags == nil || len(tags) == 0 {
@@ -311,7 +362,7 @@ func init() {
// init Email
revel.OnAppStart(func() {
// 数据库
- db.Init()
+ db.Init("", "")
// email配置
InitEmail()
InitVd()
@@ -323,4 +374,5 @@ func init() {
member.InitService()
service.ConfigS.InitGlobalConfigs()
})
+
}
diff --git a/app/release/release.go b/app/release/release.go
index dfe4019..d02621d 100644
--- a/app/release/release.go
+++ b/app/release/release.go
@@ -32,10 +32,10 @@ import (
//var jss = []string{"js/jquery-cookie", "js/bootstrap"}
var jss = []string{"js/jquery-cookie", "js/bootstrap",
"js/common", "js/app/note", "js/app/tag", "js/app/notebook", "js/app/share",
- "js/object_id", "js/ZeroClipboard/ZeroClipboard"}
+ "js/object_id"}
-var base1 = "/Users/life/Documents/Go/package1/src/github.com/leanote/leanote/"
-var base = "/Users/life/Documents/Go/package1/src/github.com/leanote/leanote/public/"
+var base1 = "/Users/life/Documents/Go/package2/src/github.com/leanote/leanote/"
+var base = "/Users/life/Documents/Go/package2/src/github.com/leanote/leanote/public/"
var cmdPath = "/usr/local/bin/uglifyjs"
func cmdError(err error) {
diff --git a/app/service/AttachService.go b/app/service/AttachService.go
index 521558d..27a0e16 100644
--- a/app/service/AttachService.go
+++ b/app/service/AttachService.go
@@ -15,16 +15,16 @@ type AttachService struct {
}
// add attach
-func (this *AttachService) AddAttach(attach info.Attach) bool {
+func (this *AttachService) AddAttach(attach info.Attach) (ok bool, msg string) {
attach.CreatedTime = time.Now()
- ok := db.Insert(db.Attachs, attach)
+ ok = db.Insert(db.Attachs, attach)
if ok {
// 更新笔记的attachs num
this.updateNoteAttachNum(attach.NoteId, 1)
}
- return ok
+ return
}
// 更新笔记的附件个数
diff --git a/app/service/FileService.go b/app/service/FileService.go
index 6a403ae..d335db7 100644
--- a/app/service/FileService.go
+++ b/app/service/FileService.go
@@ -17,7 +17,7 @@ type FileService struct {
}
// add Image
-func (this *FileService) AddImage(image info.File, albumId, userId string) bool {
+func (this *FileService) AddImage(image info.File, albumId, userId string, needCheckSize bool) (ok bool, msg string) {
image.CreatedTime = time.Now()
if albumId != "" {
image.AlbumId = bson.ObjectIdHex(albumId)
@@ -27,7 +27,8 @@ func (this *FileService) AddImage(image info.File, albumId, userId string) bool
}
image.UserId = bson.ObjectIdHex(userId)
- return db.Insert(db.Files, image)
+ ok = db.Insert(db.Files, image)
+ return
}
// list images
@@ -232,7 +233,7 @@ func (this *FileService) CopyImage(userId, fileId, toUserId string) (bool, strin
id := bson.NewObjectId();
fileInfo.FileId = id
fileId = id.Hex()
- Ok := this.AddImage(fileInfo, "", toUserId)
+ Ok, _ := this.AddImage(fileInfo, "", toUserId, false)
if Ok {
return Ok, id.Hex()
diff --git a/app/views/note/note.html b/app/views/note/note.html
index 43492db..d0e9eb5 100644
--- a/app/views/note/note.html
+++ b/app/views/note/note.html
@@ -13,12 +13,11 @@
-
-
-
+
+
-
+
@@ -915,8 +914,10 @@ initPage();
+
+
");if(lastEndScriptPos==-1){return content}var length=content.length;if(length-9==lastEndScriptPos){var lastScriptPos=content.lastIndexOf("");if(lastEndScriptPos==-1){return content}var length=content.length;if(length-9==lastEndScriptPos){var lastScriptPos=content.lastIndexOf("