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
69 lignes
3,5 Kio
HTML
69 lignes
3,5 Kio
HTML
{{define "title"}}{{ call $.T "torrent_edit_panel" }}{{end}}
|
|
{{define "content"}}
|
|
<div class="results box">
|
|
<h3 id="torrents">{{ call $.T "torrent_edit_panel" }}</h3>
|
|
{{with .Form}}
|
|
<form style="text-align:left;padding-left:10px;padding-right:10px;" enctype="multipart/form-data" role="upload" method="POST">
|
|
{{ block "csrf_field" $ }}{{end}}
|
|
{{ range (index $.FormInfos "infos")}}
|
|
<p class="success-text">{{ . }}</p>
|
|
{{end}}
|
|
{{ range (index $.FormErrors "errors")}}
|
|
<p class="error-text">{{ . }}</p>
|
|
{{end}}
|
|
<div class="form-group">
|
|
<label for="name">{{call $.T "name"}}</label>
|
|
<input type="text" name="name" class="form-input up-input" placeholder="{{call $.T "file_name"}}" value="{{.Name}}" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="c">{{call $.T "category"}}</label>
|
|
<select name="c" class="form-input up-input">
|
|
<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>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="language">{{ call $.T "torrent_language" }}</label>
|
|
<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>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="Status">{{call $.T "torrent_status"}}</label>
|
|
<select name="status" class="form-input up-input">
|
|
<option value="5" {{if eq .Status 5}}selected{{end}}>{{ call $.T "torrent_status_blocked" }}</option>
|
|
<option value="1" {{if eq .Status 1}}selected{{end}}>{{call $.T "torrent_status_normal"}}</option>
|
|
<option value="2" {{if eq .Status 2}}selected{{end}}>{{call $.T "torrent_status_remake"}}</option>
|
|
<option value="3" {{if eq .Status 3}}selected{{end}}>{{call $.T "trusted"}}</option>
|
|
<option value="4" {{if eq .Status 4}}selected{{end}}>A+</option>
|
|
</select>
|
|
</div>
|
|
{{ if $.User }}
|
|
<p>
|
|
<input type="checkbox" name="hidden" id="hidden" {{ if .Hidden }}checked{{end}}>
|
|
<label for="hidden">{{call $.T "mark_as_hidden"}}</label>
|
|
</p>
|
|
{{ end }}
|
|
<div class="form-group">
|
|
<label for="website_link">{{call $.T "website_link"}}</label>
|
|
<input name="website_link" id="website_link" class="form-input up-input" type="text" value="{{.WebsiteLink}}">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="desc">{{call $.T "torrent_description"}}</label>
|
|
<p class="help-block">{{call $.T "description_markdown_notice"}}</p>
|
|
<textarea name="desc" class="form-input up-input" rows="10">{{.Description}}</textarea>
|
|
</div>
|
|
<button type="submit" class="form-input up-input btn-green">{{call $.T "save_changes"}}</button>
|
|
</form>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|