PlotDirector/PlotLine/Views/Writing/_ContextNames.cshtml

26 lines
4.4 KiB
Plaintext

@model WritingContextDisplayViewModel
@{var panel=Model.NamePanel;var library=panel?.Library;}
@if(library==null){<p>Names Library is unavailable. Refresh this tool.</p>}else{
var f=library.Filter;
<div data-context-names data-book="@panel!.BookID">
<form data-context-name-search>
<div class="context-name-primary"><label>Find a name <input name="Search" value="@f.Search" maxlength="120" type="search" class="form-control" autocomplete="off"/></label>
<label>Locale <select name="LocaleCode" class="form-select"><option value="">All locales</option>@foreach(var l in library.Locales){<option value="@l.LocaleCode" selected="@(l.LocaleCode==f.LocaleCode)">@l.DisplayName</option>}</select></label>
<label>Usage <select name="UsedOnly" class="form-select"><option value="">Used and unused</option><option value="true" selected="@(f.UsedOnly==true)">Already used</option><option value="false" selected="@(f.UsedOnly==false)">Unused in scope</option></select></label><button type="submit" class="btn btn-primary">Search library</button></div>
<details data-name-filters><summary>More filters and usage scope</summary><div class="context-name-filters">
<label>Birth year <input name="BirthYear" value="@f.BirthYear" inputmode="numeric" type="number" class="form-control"/></label>
<label>Gender prior <select data-name-gender class="form-select"><option value="">Any</option>@foreach(var choice in new[]{("Female","0.5","Mostly female"),("Female","0.7","Strongly female"),("Female","0.9","Very strongly female"),("Male","0.5","Mostly male"),("Male","0.7","Strongly male"),("Male","0.9","Very strongly male"),("Mixed","0.65","Balanced / mixed")}){<option value="@(choice.Item1+":"+choice.Item2)" selected="@(f.GenderPreference==choice.Item1&&f.GenderThreshold?.ToString(System.Globalization.CultureInfo.InvariantCulture)==choice.Item2)">@choice.Item3</option>}</select></label>
<input type="hidden" name="GenderPreference" value="@f.GenderPreference"/><input type="hidden" name="GenderThreshold" value="@f.GenderThreshold?.ToString(System.Globalization.CultureInfo.InvariantCulture)"/>
<label>Name type <select name="NameType" class="form-select"><option value="">Any</option>@foreach(var type in new[]{"Canonical","Independent","Diminutive","Nickname","Variant"}){<option value="@type" selected="@(f.NameType==type)">@type</option>}</select></label>
<label>Commonness <select name="MinimumUsage" class="form-select"><option value="">Any</option>@foreach(var c in new[]{("0.01","Rare or above"),("0.05","Familiar"),("0.25","Common"),("0.6","Very common")}){<option value="@c.Item1" selected="@(f.MinimumUsage?.ToString(System.Globalization.CultureInfo.InvariantCulture)==c.Item1)">@c.Item2</option>}</select></label>
<label>Used scope <select name="UsedScope" class="form-select"><option value="Project" selected="@(f.UsedScope=="Project")">This project</option><option value="Book" selected="@(f.UsedScope=="Book")">Selected book</option><option value="Library" selected="@(f.UsedScope=="Library")">Accessible projects</option></select></label>
<label>Book (scope and recorded defaults) <select name="BookID" class="form-select"><option value="">Project defaults</option>@foreach(var book in library.Books){<option value="@book.BookID" selected="@(f.BookID==book.BookID)">@book.BookDisplayTitle</option>}</select></label>
<label>Results per page <select name="PageSize" class="form-select">@foreach(var count in new[]{25,50,100}){<option value="@count" selected="@(f.PageSize==count)">@count</option>}</select></label></div></details>
</form>
<p class="small">Candidates come from the existing Names Library. Usage is evaluated in the selected scope; unused in one book does not mean unused elsewhere.</p>
<p data-name-query-status role="status"></p><div data-context-name-results><partial name="~/Views/Writing/_ContextNameResults.cshtml" model="panel"/></div>
<details class="mt-3" data-established-names><summary>Look up an established character or alias</summary><form data-context-name-lookup><label>Exact recorded spelling <input name="search" type="search" maxlength="120" class="form-control" required/></label><button type="submit" class="btn btn-outline-primary">Find established use</button></form><div data-context-name-identities></div></details>
<div data-context-name-identity></div><p data-context-interaction-status role="status"></p>
<a href="/Names?projectId=@panel.ProjectID&bookId=@panel.BookID" data-context-workspace-target="names" target="_blank" rel="noopener">Open full Names workspace</a>
</div>}