Plume/templates/partials/image_select.rs.html
Mostafa Ahangarha 54c6d21fc5 WIP - initial RTL support #575 (#577)
* initial RTL support

* fix dir in template-util

* fix dir in blogs new

* fix dir in blogs details

* fix dir in posts new

* fix dir in posts details

* fix dir in posts remote

* Fix dir in partials

some parts should be recheck carefully in real usage
2019-07-11 09:34:27 +02:00

25 lines
848 B
HTML

@use template_utils::*;
@use plume_models::medias::*;
@(ctx: BaseContext, id: &str, title: String, optional: bool, medias: Vec<Media>, selected: Option<i32>)
<label for="@id" dir="auto">
@title
@if optional {
<small>@i18n!(ctx.1, "Optional")</small>
}
</label>
<select id="@id" name="@id">
<option value="none" @if selected.is_none() { selected }>@i18n!(ctx.1, "None")</option>
@for media in medias {
@if media.category() == MediaCategory::Image {
<option value="@media.id" @if selected.map(|c| c == media.id).unwrap_or(false) { selected } dir="auto">
@if !media.alt_text.is_empty() {
@media.alt_text
} else {
@media.content_warning.unwrap_or(i18n!(ctx.1, "No description"))
}
</option>
}
}
</select>