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/site/torrents/upload.jet.html
kilo cedbec3246 New design for upload form (#1574)
* CSS for new upload form

* add torrent_name in translation

* Update CHANGELOG.md

* New upload form HTML, don't load kilo.js

* Update upload.jet.html

* Update main.css

* change placeholder of torrent name input

* Update upload.jet.html

* remove useless function call from upload

* responsive upload form

* Fix description being constantly bold in upload

* fix vertical align of labels in upload

* upload tags inputs in table too

* tag table styling & remove old upload tag styling

* Update main.css

* Update main.css

* Update main.css

* Update upload.jet.html

* fix flag misalignement in upload form

* Remove rules <div> from upload, provide temporary link to rules in faq (maybe will turn into a modal in the future?), remove useless input

* bigger upload button & no margin for upload rules text

* Update en-us.all.json

* Update CHANGELOG.md

* add ID to rules div

* Update upload.jet.html
2017-09-17 20:30:58 +02:00

135 lignes
6,3 Kio
HTML

{{ extends "layouts/index_site" }}
{{ import "layouts/partials/helpers/csrf" }}
{{ import "layouts/partials/helpers/captcha" }}
{{ import "layouts/partials/helpers/flags" }}
{{ import "layouts/partials/helpers/rules" }}
{{ import "layouts/partials/helpers/tag_form" }}
{{block title()}}{{ T("upload")}}{{end}}
{{block content_body()}}
<div style="text-align: left;" class="box">
<p class="upload-rules">{{ T("read_rules")|raw }}</p>
<form enctype="multipart/form-data" method="POST">
{{ yield csrf_field() }}
<div class="upload-errors">
{{ yield errors(name="name")}}
{{ yield errors(name="torrent")}}
{{ yield errors(name="magnet")}}
{{ yield errors(name="c")}}
{{ yield errors(name="remake")}}
{{ yield errors(name="hidden")}}
{{ yield errors(name="website_link")}}
{{ yield errors(name="tags")}}
</div>
<table class="upload-form-table">
<tbody>
<tr>
<td class="table-input-label"><label for="name">{{ T("name")}}</label></td>
<td class="table-input"><input type="text" name="name" id="name" class="form-input up-input form-torrent-name" placeholder="{{ T("torrent_name")}}" value="{{Form.Name}}" autofocus></td>
</tr>
<tr class="table-torrent-link">
<td class="table-input-label"><label for="torrent">{{ T("torrent_file")}} / {{ T("magnet_link")}}</label></td>
<td class="table-input"><input type="file" name="torrent" id="torrent" class="up-input" accept=".torrent" {{ if Form.Magnet != "" }}disabled{{end}}/><input type="text" name="magnet" id="magnet" class="form-input up-input" placeholder="{{ T("magnet_link")}}" value="{{Form.Magnet}}"/></td>
</tr>
<tr>
<td class="table-input-label"><label for="c">{{ T("category")}}</label></td>
<td class="table-input">
<select name="c" id="c" class="form-input up-input form-torrent-category" required>
<option value="">{{ T("select_a_torrent_category")}}</option>
{{ range _, cat := GetCategories(false, true) }}
<option value="{{ cat.ID }}" {{if Form.Category == cat.ID }}selected{{end}}>{{ T(cat.Name) }}</option>
{{ end }}
</select>
</td>
</tr>
<td class="table-input-label">{{ T("torrent_language")}}</td>
<td class="table-input">
<div class="form-input language">
{{ yield flagList(languages=GetTorrentLanguages(), selected=Form.Languages, inputname="languages", id="upload-lang")}}
</div>
</td>
</tr>
<tr class="table-checkboxes">
<td class="table-input-label"></td>
<td class="table-input" style="font-weight: normal;"><input type="checkbox" value="true" name="remake" id="remake" class="form-torrent-remake"/><label for="remake">{{ T("mark_as_remake")}}</label> <input type="checkbox" value="true" name="hidden" id="hidden" class="form-torrent-hidden {{ if User.ID == 0 }}hidden{{end}}" {{ if User.ID == 0 }}disabled{{end}}><label for="hidden" {{ if User.ID == 0 }}class="hidden"{{end}}>{{ T("upload_as_anon")}}</label></td>
</tr>
<tr>
<tr>
<td class="table-input-label"><label for="website_link">{{ T("website_link")}}</label></td>
<td class="table-input"><input name="website_link" id="website_link" placeholder="http://" class="form-input up-input" type="text" value="{{Form.WebsiteLink}}"/></td>
</tr>
<tr>
<td class="table-input-label"><label for="desc">{{ T("torrent_description")}}</label></td>
<td class="table-input"><textarea name="desc" id="desc" class="form-input up-input" style="height: 10rem;">{{Form.Description}}</textarea></td>
</tr>
</tbody>
</table>
<table class="upload-tag-table">
<tbody>
<tr><td colspan="3"><h3 id="tag-h3">{{ T("torrent_tags")}}</h3></td></tr>
<tr>
{{ range _, tag := Config.Torrents.Tags.Types}}
<td>
{{ yield tagForm(tagType=tag, acceptedTag=Form.Tags.Get(tag.Name)) }}
{{ if _ % 3 == 1 && _ == len(Config.Torrents.Tags.Types) - 1}}
</td>
<td>
<div class="form-group">
<label class="input-label" for="tag_{{Config.Torrents.Tags.Default}}">{{ T("tagtype_tags") }}</label>
<input type="text" name="tag_{{Config.Torrents.Tags.Default}}" class="form-input" id="tag_{{Config.Torrents.Tags.Default}}" value="{{ Form.Tags.Get(Config.Torrents.Tags.Default).Tag }}" />
</div>
</td>
{{ else }}
{{ if _ % 3 == 2}}
</td></tr><tr>
{{else}}
</td>
{{end}}
{{end}}
{{ if _ % 3 != 1 && _ == len(Config.Torrents.Tags.Types) - 1}}
</tr>
<tr>
<td>
<div class="form-group">
<label class="input-label" for="tag_{{Config.Torrents.Tags.Default}}">{{ T("tagtype_tags") }}</label>
<input type="text" name="tag_{{Config.Torrents.Tags.Default}}" class="form-input" id="tag_{{Config.Torrents.Tags.Default}}" value="{{ Form.Tags.Get(Config.Torrents.Tags.Default).Tag }}" />
</div>
</td>
{{end}}
{{ end }}
</tr>
</tbody>
</table>
<div style="width: 240px">
{{yield captcha(captchaid=Form.CaptchaID)}}
</div>
{{ yield errors(name="captchaID")}}
<button type="submit" class="form-input up-btn" id="upload-button">{{ T("upload")}}</button>
</form>
</div>
{{end}}
{{ block footer_js()}}
<script type="text/javascript" src="/js/translation.js?v={{ Config.Version}}{{ Config.Build }}"></script>
<script type="text/javascript" src="/js/template.js?v={{ Config.Version}}{{ Config.Build }}"></script>
<script type="text/javascript" src="/js/simplemde.min.js?v={{ Config.Version}}{{ Config.Build }}"></script>
{{ include "layouts/partials/torrent_item_upload" }}
<script type="text/javascript">
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}}