mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 13:44:15 +00:00
web: Show amounts when displaying substances
This commit is contained in:
parent
acdc0321a8
commit
71af018e18
4 changed files with 7 additions and 1 deletions
|
@ -84,6 +84,7 @@ pub struct PropertyReply {
|
|||
pub struct SubstanceReply {
|
||||
pub name: String,
|
||||
pub doc: Option<String>,
|
||||
pub amount: NumberParts,
|
||||
pub properties: Vec<PropertyReply>,
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ impl Substance {
|
|||
Ok(SubstanceReply {
|
||||
name: self.properties.name.clone(),
|
||||
doc: context.docs.get(&self.properties.name).cloned(),
|
||||
amount: self.amount.to_parts(context),
|
||||
properties: try!(self.properties.properties.iter().map(|(k, v)| {
|
||||
let (input, output) = if v.input.1.len() == 0 {
|
||||
let res = (&v.output * &self.amount).unwrap();
|
||||
|
@ -218,6 +219,7 @@ impl Substance {
|
|||
Ok(SubstanceReply {
|
||||
name: self.properties.name.clone(),
|
||||
doc: context.docs.get(&self.properties.name).cloned(),
|
||||
amount: self.amount.to_parts(context),
|
||||
properties: try!(
|
||||
once(Ok(Some(amount)))
|
||||
.chain(self.properties.properties.iter().map(func))
|
||||
|
@ -234,6 +236,7 @@ impl Substance {
|
|||
Ok(SubstanceReply {
|
||||
name: self.properties.name.clone(),
|
||||
doc: context.docs.get(&self.properties.name).cloned(),
|
||||
amount: self.amount.to_parts(context),
|
||||
properties: try!(self.properties.properties.iter().map(|(k, v)| {
|
||||
let (input, output) = if v.input.1.len() == 0 {
|
||||
let res = (&v.output * &self.amount).unwrap();
|
||||
|
@ -304,6 +307,7 @@ impl Substance {
|
|||
Ok(SubstanceReply {
|
||||
name: self.properties.name.clone(),
|
||||
doc: context.docs.get(&self.properties.name).cloned(),
|
||||
amount: self.amount.to_parts(context),
|
||||
properties: try!(
|
||||
once(Ok(Some(amount)))
|
||||
.chain(self.properties.properties.iter().map(func))
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
{{else}}
|
||||
{{dimensions}}
|
||||
{{/if}}
|
||||
{{insert}}
|
||||
{{#if quantity}}
|
||||
({{quantity}})
|
||||
{{/if}}
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
{{#with Substance}}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
Substance: {{name}}
|
||||
Substance: {{> number amount}} {{name}}
|
||||
</div>
|
||||
{{#with doc}}
|
||||
<div class="panel-body">
|
||||
|
|
Loading…
Reference in a new issue