Fix Navigation Admin Panel (#1398)
* Fix Navigation Admin Panel * Fix broken html on reassign page * fix user link in comment list * Fix Unknown bytes * Fix switch file upload/magnet * fix modtools background white + width * fix /mod/ redirection url * Fix last torrents on modpanel * empty torrent file input * Add hidden class to h3
Cette révision appartient à :
Parent
2b4731d16c
révision
b3e3ec6083
12 fichiers modifiés avec 64 ajouts et 24 suppressions
|
@ -2,6 +2,7 @@ package userController
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/NyaaPantsu/nyaa/utils/cookies"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
@ -13,6 +14,9 @@ func UserLogoutHandler(c *gin.Context) {
|
|||
if logout != "" {
|
||||
cookies.Clear(c)
|
||||
url := c.DefaultPostForm("redirectTo", "/")
|
||||
if strings.Contains(url, "/mod/") {
|
||||
url = "/"
|
||||
}
|
||||
c.Redirect(http.StatusSeeOther, url)
|
||||
} else {
|
||||
c.Status(http.StatusNotFound)
|
||||
|
|
|
@ -164,7 +164,7 @@ func findOrderBy(parameters Query, orderBy string, limit int, offset int, countA
|
|||
}
|
||||
|
||||
if orderBy == "" { // default OrderBy
|
||||
orderBy = "torrent_date DESC"
|
||||
orderBy = "date DESC"
|
||||
}
|
||||
dbQuery = dbQuery.Order(orderBy)
|
||||
if limit != 0 || offset != 0 { // if limits provided
|
||||
|
|
|
@ -38,7 +38,7 @@ a:hover {
|
|||
color: #d5d5d5;
|
||||
}
|
||||
|
||||
.box, .pagination li {
|
||||
.box, .pagination li, .modtools {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
border-color: #BBC9CF !important;
|
||||
}
|
||||
|
|
|
@ -193,3 +193,8 @@ td.tr-le, .error-text {
|
|||
background: linear-gradient(to bottom, #EFDCF0 0%, #EBCFEC 100%);
|
||||
border-color: #C48CBE;
|
||||
}
|
||||
|
||||
.modtools {
|
||||
background-color: #F7F8F9;
|
||||
border-color: #cbbdd7;
|
||||
}
|
|
@ -12,7 +12,7 @@ a {
|
|||
text-decoration: none;
|
||||
}
|
||||
|
||||
body, .container { min-width: 400px;}
|
||||
body, .container, .modtools { min-width: 400px;}
|
||||
|
||||
.header, .pagination {
|
||||
-webkit-user-select: none;
|
||||
|
@ -61,8 +61,11 @@ body {
|
|||
height: 60px;
|
||||
border-bottom: 1px solid;
|
||||
}
|
||||
.header.content-admin {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.container {
|
||||
.container, .modtools {
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
@ -93,12 +96,20 @@ body {
|
|||
left: 0;
|
||||
text-align: left;
|
||||
}
|
||||
.header.content-admin .h-left {
|
||||
position: initial;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.h-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
text-align: right;
|
||||
}
|
||||
.header.content-admin .h-right {
|
||||
position: initial;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.h-logo {
|
||||
height: 60px;
|
||||
|
@ -107,7 +118,6 @@ body {
|
|||
.h-logo, .h-nav {
|
||||
display: inline-block;
|
||||
float: left;
|
||||
/* Property is ignored due to the display. With 'display: inline-block', float properties have no effect. */
|
||||
}
|
||||
|
||||
.header .h-logo img {
|
||||
|
@ -132,6 +142,10 @@ body {
|
|||
.header .h-search {
|
||||
margin-right: 6px;
|
||||
}
|
||||
.header.content-admin .h-search {
|
||||
height: auto;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.header .h-search .form-input {
|
||||
font-size: 80%;
|
||||
|
@ -664,7 +678,7 @@ html, body {
|
|||
|
||||
|
||||
@media (min-width: 2560px) {
|
||||
.container { max-width: 60%!important; }
|
||||
.container, .modtools { max-width: 60%!important; }
|
||||
}
|
||||
|
||||
/* hide the username */
|
||||
|
@ -829,6 +843,9 @@ html, body {
|
|||
.header {
|
||||
height: 56px;
|
||||
}
|
||||
.header.content-admin{
|
||||
height: auto;
|
||||
}
|
||||
.header .container > div {
|
||||
line-height: 58px; padding: 0 0.6rem;
|
||||
}
|
||||
|
@ -1258,10 +1275,9 @@ input.filelist-checkbox:checked+table.table-filelist {
|
|||
position: fixed;
|
||||
top: 65px;
|
||||
padding: 5px 10px;
|
||||
max-width: 1060px;
|
||||
width: 100%;
|
||||
background-color: #F7F8F9;
|
||||
border: 1px solid #cbbdd7;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
height: 50px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
@ -1545,9 +1561,10 @@ input.filelist-checkbox:checked+table.table-filelist {
|
|||
float: right;
|
||||
}
|
||||
|
||||
.header-admin .user-menu {
|
||||
width: 155px!important;
|
||||
z-index: 10;
|
||||
.header.content-admin .user-menu {
|
||||
position: absolute;
|
||||
top: 57px;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
#content.content-admin {
|
||||
|
|
|
@ -32,7 +32,7 @@ a:hover {
|
|||
color: #eee;
|
||||
}
|
||||
|
||||
.box, .pagination li {
|
||||
.box, .pagination li, .modtools {
|
||||
background: hsla(222, 8%, 20%, 0.85);
|
||||
border-color: #141517 !important;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ function startupCode() {
|
|||
|
||||
document.getElementById("dark-toggle").addEventListener("click", toggleTheme);
|
||||
|
||||
if(document.cookie.includes("theme")) {
|
||||
if(document.cookie.includes("theme=")) {
|
||||
var startPos = document.cookie.indexOf("theme=") + 6
|
||||
var endPos = document.cookie.substring(startPos).indexOf(";")
|
||||
UserTheme = [endPos == "-1" ? document.cookie.substring(startPos) : document.cookie.substring(startPos, endPos + startPos), "tomorrow"]
|
||||
|
@ -154,7 +154,7 @@ function startupCode() {
|
|||
//If user has no default theme, set these by default
|
||||
|
||||
|
||||
if(document.cookie.includes("theme2")) {
|
||||
if(document.cookie.includes("theme2=")) {
|
||||
var startPos = document.cookie.indexOf("theme2=") + 7
|
||||
var endPos = document.cookie.substring(startPos).indexOf(";")
|
||||
UserTheme[1] = endPos == "-1" ? document.cookie.substring(startPos) : document.cookie.substring(startPos, endPos + startPos)
|
||||
|
@ -213,6 +213,8 @@ document.getElementsByClassName("form-input refine")[0].addEventListener("click"
|
|||
})
|
||||
|
||||
function humanFileSize(bytes, si) {
|
||||
if (bytes == 0)
|
||||
return "Unknown"
|
||||
var k = si ? 1000 : 1024
|
||||
var i = ~~(Math.log(bytes) / Math.log(k))
|
||||
return i == 0 ? bytes + " B" : (bytes / Math.pow(k, i)).toFixed(1) + " " + "KMGTPEZY" [i - 1] + (si ? "" : "i") + "B"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
</td>
|
||||
<td class="tr-size home-td">
|
||||
{{if .User }}
|
||||
{{ .User.Username }}
|
||||
<a href="/user/{{ .User.ID }}/{{ .User.Username }}" title="{{ .User.Username }}">{{ .User.Username }}</a>
|
||||
{{else}}
|
||||
れんちょん
|
||||
{{end}}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<textarea rows="20" cols="40" name="data">{{Form.Data}}</textarea>
|
||||
</div>
|
||||
|
||||
<p>{{ T("reassign_warning_2") }}</p>
|
||||
<p>{{ T("reassign_warning_2")|raw }}</p>
|
||||
<button type="submit" class="form-input btn-green">{{ T("save_changes")}}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
{{block additional_header()}}{{end}}
|
||||
</head>
|
||||
<body {{if Sukebei()}}class="sukebei"{{end}}>
|
||||
<nav id="header" class="header">
|
||||
<nav id="header" class="header {{ block contclass() }}{{end}}">
|
||||
{{block menu()}}{{end}}
|
||||
</nav>
|
||||
<div id="content" class="{{ block contclass() }}{{end}}{{if isset(Infos["system"])}} no-center{{end}}">
|
||||
|
|
|
@ -42,15 +42,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="h-right">
|
||||
<div class="h-user">
|
||||
{{ include "layouts/partials/helpers/badgemenu" }}
|
||||
</div>
|
||||
{{ include "layouts/partials/helpers/badgemenu" }}
|
||||
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
<div class="h-search">
|
||||
<form role="search" action="{{URL.Parse("/mod/torrents")}}" method="get">
|
||||
{{ yield search_common() }}
|
||||
{{ yield search_button() }}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -114,8 +114,8 @@
|
|||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<h3>{{ T("torrent_file")}}</h3>
|
||||
<input type="file" name="torrent" id="torrent" class="up-input" accept=".torrent"/>
|
||||
<h3 {{ if Form.Magnet != "" }}class="hidden"{{end}}>{{ T("torrent_file")}}</h3>
|
||||
<input type="file" name="torrent" id="torrent" class="up-input" accept=".torrent" {{ if Form.Magnet != "" }}disabled{{end}}/>
|
||||
<p>{{ T("uploading_file_prefills_fields")}}</p>
|
||||
{{ yield errors(name="torrent")}}
|
||||
|
||||
|
@ -201,6 +201,19 @@
|
|||
listContext: true
|
||||
})
|
||||
preview.render()
|
||||
document.querySelector("input[name='magnet']").addEventListener("keyup", (e) => {
|
||||
var torrentInput = document.querySelector("input[name='torrent']")
|
||||
torrentInput.disabled = e.target.value != ""
|
||||
if (e.target.value == "") torrentInput.previousElementSibling.classList.remove("hidden")
|
||||
else torrentInput.previousElementSibling.classList.add("hidden")
|
||||
try{
|
||||
torrentInput.value = '';
|
||||
if (torrentInput.value) {
|
||||
torrentInput.type = "text";
|
||||
torrentInput.type = "file";
|
||||
}
|
||||
}catch(e){}
|
||||
})
|
||||
</script>
|
||||
<script type="text/javascript">new SimpleMDE({ element: document.getElementById("desc"), spellChecker: false, showIcons: [ "strikethrough", "code", "table", "horizontal-rule" ] });</script>
|
||||
{{end}}
|
||||
|
|
Référencer dans un nouveau ticket