Replace the input! macro with an Input builder (#646)
* Replace the input! macro with an Input builder * Use a BTreeMap instead of an HashMap Followinf @fdb-hiroshima's advice * Rename Input::to_html to Input::html To make clippy happy * Wrap error messages in red paragraphs
This commit is contained in:
@@ -6,21 +6,48 @@
|
||||
@:base(ctx, i18n!(ctx.1, "Search"), {}, {}, {
|
||||
<h1>@i18n!(ctx.1, "Search")</h1>
|
||||
<form method="get" id="form">
|
||||
<input id="q" name="q" placeholder="@i18n!(ctx.1, "Your query")" type="search" style="-webkit-appearance: none;">
|
||||
@(Input::new("q", "Your query")
|
||||
.input_type("search")
|
||||
.set_prop("style", "-webkit-appearance: none;")
|
||||
.html(ctx.1))
|
||||
<details>
|
||||
<summary>@i18n!(ctx.1, "Advanced search")</summary>
|
||||
@input!(ctx.1, title (text), "Article title matching these words", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Title")))
|
||||
@input!(ctx.1, subtitle (text), "Subtitle matching these words", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Subtitle - byline")))
|
||||
@input!(ctx.1, content (text), "Content matching these words", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Body content")))
|
||||
@input!(ctx.1, after (date), "From this date", &format!("max={}", now))
|
||||
@input!(ctx.1, before (date), "To this date", &format!("max={}", now))
|
||||
|
||||
@input!(ctx.1, tag (text), "Containing these tags", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Tags")))
|
||||
@input!(ctx.1, instance (text), "Posted on one of these instances", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Instance domain")))
|
||||
@input!(ctx.1, author (text), "Posted by one of these authors", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Author(s)")))
|
||||
@input!(ctx.1, blog (text), "Posted on one of these blogs", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Blog title")))
|
||||
@input!(ctx.1, lang (text), "Written in this language", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Language")))
|
||||
@input!(ctx.1, license (text), "Published under this license", &format!("placeholder=\"{}\"", i18n!(ctx.1, "Article license")))
|
||||
@(Input::new("title", i18n!(ctx.1, "Article title matching these words"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Title"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("subtitle", i18n!(ctx.1, "Subtitle matching these words"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Subtitle"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("content", i18n!(ctx.1, "Content macthing these words"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Body content"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("after", i18n!(ctx.1, "From this date"))
|
||||
.input_type("date")
|
||||
.set_prop("max", now)
|
||||
.html(ctx.1))
|
||||
@(Input::new("before", i18n!(ctx.1, ""))
|
||||
.input_type("date")
|
||||
.set_prop("max", now)
|
||||
.html(ctx.1))
|
||||
@(Input::new("tag", i18n!(ctx.1, "Containing these tags"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Tags"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("instance", i18n!(ctx.1, "Posted on one of these instances"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Instance domain"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("author", i18n!(ctx.1, "Posted by one of these authors"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Author(s)"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("blog", i18n!(ctx.1, "Posted on one of these blogs"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Blog title"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("lang", i18n!(ctx.1, "Written in this language"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Language"))
|
||||
.html(ctx.1))
|
||||
@(Input::new("license", i18n!(ctx.1, "Published under this license"))
|
||||
.set_prop("placeholder", i18n!(ctx.1, "Article license"))
|
||||
.html(ctx.1))
|
||||
</details>
|
||||
<input type="submit" value="@i18n!(ctx.1, "Search")"/>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user