d8e17478f8
* Add flags for torrents Add a new field, .Language, to the Torrent model, and a new package, torrentLanguages, which maps languages to flags. Added also a flag icon pack from googlei18n/region-flags, with (mostly) public domain flags from Wikipedia. * Optimize flags * Use FlagSprites CSS instead of .png files * Only use flags for languages we support * Add test for CSS flags Ensure that we have all the flags for the languages we support. * Add AdditionalLanguages field to config This allows us to support additional languages for new uploaded torrents, even if we have no translation for it. * Minor CSS fix * Add "other" and "multiple" torrent languages Also removed the TorrentLanguage struct, as it wasn't much useful. * Fix test * Add colspan=2 to category when language is empty Also hide the language column if empty. * Add lang field to search. Hopefully it works with Elasticsearch as well, but I haven't tested (lol Java) * Add language field to ES index and settings * Add language column to JS template * Add keyword type to language ES field * Remove 'raw' from keyword * Set "simple" analyzer on language * Document .Language field on Torrent model
68 lignes
3 Kio
HTML
68 lignes
3 Kio
HTML
{{define "title"}}{{call $.T "upload"}}{{end}}
|
|
{{define "content"}}
|
|
{{with .Form}}
|
|
<div style="text-align: left;" class="box">
|
|
<form enctype="multipart/form-data" role="upload" method="POST">
|
|
{{ block "csrf_field" $ }}{{end}}
|
|
{{ range (index $.FormErrors "errors")}}
|
|
<p class="error-text">{{ . }}</p>
|
|
{{end}}
|
|
|
|
<h3>{{call $.T "name"}}</h3>
|
|
<input type="text" name="name" id="name" class="form-input up-input" placeholder="{{call $.T "file_name"}}" value="{{.Name}}" autofocus>
|
|
|
|
<h3>{{call $.T "torrent_file"}}</h3>
|
|
<input type="file" name="torrent" id="torrent" class="up-input" accept=".torrent">
|
|
<p>{{call $.T "uploading_file_prefills_fields"}}</p>
|
|
|
|
<h3>{{call $.T "magnet_link"}}</h3>
|
|
<input type="text" name="magnet" id="magnet" class="form-input up-input" placeholder="{{call $.T "magnet_link"}}" value="{{.Magnet}}">
|
|
<p>{{ call $.T "please_include_our_tracker" }}</p>
|
|
|
|
<h3>{{call $.T "category"}}</h3>
|
|
<select name="c" id="c" class="form-input up-input" required>
|
|
<option value="">{{call $.T "select_a_torrent_category"}}</option>
|
|
{{ range $name_cat, $id_cat := (GetCategories false) }}
|
|
<option value="{{ $id_cat }}" {{if eq $.Form.Category $id_cat }}selected{{end}}>{{call $.T $name_cat }}</option>
|
|
{{ end }}
|
|
</select>
|
|
|
|
<h3>{{ call $.T "torrent_language" }}</h3>
|
|
<select name="language" id="language" class="form-input up-input" required>
|
|
<option value="">{{call $.T "select_a_torrent_language"}}</option>
|
|
<option value="other" {{if eq $.Form.Language "other"}}selected{{end}}>{{call $.T "language_other_name"}}</option>
|
|
<option value="multiple" {{if eq $.Form.Language "multiple"}}selected{{end}}>{{call $.T "language_multiple_name"}}</option>
|
|
{{ range $_, $language := (GetTorrentLanguages) }}
|
|
<option value="{{ $language }}" {{if eq $.Form.Language $language}}selected{{end}}>
|
|
{{LanguageName $language $.T}}
|
|
</option>
|
|
{{ end }}
|
|
</select>
|
|
<p>
|
|
<input type="checkbox" name="remake" id="remake" >
|
|
<label for="remake">{{call $.T "mark_as_remake"}}</label>
|
|
</p>
|
|
{{ if gt $.User.ID 0 }}
|
|
<p>
|
|
<input type="checkbox" name="hidden" id="hidden" >
|
|
<label for="hidden">{{call $.T "mark_as_hidden"}}</label>
|
|
</p>
|
|
{{ end }}
|
|
<h3>{{call $.T "website_link"}}</h3>
|
|
<input name="website_link" id="website_link" class="form-input up-input" type="text" value="{{.WebsiteLink}}">
|
|
|
|
<h3>{{call $.T "torrent_description"}}</h3>
|
|
<p>{{call $.T "description_markdown_notice"}}</p>
|
|
<textarea name="desc" id="desc" class="form-input up-input" style="height: 10rem;">{{.Description}}</textarea>
|
|
|
|
{{block "captcha" (makeCaptchaData .CaptchaID $.T)}}{{end}}
|
|
|
|
<button type="submit" class="form-input up-btn">{{call $.T "upload"}}</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{ define "footer_js"}}
|
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
|
<script type="text/javascript">new SimpleMDE({ element: document.getElementById("desc"), spellChecker: false, showIcons: [ "strikethrough", "code", "table", "horizontal-rule" ] });</script>
|
|
{{end}}
|