: my $term_arg = $c.req.param('t') ? [ 't', $c.req.param('t') ] : [];
<div class="panel panel-default">
  <div class="panel-heading">
    <h2 class="panel-title">
      : if ! $c.args.graph_name {
      <a href="#graph_<: if $graph.complex_graph{ :>complex_<: } :><: $graph.id :>" id="for_graph_<: if $graph.complex_graph{ :>complex_<: } :><: $graph.id :>" data-toggle="collapse"><span class="glyphicon glyphicon-chevron-down" style="font-size:0.5em; vertical-align: text-middle"></span></a>
      : }
      : if $graph.complex_graph {
      <a href="<: $c.req.uri_for('/view_complex/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name), $term_arg) :>" data-id="<: $graph.id :>"><: $graph.graph_name :></a>
      : } else {
      <a href="<: $c.req.uri_for('/view_graph/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name), $term_arg) :>" data-id="<: $graph.id :>"><: $graph.graph_name :></a>
      : }
      <small style="font-size:0.8em"><: $graph.description :></small>
    </h2>
  </div>
</div>

<p style="margin: 2px 0px 4px">
  : if $graph.complex_graph {
  <a class="label label-success" style="cursor: pointer" href="<: $c.req.uri_for('/edit_complex/'~$graph.id) :>"><span class="glyphicon glyphicon-wrench"></span> Setting</a>
  <span class="label label-warning">Complex Graph</span>
  <a class="label label-info" style="cursor: pointer" href="<: $c.req.uri_for('/xport/'~$graph.complex_graph, [t=>$term,sumup=>$graph.sumup]) :>"><span class="glyphicon glyphicon-share"></span> JSON</a>
  : } else {
  <a class="label label-success" style="cursor: pointer" href="<: $c.req.uri_for('/edit/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name)) :>"><span class="glyphicon glyphicon-wrench"></span> Setting</a>
  <a class="label label-info" style="cursor: pointer" href="<: $c.req.uri_for('/xport/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name)) :>"><span class="glyphicon glyphicon-share"></span> JSON</a>
  <span class="label label-default">current</span> <: $graph.number | format_number :>
  <span class="label label-default">mode</span> <: $graph.mode :>
  : }
  <span class="label label-default">created_at</span> <: $graph.created_at :>
  <span class="label label-default">updated_at</span> <: $graph.updated_at :>
</p>

<div id="graph_<: if $graph.complex_graph{ :>complex_<: } :><: $graph.id :>" class="<: if ! $c.args.graph_name { :>section_graphs <: } :>panel-collapse in">
<table style="margin: 0 auto 10px">
: if ! $graph.complex_graph {
  : my $gmodes = ( $graph.gmode == 'both' ) ? ['gauge','subtract'] : ( $graph.gmode == 'gauge') ? ['gauge'] : ['subtract']
  : for $gmodes -> $gmode {
    : my $terms = ( $c.req.param('t') == 'h' ) ? ['h','n'] :  ( $c.req.param('t') == 'm') ? ['m','y'] :  ( $c.req.param('t') == 'sh' ) ? ['sh','s8h'] :  ( $c.req.param('t') == 'sd') ? ['sd','s3d'] : ['d','w'];
    <tr>
    : for $terms -> $term {
      <td><img src="<: $c.req.uri_for('/graph/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name), [t=>$term,gmode=>$gmode]) :>" class="graph" /></td>
    : }
    </tr>
  : }
: } else {
    : my $terms = ( $c.req.param('t') == 'h' ) ? ['h','n'] :  ( $c.req.param('t') == 'm') ? ['m','y'] :  ( $c.req.param('t') == 'sh' ) ? ['sh','s8h'] :  ( $c.req.param('t') == 'sd') ? ['sd','s3d'] : ['d','w'];
    <tr>
    : for $terms -> $term {
      <td><img src="<: $c.req.uri_for('/graph/'~$graph.complex_graph, [t=>$term,sumup=>$graph.sumup]) :>" class="graph" /></td>
    : }
    </tr>
: }
</table>
</div>
