Add a 'home' link to the character sheets

This commit is contained in:
projectmoon 2021-01-23 15:26:30 +00:00
parent a8a37104a6
commit e5ec81464c
3 changed files with 9 additions and 1 deletions

View File

@ -165,7 +165,6 @@
{# Webpack Templating for API script #} {# Webpack Templating for API script #}
<%= htmlWebpackPlugin.tags.bodyTags %> <%= htmlWebpackPlugin.tags.bodyTags %>
<h1>Core Sheet</h1>
<div> <div>
<div id="basics"> <div id="basics">
<h1> <h1>
@ -173,6 +172,12 @@
<input type="text" id="characterName" name="characterName" value="{{name}}" /> <input type="text" id="characterName" name="characterName" value="{{name}}" />
</h1> </h1>
<div class="links">
<a href="/">Home</a> |
<a href="/characters/{{username}}/{{id}}">Save Changes</a> |
<a href="/characters/{{username}}/{{id}}/delete">Delete Character</a>
</div>
<h2>Basics</h2> <h2>Basics</h2>
<div>System: {{data_type}}</div> <div>System: {{data_type}}</div>

View File

@ -172,6 +172,7 @@
</h1> </h1>
<div class="links"> <div class="links">
<a href="/">Home</a> |
<a href="/characters/{{username}}/{{id}}/edit">Edit Character</a> | <a href="/characters/{{username}}/{{id}}/edit">Edit Character</a> |
<a href="/characters/{{username}}/{{id}}/delete">Delete Character</a> <a href="/characters/{{username}}/{{id}}/delete">Delete Character</a>
</div> </div>

View File

@ -10,6 +10,7 @@ use strum::IntoEnumIterator;
struct EditCharacterContext<'a> { struct EditCharacterContext<'a> {
pub name: &'a str, pub name: &'a str,
pub username: &'a str, pub username: &'a str,
pub id: i32,
pub data_type: &'a CharacterDataType, pub data_type: &'a CharacterDataType,
pub sheet: Box<DynCharacterData>, pub sheet: Box<DynCharacterData>,
pub state: FormStateContext<'a>, pub state: FormStateContext<'a>,
@ -26,6 +27,7 @@ fn edit_character_template(user: &User, character: Character) -> Result<Template
let context = EditCharacterContext { let context = EditCharacterContext {
name: &character.character_name, name: &character.character_name,
username: &user.username, username: &user.username,
id: character.id,
data_type: &character.data_type, data_type: &character.data_type,
sheet: character.dyn_deserialize()?, sheet: character.dyn_deserialize()?,
state: FormStateContext { state: FormStateContext {