Skip to content

Commit

Permalink
[#43] Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Orchaldir committed Oct 28, 2023
1 parent e82cab5 commit 1e873d9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
12 changes: 2 additions & 10 deletions resources/characters/characters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,7 @@
pants:
style: Balloon
color: Red
belt:
buckle:
style: Circle
color: Gray
color: Black
belt: null
shirt:
sleeve_style: Long
neckline: DeepV
Expand Down Expand Up @@ -253,11 +249,7 @@
pants:
style: Shorts
color: Purple
belt:
buckle:
style: Box
color: Gray
color: Black
belt: null
shirt:
sleeve_style: None
neckline: Crew
Expand Down
2 changes: 2 additions & 0 deletions resources/templates/appearance_edit.html.tera
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,8 @@
<li>
{% if appearance.body.clothing.pants.belt %}
<b>Belt Availability:</b> {{ macros::add_select(name="appearance.body.clothing.pants.belt.availability", options=[ "true","false" ], selected="true", update=true) }}
</li>
<li>
<b>Belt</b>
<ul>
<li>
Expand Down
17 changes: 12 additions & 5 deletions rpg_tools_core/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ impl EditorVisitor {
&self.lines
}

fn get_pretty_name(&self) -> String {
prettify(&self.get_name())
}

fn get_name(&self) -> String {
prettify(self.path.last().unwrap())
self.path.last().unwrap().clone()
}

fn enter(&mut self) {
Expand All @@ -48,7 +52,7 @@ impl EditorVisitor {
}

fn add_selection(&mut self, path: &str, variants: &[String]) {
self.add_named_selection(&self.get_name(), path, variants, path);
self.add_named_selection(&self.get_pretty_name(), path, variants, path);
}

fn add_named_selection(&mut self, name: &str, path: &str, variants: &[String], selected: &str) {
Expand Down Expand Up @@ -105,17 +109,20 @@ impl UiVisitor for EditorVisitor {
self.lines
.push(format!("{}{{% if {} %}}", self.spaces, self.get_path(),));
self.add_named_selection(
&format!("{} Availability", self.get_name()),
&format!("{} Availability", self.get_pretty_name()),
&format!("{}.availability", self.get_path()),
&vec!["true".to_string(), "false".to_string()],

Check warning on line 114 in rpg_tools_core/src/ui/editor.rs

View workflow job for this annotation

GitHub Actions / clippy

useless use of `vec!`

warning: useless use of `vec!` --> rpg_tools_core/src/ui/editor.rs:114:13 | 114 | &vec!["true".to_string(), "false".to_string()], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use a slice directly: `&["true".to_string(), "false".to_string()]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec = note: `#[warn(clippy::useless_vec)]` on by default
"\"true\"",
);
let name = self.get_name();
self.leave_child();
self.enter_child(&name);
}

fn leave_option(&mut self) {
self.lines.push(format!("{}{{% else %}}", self.spaces));
self.add_named_selection(
&format!("{} Availability", self.get_name()),
&format!("{} Availability", self.get_pretty_name()),
&format!("{}.availability", self.get_path()),
&vec!["true".to_string(), "false".to_string()],

Check warning on line 127 in rpg_tools_core/src/ui/editor.rs

View workflow job for this annotation

GitHub Actions / clippy

useless use of `vec!`

warning: useless use of `vec!` --> rpg_tools_core/src/ui/editor.rs:127:13 | 127 | &vec!["true".to_string(), "false".to_string()], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use a slice directly: `&["true".to_string(), "false".to_string()]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
"\"false\"",
Expand All @@ -130,7 +137,7 @@ impl UiVisitor for EditorVisitor {
self.path.pop();
} else {
self.lines
.push(format!("{}<b>{}</b>", self.spaces, self.get_name()));
.push(format!("{}<b>{}</b>", self.spaces, self.get_pretty_name()));
self.enter_list();
}
}
Expand Down

0 comments on commit 1e873d9

Please sign in to comment.