Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/templates/admin/torrentlist.html
akuma06 6edc68fe22 Deleted torrents mod done (#732)
* Torrent Mass Edit Api (WIP)

* Torrents can be deleted in mass from frontend with api post request
* Torrents status can be edited from frontend with api post request
-- Look to function doc for more info on how to use it

It is a WIP so it might not work =D

* Finished Mass mod Api

As per suggestion of @yiiTT in #720, I added:
* Changing torrents category
* Deletion of reports with deletion of a torrent
* Changing owner of multiple torrents

Commit also add some new translation strings.

* Make some changes

* Reports can now be cleared for the torrents selected without having to
delete them
* Users with no admin rights can't delete reports

* Fix moveto to status

moveto deprecated in api

* Tested and works!

Changes:
* Updates only the colomns of torrent table
* Moved categories config in config/torrents.go

* Forgot this file in last commit

* Less useless queries

The use of Save makes it that users are created and updates also all the
associatiated models. Better to just update the colomns needed (less
useless queries)

* Some Updates

* Added a new status of 5 for locking torrents
* Modifying the list torrents view for using it in deleted torrents view
* Added function to get deleted torrents
* Torrents (and reports) can be definitely deleted
* Some new translation string

* Fixing

* fix 2

* Added upload check for locked torrents

If a user owns a torrent, has deleted it and try to repload it. As long
as it has not been locked, he can.

* Fixing wrong condition in isdeleted

* Finished

* Info messages on success when deletes or lock
* Fixed double deleted_at is Null
* Added Link to view of deleted torrents
* Added new translation string
2017-05-25 02:19:05 +02:00

83 lignes
4,1 Kio
HTML
Brut Annotations Historique

Ce fichier contient des caractères Unicode ambigus.

Ce fichier contient des caractères Unicode qui peuvent être confondus avec d'autres caractères. Si vous pensez que c'est intentionnel, vous pouvez ignorer cet avertissement. Utilisez le bouton Échappe pour les dévoiler.

{{define "title"}}Torrents List{{end}}
{{define "contclass"}}cont-view{{end}}
{{define "content"}}
<div class="blockBody">
<form method="post" action="">
{{ range (index $.Infos "infos")}}
<div class="alert alert-info"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-info-sign"></i> {{ . }}</div>
{{end}}
{{ range (index $.Errors "errors")}}
<div class="alert alert-danger"><a class="panel-close close" data-dismiss="alert">×</a><i class="glyphicon glyphicon-exclamation-sign"></i> {{ . }}</div>
{{end}}
<nav class="navbar navbar-default">
<div class="navbar-form">
<div class="form-group">
<select class="form-control" name="action">
<option value="">Action...</option>
<option value="status">Change Status</option>
<option value="delete">Delete</option>
</select>
<select class="form-control" style="display: none;" name="status">
<option value="">To...</option>
<option value="5">{{call $.T "torrent_status_blocked"}}</option>
<option value="0">{{call $.T "torrent_status_hidden"}}</option>
<option value="1">{{call $.T "torrent_status_normal"}}</option>
<option value="2">{{call $.T "torrent_status_remake"}}</option>
<option value="3">{{call $.T "trusted"}}</option>
<option value="4">A+</option>
</select>
</div>
<input type="submit" class="btn btn-success" value="Apply">
<input type="reset" class="btn btn-danger" value="Reset">
<div class="pull-right">
<a href="{{genRoute "mod_tlist" }}" class="btn btn-success">Not Deleted</a>
<a href="{{genRoute "mod_tlist_deleted" }}" class="btn btn-danger">Deleted</a>
</div>
</div>
</nav>
<div class="table-responsive">
<table class="table table-hover">
<tr>
<th style="width:12px;"><input type="checkbox" name="checkall" data-selectall="checkbox"></th>
<th>Torrent Name</th>
<th>Uploader</th>
<th>Action</th>
</tr>
{{ range .Torrents}}
<tr>
<td><input type="checkbox" name="torrent_id" value="{{.ID }}"></td>
<td><a href="{{ genViewTorrentRoute .ID }}">{{ .Name }}</a> {{ if not .IsDeleted }}(<a href="{{ genRoute "mod_tedit" }}?id={{.ID}}">{{ call $.T "edit"}}</a>){{end}}</td>
<td>{{ if .Uploader }}<a href="{{ if .IsDeleted }}{{ genRoute "mod_tlist_deleted" }}{{else}}{{ genRoute "mod_tlist" }}{{end}}?userID={{.UploaderID}}">{{ .Uploader.Username }}</a>{{ else }}れんちょん{{end}}</td>
<td>
<a href="{{ genRoute "mod_tblock" }}?id={{ .ID }}" class="btn btn-danger" onclick="if (!confirm('{{ call $.T "are_you_sure"}}')) return false;">{{ if .IsBlocked }}{{ call $.T "torrent_unblock" }}{{else}}{{ call $.T "torrent_block" }}{{end}}</a>
{{ if .IsDeleted }}
<a href="{{ genRoute "mod_tdelete" }}?definitely&id={{ .ID }}" class="btn btn-danger" onclick="if (!confirm('{{ call $.T "are_you_sure"}} {{ call $.T "delete_definitely_torrent_warning"}}')) return false;"><i class="glyphicon glyphicon-trash"></i> {{ call $.T "delete_definitely" }}</a>
{{ else }}
<a href="{{ genRoute "mod_tdelete" }}?id={{ .ID }}" class="btn btn-danger" onclick="if (!confirm('{{ call $.T "are_you_sure"}}')) return false;"><i class="glyphicon glyphicon-trash"></i> {{ call $.T "delete" }}</a>
{{ end }}
</td>
</tr>
{{end}}
</table>
</div>
</form>
<nav class="torrentNav" aria-label="Page navigation">
<ul class="pagination">
{{ genNav .Navigation .URL 5 }}
</ul>
</nav>
</div>
{{end}}
{{ define "js_footer"}}
<!-- JS Function for selecting multiple checkboxes -->
<script type="text/javascript" src="{{ .URL.Parse "/js/selectAll.js" }}"></script>
<script type="text/javascript">
$("select[name='action']").on("change", function(e) {
if ($(this).val() == "move")
$(this).siblings("select[name='moveto']").show()
else
$(this).siblings("select[name='moveto']").hide()
});
</script>
{{end}}