"No comments" message, avatar in comments, classic theme improvements, some other changes, Old Navigation (#1545)
* Update view.jet.html * Update en-us.all.json * Update view.jet.html * Update CHANGELOG.md * fix travis * Update classic.css * Update view.jet.html * Update main.css * Update classic.css * Update classic.css * Update classic.css * add link to user page & avatar in comment * stylisation for avatar in main.css * Update classic.css * Fix wrongly placed ::before * Add rule list to terms of service * import rules on register * fix refine-container-2's inputs * Update base.jet.html * Update en-us.all.json * Update CHANGELOG.md * GenNav changes to constantly put HTML for nav arrows regardless of page * css changes for website nav etc etc * add OldNav global variable * Add OldNav to test.go * Update publicSettings.go * change OldNav's value type * Old navigation in settings * add OldNav in user variables * add oldNav input handler in settings.go * Change OldNav's default value into false * Create OldNav.jet.html * Update search.jet.html * remove character that had nothing to do here * fix wrong variable name * fix worng variable name and travis * Update classic.css * Add sort order & type to old nav * add toString() function in test * add toString() function * translation string for oldnav setting * Use translation string in settings.jet.html * fix few html errors * ditto * travis fix test * remove useless charset * remove useless things * add spaces before attributes * attempt at fixing travis 2 * fix wrong variable name * Update classic.css * fix travis plsss
Cette révision appartient à :
Parent
ed35976564
révision
870b72f1e9
18 fichiers modifiés avec 260 ajouts et 33 suppressions
|
@ -34,6 +34,7 @@ func ChangePublicSettingsHandler(c *gin.Context) {
|
|||
mascot := c.PostForm("mascot")
|
||||
mascotURL := c.PostForm("mascot_url")
|
||||
altColors := c.PostForm("altColors")
|
||||
oldNav := c.PostForm("oldNav")
|
||||
|
||||
messages := msg.GetMessages(c)
|
||||
|
||||
|
@ -61,6 +62,7 @@ func ChangePublicSettingsHandler(c *gin.Context) {
|
|||
user.Mascot = mascot
|
||||
user.MascotURL = mascotURL
|
||||
user.AltColors = altColors
|
||||
user.OldNav = oldNav
|
||||
user.UpdateRaw()
|
||||
}
|
||||
// Set cookie with http and not gin for expires (maxage not supported in <IE8)
|
||||
|
@ -68,7 +70,7 @@ func ChangePublicSettingsHandler(c *gin.Context) {
|
|||
http.SetCookie(c.Writer, &http.Cookie{Name: "theme", Value: theme, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
http.SetCookie(c.Writer, &http.Cookie{Name: "mascot", Value: mascot, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
http.SetCookie(c.Writer, &http.Cookie{Name: "mascot_url", Value: mascotURL, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
http.SetCookie(c.Writer, &http.Cookie{Name: "altColors", Value: altColors, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
http.SetCookie(c.Writer, &http.Cookie{Name: "oldNav", Value: oldNav, Domain: getDomainName(), Path: "/", Expires: timeHelper.FewDaysLater(365)})
|
||||
|
||||
c.Redirect(http.StatusSeeOther, "/")
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ type User struct {
|
|||
Language string `gorm:"column:language"`
|
||||
Theme string `gorm:"column:theme"`
|
||||
AltColors string `gorm:"column:alt_colors"`
|
||||
OldNav string `gorm:"column:old_nav"`
|
||||
Mascot string `gorm:"column:mascot"`
|
||||
MascotURL string `gorm:"column:mascot_url"`
|
||||
UserSettings string `gorm:"column:settings"`
|
||||
|
|
|
@ -25,6 +25,10 @@ body {
|
|||
width: 90px;
|
||||
}
|
||||
|
||||
#sort-list-order {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #106655;
|
||||
}
|
||||
|
@ -55,6 +59,9 @@ th.tr-name a {
|
|||
width: 29px;
|
||||
text-align: right;
|
||||
}
|
||||
.tr-links .icon-magnet::before {
|
||||
margin-right: 2px;
|
||||
}
|
||||
.tr-links a {
|
||||
display: block;
|
||||
}
|
||||
|
@ -142,6 +149,7 @@ th.tr-name a {
|
|||
top: auto;
|
||||
position: initial;
|
||||
border: 1px solid grey;
|
||||
cursor: auto;
|
||||
background: linear-gradient(to bottom, #fff 0%, #d8d8d8 72%);
|
||||
}
|
||||
.form-input.search-box+.icon-search:active {
|
||||
|
@ -182,15 +190,101 @@ select.form-input {
|
|||
border: 1px solid #333333;
|
||||
color: #FBFBFB;
|
||||
}
|
||||
.website-nav .pagination p {
|
||||
display: none;
|
||||
}
|
||||
.website-nav {
|
||||
padding-bottom: 2px!important;
|
||||
}
|
||||
.website-nav .pagination a {
|
||||
display: inline!important;
|
||||
}
|
||||
.website-nav #page-prev li{
|
||||
float: left;
|
||||
}
|
||||
.website-nav #page-next li{
|
||||
float: right;
|
||||
}
|
||||
|
||||
#description-box code {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.results.box {
|
||||
padding: 1px!important;
|
||||
border-top: none;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
.box, #description-box, .comment-box, .comment-submit,input#show-filelist:checked~#filelist {
|
||||
.box, #description-box, .comment-box,input#show-filelist:checked~#filelist {
|
||||
background-color: #FBFBFB;
|
||||
border: 2px solid #666666;
|
||||
}
|
||||
|
||||
.comment-box {
|
||||
font-size: .9em;
|
||||
border-radius: 5px;
|
||||
margin: 0 0 4px 0;
|
||||
padding: 4px;
|
||||
min-height: 70px;
|
||||
}
|
||||
|
||||
span.comment-index+p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
span.comment-index+p a {
|
||||
font-weight: bold;
|
||||
padding-top: 2px;
|
||||
font-size: .9em;
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
line-height: 22px;
|
||||
}
|
||||
span.comment-index+p a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.comment-index {
|
||||
margin: 3px 0 0 0;
|
||||
}
|
||||
|
||||
#solution {
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
.comment-index a::before {
|
||||
content: '';
|
||||
}
|
||||
.comment-index a {
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
float: right;
|
||||
margin-left: 9px;
|
||||
}
|
||||
.comment-index a:hover {
|
||||
color: #44A0A0;
|
||||
}
|
||||
|
||||
|
||||
.comment-submit {
|
||||
border: none;
|
||||
background: none;
|
||||
margin-top: 15px!important;
|
||||
}
|
||||
.comment-submit .comment-form {
|
||||
margin: 0;
|
||||
}
|
||||
.comment-form h3 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.comment-submit textarea{
|
||||
height: auto!important;
|
||||
width: auto!important;
|
||||
min-width: 310px;
|
||||
min-height: 50px!important;
|
||||
}
|
||||
|
||||
#description-box {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
@ -220,7 +314,8 @@ select.form-input {
|
|||
#torrent-description-hr {
|
||||
margin-top: 40px;
|
||||
}
|
||||
.torrent-hr {
|
||||
|
||||
.comment-submit h3 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.torrent-hr::after {
|
||||
|
@ -229,12 +324,13 @@ select.form-input {
|
|||
#torrent-name h1::after {
|
||||
content: '';
|
||||
}
|
||||
#torrent-name {
|
||||
font-size: 1.26em;
|
||||
#torrent-name h1 {
|
||||
font-size: .7em;
|
||||
text-align: left!important;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.header .h-user .user-menu {
|
||||
|
||||
background: linear-gradient(to bottom, #000000 0%, #2b2b2b 72%);
|
||||
}
|
||||
|
||||
|
@ -273,6 +369,14 @@ select.form-input {
|
|||
display: none;
|
||||
}
|
||||
|
||||
#comments {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
#no-comment-message {
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
th, th a {
|
||||
color: black;
|
||||
}
|
||||
|
@ -405,6 +509,10 @@ a.nav-btn.log-in {
|
|||
.torrent-preview-table{
|
||||
display: none!important;
|
||||
}
|
||||
.results table {
|
||||
|
||||
.box.profile-panel {
|
||||
border-right: none;
|
||||
}
|
||||
.profile-panel .btn-green {
|
||||
min-height: 22px;
|
||||
padding: 1px 0;
|
||||
}
|
||||
|
|
|
@ -1063,6 +1063,13 @@ html, body {
|
|||
text-align: justify;
|
||||
}
|
||||
|
||||
.comment-box img {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
float: left;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.comment-form {
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
|
@ -1075,6 +1082,9 @@ html, body {
|
|||
margin-top: 5px;
|
||||
float: right;
|
||||
}
|
||||
.comment-index a::before {
|
||||
content: '#';
|
||||
}
|
||||
|
||||
.torrent-buttons {
|
||||
margin-top: 20px;
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
</div>
|
||||
<center class="container" id="ad-container">
|
||||
{{ adId = Sukebei() ? 634159 : 634157 }}
|
||||
<iframe data-aa='{{adId}}' src='//ad.a-ads.com/{{adId}}?size=728x90' scrolling='no' allowtransparency='true'></iframe>
|
||||
<iframe data-aa='{{adId}}' src='//ad.a-ads.com/{{adId}}?size=728x90'></iframe>
|
||||
</center>
|
||||
<footer id="footer">
|
||||
<div class="container footer center">
|
||||
|
@ -94,8 +94,8 @@
|
|||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
{{ if !EUCookieLaw }}<div id="cookie-warning"><span id="cookie-warning-close" class="close">×</span>{{ T("cookie_warning")|raw }}</div>{{ end }}
|
||||
<script type="text/javascript" charset="utf-8">var commitVersion = "{{ Config.Build }}", UserID = {{User.ID}};</script>
|
||||
{{ if !EUCookieLaw && URL.String() == ""}}<div id="cookie-warning"><span id="cookie-warning-close" class="close">×</span>{{ T("cookie_warning")|raw }}</div>{{ end }}
|
||||
<script type="text/javascript">var commitVersion = "{{ Config.Build }}", UserID = {{User.ID}};</script>
|
||||
<script type="text/javascript" src="/js/query.js?v={{ Config.Version}}{{ Config.Build }}"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="/js/main.js?v={{ Config.Version }}{{ Config.Build }}" async></script>
|
||||
{{block footer_js()}}{{end}}
|
||||
|
|
24
templates/layouts/partials/helpers/OldNav.jet.html
Fichier normal
24
templates/layouts/partials/helpers/OldNav.jet.html
Fichier normal
|
@ -0,0 +1,24 @@
|
|||
<div class="box refine website-nav{{if URL.String() != "/" && !kilo_strcmp(URL.String(), "/search", 7, 1) }} refine-not-search{{end}}">
|
||||
<table id="sort-list-order">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
{{ if Search.Sort != 2 && Search.Sort != 0}}<a href="{{ genSearchWithOrdering(URL, "2") }}">Date</a>{{else}}<b>Date</b>{{end}} /
|
||||
{{ if Search.Sort != 5}}<a href="{{ genSearchWithOrdering(URL, "5") }}">Seeders</a>{{else}}<b>Seeders</b>{{end}} /
|
||||
{{ if Search.Sort != 6}}<a href="{{ genSearchWithOrdering(URL, "6") }}">Leechers</a>{{else}}<b>Leechers</b>{{end}} /
|
||||
{{ if Search.Sort != 7}}<a href="{{ genSearchWithOrdering(URL, "7") }}">Downloads</a>{{else}}<b>Downloads</b>{{end}} /
|
||||
{{ if Search.Sort != 4}}<a href="{{ genSearchWithOrdering(URL, "4") }}">Size</a>{{else}}<b>Size</b>{{end}} /
|
||||
{{ if Search.Sort != 1}}<a href="{{ genSearchWithOrdering(URL, "1") }}">Name</a>{{else}}<b>Name</b>{{end}}
|
||||
</td>
|
||||
<td style="padding: 0 0.4em!important;"> | </td>
|
||||
<td>
|
||||
{{ if Search.Order}}<a href="{{ genSearchWithOrdering(URL, toString(Search.Sort)) }}">Ascending</a>{{else}}<b>Ascending</b>{{end}} /
|
||||
{{ if !Search.Order}}<a href="{{ genSearchWithOrdering(URL, toString(Search.Sort)) }}">Descending</a>{{else}}<b>Descending</b>{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pagination">
|
||||
{{ genNav(Navigation, URL, 33)|raw }}
|
||||
</div>
|
||||
</div>
|
|
@ -12,8 +12,10 @@
|
|||
<button type="submit" class="form-input icon-search"></button><button type="submit" class="form-input refine" name="refine" value="1">{{ T("refine")}}</button>
|
||||
{{end}}
|
||||
{{block search_refine(url="") }}
|
||||
{{ if OldNav && (URL.String() == "/" || kilo_strcmp(URL.String(), "/search", 7, 1) )}}
|
||||
{{ include "layouts/partials/helpers/oldNav" }}
|
||||
{{ else }}
|
||||
<div {{ if !Search.ShowRefine }}style="display: none;"{{end}} class="box refine{{if URL.String() != "/" && !kilo_strcmp(URL.String(), "/search", 7, 1) }} refine-not-search{{end}}">
|
||||
</span>
|
||||
<form method="GET" action="{{ url }}">
|
||||
<h3>{{ T("refine_search") }}</h3>
|
||||
<div>
|
||||
|
@ -44,10 +46,10 @@
|
|||
{{ T("and")}}
|
||||
<input size="7" class="form-input" name="maxSize" type="text" value="{{Search.MaxSize}}"/>
|
||||
<select name="sizeType" class="form-input">
|
||||
<option value="b"{{if Search.SizeType == "b"}} selected{{end}}>B</option>
|
||||
<option value="k"{{if Search.SizeType == "k"}} selected{{end}}>KiB</option>
|
||||
<option value="m"{{if Search.SizeType == "m"}} selected{{end}}>MiB</option>
|
||||
<option value="g"{{if Search.SizeType == "g"}} selected{{end}}>GiB</option>
|
||||
<option value="b" {{if Search.SizeType == "b"}} selected{{end}}>B</option>
|
||||
<option value="k" {{if Search.SizeType == "k"}} selected{{end}}>KiB</option>
|
||||
<option value="m" {{if Search.SizeType == "m"}} selected{{end}}>MiB</option>
|
||||
<option value="g" {{if Search.SizeType == "g"}} selected{{end}}>GiB</option>
|
||||
</select>
|
||||
{{ T("large")}}
|
||||
</span>
|
||||
|
@ -61,16 +63,16 @@
|
|||
<span class="form-refine" style="margin-bottom: 2px;">
|
||||
<span class="spacing">{{T("sort_by")}}</span>
|
||||
<select name="sort" class="form-input">
|
||||
<option value="1"{{if Search.Sort == 1}}selected{{end}}>{{T("name")}}</option>
|
||||
<option value="4"{{if Search.Sort == 4}}selected{{end}}>{{T("size")}}</option>
|
||||
<option value="5"{{if Search.Sort == 5}}selected{{end}}>{{T("seeders")}}</option>
|
||||
<option value="6"{{if Search.Sort == 6}}selected{{end}}>{{T("leechers")}}</option>
|
||||
<option value="7"{{if Search.Sort == 7}}selected{{end}}>{{T("completed")}}</option>
|
||||
<option value="2"{{if Search.Sort == 2 || Search.Sort == 0}}selected{{end}}>{{T("date")}}</option>
|
||||
<option value="1" {{if Search.Sort == 1}}selected{{end}}>{{T("name")}}</option>
|
||||
<option value="4" {{if Search.Sort == 4}}selected{{end}}>{{T("size")}}</option>
|
||||
<option value="5" {{if Search.Sort == 5}}selected{{end}}>{{T("seeders")}}</option>
|
||||
<option value="6" {{if Search.Sort == 6}}selected{{end}}>{{T("leechers")}}</option>
|
||||
<option value="7" {{if Search.Sort == 7}}selected{{end}}>{{T("completed")}}</option>
|
||||
<option value="2" {{if Search.Sort == 2 || Search.Sort == 0}}selected{{end}}>{{T("date")}}</option>
|
||||
</select>
|
||||
<select name="order" class="form-input">
|
||||
<option value="true">{{T("ascending")}}</option>
|
||||
<option value="false"{{if !Search.Order}}selected{{end}}>{{T("descending")}}</option>
|
||||
<option value="false" {{if !Search.Order}}selected{{end}}>{{T("descending")}}</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
@ -100,3 +102,4 @@
|
|||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="tr-name home-td"{{ if len(.Comments) == 0 }}colspan="2"{{ end }}>
|
||||
<td class="tr-name home-td" {{ if len(.Comments) == 0 }}colspan="2"{{ end }}>
|
||||
<a href="/view/{{ .ID }}">
|
||||
{{.Name}}
|
||||
</a>
|
||||
|
|
|
@ -177,13 +177,16 @@
|
|||
{{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}}">{{index}}</a>
|
||||
<small style="padding-left: 4px;" class="date-short">{{formatDateRFC(element.Date)}}</small>
|
||||
</span>
|
||||
<p>{{element.Username}}</p>
|
||||
<p>{{element.Content|raw}}</p>
|
||||
<p><img src="https://www.gravatar.com/avatar/{{ element.UserAvatar }}"/><a href="/user/{{element.UserID}}/{{element.Username}}" class="comment-user">{{element.Username}}</a></p>
|
||||
<p class="comment-content">{{element.Content|raw}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{ if len(Torrent.Comments) == 0 }}
|
||||
<p id="no-comment-message">{{ T("torrent_no_comments") }}</p>
|
||||
{{ end }}
|
||||
<div style="margin-top: 10px" class="torrent-info-box comment-submit">
|
||||
<form method="post">
|
||||
{{ yield csrf_field()}}
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
<span class="form-group">
|
||||
<h3>{{ T("alternating_color") }}</h3>
|
||||
<p>{{ T("old_nav_explanation") }}</p>
|
||||
<select id="altColors-selector" name="altColors" class="form-input">
|
||||
<option value="false">Disabled</option>
|
||||
<option value="true" {{if AltColors}}selected{{end}}>Enabled</option>
|
||||
|
@ -49,6 +50,15 @@
|
|||
<br/>
|
||||
</span>
|
||||
|
||||
<span class="form-group">
|
||||
<h3>{{ T("old_nav") }}</h3>
|
||||
<select id="oldNav-selector" name="oldNav" class="form-input">
|
||||
<option value="false">Disabled</option>
|
||||
<option value="true" {{if OldNav}}selected{{end}}>Enabled</option>
|
||||
</select>
|
||||
<br/>
|
||||
</span>
|
||||
|
||||
<p>{{ T("cookies")}}</p>
|
||||
<button type="submit" class="form-input btn">{{ T("save_changes")}}</button>
|
||||
</div>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
{{ import "layouts/partials/helpers/csrf" }}
|
||||
{{ import "layouts/partials/helpers/captcha" }}
|
||||
{{ import "layouts/partials/helpers/errors" }}
|
||||
{{ import "layouts/partials/helpers/rules" }}
|
||||
{{block title()}}{{ T("register_title") }}{{end}}
|
||||
{{block content_body()}}
|
||||
<div class="box">
|
||||
|
@ -44,6 +45,7 @@
|
|||
<h2>{{ T("terms_conditions") }}</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{{ yield ruleList() }}
|
||||
<p>{{ T("terms_conditions_full")|raw }}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -54,6 +54,7 @@ func Commonvariables(c *gin.Context) jet.VarMap {
|
|||
variables.Set("T", publicSettings.GetTfuncFromRequest(c))
|
||||
variables.Set("Theme", publicSettings.GetThemeFromRequest(c))
|
||||
variables.Set("AltColors", publicSettings.GetAltColorsFromRequest(c))
|
||||
variables.Set("OldNav", publicSettings.GetOldNavFromRequest(c))
|
||||
variables.Set("Mascot", publicSettings.GetMascotFromRequest(c))
|
||||
variables.Set("MascotURL", publicSettings.GetMascotURLFromRequest(c))
|
||||
variables.Set("User", user)
|
||||
|
|
|
@ -49,6 +49,7 @@ func templateFunctions(vars jet.VarMap) jet.VarMap {
|
|||
vars.Set("genUploaderLink", genUploaderLink)
|
||||
vars.Set("genActivityContent", genActivityContent)
|
||||
vars.Set("contains", contains)
|
||||
vars.Set("toString", toString)
|
||||
vars.Set("kilo_strcmp", kilo_strcmp)
|
||||
vars.Set("kilo_strfind", kilo_strfind)
|
||||
return vars
|
||||
|
@ -83,6 +84,8 @@ func genSearchWithOrdering(currentURL *url.URL, sortBy string) string {
|
|||
return u.String()
|
||||
}
|
||||
|
||||
|
||||
|
||||
func genSortArrows(currentURL *url.URL, sortBy string) template.HTML {
|
||||
values := currentURL.Query()
|
||||
leftclass := "sortarrowdim"
|
||||
|
@ -116,10 +119,14 @@ func genNav(nav Navigation, currentURL *url.URL, pagesSelectable int) template.H
|
|||
if nav.TotalItem > 0 {
|
||||
maxPages := math.Ceil(float64(nav.TotalItem) / float64(nav.MaxItemPerPage))
|
||||
|
||||
href := ""
|
||||
display := " style=\"display:none;\""
|
||||
if nav.CurrentPage-1 > 0 {
|
||||
url := "/" + nav.Route + "/1"
|
||||
ret = ret + "<a id=\"page-prev\" href=\"" + url + "?" + currentURL.RawQuery + "\" aria-label=\"Previous\"><li><span aria-hidden=\"true\">«</span></li></a>"
|
||||
display = ""
|
||||
href = " href=\"" + "/" + nav.Route + "/1" + "?" + currentURL.RawQuery + "\""
|
||||
}
|
||||
ret = ret + "<a id=\"page-prev\"" + display + href + " aria-label=\"Previous\"><li><span aria-hidden=\"true\">«</span></li></a>"
|
||||
|
||||
startValue := 1
|
||||
if nav.CurrentPage > pagesSelectable/2 {
|
||||
startValue = (int(math.Min((float64(nav.CurrentPage)+math.Floor(float64(pagesSelectable)/2)), maxPages)) - pagesSelectable + 1)
|
||||
|
@ -140,10 +147,15 @@ func genNav(nav Navigation, currentURL *url.URL, pagesSelectable int) template.H
|
|||
}
|
||||
ret = ret + ">" + strconv.Itoa(i) + "</li></a>"
|
||||
}
|
||||
|
||||
href = ""
|
||||
display = " style=\"display:none;\""
|
||||
if nav.CurrentPage < int(maxPages) {
|
||||
url := "/" + nav.Route + "/" + strconv.Itoa(nav.CurrentPage+1)
|
||||
ret = ret + "<a id=\"page-next\" href=\"" + url + "?" + currentURL.RawQuery + "\" aria-label=\"Next\"><li><span aria-hidden=\"true\">»</span></li></a>"
|
||||
display = ""
|
||||
href = " href=\"" + "/" + nav.Route + "/" + strconv.Itoa(nav.CurrentPage+1) + "?" + currentURL.RawQuery + "\""
|
||||
}
|
||||
ret = ret + "<a id=\"page-next\"" + display + href +" aria-label=\"Next\"><li><span aria-hidden=\"true\">»</span></li></a>"
|
||||
|
||||
itemsThisPageStart := nav.MaxItemPerPage*(nav.CurrentPage-1) + 1
|
||||
itemsThisPageEnd := nav.MaxItemPerPage * nav.CurrentPage
|
||||
if nav.TotalItem < itemsThisPageEnd {
|
||||
|
@ -309,6 +321,10 @@ func torrentFileExists(hash string, TorrentLink string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func toString(number int) string {
|
||||
return strconv.Itoa(number)
|
||||
}
|
||||
|
||||
func kilo_strcmp(str1 string, str2 string, end int, start int) bool {
|
||||
//Compare two strings but has length arguments
|
||||
|
||||
|
|
|
@ -630,6 +630,24 @@ func Testkilo_strcmp(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestToString(t *testing.T) {
|
||||
var tests = []struct {
|
||||
TestInt int
|
||||
Expected string
|
||||
}{
|
||||
{
|
||||
TestInt: 0,
|
||||
Expected: "0",
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
value := toString(test.TestInt)
|
||||
if value != test.Expected {
|
||||
t.Errorf("Unexpected value from the function languageName, got '%t', wanted '%t'", value, test.Expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Testkilo_strfind(t *testing.T) {
|
||||
var tests = []struct {
|
||||
|
|
|
@ -51,7 +51,7 @@ func walkDirTest(dir string, t *testing.T) {
|
|||
em := "cop@cat.fe"
|
||||
|
||||
fakeTag := &models.Tag{1, 1, "12345", "anidbid", 1, 0, true}
|
||||
fakeUser := &models.User{1, "test", "test", "test", 1, time.Now(), time.Now(), "test", time.Now(), "en", "test", "test", "test", "test", "test", 0.0, []models.User{}, []models.User{}, "test", []models.Torrent{}, []models.Notification{}, 1, models.UserSettings{}, []models.Tag{*fakeTag}}
|
||||
fakeUser := &models.User{1, "test", "test", "test", 1, time.Now(), time.Now(), "test", time.Now(), "en", "test", "test", "test", "test", "test", "test", 0.0, []models.User{}, []models.User{}, "test", []models.Torrent{}, []models.Notification{}, 1, models.UserSettings{}, []models.Tag{*fakeTag}}
|
||||
fakeComment := &models.Comment{1, 1, 1, "test", time.Now(), time.Now(), nil, &models.Torrent{}, fakeUser}
|
||||
fakeScrapeData := &models.Scrape{1, 0, 0, 10, time.Now()}
|
||||
fakeFile := &models.File{1, 1, "l12:somefile.mp4e", 3}
|
||||
|
@ -282,6 +282,7 @@ func mockupCommonvariables(t *testing.T) jet.VarMap {
|
|||
variables.Set("T", T)
|
||||
variables.Set("Theme", "test")
|
||||
variables.Set("AltColors", "test")
|
||||
variables.Set("OldNav", "test")
|
||||
variables.Set("Mascot", "test")
|
||||
variables.Set("MascotURL", "test")
|
||||
variables.Set("User", &models.User{})
|
||||
|
|
|
@ -35,3 +35,6 @@
|
|||
* - removed: hide_ads_setting_explanation
|
||||
## 2017/09/08
|
||||
* + rule_tracker_url
|
||||
## 2017/09/10
|
||||
* + torrent_no_comments
|
||||
* ~ edited: change_settings
|
||||
|
|
|
@ -575,6 +575,10 @@
|
|||
"id": "submit_a_comment_as_anonymous",
|
||||
"translation": "Submit a comment as Anonymous"
|
||||
},
|
||||
{
|
||||
"id": "torrent_no_comments",
|
||||
"translation": "No user comments have been posted."
|
||||
},
|
||||
{
|
||||
"id": "submit",
|
||||
"translation": "Submit"
|
||||
|
@ -1073,7 +1077,7 @@
|
|||
},
|
||||
{
|
||||
"id": "change_settings",
|
||||
"translation": "Change Appearance/Language"
|
||||
"translation": "Change Appearance/Settings"
|
||||
},
|
||||
{
|
||||
"id": "mascot",
|
||||
|
@ -1319,6 +1323,14 @@
|
|||
"id": "alternating_color",
|
||||
"translation": "Alternating Color (and non-bold fonts)"
|
||||
},
|
||||
{
|
||||
"id": "old_nav",
|
||||
"translation": "Old Navigation"
|
||||
},
|
||||
{
|
||||
"id": "old_nav_explanation",
|
||||
"translation": "Shows main categories and page numbers at the top of the page during a search, just like nyaa.se. Replaces refine."
|
||||
},
|
||||
{
|
||||
"id": "no_notifications",
|
||||
"translation": "No Notifications"
|
||||
|
|
|
@ -197,6 +197,19 @@ func GetAltColorsFromRequest(c *gin.Context) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// GetOldNavFromRequest : Return whether user has enabled old navigation or not
|
||||
func GetOldNavFromRequest(c *gin.Context) bool {
|
||||
user, _ := getCurrentUser(c)
|
||||
if user.ID > 0 {
|
||||
return user.OldNav == "true"
|
||||
}
|
||||
cookie, err := c.Cookie("oldNav")
|
||||
if err == nil {
|
||||
return cookie == "true"
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetMascotFromRequest : Return whether user has enabled mascot or not
|
||||
func GetMascotFromRequest(c *gin.Context) string {
|
||||
user, _ := getCurrentUser(c)
|
||||
|
|
Référencer dans un nouveau ticket