diff --git a/public/css/style-night.css b/public/css/style-night.css index d7926659..4b9263d6 100644 --- a/public/css/style-night.css +++ b/public/css/style-night.css @@ -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; } diff --git a/public/css/style.css b/public/css/style.css index 100a4d41..b472ac28 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -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; } diff --git a/router/database_dump_handler.go b/router/database_dump_handler.go index 3a96d879..5d41bccf 100644 --- a/router/database_dump_handler.go +++ b/router/database_dump_handler.go @@ -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) diff --git a/router/faq_handler.go b/router/faq_handler.go index 41501504..f9331b9f 100644 --- a/router/faq_handler.go +++ b/router/faq_handler.go @@ -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) diff --git a/router/home_handler.go b/router/home_handler.go index 4499336b..f3906839 100644 --- a/router/home_handler.go +++ b/router/home_handler.go @@ -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) diff --git a/router/language_handler.go b/router/language_handler.go index 60df29f7..888d9001 100644 --- a/router/language_handler.go +++ b/router/language_handler.go @@ -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 { diff --git a/router/modpanel.go b/router/modpanel.go index f6ccb54e..305a2574 100644 --- a/router/modpanel.go +++ b/router/modpanel.go @@ -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_) } diff --git a/router/not_found_handler.go b/router/not_found_handler.go index 06f35146..b757138a 100644 --- a/router/not_found_handler.go +++ b/router/not_found_handler.go @@ -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 { diff --git a/router/search_handler.go b/router/search_handler.go index cc335280..efd665c5 100644 --- a/router/search_handler.go +++ b/router/search_handler.go @@ -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 { diff --git a/router/template_functions.go b/router/template_functions.go index 9889a77c..df9fdf9e 100644 --- a/router/template_functions.go +++ b/router/template_functions.go @@ -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} + }, } diff --git a/router/template_variables.go b/router/template_variables.go index c23f7cd6..f1892c9b 100644 --- a/router/template_variables.go +++ b/router/template_variables.go @@ -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), + } +} diff --git a/router/upload.go b/router/upload.go index e4ce3c0e..74ce5abc 100644 --- a/router/upload.go +++ b/router/upload.go @@ -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)) diff --git a/router/upload_handler.go b/router/upload_handler.go index 75e08f78..fadd73f4 100644 --- a/router/upload_handler.go +++ b/router/upload_handler.go @@ -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 { diff --git a/router/user_handler.go b/router/user_handler.go index 57ee1afc..3ef4a324 100644 --- a/router/user_handler.go +++ b/router/user_handler.go @@ -29,14 +29,9 @@ func UserRegisterFormHandler(w http.ResponseWriter, r *http.Request) { modelHelper.BindValueForm(®istrationForm, 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) } -} \ No newline at end of file +} diff --git a/router/view_torrent_handler.go b/router/view_torrent_handler.go index 4eaa3b1a..d293dbaf 100644 --- a/router/view_torrent_handler.go +++ b/router/view_torrent_handler.go @@ -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 { diff --git a/templates/_badgemenu.html b/templates/_badgemenu.html index 0995cb0a..e906f2a0 100644 --- a/templates/_badgemenu.html +++ b/templates/_badgemenu.html @@ -3,26 +3,26 @@ diff --git a/templates/_captcha.html b/templates/_captcha.html index ddf0680e..5d9363bc 100644 --- a/templates/_captcha.html +++ b/templates/_captcha.html @@ -1,5 +1,4 @@ {{define "captcha"}} -{{with .Upload}} {{/* unset if user doesn't need captcha */}} {{if ne .CaptchaID ""}}
@@ -10,4 +9,3 @@
{{end}} {{end}} -{{end}} diff --git a/templates/_user_list_torrents.html b/templates/_user_list_torrents.html index 0861b3f2..b2feb40f 100644 --- a/templates/_user_list_torrents.html +++ b/templates/_user_list_torrents.html @@ -33,7 +33,13 @@ {{.Date}} - {{.Filesize}} + + {{if ne .Filesize "Unknown"}} + {{.Filesize}} + {{else}} + {{ call $.T "unknown"}} + {{end}} + diff --git a/templates/admin/paneltorrentedit.html b/templates/admin/paneltorrentedit.html index 83cca2d8..79d4f520 100644 --- a/templates/admin/paneltorrentedit.html +++ b/templates/admin/paneltorrentedit.html @@ -64,6 +64,10 @@ +
+ + +

{{call $.T "description_markdown_notice"}}

diff --git a/templates/home.html b/templates/home.html index 26bc746b..d4042bdc 100644 --- a/templates/home.html +++ b/templates/home.html @@ -73,7 +73,13 @@ Your browser does not support the audio element. {{end}} {{.Date}} - {{.Filesize}} + + {{if ne .Filesize "Unknown"}} + {{.Filesize}} + {{else}} + {{ call $.T "unknown"}} + {{end}} +
diff --git a/templates/upload.html b/templates/upload.html index 54d61360..953c00d4 100644 --- a/templates/upload.html +++ b/templates/upload.html @@ -68,17 +68,17 @@
+
+ + +

{{call $.T "description_markdown_notice"}}

-
- - -
- {{block "captcha" $}}{{end}} + {{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
diff --git a/templates/user/register.html b/templates/user/register.html index 5ac5414e..187d8eb4 100644 --- a/templates/user/register.html +++ b/templates/user/register.html @@ -56,7 +56,7 @@ - {{block "captcha" .}}{{end}} + {{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
diff --git a/templates/view.html b/templates/view.html index 9a81ec19..fc46858e 100644 --- a/templates/view.html +++ b/templates/view.html @@ -70,8 +70,14 @@

{{call $.T "date"}}

{{.Date}}


-

{{call $.T "size"}}

-

{{.Filesize}}

+

{{ call $.T "size"}}

+

+ {{if ne .Filesize "Unknown"}} + {{.Filesize}} + {{else}} + {{ call $.T "unknown"}} + {{end}} +


{{if ne .WebsiteLink ""}}

{{call $.T "link"}}

@@ -93,7 +99,7 @@ {{else}}
{{.Seeders}}
{{.Leechers}}
-
{{.Completed}}
+
{{.Completed}}
{{end}}
@@ -189,7 +195,7 @@ - {{block "captcha" .}}{{end}} + {{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}} @@ -211,7 +217,7 @@


- {{block "captcha" .}}{{end}} + {{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
diff --git a/translations/en-us.all.json b/translations/en-us.all.json index b8aebc13..9a9a77ff 100644 --- a/translations/en-us.all.json +++ b/translations/en-us.all.json @@ -479,6 +479,10 @@ "id": "art_manga", "translation": "Art - Manga" }, + { + "id": "art_pictures", + "translation": "Art - Pictures" + }, { "id": "real_life", "translation": "Real Life" diff --git a/translations/fr-fr.all.json b/translations/fr-fr.all.json index fcee6e61..e16b4567 100644 --- a/translations/fr-fr.all.json +++ b/translations/fr-fr.all.json @@ -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" } ] diff --git a/translations/ru-ru.all.json b/translations/ru-ru.all.json index 04b39657..936260bb 100644 --- a/translations/ru-ru.all.json +++ b/translations/ru-ru.all.json @@ -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": "Сейчас нет доступных дампов базы" } ] diff --git a/translations/th-th.all.json b/translations/th-th.all.json index e7f3a480..b5c96be8 100644 --- a/translations/th-th.all.json +++ b/translations/th-th.all.json @@ -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" +} ] diff --git a/translations/zh-tw.all.json b/translations/zh-tw.all.json index eb986b17..c4eb1ed9 100644 --- a/translations/zh-tw.all.json +++ b/translations/zh-tw.all.json @@ -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",