Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	router/template_functions.go
Cette révision appartient à :
akuma06 2017-05-21 13:56:38 +02:00
révision 380515b322
28 fichiers modifiés avec 426 ajouts et 349 suppressions

Voir le fichier

@ -1,27 +1,44 @@
/*Don't make changes to layout here, only colours*/
/* Torrent status colors */
.remake {
background-color: #473e50; /*270,13%,28%*/
/*270,13%,28%*/
background-color: #473e50;
}
.trusted {
background-color: #395045; /*150,17%,27%*/
/*150,17%,27%*/
background-color: #395045;
}
.aplus {
background-color: #3c5b71; /*205,30%,34%*/
/*205,30%,34%*/
background-color: #3c5b71;
}
.remake a {
color: #cfc2dc; /*270,26%,81%*/
/*270,26%,81%*/
color: #cfc2dc;
}
.trusted a {
color: #bde0db; /*170,36%,81%*/
/*170,36%,81%*/
color: #bde0db;
}
.remake a:hover {
color: #cf9fff;
}
.trusted a:hover {
color: #6ae3d1;
}
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th {
.table > tbody > tr > td,
.table > tbody > tr > th,
.table > tfoot > tr > td,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > thead > tr > th {
border-color: hsla(200,60%,70%,0.15);
}
@ -60,26 +77,29 @@
background-image: url(/img/megumin.png);
}
body, footer {
body,
footer {
background-color: #282A2E;
color: #eff5f5;
}
.pagination > .active > a {
background: #ececec;
border-color: #ececec;
color: #337ab7; /* restore usual text color */
/* restore usual text color */
color: #337ab7;
}
/* Links, Text */
a {
color: #a2c9dd;
}
a:hover {
color: #55c5ff;
text-shadow: 1px 1px 0 #000;
}
.btn-success {
color: #fff;
background-color: #b294bb;
@ -90,16 +110,21 @@ a:hover {
background-color: #b294bb;
}
.form-control, pre {
.form-control,
pre {
color: #fff;
background-color: #29363d
}
/* style the dropdown member menu */
.nav > .dropdown.open, .profile-image[aria-expanded="true"], .nav ul.dropdown-menu {
.nav > .dropdown.open,
.profile-image[aria-expanded="true"],
.nav ul.dropdown-menu {
background: #282A2E;
}
.dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover {
.dropdown-menu > li > a:focus,
.dropdown-menu > li > a:hover {
background: #263238;
}
@ -127,9 +152,11 @@ a:hover {
border-bottom: .5em solid #fff;
margin-bottom: -.5em;
}
.modal-content {
background: #29363d;
}
.modal-content .close {
color: #fff;
}
@ -140,7 +167,6 @@ a:hover {
}
/*Comments*/
.commentList .commentData {
color: #fff;
}
@ -153,6 +179,7 @@ a:hover {
textarea.torrent-desc {
background: none;
}
.md-editor>textarea:focus {
.md-editor > textarea:focus {
background: none;
}

Voir le fichier

@ -2,9 +2,11 @@
.remake {
background-color: rgb(240, 176, 128);
}
.trusted {
background-color: #a3e9a4;
}
.aplus {
background-color: #81d3fa;
}
@ -12,39 +14,47 @@
.container.remake {
box-shadow: 0px 0px 30px 10px rgba(240, 176, 128, 0.6);
}
.row.remake {
margin-bottom: 0.5rem;
color: rgb(119, 94, 140);
padding:2px 0;
padding: 2px 0;
}
.container.trusted {
box-shadow: 0px 0px 30px 10px rgba(163, 233, 164, 0.6);
}
.row.trusted {
margin-bottom: 0.5rem;
color: rgb(119, 94, 140);
padding:2px 0;
padding: 2px 0;
}
.container.aplus {
box-shadow: 0px 0px 30px 10px rgba(129, 211, 250, 0.6);
}
.row.aplus {
margin-bottom: 0.5rem;
color: rgb(119, 94, 140);
padding:2px 0;
padding: 2px 0;
}
/* modified copy of NyaaTorrent theme */
#mainmenu, #mainmenu .dropdown-menu{
#mainmenu,
#mainmenu .dropdown-menu {
background: #263238;
color: white;
}
#mainmenu {
position: fixed;
width: 100%;
z-index: 4;
border: 0px solid white;
}
#mainmenu a {
background: none;
color: white;
@ -59,6 +69,7 @@
background: white;
}
/* This used to avoid usage of Javascript for switching images. */
#mascot {
background-image: url(/img/renchon.png);
width: 125px;
@ -67,7 +78,6 @@
bottom: 0px;
left: 2%;
}
/* This used to avoid usage of Javascript for switching images. */
body {
background-color: #ececec;
@ -84,7 +94,8 @@ body {
.pagination > .active > a {
background: #ececec;
border-color: #ececec;
color: #337ab7; /* restore usual text color */
/* restore usual text color */
color: #337ab7;
}
/* Links, Text */
@ -125,15 +136,17 @@ td {
.comment-row td:first-of-type {
vertical-align: top;
text-align: left;
color:#bbb;
color: #bbb;
}
.md-editor > textarea, .md-preview {
.md-editor > textarea,
.md-preview {
background: none !important;
}
/* Table style & fixes */
.table > tbody > tr > th, .nowrap {
.table > tbody > tr > th,
.nowrap {
white-space: nowrap;
}
@ -142,7 +155,8 @@ td {
vertical-align: middle;
}
.table > tbody > tr > th, .table > tbody > tr > td {
.table > tbody > tr > th,
.table > tbody > tr > td {
padding: 4px;
}
@ -172,15 +186,34 @@ th a:hover {
opacity: 0.25;
}
div.container div.blockBody:nth-of-type(2) table{table-layout:fixed;}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:first-of-type, div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(5){width:10%;}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(3){width:15%;}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(4){width:19%;}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-type{width:6%;}
div.container div.blockBody:nth-of-type(2) table {
table-layout: fixed;
}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:first-of-type,
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(5) {
width: 10%;
}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(3) {
width: 15%;
}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:nth-of-type(4) {
width: 19%;
}
div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-type {
width: 6%;
}
/* Mobile-friendly main table */
@media only screen and (max-width: 700px) {
table, thead, tbody, tr {
table,
thead,
tbody,
tr {
display: block;
}
@ -192,7 +225,8 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
display: inline-block;
}
td:nth-of-type(1), td:nth-of-type(2) {
td:nth-of-type(1),
td:nth-of-type(2) {
display: block;
}
@ -235,18 +269,15 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
display: none;
}
#mainmenu .navbar-form select.form-control
{
#mainmenu .navbar-form select.form-control {
width: 12rem;
}
#mainmenu .navbar-form select.form-control#max
{
#mainmenu .navbar-form select.form-control#max {
width: 6rem;
}
.special-img
{
.special-img {
position: relative;
top: -7px;
float: left;
@ -257,13 +288,16 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
line-height: 35px;
}
#mainmenu .navbar-header, #mainmenu .navbar-nav, #mainmenu .navbar-form {
#mainmenu .navbar-header,
#mainmenu .navbar-nav,
#mainmenu .navbar-form {
padding-top: 8px;
}
#mainmenu .badgemenu {
padding-top: 0;
margin-right: -50px; /* Any order columns */
/* Any order columns */
margin-right: -50px;
}
/* PROFILE PAGE */
@ -407,6 +441,7 @@ select#bottom_language_selector {
#comments blockquote {
color: #789922;
}
#comments blockquote:before {
content: ">";
}
@ -418,7 +453,9 @@ select#bottom_language_selector {
}
.proSeedBar {
width:100%; height: 0.5rem; overflow: hidden;
width: 100%;
height: 0.5rem;
overflow: hidden;
}
.proSeedBar .seeds {
@ -436,7 +473,8 @@ select#bottom_language_selector {
.comment-date {
font-size: smaller;
width: auto; /* Undo bootstrap's fixed width */
/* Undo bootstrap's fixed width */
width: auto;
}
.text-error {
@ -444,7 +482,6 @@ select#bottom_language_selector {
}
/* Wordbreak fix*/
.break {
word-break: break-all;
hyphens: auto;
@ -463,7 +500,6 @@ select#bottom_language_selector {
}
/*Comments*/
.commentList::before,
.commentList::after {
content: "";
@ -516,7 +552,7 @@ select#bottom_language_selector {
height: 2.2em;
}
.commentList ul.comments ul{
.commentList ul.comments ul {
list-style-type: none;
padding: 0;
margin-left: 85px;
@ -536,7 +572,7 @@ select#bottom_language_selector {
margin-left: 12%;
}
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
.comment {
width: 100%;
@ -545,42 +581,54 @@ select#bottom_language_selector {
}
@media (max-width: 995px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
.navbar-left,
.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
.navbar-nav > li {
float: none;
}
.navbar-nav>li>a {
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
.collapse.in {
display: block !important;
}
}
@media (max-width: 1500px) {
#mascot {
display: none;
}

Voir le fichier

@ -8,10 +8,8 @@ import (
"time"
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/metainfo"
"github.com/gorilla/mux"
)
const (
@ -49,8 +47,9 @@ func DatabaseDumpHandler(w http.ResponseWriter, r *http.Request) {
// TODO Remove ?
navigationTorrents := Navigation{0, 0, 0, "search_page"}
T := languages.GetTfuncFromRequest(r)
dtv := DatabaseDumpTemplateVariables{dumpsJson, "/gpg/gpg.pub", NewSearchForm(), navigationTorrents, T, GetUser(r), r.URL, mux.CurrentRoute(r)}
common := NewCommonVariables(r)
common.Navigation = navigationTorrents
dtv := DatabaseDumpTemplateVariables{common, dumpsJson, "/gpg/gpg.pub"}
err = databaseDumpTemplate.ExecuteTemplate(w, "index.html", dtv)
if err != nil {
log.Errorf("DatabaseDump(): %s", err)

Voir le fichier

@ -2,20 +2,10 @@ package router
import (
"net/http"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/gorilla/mux"
)
func FaqHandler(w http.ResponseWriter, r *http.Request) {
ftv := FaqTemplateVariables{
Navigation: NewNavigation(),
Search: NewSearchForm(),
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
}
ftv := FaqTemplateVariables{NewCommonVariables(r)}
err := faqTemplate.ExecuteTemplate(w, "index.html", ftv)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)

Voir le fichier

@ -10,7 +10,6 @@ import (
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/gorilla/mux"
)
@ -64,14 +63,11 @@ func HomeHandler(w http.ResponseWriter, r *http.Request) {
}
torrentsJson := model.TorrentsToJSON(torrents)
common := NewCommonVariables(r)
common.Navigation = navigationTorrents
htv := HomeTemplateVariables{
CommonTemplateVariables: common,
ListTorrents: torrentsJson,
Search: NewSearchForm(),
Navigation: navigationTorrents,
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
}
err = homeTemplate.ExecuteTemplate(w, "index.html", htv)

Voir le fichier

@ -7,7 +7,6 @@ import (
"github.com/NyaaPantsu/nyaa/service/user"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/timeHelper"
"github.com/gorilla/mux"
)
type LanguagesJSONResponse struct {
@ -29,14 +28,9 @@ func SeeLanguagesHandler(w http.ResponseWriter, r *http.Request) {
}
} else {
clv := ChangeLanguageVariables{
Search: NewSearchForm(),
Navigation: NewNavigation(),
T: languages.GetTfuncFromRequest(r),
CommonTemplateVariables: NewCommonVariables(r),
Language: Tlang.Tag,
Languages: availableLanguages,
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
}
err := changeLanguageTemplate.ExecuteTemplate(w, "index.html", clv)
if err != nil {

Voir le fichier

@ -17,7 +17,6 @@ import (
"github.com/NyaaPantsu/nyaa/service/user"
"github.com/NyaaPantsu/nyaa/service/user/permission"
form "github.com/NyaaPantsu/nyaa/service/user/form"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
msg "github.com/NyaaPantsu/nyaa/util/messages"
"github.com/NyaaPantsu/nyaa/util/search"
@ -106,9 +105,13 @@ func NewPanelSearchForm() SearchForm {
return form
}
func NewPanelCommonVariables(r *http.Request) CommonTemplateVariables {
common := NewCommonVariables(r)
common.Search = NewPanelSearchForm()
return common
}
func IndexModPanel(w http.ResponseWriter, r *http.Request) {
// FIXME WrapModHandler already get user from db
currentUser := GetUser(r)
offset := 10
torrents, _, _ := torrentService.GetAllTorrents(offset, 0)
@ -116,14 +119,12 @@ func IndexModPanel(w http.ResponseWriter, r *http.Request) {
comments, _ := commentService.GetAllComments(offset, 0, "", "")
torrentReports, _, _ := reportService.GetAllTorrentReports(offset, 0)
T := languages.GetTfuncFromRequest(r)
htv := PanelIndexVbs{torrents, model.TorrentReportsToJSON(torrentReports), users, comments, NewPanelSearchForm(), T, currentUser, r.URL}
htv := PanelIndexVbs{NewPanelCommonVariables(r), torrents, model.TorrentReportsToJSON(torrentReports), users, comments}
err := panelIndex.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err)
}
func TorrentsListPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
vars := mux.Vars(r)
page := vars["page"]
@ -145,15 +146,15 @@ func TorrentsListPanel(w http.ResponseWriter, r *http.Request) {
}
messages := msg.GetMessages(r)
T := languages.GetTfuncFromRequest(r)
navigation := Navigation{ count, int(searchParam.Max), pagenum, "mod_tlist_page"}
ptlv := PanelTorrentListVbs{torrents, searchForm, navigation, T, currentUser, messages.GetAllErrors(), messages.GetAllInfos(), r.URL}
common := NewCommonVariables(r)
common.Navigation = Navigation{ count, int(searchParam.Max), pagenum, "mod_tlist_page"}
common.Search = searchForm
ptlv := PanelTorrentListVbs{common, torrents, messages.GetAllErrors(), messages.GetAllInfos()}
err = panelTorrentList.ExecuteTemplate(w, "admin_index.html", ptlv)
log.CheckError(err)
}
func TorrentReportListPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
vars := mux.Vars(r)
page := vars["page"]
@ -171,15 +172,14 @@ func TorrentReportListPanel(w http.ResponseWriter, r *http.Request) {
torrentReports, nbReports, _ := reportService.GetAllTorrentReports(offset, (pagenum-1)*offset)
reportJSON := model.TorrentReportsToJSON(torrentReports)
T := languages.GetTfuncFromRequest(r)
navigation := Navigation{nbReports, offset, pagenum, "mod_trlist_page"}
ptrlv := PanelTorrentReportListVbs{reportJSON, NewSearchForm(), navigation, T, currentUser, r.URL}
common := NewCommonVariables(r)
common.Navigation = Navigation{nbReports, offset, pagenum, "mod_trlist_page"}
ptrlv := PanelTorrentReportListVbs{common, reportJSON}
err = panelTorrentReportList.ExecuteTemplate(w, "admin_index.html", ptrlv)
log.CheckError(err)
}
func UsersListPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
vars := mux.Vars(r)
page := vars["page"]
@ -195,14 +195,14 @@ func UsersListPanel(w http.ResponseWriter, r *http.Request) {
offset := 100
users, nbUsers := userService.RetrieveUsersForAdmin(offset, (pagenum-1)*offset)
T := languages.GetTfuncFromRequest(r)
htv := PanelUserListVbs{users, NewSearchForm(), Navigation{nbUsers, offset, pagenum, "mod_ulist_page"}, T, currentUser, r.URL}
common := NewCommonVariables(r)
common.Navigation = Navigation{nbUsers, offset, pagenum, "mod_ulist_page"}
htv := PanelUserListVbs{common, users}
err = panelUserList.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err)
}
func CommentsListPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
vars := mux.Vars(r)
page := vars["page"]
@ -225,31 +225,30 @@ func CommentsListPanel(w http.ResponseWriter, r *http.Request) {
}
comments, nbComments := commentService.GetAllComments(offset, (pagenum-1)*offset, conditions, values...)
T := languages.GetTfuncFromRequest(r)
htv := PanelCommentListVbs{comments, NewSearchForm(), Navigation{nbComments, offset, pagenum, "mod_clist_page"}, T, currentUser, r.URL}
common := NewCommonVariables(r)
common.Navigation = Navigation{nbComments, offset, pagenum, "mod_clist_page"}
htv := PanelCommentListVbs{common, comments}
err = panelCommentList.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err)
}
func TorrentEditModPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
id := r.URL.Query().Get("id")
torrent, _ := torrentService.GetTorrentById(id)
T := languages.GetTfuncFromRequest(r)
torrentJson := torrent.ToJSON()
uploadForm := NewUploadForm()
uploadForm.Name = torrentJson.Name
uploadForm.Category = torrentJson.Category + "_" + torrentJson.SubCategory
uploadForm.Status = torrentJson.Status
uploadForm.WebsiteLink = string(torrentJson.WebsiteLink)
uploadForm.Description = string(torrentJson.Description)
htv := PanelTorrentEdVbs{uploadForm, NewPanelSearchForm(), T, currentUser, form.NewErrors(), form.NewInfos(), r.URL}
htv := PanelTorrentEdVbs{NewPanelCommonVariables(r), uploadForm, form.NewErrors(), form.NewInfos()}
err := panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err)
}
func TorrentPostEditModPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
var uploadForm UploadForm
id := r.URL.Query().Get("id")
err := form.NewErrors()
@ -266,14 +265,14 @@ func TorrentPostEditModPanel(w http.ResponseWriter, r *http.Request) {
torrent.Category = uploadForm.CategoryID
torrent.SubCategory = uploadForm.SubCategoryID
torrent.Status = uploadForm.Status
torrent.WebsiteLink = uploadForm.WebsiteLink
torrent.Description = uploadForm.Description
torrent.Uploader = nil // GORM will create a new user otherwise (wtf?!)
db.ORM.Save(&torrent)
infos["infos"] = append(infos["infos"], "Torrent details updated.")
}
}
T := languages.GetTfuncFromRequest(r)
htv := PanelTorrentEdVbs{uploadForm, NewPanelSearchForm(), T, currentUser, err, infos, r.URL}
htv := PanelTorrentEdVbs{NewPanelCommonVariables(r), uploadForm, err, infos}
err_ := panelTorrentEd.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err_)
}
@ -314,16 +313,12 @@ func TorrentReportDeleteModPanel(w http.ResponseWriter, r *http.Request) {
}
func TorrentReassignModPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
T := languages.GetTfuncFromRequest(r)
htv := PanelTorrentReassignVbs{ReassignForm{}, NewPanelSearchForm(), T, currentUser, form.NewErrors(), form.NewInfos(), r.URL}
htv := PanelTorrentReassignVbs{NewPanelCommonVariables(r), ReassignForm{}, form.NewErrors(), form.NewInfos()}
err := panelTorrentReassign.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err)
}
func TorrentPostReassignModPanel(w http.ResponseWriter, r *http.Request) {
currentUser := GetUser(r)
var rForm ReassignForm
err := form.NewErrors()
infos := form.NewInfos()
@ -340,8 +335,7 @@ func TorrentPostReassignModPanel(w http.ResponseWriter, r *http.Request) {
}
}
T := languages.GetTfuncFromRequest(r)
htv := PanelTorrentReassignVbs{rForm, NewPanelSearchForm(), T, currentUser, err, infos, r.URL}
htv := PanelTorrentReassignVbs{NewPanelCommonVariables(r), rForm, err, infos}
err_ := panelTorrentReassign.ExecuteTemplate(w, "admin_index.html", htv)
log.CheckError(err_)
}

Voir le fichier

@ -2,22 +2,12 @@ package router
import (
"net/http"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/gorilla/mux"
)
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
nftv := NotFoundTemplateVariables{
Navigation: NewNavigation(),
Search: NewSearchForm(),
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
}
nftv := NotFoundTemplateVariables{NewCommonVariables(r)}
err := notFoundTemplate.ExecuteTemplate(w, "index.html", nftv)
if err != nil {

Voir le fichier

@ -3,7 +3,6 @@ package router
import (
"github.com/NyaaPantsu/nyaa/model"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
"github.com/NyaaPantsu/nyaa/util/search"
"github.com/gorilla/mux"
@ -39,15 +38,15 @@ func SearchHandler(w http.ResponseWriter, r *http.Request) {
b := model.TorrentsToJSON(torrents)
navigationTorrents := Navigation{nbTorrents, int(searchParam.Max), pagenum, "search_page"}
common := NewCommonVariables(r)
common.Navigation = Navigation{nbTorrents, int(searchParam.Max), pagenum, "search_page"}
// Convert back to strings for now.
searchForm := SearchForm{
common.Search = SearchForm{
SearchParam: searchParam,
Category: searchParam.Category.String(),
ShowItemsPerPage: true,
}
T := languages.GetTfuncFromRequest(r)
htv := HomeTemplateVariables{b, searchForm, navigationTorrents, T, GetUser(r), r.URL, mux.CurrentRoute(r)}
htv := HomeTemplateVariables{common, b}
err = searchTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil {

Voir le fichier

@ -15,6 +15,11 @@ import (
"github.com/nicksnyder/go-i18n/i18n"
)
type captchaData struct {
CaptchaID string
T languages.TemplateTfunc
}
var FuncMap = template.FuncMap{
"inc": func(i int) int {
return i + 1
@ -211,4 +216,7 @@ var FuncMap = template.FuncMap{
}
return filesize
},
"makeCaptchaData": func(captchaID string, T languages.TemplateTfunc) captchaData {
return captchaData{captchaID, T}
},
}

Voir le fichier

@ -19,218 +19,138 @@ import (
*/
type FaqTemplateVariables struct {
Navigation Navigation
Search SearchForm
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
CommonTemplateVariables
}
type NotFoundTemplateVariables struct {
Navigation Navigation
Search SearchForm
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
CommonTemplateVariables
}
type ViewTemplateVariables struct {
CommonTemplateVariables
Torrent model.TorrentJSON
CaptchaID string
FormErrors map[string][]string
Infos map[string][]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type UserRegisterTemplateVariables struct {
CommonTemplateVariables
RegistrationForm userForms.RegistrationForm
FormErrors map[string][]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type UserProfileEditVariables struct {
CommonTemplateVariables
UserProfile *model.User
UserForm userForms.UserForm
FormErrors map[string][]string
FormInfos map[string][]string
Languages map[string]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type UserVerifyTemplateVariables struct {
CommonTemplateVariables
FormErrors map[string][]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type UserLoginFormVariables struct {
CommonTemplateVariables
LoginForm userForms.LoginForm
FormErrors map[string][]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type UserProfileVariables struct {
CommonTemplateVariables
UserProfile *model.User
FormInfos map[string][]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type UserProfileNotifVariables struct {
CommonTemplateVariables
Infos map[string][]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type HomeTemplateVariables struct {
CommonTemplateVariables
ListTorrents []model.TorrentJSON
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type DatabaseDumpTemplateVariables struct {
CommonTemplateVariables
ListDumps []model.DatabaseDumpJSON
GPGLink string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
Route *mux.Route // For getting current route in templates
}
type UploadTemplateVariables struct {
CommonTemplateVariables
Upload UploadForm
FormErrors map[string][]string
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL
Route *mux.Route
}
type ChangeLanguageVariables struct {
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
CommonTemplateVariables
Language string
Languages map[string]string
User *model.User
URL *url.URL
Route *mux.Route
}
/* MODERATION Variables */
type PanelIndexVbs struct {
CommonTemplateVariables
Torrents []model.Torrent
TorrentReports []model.TorrentReportJson
Users []model.User
Comments []model.Comment
Search SearchForm
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
}
type PanelTorrentListVbs struct {
CommonTemplateVariables
Torrents []model.Torrent
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
Errors map[string][]string
Infos map[string][]string
URL *url.URL // For parsing Url in templates
}
type PanelUserListVbs struct {
CommonTemplateVariables
Users []model.User
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
}
type PanelCommentListVbs struct {
CommonTemplateVariables
Comments []model.Comment
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
}
type PanelTorrentEdVbs struct {
CommonTemplateVariables
Upload UploadForm
Search SearchForm
T languages.TemplateTfunc
User *model.User
FormErrors map[string][]string
FormInfos map[string][]string
URL *url.URL // For parsing Url in templates
}
type PanelTorrentReportListVbs struct {
CommonTemplateVariables
TorrentReports []model.TorrentReportJson
Search SearchForm
Navigation Navigation
T languages.TemplateTfunc
User *model.User
URL *url.URL // For parsing Url in templates
}
type PanelTorrentReassignVbs struct {
CommonTemplateVariables
Reassign ReassignForm
Search SearchForm // unused?
T languages.TemplateTfunc
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
*/
type CommonTemplateVariables struct {
Navigation Navigation
Search SearchForm
T languages.TemplateTfunc
User *model.User
URL *url.URL // for parsing URL in templates
Route *mux.Route // for getting current route in templates
}
type Navigation struct {
TotalItem int
MaxItemPerPage int // FIXME: shouldn't this be in SearchForm?
@ -263,4 +183,14 @@ func GetUser(r *http.Request) *model.User {
return &user
}
func NewCommonVariables(r *http.Request) CommonTemplateVariables {
return CommonTemplateVariables{
Navigation: NewNavigation(),
Search: NewSearchForm(),
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
}
}

Voir le fichier

@ -241,6 +241,7 @@ func (f *UploadForm) ExtractInfo(r *http.Request) error {
func (f *UploadForm) ExtractEditInfo(r *http.Request) error {
f.Name = r.FormValue(UploadFormName)
f.Category = r.FormValue(UploadFormCategory)
f.WebsiteLink = r.FormValue(UploadFormWebsiteLink)
f.Description = r.FormValue(UploadFormDescription)
f.Status, _ = strconv.Atoi(r.FormValue(UploadFormStatus))

Voir le fichier

@ -15,7 +15,6 @@ import (
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util/languages"
msg "github.com/NyaaPantsu/nyaa/util/messages"
"github.com/gorilla/mux"
)
func UploadHandler(w http.ResponseWriter, r *http.Request) {
@ -125,14 +124,9 @@ func UploadGetHandler(w http.ResponseWriter, r *http.Request) {
}
utv := UploadTemplateVariables{
CommonTemplateVariables: NewCommonVariables(r),
Upload: uploadForm,
FormErrors: messages.GetAllErrors(),
Search: NewSearchForm(),
Navigation: NewNavigation(),
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
}
err := uploadTemplate.ExecuteTemplate(w, "index.html", utv)
if err != nil {

Voir le fichier

@ -29,14 +29,9 @@ func UserRegisterFormHandler(w http.ResponseWriter, r *http.Request) {
modelHelper.BindValueForm(&registrationForm, r)
registrationForm.CaptchaID = captcha.GetID()
urtv := UserRegisterTemplateVariables{
RegistrationForm: registrationForm,
FormErrors: form.NewErrors(),
Search: NewSearchForm(),
Navigation: NewNavigation(),
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
CommonTemplateVariables: NewCommonVariables(r),
RegistrationForm: registrationForm,
FormErrors: form.NewErrors(),
}
err := viewRegisterTemplate.ExecuteTemplate(w, "index.html", urtv)
if err != nil {
@ -50,14 +45,9 @@ func UserLoginFormHandler(w http.ResponseWriter, r *http.Request) {
modelHelper.BindValueForm(&loginForm, r)
ulfv := UserLoginFormVariables{
LoginForm: loginForm,
FormErrors: form.NewErrors(),
Search: NewSearchForm(),
Navigation: NewNavigation(),
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
CommonTemplateVariables: NewCommonVariables(r),
LoginForm: loginForm,
FormErrors: form.NewErrors(),
}
err := viewLoginTemplate.ExecuteTemplate(w, "index.html", ulfv)
@ -85,7 +75,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
if errUser != nil {
err["errors"] = append(err["errors"], errUser.Error())
}
htv := UserVerifyTemplateVariables{err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
htv := UserVerifyTemplateVariables{NewCommonVariables(r), err}
errorTmpl := viewUserDeleteTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -97,7 +87,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
if unfollow != nil {
infosForm["infos"] = append(infosForm["infos"], fmt.Sprintf(string(T("user_unfollowed_msg")), userProfile.Username))
}
htv := UserProfileVariables{&userProfile, infosForm, NewSearchForm(), NewNavigation(), T, currentUser, r.URL, mux.CurrentRoute(r)}
htv := UserProfileVariables{NewCommonVariables(r), &userProfile, infosForm}
err := viewProfileTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil {
@ -105,7 +95,7 @@ func UserProfileHandler(w http.ResponseWriter, r *http.Request) {
}
}
} else {
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewNavigation(), NewSearchForm(), T, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewCommonVariables(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
@ -117,21 +107,20 @@ func UserDetailsHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
id := vars["id"]
currentUser := GetUser(r)
T := languages.GetTfuncFromRequest(r)
userProfile, _, errorUser := userService.RetrieveUserForAdmin(id)
if errorUser == nil && userPermission.CurrentOrAdmin(currentUser, userProfile.ID) {
if userPermission.CurrentOrAdmin(currentUser, userProfile.ID) {
b := form.UserForm{}
modelHelper.BindValueForm(&b, r)
availableLanguages := languages.GetAvailableLanguages()
htv := UserProfileEditVariables{&userProfile, b, form.NewErrors(), form.NewInfos(), availableLanguages, NewSearchForm(), NewNavigation(), T, currentUser, r.URL, mux.CurrentRoute(r)}
htv := UserProfileEditVariables{NewCommonVariables(r), &userProfile, b, form.NewErrors(), form.NewInfos(), availableLanguages}
err := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
} else {
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewNavigation(), NewSearchForm(), T, GetUser(r), r.URL, mux.CurrentRoute(r)})
err := notFoundTemplate.ExecuteTemplate(w, "index.html", NotFoundTemplateVariables{NewCommonVariables(r)})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
@ -187,17 +176,12 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
}
availableLanguages := languages.GetAvailableLanguages()
upev := UserProfileEditVariables{
UserProfile: &userProfile,
UserForm: userForm,
FormErrors: err,
FormInfos: infos,
Languages: availableLanguages,
Search: NewSearchForm(),
Navigation: NewNavigation(),
T: T,
User: currentUser,
URL: r.URL,
Route: mux.CurrentRoute(r),
CommonTemplateVariables: NewCommonVariables(r),
UserProfile: &userProfile,
UserForm: userForm,
FormErrors: err,
FormInfos: infos,
Languages: availableLanguages,
}
errorTmpl := viewProfileEditTemplate.ExecuteTemplate(w, "index.html", upev)
if errorTmpl != nil {
@ -207,7 +191,6 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
// Post Registration controller, we do some check on the form here, the rest on user service
func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
T := languages.GetTfuncFromRequest(r)
b := form.RegistrationForm{}
err := form.NewErrors()
if !captcha.Authenticate(captcha.Extract(r)) {
@ -227,10 +210,11 @@ func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
err["errors"] = append(err["errors"], errorUser.Error())
}
if len(err) == 0 {
u := model.User{
common := NewCommonVariables(r)
common.User = &model.User{
Email: r.PostFormValue("email"), // indicate whether user had email set
}
htv := UserRegisterTemplateVariables{b, err, NewSearchForm(), NewNavigation(), T, &u, r.URL, mux.CurrentRoute(r)}
htv := UserRegisterTemplateVariables{common, b, err}
errorTmpl := viewRegisterSuccessTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -241,7 +225,7 @@ func UserRegisterPostHandler(w http.ResponseWriter, r *http.Request) {
}
if len(err) > 0 {
b.CaptchaID = captcha.GetID()
htv := UserRegisterTemplateVariables{b, err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
htv := UserRegisterTemplateVariables{NewCommonVariables(r), b, err}
errorTmpl := viewRegisterTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -257,8 +241,7 @@ func UserVerifyEmailHandler(w http.ResponseWriter, r *http.Request) {
if errEmail != nil {
err["errors"] = append(err["errors"], errEmail.Error())
}
T := languages.GetTfuncFromRequest(r)
htv := UserVerifyTemplateVariables{err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
htv := UserVerifyTemplateVariables{NewCommonVariables(r), err}
errorTmpl := viewVerifySuccessTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -267,7 +250,6 @@ func UserVerifyEmailHandler(w http.ResponseWriter, r *http.Request) {
// Post Login controller
func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
T := languages.GetTfuncFromRequest(r)
b := form.LoginForm{}
modelHelper.BindValueForm(&b, r)
err := form.NewErrors()
@ -276,7 +258,7 @@ func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
_, errorUser := userService.CreateUserAuthentication(w, r)
if errorUser != nil {
err["errors"] = append(err["errors"], errorUser.Error())
htv := UserLoginFormVariables{b, err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
htv := UserLoginFormVariables{NewCommonVariables(r), b, err}
errorTmpl := viewLoginTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -288,7 +270,7 @@ func UserLoginPostHandler(w http.ResponseWriter, r *http.Request) {
}
}
if len(err) > 0 {
htv := UserLoginFormVariables{b, err, NewSearchForm(), NewNavigation(), T, GetUser(r), r.URL, mux.CurrentRoute(r)}
htv := UserLoginFormVariables{NewCommonVariables(r), b, err}
errorTmpl := viewLoginTemplate.ExecuteTemplate(w, "index.html", htv)
if errorTmpl != nil {
http.Error(w, errorTmpl.Error(), http.StatusInternalServerError)
@ -327,13 +309,12 @@ func UserNotificationsHandler(w http.ResponseWriter, r *http.Request) {
if currentUser.ID > 0 {
messages := msg.GetMessages(r)
Ts, _ := languages.GetTfuncAndLanguageFromRequest(r)
T := languages.GetTfuncFromRequest(r)
if r.URL.Query()["clear"] != nil {
notifierService.DeleteAllNotifications(currentUser.ID)
messages.AddInfo("infos", Ts("notifications_cleared"))
currentUser.Notifications = []model.Notification{}
}
htv := UserProfileNotifVariables{messages.GetAllInfos(), NewSearchForm(), NewNavigation(), T, currentUser, r.URL, mux.CurrentRoute(r)}
htv := UserProfileNotifVariables{NewCommonVariables(r), messages.GetAllInfos()}
err := viewProfileNotifTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
@ -341,4 +322,4 @@ func UserNotificationsHandler(w http.ResponseWriter, r *http.Request) {
} else {
NotFoundHandler(w, r)
}
}
}

Voir le fichier

@ -13,7 +13,6 @@ import (
"github.com/NyaaPantsu/nyaa/service/torrent"
"github.com/NyaaPantsu/nyaa/service/user/permission"
"github.com/NyaaPantsu/nyaa/util"
"github.com/NyaaPantsu/nyaa/util/languages"
"github.com/NyaaPantsu/nyaa/util/log"
msg "github.com/NyaaPantsu/nyaa/util/messages"
"github.com/gorilla/mux"
@ -44,8 +43,7 @@ func ViewHandler(w http.ResponseWriter, r *http.Request) {
if userPermission.NeedsCaptcha(user) {
captchaID = captcha.GetID()
}
T := languages.GetTfuncFromRequest(r)
htv := ViewTemplateVariables{b, captchaID, messages.GetAllErrors(), messages.GetAllInfos(), NewSearchForm(), NewNavigation(), T, user, r.URL, mux.CurrentRoute(r)}
htv := ViewTemplateVariables{NewCommonVariables(r), b, captchaID, messages.GetAllErrors(), messages.GetAllInfos()}
err = viewTemplate.ExecuteTemplate(w, "index.html", htv)
if err != nil {

Voir le fichier

@ -3,26 +3,26 @@
<ul class="nav navbar-nav navbar-right badgemenu">
<li class="dropdown">
{{if gt .ID 0}}
<a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}" class="dropdown-toggle profile-image" data-toggle="dropdown">
<img src="https://www.gravatar.com/avatar/{{ .MD5 }}?s=50" class="img-circle special-img"> {{ .Username }} <span class="badge">{{ .GetUnreadNotifications }}</span><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "profile"}}</a></li>
<li><a href="{{ genRoute "user_notifications" }}"><i class="fa fa-cog"></i> {{ call $.T "my_notifications"}} <span class="badge">{{ .GetUnreadNotifications }}</span></a></li>
<li><a href="{{ genRoute "user_profile_edit" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "settings"}}</a></li>
<li class="divider"></li>
{{if HasAdmin . }}<li><a href="{{ genRoute "mod_index" }}"><i class="fa fa-cog"></i> {{call $.T "moderation"}}</a></li><li class="divider"></li>{{end}}
<li><a href="{{ genRoute "user_logout" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_out"}}</a></li>
</ul>
{{ else }}
<a href="#" class="dropdown-toggle profile-image" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="hidden-md hidden-sm">{{ call $.T "member" }}</span>
<span class="glyphicon glyphicon-user visible-md-inline"></span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="{{ genRoute "user_login" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_in"}}</a></li>
<li><a href="{{ genRoute "user_register" }}"><i class="fa fa-cog"></i> {{ call $.T "sign_up"}}</a></li>
</ul>
<a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}" class="dropdown-toggle profile-image" data-toggle="dropdown">
<img src="https://www.gravatar.com/avatar/{{ .MD5 }}?s=50" class="img-circle special-img"> {{ .Username }} <span class="badge">{{ .GetUnreadNotifications }}</span><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{{ genRoute "user_profile" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "profile"}}</a></li>
<li><a href="{{ genRoute "user_notifications" }}"><i class="fa fa-cog"></i> {{ call $.T "my_notifications"}} <span class="badge">{{ .GetUnreadNotifications }}</span></a></li>
<li><a href="{{ genRoute "user_profile_edit" "id" (print .ID) "username" .Username }}"><i class="fa fa-cog"></i> {{call $.T "settings"}}</a></li>
<li class="divider"></li>
{{if HasAdmin . }}<li><a href="{{ genRoute "mod_index" }}"><i class="fa fa-cog"></i> {{call $.T "moderation"}}</a></li><li class="divider"></li>{{end}}
<li><a href="{{ genRoute "user_logout" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_out"}}</a></li>
</ul>
{{ else }}
<a href="#" class="dropdown-toggle profile-image" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<span class="hidden-md hidden-sm">{{ call $.T "member" }}</span>
<span class="glyphicon glyphicon-user visible-md-inline"></span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a href="{{ genRoute "user_login" }}"><i class="fa fa-sign-out"></i> {{ call $.T "sign_in"}}</a></li>
<li><a href="{{ genRoute "user_register" }}"><i class="fa fa-cog"></i> {{ call $.T "sign_up"}}</a></li>
</ul>
{{end}}
</li>
</ul>

Voir le fichier

@ -1,5 +1,4 @@
{{define "captcha"}}
{{with .Upload}}
{{/* unset if user doesn't need captcha */}}
{{if ne .CaptchaID ""}}
<div class="form-group captcha-container">
@ -10,4 +9,3 @@
</div>
{{end}}
{{end}}
{{end}}

Voir le fichier

@ -33,7 +33,13 @@
</a>
</td>
<td class="nowrap date-short">{{.Date}}</td>
<td class="nowrap">{{.Filesize}}</td>
<td class="nowrap">
{{if ne .Filesize "Unknown"}}
{{.Filesize}}
{{else}}
{{ call $.T "unknown"}}
{{end}}
</td>
<td>
<a href="{{.Magnet}}" title="{{ call $.T "magnet_link" }}">
<span class="glyphicon glyphicon-magnet" aria-hidden="true"></span>

Voir le fichier

@ -64,6 +64,10 @@
</select>
</div>
<div class="form-group">
<label for="website_link">{{call $.T "website_link"}}</label>
<input name="website_link" id="website_link" class="form-control" type="text" value="{{.WebsiteLink}}">
</div>
<div class="form-group">
<label for="desc">{{call $.T "torrent_description"}}</label>
<p class="help-block">{{call $.T "description_markdown_notice"}}</p>

Voir le fichier

@ -73,7 +73,13 @@ Your browser does not support the audio element.
</td>
{{end}}
<td class="hidden-xs nowrap date-short">{{.Date}}</td>
<td class="hidden-xs nowrap">{{.Filesize}}</td>
<td class="hidden-xs nowrap">
{{if ne .Filesize "Unknown"}}
{{.Filesize}}
{{else}}
{{ call $.T "unknown"}}
{{end}}
</td>
<td class="hidden-xs nowrap">
<a href="{{.Magnet}}" title="Magnet link">
<span class="glyphicon glyphicon-magnet" aria-hidden="true"></span>

Voir le fichier

@ -68,17 +68,17 @@
<label for="remake">{{call $.T "mark_as_remake"}}</label>
</div>
<div class="form-group">
<label for="website_link">{{call $.T "website_link"}}</label>
<input name="website_link" id="website_link" class="form-control" type="text" value="{{.WebsiteLink}}">
</div>
<div class="form-group">
<label for="desc">{{call $.T "torrent_description"}}</label>
<p class="help-block">{{call $.T "description_markdown_notice"}}</p>
<textarea name="desc" id="desc" class="form-control torrent-desc" rows="15">{{.Description}}</textarea>
</div>
<div class="form-group">
<label for="website_link">{{call $.T "website_link"}}</label>
<input name="website_link" id="website_link" class="form-control" type="text" value="{{.WebsiteLink}}">
</div>
{{block "captcha" $}}{{end}}
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
<button type="submit" class="btn btn-success">{{call $.T "upload"}}</button>
<br />

Voir le fichier

@ -56,7 +56,7 @@
</div>
</div>
{{block "captcha" .}}{{end}}
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
<hr class="colorgraph">
<div class="row">

Voir le fichier

@ -70,8 +70,14 @@
<h4>{{call $.T "date"}}</h4>
<p class="date-full">{{.Date}}</p>
<hr>
<h4>{{call $.T "size"}}</h4>
<p>{{.Filesize}}</p>
<h4>{{ call $.T "size"}}</h4>
<p>
{{if ne .Filesize "Unknown"}}
{{.Filesize}}
{{else}}
{{ call $.T "unknown"}}
{{end}}
</p>
<hr>
{{if ne .WebsiteLink ""}}
<h4>{{call $.T "link"}}</h4>
@ -93,7 +99,7 @@
{{else}}
<div class="col-md-4">{{.Seeders}}</div>
<div class="col-md-4">{{.Leechers}}</div>
<div class="col-md-4"><span class="completed" style="">{{.Completed}}</span></div>
<div class="col-md-4"><span class="completed">{{.Completed}}</span></div>
{{end}}
</div>
</div>
@ -189,7 +195,7 @@
<label for="comment">{{ if gt .User.ID 0}} {{call $.T "submit_a_comment_as_username" .User.Username}} {{else}} {{call $.T "submit_a_comment_as_anonymous"}} {{end}}</label>
<textarea name="comment" class="form-control" rows="5"></textarea>
</div>
{{block "captcha" .}}{{end}}
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
<button type="submit" class="btn btn-success">{{call $.T "submit" }}</button>
</form>
</div>
@ -211,7 +217,7 @@
<input type="radio" name="report_type" value="spam" id="spam" required> <label for="spam">{{ call $.T "spam_garbage" }}</label><br />
<input type="radio" name="report_type" value="wrongcat" id="wrongcat" required> <label for="wrongcat">{{ call $.T "wrong_category" }}</label><br />
<input type="radio" name="report_type" value="dup" id="dup" required> <label for="dup">{{ call $.T "duplicate_deprecated" }}</label><br />
{{block "captcha" .}}{{end}}
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
<button type="submit" class="btn btn-default">{{ call $.T "report_btn" }}</button>
</form> <br />
</div>

Voir le fichier

@ -479,6 +479,10 @@
"id": "art_manga",
"translation": "Art - Manga"
},
{
"id": "art_pictures",
"translation": "Art - Pictures"
},
{
"id": "real_life",
"translation": "Real Life"

Voir le fichier

@ -679,6 +679,10 @@
"id": "delete",
"translation": "Supprimer"
},
{
"id": "website_link",
"translation": "Lien du site web"
},
{
"id": "files",
"translation": "Fichiers"
@ -758,5 +762,21 @@
{
"id": "no_database_dumps_available",
"translation": "Aucune sauvegarde de base de données n'est disponible en ce moment."
},
{
"id": "clear_notifications",
"translation": "Effacer les notifications"
},
{
"id": "notifications_cleared",
"translation": "Notifications supprimées !"
},
{
"id": "my_notifications",
"translation": "Mes Notifications"
},
{
"id": "new_torrent_uploaded",
"translation": "Nouveau torrent : \"%s\" de %s"
}
]

Voir le fichier

@ -69,7 +69,7 @@
},
{
"id": "terms_conditions_full",
"translation": "Некоторое дерьмо."
"translation": "Здесь будет магия и дружба."
},
{
"id": "remember_me",
@ -117,7 +117,7 @@
},
{
"id": "follow",
"translation": "Следить"
"translation": "Подписаться"
},
{
"id": "unfollow",
@ -125,7 +125,7 @@
},
{
"id": "user_followed_msg",
"translation": "Вы отслеживаете %s!"
"translation": "Вы подписались на %s!"
},
{
"id": "user_unfollowed_msg",
@ -137,7 +137,7 @@
},
{
"id": "see_more_torrents_from",
"translation": "Смотреть другие торренты %s "
"translation": "Посмотреть другие торренты %s "
},
{
"id": "category",
@ -179,9 +179,13 @@
"id": "faq",
"translation": "FAQ"
},
{
"id": "fun",
"translation": "Fun"
},
{
"id": "fap",
"translation": "Фап"
"translation": "Fap"
},
{
"id": "advanced_search",
@ -209,7 +213,7 @@
},
{
"id": "member",
"translation": "Членство"
"translation": "Пользователь"
},
{
"id": "sign_in",
@ -225,7 +229,7 @@
},
{
"id": "notice_keep_seeding",
"translation": "УВЕДОМЛЕНИЕ: УДЕРЖИВАЙ РАЗДАЧУ И ВКЛЮЧАЙ DHT ТЫ ТОРМОЗ"
"translation": "ОСТАВАЙТЕСЬ НА РАЗДАЧЕ И ВКЛЮЧИТЕ DHT!"
},
{
"id": "official_nyaapocalipse_faq",
@ -257,7 +261,7 @@
},
{
"id": "is_everything_lost",
"translation": "Все потеряно?"
"translation": "Все пропало?"
},
{
"id": "in_short_no",
@ -265,7 +269,7 @@
},
{
"id": "are_some_things_lost",
"translation": "Некоторые вещи потеряны?"
"translation": "Что-нибудь все же потерялось?"
},
{
"id": "answer_is_nyaa_db_lost",
@ -277,7 +281,7 @@
},
{
"id": "how_are_we_recovering",
"translation": "Как мы выздоравливаем?"
"translation": "Как идет процесс восстановления?"
},
{
"id": "answer_how_are_we_recovering",
@ -317,11 +321,7 @@
},
{
"id": "answer_which_trackers_do_you_recommend",
"translation": "Если ваша торрент-загрузка запрещена из-за трекеров, вам нужно добавить некоторые из них:"
},
{
"id": "other_trackers",
"translation": "Но тебе стоит еще добавить эти, просто на случай, если что-то пойдет не так"
"translation": "У нас теперь появился свой собственный трекер doko.moe, добавьте его наверх списка перед загрузкой. Вам стоит еще добавить эти, просто на случай, если что-то пойдет не так."
},
{
"id": "how_can_i_help",
@ -337,7 +337,7 @@
},
{
"id": "why_written_in_go",
"translation": "Почему ваше дерьмо написано на Go?"
"translation": "Почему это дерьмо написано на Go?"
},
{
"id": "authors_favorite_language",
@ -459,6 +459,42 @@
"id": "software_games",
"translation": "Софт - Игры"
},
{
"id": "art",
"translation": "Арт"
},
{
"id": "art_anime",
"translation": "Арт - Аниме"
},
{
"id": "art_doujinshi",
"translation": "Арт - Додзинси"
},
{
"id": "art_games",
"translation": "Арт - Игры"
},
{
"id": "art_manga",
"translation": "Арт - Манга"
},
{
"id": "art_pictures",
"translation": "Арт - Картинки"
},
{
"id": "real_life",
"translation": "Real Life"
},
{
"id": "real_life_photobooks_and_pictures",
"translation": "Real Life - Фотокниги и картинки"
},
{
"id": "real_life_videos",
"translation": "Real Life - Видео"
},
{
"id": "torrent_description",
"translation": "Описание торрента"
@ -517,7 +553,7 @@
},
{
"id": "submit_a_comment_as_anonymous",
"translation": "Отправить комментарий как Анонимный"
"translation": "Отправить анонимный комментарий"
},
{
"id": "submit",
@ -541,7 +577,7 @@
},
{
"id": "banned",
"translation": "Banned"
"translation": "Забанен"
},
{
"id": "default",
@ -647,6 +683,14 @@
"id": "delete",
"translation": "Удалить"
},
{
"id": "files",
"translation": "Файлы"
},
{
"id": "filename",
"translation": "Имя файла"
},
{
"id": "uploaded_by",
"translation": "Загрузил"
@ -698,5 +742,25 @@
{
"id": "cancel",
"translation": "Отменить"
},
{
"id": "please_include_our_tracker",
"translation": "Пожалуйста добавьте udp://tracker.doko.moe:6969 в список трекеров."
},
{
"id": "unknown",
"translation": "Неизвестно"
},
{
"id": "last_scraped",
"translation": "Обновлялось в: "
},
{
"id": "server_status_link",
"translation": "Узнать о состоянии сервера можно здесь"
},
{
"id": "no_database_dumps_available",
"translation": "Сейчас нет доступных дампов базы"
}
]

Voir le fichier

@ -678,6 +678,10 @@
{
"id": "delete",
"translation": "ลบ"
},
{
"id": "website_link",
"translation": "ลิงค์เว็บ"
},
{
"id": "files",
@ -758,5 +762,21 @@
{
"id": "no_database_dumps_available",
"translation": "ยังไม่มีไฟล์ดัมพ์ฐานข้อมูลในขณะนี้"
}
},
{
"id": "clear_notifications",
"translation": "ล้างการแจ้งเตือน"
},
{
"id": "notifications_cleared",
"translation": "ลบการแจ้งเตือนแล้ว!"
},
{
"id": "my_notifications",
"translation": "การแจ้งเตือนของฉัน"
},
{
"id": "new_torrent_uploaded",
"translation": "ทอร์เรนท์ใหม่: \"%s\" จาก %s"
}
]

Voir le fichier

@ -377,7 +377,7 @@
},
{
"id": "anime_raw",
"translation": "動畫 - Raw"
"translation": "動畫 - 生肉"
},
{
"id": "audio",
@ -401,7 +401,7 @@
},
{
"id": "literature_raw",
"translation": "文學 - Raw"
"translation": "文學 - 生肉"
},
{
"id": "literature_non_english_translated",
@ -425,7 +425,7 @@
},
{
"id": "live_action_raw",
"translation": "真人電影 - Raw"
"translation": "真人電影 - 生肉"
},
{
"id": "pictures",