Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge pull request #470 from sfan5/wtf

Cette révision appartient à :
PantsuDev 2017-05-14 21:12:27 +10:00 révisé par GitHub
révision 107f46ed1a
9 fichiers modifiés avec 47 ajouts et 45 suppressions

Voir le fichier

@ -224,6 +224,7 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
#mainmenu .badgemenu {
padding-top: 0;
margin-right: -50px; /* don't ask */
}
/* PROFILE PAGE */

Voir le fichier

@ -8,11 +8,8 @@ import (
)
func FaqHandler(w http.ResponseWriter, r *http.Request) {
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
languages.SetTranslationFromRequest(faqTemplate, r, "en-us")
err := faqTemplate.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := faqTemplate.ExecuteTemplate(w, "index.html", FaqTemplateVariables{Navigation{}, NewSearchForm(), GetUser(r), r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}

Voir le fichier

@ -110,7 +110,9 @@ func IndexModPanel(w http.ResponseWriter, r *http.Request) {
torrentReports, _, _ := reportService.GetAllTorrentReports(offset, 0)
languages.SetTranslationFromRequest(panelIndex, r, "en-us")
htv := PanelIndexVbs{torrents, model.TorrentReportsToJSON(torrentReports), users, comments, NewSearchForm(), currentUser, r.URL}
search := NewSearchForm()
search.ShowItemsPerPage = false
htv := PanelIndexVbs{torrents, model.TorrentReportsToJSON(torrentReports), users, comments, search, currentUser, r.URL}
err := panelIndex.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err)
} else {
@ -137,9 +139,9 @@ func TorrentsListPanel(w http.ResponseWriter, r *http.Request) {
searchParam, torrents, _, err := search.SearchByQuery(r, pagenum)
searchForm := SearchForm{
SearchParam: searchParam,
Category: searchParam.Category.String(),
HideAdvancedSearch: false,
SearchParam: searchParam,
Category: searchParam.Category.String(),
ShowItemsPerPage: true,
}
languages.SetTranslationFromRequest(panelTorrentList, r, "en-us")

Voir le fichier

@ -10,11 +10,8 @@ import (
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
languages.SetTranslationFromRequest(notFoundTemplate, r, "en-us")
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, NewSearchForm(), GetUser(r), r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}

Voir le fichier

@ -38,9 +38,9 @@ func SearchHandler(w http.ResponseWriter, r *http.Request) {
navigationTorrents := Navigation{nbTorrents, int(searchParam.Max), pagenum, "search_page"}
// Convert back to strings for now.
searchForm := SearchForm{
SearchParam: searchParam,
Category: searchParam.Category.String(),
HideAdvancedSearch: false,
SearchParam: searchParam,
Category: searchParam.Category.String(),
ShowItemsPerPage: true,
}
htv := HomeTemplateVariables{b, searchForm, navigationTorrents, GetUser(r), r.URL, mux.CurrentRoute(r)}

Voir le fichier

@ -196,14 +196,15 @@ type Navigation struct {
type SearchForm struct {
common.SearchParam
Category string
HideAdvancedSearch bool
Category string
ShowItemsPerPage bool
}
// Some Default Values to ease things out
func NewSearchForm() SearchForm {
return SearchForm{
Category: "_",
ShowItemsPerPage: true,
}
}

Voir le fichier

@ -66,9 +66,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
err["errors"] = append(err["errors"], errUser.Error())
}
languages.SetTranslationFromRequest(viewUserDeleteTemplate, r, "en-us")
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
htv := UserVerifyTemplateVariables{err, searchForm, Navigation{}, GetUser(r), r.URL, mux.CurrentRoute(r)}
htv := UserVerifyTemplateVariables{err, NewSearchForm(), Navigation{}, GetUser(r), r.URL, mux.CurrentRoute(r)}
errorTmpl := viewUserDeleteTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -81,9 +79,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
if unfollow != nil {
infosForm["infos"] = append(infosForm["infos"], fmt.Sprintf(T("user_unfollowed_msg"), userProfile.Username))
}
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
htv := UserProfileVariables{&userProfile, infosForm, searchForm, Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)}
htv := UserProfileVariables{&userProfile, infosForm, NewSearchForm(), Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)}
err := viewProfileTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil {
@ -91,11 +87,8 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
}
}
} else {
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
languages.SetTranslationFromRequest(notFoundTemplate, r, "en-us")
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, NewSearchForm(), GetUser(r), r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
@ -113,21 +106,16 @@ func UserDetailsHandler(w http.ResponseWriter, r *http.Request) {
b := form.UserForm{}
modelHelper.BindValueForm(&b, r)
languages.SetTranslationFromRequest(viewProfileEditTemplate, r, "en-us")
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
availableLanguages := languages.GetAvailableLanguages()
htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), availableLanguages, searchForm, Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)}
htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), availableLanguages, NewSearchForm(), Navigation{}, currentUser, r.URL, mux.CurrentRoute(r)}
err := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
} else {
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
languages.SetTranslationFromRequest(notFoundTemplate, r, "en-us")
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, NewSearchForm(), GetUser(r), r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
@ -185,21 +173,15 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
}
} else {
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
languages.SetTranslationFromRequest(notFoundTemplate, r, "en-us")
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, NewSearchForm(), GetUser(r), r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
} else {
searchForm := NewSearchForm()
searchForm.HideAdvancedSearch = true
languages.SetTranslationFromRequest(notFoundTemplate, r, "en-us")
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, searchForm, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{Navigation{}, NewSearchForm(), GetUser(r), r.URL, mux.CurrentRoute(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}

Voir le fichier

@ -31,6 +31,7 @@
<option value="2" {{if eq .Search.Status 2}}selected{{end}}>{{T "trusted"}}</option>
<option value="3" {{if eq .Search.Status 3}}selected{{end}}>A+</option>
</select>
{{ if .Search.ShowItemsPerPage }}
<select id="max" name="max" class="form-control input-sm">
<option value="5" {{if eq .Navigation.MaxItemPerPage 5}}selected{{end}}>5</option>
<option value="10" {{if eq .Navigation.MaxItemPerPage 10}}selected{{end}}>10</option>
@ -48,9 +49,26 @@
<option value="200" {{if eq .Navigation.MaxItemPerPage 200}}selected{{end}}>200</option>
<option value="300" {{if eq .Navigation.MaxItemPerPage 300}}selected{{end}}>300</option>
</select>
{{ end }}
<input type="hidden" name="userID" value="{{ .Search.UserID }}">
{{end}}
{{/* this is used in the modpanel */}}
{{define "search_advanced"}}
<select name="sort" class="form-control input-sm">
<option value="0" {{if eq .Search.Sort 0}}selected{{end}}>{{T "id"}}</option>
<option value="1" {{if eq .Search.Sort 1}}selected{{end}}>{{T "name"}}</option>
<option value="2" {{if eq .Search.Sort 2}}selected{{end}}>{{T "date"}}</option>
<option value="3" {{if eq .Search.Sort 3}}selected{{end}}>{{T "downloads"}}</option>
<option value="4" {{if eq .Search.Sort 4}}selected{{end}}>{{T "size"}}</option>
<option value="5" {{if eq .Search.Sort 4}}selected{{end}}>{{T "seeders"}}</option>
<option value="6" {{if eq .Search.Sort 4}}selected{{end}}>{{T "leechers"}}</option>
<option value="7" {{if eq .Search.Sort 4}}selected{{end}}>{{T "completed"}}</option>
</select>
<select name="order" class="form-control input-sm">
<option value="false" {{if eq .Search.Order false}}selected{{end}}>{{T "descending"}}</option>
<option value="true" {{if eq .Search.Order true}}selected{{end}}>{{T "ascending"}}</option>
</select>
{{end}}
{{define "search_button"}}
<div class="input-group">
<input name="q" class="form-control input-sm" placeholder="{{T "search"}}" type="text" value="{{.Search.Query}}">

Voir le fichier

@ -305,11 +305,15 @@
},
{
"id": "which_trackers_do_you_recommend",
"translation": "Welche Tracker sind empfohlen?"
"translation": "Welche Tracker empfehlt ihr?"
},
{
"id": "answer_which_trackers_do_you_recommend",
"translation": "Wenn deine Torrents wegen Trackern Probleme machen, solltest du einige dieser hinzufügen:"
"translation": "Wir haben jetzt unseren eigenen Tracker! Füge ihn vorm Hochladen deinen Torrents hinzu:"
},
{
"id": "other_trackers",
"translation": "Allerdings solltest du diese auch hinzufügen, nur für den Fall, dass etwas schief läuft"
},
{
"id": "how_can_i_help",