diff --git a/controllers/torrent/view.go b/controllers/torrent/view.go index addd3b61..10934956 100644 --- a/controllers/torrent/view.go +++ b/controllers/torrent/view.go @@ -65,6 +65,14 @@ func ViewHandler(c *gin.Context) { if user.NeedsCaptcha() { captchaID = captcha.GetID() } + + if c.Request.URL.Query()["followed"] != nil { + messages.AddInfoTf("infos", "user_followed_msg", b.UploaderName) + } + if c.Request.URL.Query()["unfollowed"] != nil { + messages.AddInfoTf("infos", "user_unfollowed_msg", b.UploaderName) + } + // Display finally the view templates.Torrent(c, b, folder, captchaID) } diff --git a/controllers/user/follow.go b/controllers/user/follow.go index 8a2559bd..85ffa976 100644 --- a/controllers/user/follow.go +++ b/controllers/user/follow.go @@ -16,7 +16,7 @@ func UserFollowHandler(c *gin.Context) { currentUser := router.GetUser(c) user, _, errorUser := users.FindForAdmin(uint(id)) if errorUser == nil && user.ID > 0 { - if !currentUser.IsFollower(user) { + if !currentUser.IsFollower(uint(id)) { followAction = "followed" currentUser.SetFollow(user) } else { @@ -25,5 +25,8 @@ func UserFollowHandler(c *gin.Context) { } } url := "/user/" + strconv.Itoa(int(user.ID)) + "/" + user.Username + "?" + followAction + if c.Query("id") != "" { + url = "/view/" + c.Query("id") + "?" + followAction + } c.Redirect(http.StatusSeeOther, url) } diff --git a/models/user.go b/models/user.go index bbcecef8..cb9f49cc 100644 --- a/models/user.go +++ b/models/user.go @@ -210,12 +210,13 @@ func (u *User) GetRole() string { } // IsFollower : Check if a user is following another -func (follower *User) IsFollower(u *User) bool { +func (follower *User) IsFollower(userid uint) bool { var likingUserCount int - ORM.Model(&UserFollows{}).Where("user_id = ? and following = ?", follower.ID, u.ID).Count(&likingUserCount) + ORM.Model(&UserFollows{}).Where("user_id = ? and following = ?", follower.ID, userid).Count(&likingUserCount) return likingUserCount != 0 } + // ToJSON : Conversion of a user model to json func (u *User) ToJSON() UserJSON { json := UserJSON{ diff --git a/public/css/main.css b/public/css/main.css index 7b43a70c..e7e01042 100644 --- a/public/css/main.css +++ b/public/css/main.css @@ -1129,7 +1129,24 @@ html, body { overflow: hidden; text-overflow: ellipsis; } - +.torrent-info-data #subscribe-link::before, .torrent-info-data #subscribe-link::after { + font-weight: normal; + color: black; +} +.torrent-info-data #subscribe-link::before { + content: '['; +} +.torrent-info-data #subscribe-link::after { + content: ']'; +} +.torrent-info-data #subscribe-link { + font-weight: bold; + font-size: 13px; +} +.torrent-info-data #subscribe-link:hover { + text-decoration: underline; +} + .torrent-info-box { border: 1px solid #ccc; border-radius: 4px; @@ -1775,7 +1792,7 @@ input.nav-btn { max-width: 100%; } -.rules-drop>summary { +details>summary { cursor: pointer; } @@ -1799,11 +1816,12 @@ summary::-webkit-details-marker { display: none } summary:after { vertical-align: middle; float: left; - margin: -1px 5px 0 0; + margin: -3px 5px 0 0; content: "+"; width: 12px; font-size: 1.5em; font-weight: bold; + outline: none; } details[open] summary:after { @@ -2041,9 +2059,42 @@ p.upload-rules a { margin-bottom: 2px; z-index: 1; } + +.upload-form-table details { + margin-bottom: 4px; +} +#anidex-upload-info > div { + height: auto; + padding: 10px 6px; + border-top: none; +} +#anidex-upload-info p { + margin-bottom: 4px; +} +#anidex-upload-info p:first-child { + margin-top: 0; +} +#anidex-upload-info > div > div { + margin-left: 9px; +} + +#anidex-upload-info > div input[type="text"], #anidex-upload-info > div select { + margin-bottom: 4px; + +} +#anidex-upload-info > div select { + width: calc(100% - 8px); +} +#anidex-upload-info > div select[name="anidex_form_category"] option{ + color: #000; + text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3); + font-size: 14px; + font-weight: bold; +} + .upload-form-table .checkbox-container+input { width: 90%; - width: calc(100% - 21px); + width: calc(100% - 29px); } .upload-form-table .checkbox-container { display: inline-block; @@ -2058,6 +2109,7 @@ p.upload-rules a { background: #dadada; } + #tag-h3 { margin: 0 0 7px; } diff --git a/public/css/themes/classic.css b/public/css/themes/classic.css index a101239c..a7e8cd9a 100644 --- a/public/css/themes/classic.css +++ b/public/css/themes/classic.css @@ -60,6 +60,9 @@ body, .header { a { color: #106655; } +.sukebei a { + color: #660000; +} a:hover { text-decoration: underline; } @@ -132,7 +135,10 @@ th.tr-name a { content: ''; } .icon-floppy { - background: url("/img/dl-link.png") no-repeat center; + background: url("classic/dl-link.png") no-repeat center; +} +.sukebei .icon-floppy { + background: url("classic/sukebei-dl-link.png") no-repeat center; } .upload-tag-table .input-label { font-size: 12px; @@ -141,7 +147,7 @@ th.tr-name a { height: 40px; } .header { - background: url("/img/topbar.png") repeat-x black; + background: url("classic/topbar.png") repeat-x black; background: linear-gradient(to bottom, #6d6d6d 0%, #000000 72%); border-color: black; height: 40px; @@ -237,6 +243,9 @@ select.form-input { border: 1px solid #333333; color: #FBFBFB; } +.sukebei .pagination span:hover { + background-color: #993333; +} .website-nav .pagination p { display: none; } @@ -441,6 +450,9 @@ span.comment-index+p a:hover { margin-right: 6px; float: left; } +.sukebei .torrent-buttons a, .sukebei .torrent-buttons button { + background: linear-gradient(to bottom, #CA3346 5%, #482120 80%); +} .torrent-buttons a.hidden { opacity: 0.6!important; filter: grayscale(0.7); @@ -486,6 +498,9 @@ td { td a { color: #106655; } +.sukebei td a { + color: #660000; +} td.tr-se, .success-text { color: green; } @@ -692,3 +707,9 @@ span.tag { width: 128px!important; height: 20px; } +.sukebei .torrent-info-data #subscribe-link { + color: #660000; +} +.torrent-info-data #subscribe-link::before, .torrent-info-data #subscribe-link:: after { + color: #111111; +} diff --git a/public/img/dl-link.png b/public/css/themes/classic/dl-link.png similarity index 100% rename from public/img/dl-link.png rename to public/css/themes/classic/dl-link.png diff --git a/public/css/themes/classic/sukebei-dl-link.png b/public/css/themes/classic/sukebei-dl-link.png new file mode 100644 index 00000000..a13ffab8 Binary files /dev/null and b/public/css/themes/classic/sukebei-dl-link.png differ diff --git a/public/img/topbar.png b/public/css/themes/classic/topbar.png similarity index 100% rename from public/img/topbar.png rename to public/css/themes/classic/topbar.png diff --git a/public/css/themes/tomorrow.css b/public/css/themes/tomorrow.css index 6c22bd84..ff5bbaa9 100644 --- a/public/css/themes/tomorrow.css +++ b/public/css/themes/tomorrow.css @@ -346,3 +346,7 @@ span.tag { .sukebei .admin-content tr:hover a { color: #ea8c8c; } + +#subscribe-link::before, #subscribe-link::after { + color: #c5c8c6; +} diff --git a/templates/layouts/partials/menu/profile.jet.html b/templates/layouts/partials/menu/profile.jet.html index ff512d72..80675ce5 100644 --- a/templates/layouts/partials/menu/profile.jet.html +++ b/templates/layouts/partials/menu/profile.jet.html @@ -20,7 +20,7 @@
{{if User.ID > 0 }} {{if !User.CurrentUserIdentical(UserProfile.ID) }} - {{if !User.IsFollower(UserProfile)}} + {{if !User.IsFollower(UserProfile.ID)}} {{ T("follow")}} {{else}} {{ T("unfollow")}} diff --git a/templates/site/torrents/view.jet.html b/templates/site/torrents/view.jet.html index 27b261e0..74c33f48 100644 --- a/templates/site/torrents/view.jet.html +++ b/templates/site/torrents/view.jet.html @@ -23,7 +23,14 @@ {{ T("uploaded_by") }}: - {{ genUploaderLink(Torrent.UploaderID, Torrent.UploaderName, Torrent.Hidden)|raw }} + {{if Torrent.UploaderID == 0}} + {{ genUploaderLink(Torrent.UploaderID, Torrent.UploaderName, Torrent.Hidden)|raw }} + {{else}} + + {{ genUploaderLink(Torrent.UploaderID, Torrent.UploaderName, Torrent.Hidden)|raw }} + {{if !Torrent.Hidden && Torrent.UploaderID != User.ID && User.ID > 0}}{{if User.IsFollower(Torrent.UploaderID)}}{{T("unfollow")}}{{else}}{{T("follow")}}{{end}}{{end}} + + {{end}}