Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Get sukebei working

Cette révision appartient à :
Eliot Whalan 2017-05-15 19:08:17 +10:00
Parent 7d5369cfe1
révision cf4e482046
13 fichiers modifiés avec 89 ajouts et 37 suppressions

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 4 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 4 Kio

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 4,3 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 4,3 Kio

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 3,7 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 3,7 Kio

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 3,1 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 3,1 Kio

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 4 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 4 Kio

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 4,3 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 4,3 Kio

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 4 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 4 Kio

Voir le fichier

@ -7,6 +7,7 @@ import (
"net/url"
"strconv"
"github.com/ewhal/nyaa/config"
"github.com/ewhal/nyaa/service/user/permission"
"github.com/ewhal/nyaa/util/languages"
"github.com/nicksnyder/go-i18n/i18n"
@ -72,7 +73,7 @@ var FuncMap = template.FuncMap{
}
}
arrows := "<span class=\"sortarrowleft "+leftclass+"\">▼</span><span class=\""+rightclass+"\">▲</span>"
arrows := "<span class=\"sortarrowleft " + leftclass + "\">▼</span><span class=\"" + rightclass + "\">▲</span>"
return template.HTML(arrows)
},
@ -111,8 +112,15 @@ var FuncMap = template.FuncMap{
}
return template.HTML(ret)
},
"T": i18n.IdentityTfunc,
"Ts": i18n.IdentityTfunc,
"Sukebei": func() bool {
if config.TableName == "sukebei_torrents" {
return true
} else {
return false
}
},
"T": i18n.IdentityTfunc,
"Ts": i18n.IdentityTfunc,
"getDefaultLanguage": languages.GetDefaultLanguage,
"getAvatar": func(hash string, size int) string {
return "https://www.gravatar.com/avatar/" + hash + "?s=" + strconv.Itoa(size)

Voir le fichier

@ -12,9 +12,9 @@ import (
)
/* Each Page should have an object to pass to their own template
* Therefore, we put them in a separate file for better maintenance
*
* MAIN Template Variables
* Therefore, we put them in a separate file for better maintenance
*
* MAIN Template Variables
*/
type FaqTemplateVariables struct {
@ -123,7 +123,6 @@ type ChangeLanguageVariables struct {
Route *mux.Route
}
/* MODERATION Variables */
type PanelIndexVbs struct {
@ -160,10 +159,10 @@ type PanelCommentListVbs struct {
type PanelTorrentEdVbs struct {
Upload UploadForm
Search SearchForm
User *model.User
FormErrors map[string][]string
FormInfos map[string][]string
Search SearchForm
User *model.User
FormErrors map[string][]string
FormInfos map[string][]string
URL *url.URL // For parsing Url in templates
}
@ -176,16 +175,16 @@ type PanelTorrentReportListVbs struct {
}
type PanelTorrentReassignVbs struct {
Reassign ReassignForm
Search SearchForm // unused?
User *model.User // unused?
FormErrors map[string][]string
FormInfos map[string][]string
URL *url.URL // For parsing Url in templates
Reassign ReassignForm
Search SearchForm // unused?
User *model.User // unused?
FormErrors map[string][]string
FormInfos map[string][]string
URL *url.URL // For parsing Url in templates
}
/*
* Variables used by the upper ones
* Variables used by the upper ones
*/
type Navigation struct {
TotalItem int
@ -203,7 +202,7 @@ type SearchForm struct {
// Some Default Values to ease things out
func NewSearchForm() SearchForm {
return SearchForm{
Category: "_",
Category: "_",
ShowItemsPerPage: true,
}
}

Voir le fichier

@ -1,6 +1,17 @@
{{define "search_common"}}
<select name="c" class="form-control input-sm" value>
<option value="_">{{T "all_categories"}}</option>
{{ if Sukebei }}
<option value="1_" {{if eq .Search.Category "1_"}}selected{{end}}>{{T "art"}}</option>
<option value="1_1" {{if eq .Search.Category "1_1"}}selected{{end}}>{{T "art_anime"}}</option>
<option value="1_2" {{if eq .Search.Category "1_2"}}selected{{end}}>{{T "art_doujinshi"}}</option>
<option value="1_3" {{if eq .Search.Category "1_3"}}selected{{end}}>{{T "art_games"}}</option>
<option value="1_4" {{if eq .Search.Category "1_4"}}selected{{end}}>{{T "art_manga"}}</option>
<option value="1_5" {{if eq .Search.Category "1_5"}}selected{{end}}>{{T "art_pictures"}}</option>
<option value="2_" {{if eq .Search.Category "2_"}}selected{{end}}>{{T "real_life"}}</option>
<option value="2_1" {{if eq .Search.Category "2_1"}}selected{{end}}>{{T "real_life_photobooks_and_Pictures"}}</option>
<option value="2_2" {{if eq .Search.Category "2_2"}}selected{{end}}>{{T "real_life_videos"}}</option>
{{ else }}
<option value="3_" {{if eq .Search.Category "3_"}}selected{{end}}>{{T "anime"}}</option>
<option value="3_12" {{if eq .Search.Category "3_12"}}selected{{end}}>{{T "anime_amv"}}</option>
<option value="3_5" {{if eq .Search.Category "3_5"}}selected{{end}}>{{T "anime_english_translated"}}</option>
@ -24,6 +35,7 @@
<option value="1_" {{if eq .Search.Category "1_"}}selected{{end}}>{{T "software"}}</option>
<option value="1_1" {{if eq .Search.Category "1_1"}}selected{{end}}>{{T "software_applications"}}</option>
<option value="1_2" {{if eq .Search.Category "1_2"}}selected{{end}}>{{T "software_games"}}</option>
{{ end }}
</select>
<select name="s" class="form-control input-sm">
<option value="0">{{T "show_all"}}</option>

Voir le fichier

@ -31,7 +31,13 @@
<!-- forced width because the <td> gets bigger randomly otherwise -->
<td class="hidden-xs" style="width:80px">
<a href="{{$.URL.Parse (printf "/search?c=%s_%s" .Category .SubCategory) }}">
{{ if Sukebei }}
<img src="{{$.URL.Parse (printf "/img/torrents/sukebei/%s%s.png" .Category .SubCategory) }}">
{{ else }}
<img src="{{$.URL.Parse (printf "/img/torrents/%s.png" .SubCategory) }}">
{{ end}}
</a>
</td>
<td class="name">

Voir le fichier

@ -22,24 +22,43 @@
<div class="form-group">
<label for="c">{{T "category"}}</label>
<select name="c" id="c" class="form-control input-sm" required>
<option value="">{{T "select_a_torrent_category"}}</option>
<option value="3_12" {{if eq .Category "3_12"}}selected{{end}}>{{T "anime_amv"}}</option>
<option value="3_5" {{if eq .Category "3_5"}}selected{{end}}>{{T "anime_english_translated"}}</option>
<option value="3_13" {{if eq .Category "3_13"}}selected{{end}}>{{T "anime_non_english_translated"}}</option>
<option value="3_6" {{if eq .Category "3_6"}}selected{{end}}>{{T "anime_raw"}}</option>
<option value="2_3" {{if eq .Category "2_3"}}selected{{end}}>{{T "audio_lossless"}}</option>
<option value="2_4" {{if eq .Category "2_4"}}selected{{end}}>{{T "audio_lossy"}}</option>
<option value="4_7" {{if eq .Category "4_7"}}selected{{end}}>{{T "literature_english_translated"}}</option>
<option value="4_8" {{if eq .Category "4_8"}}selected{{end}}>{{T "literature_raw"}}</option>
<option value="4_14" {{if eq .Category "4_14"}}selected{{end}}>{{T "literature_non_english_translated"}}</option>
<option value="5_9" {{if eq .Category "5_9"}}selected{{end}}>{{T "live_action_english_translated"}}</option>
<option value="5_10" {{if eq .Category "5_10"}}selected{{end}}>{{T "live_action_idol_pv"}}</option>
<option value="5_18" {{if eq .Category "5_18"}}selected{{end}}>{{T "live_action_non_english_translated"}}</option>
<option value="5_11" {{if eq .Category "5_11"}}selected{{end}}>{{T "live_action_raw"}}</option>
<option value="6_15" {{if eq .Category "6_15"}}selected{{end}}>{{T "pictures_graphics"}}</option>
<option value="6_16" {{if eq .Category "6_16"}}selected{{end}}>{{T "pictures_photos"}}</option>
<option value="1_1" {{if eq .Category "1_1"}}selected{{end}}>{{T "software_applications"}}</option>
<option value="1_2" {{if eq .Category "1_2"}}selected{{end}}>{{T "software_games"}}</option>
{{ if Sukebei }}
<option value="1_" {{if eq .Search.Category "1_"}}selected{{end}}>{{T "art"}}</option>
<option value="1_1" {{if eq .Search.Category "1_1"}}selected{{end}}>{{T "art_anime"}}</option>
<option value="1_2" {{if eq .Search.Category "1_2"}}selected{{end}}>{{T "art_doujinshi"}}</option>
<option value="1_3" {{if eq .Search.Category "1_3"}}selected{{end}}>{{T "art_games"}}</option>
<option value="1_4" {{if eq .Search.Category "1_4"}}selected{{end}}>{{T "art_manga"}}</option>
<option value="1_5" {{if eq .Search.Category "1_5"}}selected{{end}}>{{T "art_pictures"}}</option>
<option value="2_" {{if eq .Search.Category "2_"}}selected{{end}}>{{T "real_life"}}</option>
<option value="2_1" {{if eq .Search.Category "2_1"}}selected{{end}}>{{T "real_life_photobooks_and_Pictures"}}</option>
<option value="2_2" {{if eq .Search.Category "2_2"}}selected{{end}}>{{T "real_life_videos"}}</option>
{{ else }}
<option value="3_" {{if eq .Search.Category "3_"}}selected{{end}}>{{T "anime"}}</option>
<option value="3_12" {{if eq .Search.Category "3_12"}}selected{{end}}>{{T "anime_amv"}}</option>
<option value="3_5" {{if eq .Search.Category "3_5"}}selected{{end}}>{{T "anime_english_translated"}}</option>
<option value="3_13" {{if eq .Search.Category "3_13"}}selected{{end}}>{{T "anime_non_english_translated"}}</option>
<option value="3_6" {{if eq .Search.Category "3_6"}}selected{{end}}>{{T "anime_raw"}}</option>
<option value="2_" {{if eq .Search.Category "2_"}}selected{{end}}>{{T "audio"}}</option>
<option value="2_3" {{if eq .Search.Category "2_3"}}selected{{end}}>{{T "audio_lossless"}}</option>
<option value="2_4" {{if eq .Search.Category "2_4"}}selected{{end}}>{{T "audio_lossy"}}</option>
<option value="4_" {{if eq .Search.Category "4_"}}selected{{end}}>{{T "literature"}}</option>
<option value="4_7" {{if eq .Search.Category "4_7"}}selected{{end}}>{{T "literature_english_translated"}}</option>
<option value="4_8" {{if eq .Search.Category "4_8"}}selected{{end}}>{{T "literature_raw"}}</option>
<option value="4_14" {{if eq .Search.Category "4_14"}}selected{{end}}>{{T "literature_non_english_translated"}}</option>
<option value="5_" {{if eq .Search.Category "5_"}}selected{{end}}>{{T "live_action"}}</option>
<option value="5_9" {{if eq .Search.Category "5_9"}}selected{{end}}>{{T "live_action_english_translated"}}</option>
<option value="5_10" {{if eq .Search.Category "5_10"}}selected{{end}}>{{T "live_action_idol_pv"}}</option>
<option value="5_18" {{if eq .Search.Category "5_18"}}selected{{end}}>{{T "live_action_non_english_translated"}}</option>
<option value="5_11" {{if eq .Search.Category "5_11"}}selected{{end}}>{{T "live_action_raw"}}</option>
<option value="6_" {{if eq .Search.Category "6_"}}selected{{end}}>{{T "pictures"}}</option>
<option value="6_15" {{if eq .Search.Category "6_15"}}selected{{end}}>{{T "pictures_graphics"}}</option>
<option value="6_16" {{if eq .Search.Category "6_16"}}selected{{end}}>{{T "pictures_photos"}}</option>
<option value="1_" {{if eq .Search.Category "1_"}}selected{{end}}>{{T "software"}}</option>
<option value="1_1" {{if eq .Search.Category "1_1"}}selected{{end}}>{{T "software_applications"}}</option>
<option value="1_2" {{if eq .Search.Category "1_2"}}selected{{end}}>{{T "software_games"}}</option>
{{ end }}
</select>
</div>
<div class="form-group">

Voir le fichier

@ -16,7 +16,15 @@
<div class="col-md-12">
<div style="float: left;">
<div class="uploaded_by">
<img style="float:left; margin-right: 1em;" src="{{$.URL.Parse (printf "/img/torrents/%s.png" .SubCategory) }}">
{{ if Sukebei }}
<img style="float:left; margin-right: 1em;" src="{{$.URL.Parse (printf "/img/torrents/sukebei/%s%s.png" .Category .SubCategory) }}">
{{ else }}
<img style="float:left; margin-right: 1em;" src="{{$.URL.Parse (printf "/img/torrents/%s.png" .SubCategory) }}">
{{ end}}
<h4>{{ T "uploaded_by" }} <a href="{{$.URL.Parse (printf "/user/%d/-" .UploaderID) }}">{{.UploaderName}}</a></h4>
</div>