docs: #352 basic UI for adding geo/date tags to poems
This commit is contained in:
parent
c356bfa2ea
commit
7f60428fa9
@ -1043,6 +1043,65 @@ else
|
||||
<td><p id="saving"> </p></td>
|
||||
</tr>
|
||||
|
||||
@if (Model.ShowAdminOps)
|
||||
{
|
||||
<tr>
|
||||
<td>برچسبهای زمان و مکان</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<th>مکان</th>
|
||||
<th>سال</th>
|
||||
<th>ماه</th>
|
||||
<th>روز</th>
|
||||
</tr>
|
||||
@foreach (var tag in Model.PoemGeoDateTags)
|
||||
{
|
||||
<tr>
|
||||
<td>@($"{(tag.Location == null ? "" : tag.Location.Name)}")</td>
|
||||
<td>@tag.LunarYear</td>
|
||||
<td>@tag.LunarMonth</td>
|
||||
<td>@tag.LunarDay</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<select id="location">
|
||||
@{
|
||||
foreach (var location in Model.Locations)
|
||||
{
|
||||
<option value="@location.Name">@location.Name</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="year" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="month" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="day" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<a role="button" class="pagebutton" onclick="newLocation()">برچسب جدید</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/Admin/Locations" role="button" class="pagebutton">مکانها</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
<tr>
|
||||
<td class="td-button-container">
|
||||
<a role="button" href="#" class="editor-button background-gray">لغزش به بالای صفحه</a>
|
||||
|
||||
@ -91,6 +91,17 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
/// </summary>
|
||||
public bool ShowAdminOps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// locations
|
||||
/// </summary>
|
||||
public List<GanjoorGeoLocation> Locations { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// poem geo date tags
|
||||
/// </summary>
|
||||
public PoemGeoDateTag[] PoemGeoDateTags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get
|
||||
/// </summary>
|
||||
@ -191,6 +202,40 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
{
|
||||
CanAssignRhythms = false;
|
||||
}
|
||||
|
||||
if(ShowAdminOps)
|
||||
{
|
||||
var responseLocations = await secureClient.GetAsync($"{APIRoot.Url}/api/locations");
|
||||
if (!responseLocations.IsSuccessStatusCode)
|
||||
{
|
||||
FatalError = JsonConvert.DeserializeObject<string>(await responseLocations.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
Locations = new List<GanjoorGeoLocation>();
|
||||
Locations.Add
|
||||
(
|
||||
new GanjoorGeoLocation()
|
||||
{
|
||||
Id = 0,
|
||||
Latitude = 0,
|
||||
Longitude = 0,
|
||||
Name = ""
|
||||
}
|
||||
);
|
||||
|
||||
Locations.AddRange(JsonConvert.DeserializeObject<GanjoorGeoLocation[]>(await responseLocations.Content.ReadAsStringAsync()));
|
||||
|
||||
|
||||
var tagsResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{PageInformation.Id}/geotag");
|
||||
if (!tagsResponse.IsSuccessStatusCode)
|
||||
{
|
||||
FatalError = JsonConvert.DeserializeObject<string>(await tagsResponse.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
PoemGeoDateTags = JsonConvert.DeserializeObject<PoemGeoDateTag[]>(await tagsResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user