Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Add RSS link on userprofile, "Search from this user" input, route changes, other changes (#1630)

* Styling for new "Search from user" input in profile

* new "Search from this user" input

* Add RSS link on user profile

* fix rss icon being misaligned

* start comment count at 1 instead of 0

* fix misalignement of category in refine in japanese

* Add new routes for user search

* Update torrents.jet.html

* add translation string

* Update en-us.all.json

* Update CHANGELOG.md

* remove margin-right of torrent button icon

* Add /username/XXX/Search route

* /username/XXX route doesn't redirect anymore
Cette révision appartient à :
kilo 2017-10-03 01:44:33 +02:00 révisé par GitHub
Parent 415db8ca06
révision 7273156007
8 fichiers modifiés avec 69 ajouts et 22 suppressions

Voir le fichier

@ -3,7 +3,6 @@ package userController
import (
"strconv"
"time"
"fmt"
"net/http"
@ -60,14 +59,36 @@ func UserProfileHandler(c *gin.Context) {
func UserGetFromName(c *gin.Context) {
username := c.Param("username")
if(username != "") {
user, _, _, err := users.FindByUsername(username)
if err == nil {
c.Redirect(http.StatusSeeOther, fmt.Sprintf("/user/%d/%s", uint32(user.ID), username))
return
}
}
c.Status(http.StatusNotFound)
Ts, _ := publicSettings.GetTfuncAndLanguageFromRequest(c)
messages := msg.GetMessages(c)
userProfile, _, _, err := users.FindByUsername(username)
if err == nil {
currentUser := router.GetUser(c)
follow := c.Request.URL.Query()["followed"]
unfollow := c.Request.URL.Query()["unfollowed"]
deleteVar := c.Request.URL.Query()["delete"]
if (deleteVar != nil) && (currentUser.CurrentOrAdmin(userProfile.ID)) {
_, err := userProfile.Delete(currentUser)
if err == nil && currentUser.CurrentUserIdentical(userProfile.ID) {
cookies.Clear(c)
}
templates.Static(c, "site/static/delete_success.jet.html")
} else {
if follow != nil {
messages.AddInfof("infos", Ts("user_followed_msg"), userProfile.Username)
}
if unfollow != nil {
messages.AddInfof("infos", Ts("user_unfollowed_msg"), userProfile.Username)
}
userProfile.ParseSettings()
templates.UserProfile(c, userProfile)
}
} else {
c.Status(http.StatusNotFound)
}
}
// UserDetailsHandler : Getting User Profile Details View

Voir le fichier

@ -2,6 +2,7 @@ package userController
import "github.com/NyaaPantsu/nyaa/controllers/router"
import "github.com/NyaaPantsu/nyaa/controllers/feed"
import "github.com/NyaaPantsu/nyaa/controllers/search"
func init() {
@ -31,9 +32,13 @@ func init() {
userRoutes.GET("/:id/:username/edit", UserDetailsHandler)
userRoutes.POST("/:id/:username/edit", UserProfileFormHandler)
userRoutes.GET("/:id/:username/apireset", UserAPIKeyResetHandler)
userRoutes.GET("/:id/:username/search", searchController.SearchHandler)
userRoutes.GET("/:id/:username/search/:page", searchController.SearchHandler)
userRoutes.GET("/:id/:username/feed", feedController.RSSHandler)
userRoutes.GET("/:id/:username/feed/:page", feedController.RSSHandler)
}
router.Get().Any("/username/:username", UserGetFromName)
router.Get().Any("/username/:username/search", searchController.SearchHandler)
router.Get().Any("/username/:username/search:page", searchController.SearchHandler)
}

Voir le fichier

@ -699,7 +699,6 @@ html, body {
.torrent-buttons a [class^="icon-"], .torrent-buttons a [class*=" icon-"], a.form-input.btn-green>div[class^="icon-"], a.form-input.btn-green>div[class*="icon-"] {
vertical-align: initial;
margin-right: 5px;
}
#mascotKeepHide {
@ -1051,7 +1050,9 @@ html, body {
display: block;
margin-bottom: 11px;
}
.profile-usermenu .icon-rss-squared {
vertical-align: top;
}
.profile-userbuttons {
display: inline-flex;
margin-bottom: 5px;
@ -2144,11 +2145,24 @@ table.multiple-upload {
padding: 5px 0;
}
.user-search {
word-spacing: -7px;
display:block;
padding: 0 1rem;
}
.user-search [type="text"] {
vertical-align: top;
width: calc(100% - 30px);
}
/* Language specific CSS */
html[lang="ja-jp"] .form-refine span.spacing {
vertical-align: middle;
}
html[lang="ja-jp"] .form-input.refine-category {
vertical-align: top;
}
@media (max-width: 1100px) {
html[lang="ja-jp"] .header .h-user>.nav-btn {
font-size: 75%;

Voir le fichier

@ -37,25 +37,22 @@
<div class="profile-usermenu">
{{ if User.ID > 0 && (User.CurrentUserIdentical(UserProfile.ID) || User.CurrentOrAdmin(UserProfile.ID)) }}
<a class="form-input btn-green" href="/user/{{ UserProfile.ID }}/{{ UserProfile.Username }}">
<div class="icon-floppy"></div>{{ T("torrents")}}
</a>
<br/>
{{ else }}
<a class="form-input btn-green" href="/search?userID={{ UserProfile.ID }}">
{{end}}
<div class="icon-floppy"></div>{{ T("torrents")}}
</a>
<br/>
{{ end }}
<a class="form-input btn-orange" href="/feed?userID={{ UserProfile.ID }}">
<div class="icon-rss-squared"></div>RSS
</a>
{{if User.ID > 0 }}
{{ if User.CurrentUserIdentical(UserProfile.ID) }}
<a class="form-input" href="/notifications">{{ T("my_notifications")}}</a>
<br/>
{{end}}
{{if UserProfile.ID > 0 && User.CurrentOrAdmin(UserProfile.ID) }}
<a class="form-input" href="/user/{{UserProfile.ID}}/{{UserProfile.Username}}/edit">
{{ T("settings")}}
</a>
<br/>
{{end}}
{{end}}
</div>

Voir le fichier

@ -177,7 +177,7 @@
{{range index, element := Torrent.Comments}}
<div class="torrent-info-box comment-box">
<span class="comment-index">
<a href="#comment_{{index}}">{{index}}</a>
<a href="#comment_{{index+1}}">{{index}}</a>
<small style="padding-left: 4px;" class="date-short">{{formatDateRFC(element.Date)}}</small>
</span>
<p><img src="https://www.gravatar.com/avatar/{{ element.UserAvatar }}"/><a {{if element.UserID > 0}}href="/user/{{element.UserID}}/{{element.Username}}"{{end}} class="comment-user">{{element.Username}}</a></p>

Voir le fichier

@ -47,15 +47,19 @@
</tr>
{{end}}
</table>
<nav class="torrentNav" aria-label="Page navigation">
<div class="pagination">
<a href="/search?userID={{ UserProfile.ID }}" aria-label="Next">
<span>
<span style="display:block;border-right:1px solid;">
{{ T("see_more_torrents_from", UserProfile.Username) }}
</span>
</a>
</div>
</nav>
<div class="user-search">
<form role="search" action="/user/{{UserProfile.ID}}/{{UserProfile.Username}}/search" id="header-form" method="get">'
<input class="form-input" name="q" type="text" placeholder="{{T("search_from_user")}}">
<button type="submit" class="form-input icon-search"></button>
</form>
</div>
{{else}}
<h2 style="text-align: center;">{{ T("no_torrents_uploaded") }}</h2>
{{end}}

Voir le fichier

@ -50,3 +50,5 @@
* + disabled
* + reset_api_key
* + tag_error
## 2017/10/02
* + search_from_user

Voir le fichier

@ -2142,5 +2142,9 @@
{
"id": "tag_error",
"translation": "Couldn't add a tag, please check your internet connection and that all fields are filled."
},
{
"id": "search_from_user",
"translation": "Search from this user..."
}
]