web: Added example sentences

Signed-off-by: Ben Aaron Goldberg <ben@benaaron.dev>
This commit is contained in:
Ben Aaron Goldberg 2021-10-24 05:34:02 -04:00
parent 5aa00e052e
commit 680bbd5b2d
2 changed files with 19 additions and 7 deletions

View file

@ -14,16 +14,14 @@ use pronouns_today::{InstanceSettings, Pronoun};
#[template(path = "index.html")] #[template(path = "index.html")]
struct IndexTemplate<'a> { struct IndexTemplate<'a> {
name: Option<String>, name: Option<String>,
short: String, pronoun: &'a Pronoun,
objective: &'a str,
pronouns: Vec<(usize, &'a Pronoun)>, pronouns: Vec<(usize, &'a Pronoun)>,
} }
fn render_page(pronoun: &Pronoun, settings: &InstanceSettings, name: Option<String>) -> String { fn render_page(pronoun: &Pronoun, settings: &InstanceSettings, name: Option<String>) -> String {
IndexTemplate { IndexTemplate {
name, name,
short: pronoun.render_threeform(), pronoun,
objective: &pronoun.object_pronoun,
pronouns: settings.pronoun_list.iter().enumerate().collect(), pronouns: settings.pronoun_list.iter().enumerate().collect(),
} }
.render() .render()

View file

@ -12,13 +12,27 @@
</head> </head>
<body> <body>
<h1>{% if name.is_some() %} {{ name.as_ref().unwrap() }}'s {% else %} <h1>{% if name.is_some() %} {{ name.as_ref().unwrap() }}'s {% else %}
My{% endif %} pronouns today are: {{ short }}</h1> My{% endif %} pronouns today are: {{ pronoun.render_threeform() }}</h1>
<p>This page picks a random pronoun from a list of preferred pronouns every <p>This page picks a random pronoun from a list of preferred pronouns every
day. day.
{% if name.is_some() %} {{ name.as_ref().unwrap() }}{% else %} {% if name.is_some() %} {{ name.as_ref().unwrap() }}{% else %}
Whoever linked you to this page{% endif %} would like you to try {{ short }} pronouns for Whoever linked you to this page{% endif %} would like you to try {{ pronoun.render_threeform() }} pronouns for
{{ objective }} today.</p> {{ pronoun.object_pronoun }} today.</p>
<h3>Here are some example sentences using my she/her pronouns:</h3>
<p>{{ pronoun.subject_pronoun | capitalize }} walked the dog.</p>
<p>I went with {{ pronoun.object_pronoun }}.</p>
<p>{{ pronoun.subject_pronoun | capitalize }} rode {{ pronoun.possesive_determiner }} bike.</p>
<p>At least I think it is {{ pronoun.possesive_pronoun }}.</p>
<p>{{ pronoun.subject_pronoun | capitalize }} bought the stuffed animal for {{ pronoun.reflexive_pronoun }}.</p>
<hr/>
<label for="form-toggle">Create your own custom link!</label> <label for="form-toggle">Create your own custom link!</label>
<input type="checkbox" id="form-toggle" style="display: none;"/> <input type="checkbox" id="form-toggle" style="display: none;"/>