Update view to separation of prep and cook time
This commit is contained in:
parent
87aa81fef4
commit
974cf8cbb1
@ -154,14 +154,29 @@ sub _generate_view {
|
|||||||
pathinfo => [ $recipe -> {"id"} ]),
|
pathinfo => [ $recipe -> {"id"} ]),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
my $preptime = $recipe -> {"preptime"} ? $self -> {"template"} -> humanise_seconds($recipe -> {"preptime"} * 60)
|
||||||
|
: "{L_VIEW_NOTSET}";
|
||||||
|
my $cooktime = $recipe -> {"cooktime"} ? $self -> {"template"} -> humanise_seconds($recipe -> {"cooktime"} * 60)
|
||||||
|
: "{L_VIEW_NOTSET}";
|
||||||
|
|
||||||
|
my $totaltime = $recipe -> {"preptime"} + $recipe -> {"cooktime"};
|
||||||
|
my $timereq = $totaltime ? $self -> {"template"} -> humanise_seconds($totaltime * 60)
|
||||||
|
: "{L_VIEW_NOTSET}";
|
||||||
|
|
||||||
|
# Mark the recipe as viewed
|
||||||
|
$self -> {"system"} -> {"recipe"} -> set_viewed($rid, $self -> {"session"} -> get_session_userid());
|
||||||
|
$self -> log("recipe:view", "Recipe $rid viewed by user ".$self -> {"session"} -> get_session_userid());
|
||||||
|
|
||||||
# and build the page itself
|
# and build the page itself
|
||||||
my $body = $self -> {"template"} -> load_template("view/content.tem",
|
my $body = $self -> {"template"} -> load_template("view/content.tem",
|
||||||
{
|
{
|
||||||
"%(name)s" => $title,
|
"%(name)s" => $title,
|
||||||
"%(source)s" => $source,
|
"%(source)s" => $source,
|
||||||
"%(yield)s" => $recipe -> {"yield"},
|
"%(yield)s" => $recipe -> {"yield"},
|
||||||
"%(timereq)s" => $recipe -> {"timereq"},
|
"%(prepinfo)s" => $recipe -> {"prepinfo"},
|
||||||
"%(timemins)s" => $self -> {"template"} -> humanise_seconds($recipe -> {"timemins"} * 60),
|
"%(preptime)s" => $preptime,
|
||||||
|
"%(cooktime)s" => $cooktime,
|
||||||
|
"%(timereq)s" => $timereq,
|
||||||
"%(temp)s" => $recipe -> {"temp"} ? $recipe -> {"temp"} : "",
|
"%(temp)s" => $recipe -> {"temp"} ? $recipe -> {"temp"} : "",
|
||||||
"%(temptype)s" => $recipe -> {"temptype"} // "",
|
"%(temptype)s" => $recipe -> {"temptype"} // "",
|
||||||
"%(type)s" => $recipe -> {"type"},
|
"%(type)s" => $recipe -> {"type"},
|
||||||
|
@ -2,7 +2,10 @@ VIEW_NAME = Name
|
|||||||
VIEW_SOURCE = Source
|
VIEW_SOURCE = Source
|
||||||
VIEW_YIELD = Yield
|
VIEW_YIELD = Yield
|
||||||
VIEW_PREPINFO = Prep info
|
VIEW_PREPINFO = Prep info
|
||||||
|
VIEW_PREPTIME = Prep time
|
||||||
|
VIEW_COOKTIME = Cook time
|
||||||
VIEW_TIMEREQ = Time required
|
VIEW_TIMEREQ = Time required
|
||||||
|
VIEW_NOTSET = Not set
|
||||||
VIEW_OVENTEMP = Oven preheat
|
VIEW_OVENTEMP = Oven preheat
|
||||||
VIEW_TYPE = Type
|
VIEW_TYPE = Type
|
||||||
VIEW_STATUS = Status
|
VIEW_STATUS = Status
|
||||||
@ -17,4 +20,4 @@ VIEW_CLONE = Clone
|
|||||||
VIEW_DELETE = Delete
|
VIEW_DELETE = Delete
|
||||||
|
|
||||||
VIEW_ERROR_FATAL = View error
|
VIEW_ERROR_FATAL = View error
|
||||||
VIEW_ERROR_NORECIPE = No matching recipe found
|
VIEW_ERROR_NORECIPE = No matching recipe found
|
||||||
|
@ -11,11 +11,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid-x grid-margin-x">
|
<div class="grid-x grid-margin-x">
|
||||||
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-tasks hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_PREPINFO}</span></div>
|
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-tasks hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_PREPINFO}</span></div>
|
||||||
<div class="cell medium-10 small-11 text-left">%(timereq)s</div>
|
<div class="cell medium-10 small-11 text-left">%(prepinfo)s</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid-x grid-margin-x">
|
||||||
|
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-clock hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_PREPTIME}</span></div>
|
||||||
|
<div class="cell medium-10 small-11 text-left">%(preptime)s</div>
|
||||||
|
</div>
|
||||||
|
<div class="grid-x grid-margin-x">
|
||||||
|
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-clock hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_COOKTIME}</span></div>
|
||||||
|
<div class="cell medium-10 small-11 text-left">%(cooktime)s</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-x grid-margin-x">
|
<div class="grid-x grid-margin-x">
|
||||||
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-clock hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_TIMEREQ}</span></div>
|
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-clock hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_TIMEREQ}</span></div>
|
||||||
<div class="cell medium-10 small-11 text-left">%(timemins)s</div>
|
<div class="cell medium-10 small-11 text-left">%(timereq)s</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-x grid-margin-x">
|
<div class="grid-x grid-margin-x">
|
||||||
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-thermometer-three-quarters hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_OVENTEMP}</span></div>
|
<div class="cell medium-2 small-1 text-right title"><i class="fa fa-thermometer-three-quarters hide-for-print hide-for-medium" aria-hidden="true"></i> <span class="show-for-medium">{L_VIEW_OVENTEMP}</span></div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user