Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Commit

Permalink
Refactored templates
Browse files Browse the repository at this point in the history
Moved all of the nav_bar block to layout.html and removed it from both
file.html and folder.html.

Note: In the previous blocks the if-condition inside the loop was a
little different for files and folders (folders had an extra “and
loop.length != 1”, but it seemed safe enough to include the extra
condition in files too (I don't think the loop.length will ever be 1).
  • Loading branch information
NimaK committed Oct 21, 2016
1 parent 83727b8 commit eab4342
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 34 deletions.
17 changes: 0 additions & 17 deletions dxr/templates/file.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,6 @@
<link href="{{ url_for('.static', filename='css/tree-selector.css') }}" rel="stylesheet" type="text/css" media="screen" />
{% endblock %}

{% block nav_bar %}
<nav class="nav-bar">
<div class="current-tree-nav">
<div class="breadcrumbs">
{%- for path, name in paths_and_names -%}
{%- if not loop.first or loop.last -%}
<span class="path-separator">/</span><a href="{{ www_root }}{{ path }}">{{ name }}</a>
{%- else -%}
<a href="{{ www_root }}{{ path }}">{{ name }}</a>
{%- endif -%}
{%- endfor -%}
</div>
</div>
{{ tree_menu(tree_tuples, tree) }}
</nav>
{% endblock %}

{% block content %}
{% if sections %}
<div class="panel">
Expand Down
17 changes: 0 additions & 17 deletions dxr/templates/folder.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@

{% set state_eof = True %}

{% block nav_bar %}
<nav class="nav-bar">
<div class="current-tree-nav">
<div class="breadcrumbs">
{%- for path, name in paths_and_names -%}
{%- if not loop.first or loop.last and loop.length != 1 -%}
<span class="path-separator">/</span><a href="{{ www_root }}{{ path }}">{{ name }}</a>
{%- else -%}
<a href="{{ www_root }}{{ path }}">{{ name }}</a>
{%- endif -%}
{%- endfor -%}
</div>
</div>
{{ tree_menu(tree_tuples, tree) }}
</nav>
{% endblock %}

{% block content %}
<table class="folder-content">
<thead>
Expand Down
14 changes: 14 additions & 0 deletions dxr/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@
</div>

{% block nav_bar %}
<nav class="nav-bar">
<div class="current-tree-nav">
<div class="breadcrumbs">
{%- for path, name in paths_and_names -%}
{%- if not loop.first or loop.last and loop.length != 1 -%}
<span class="path-separator">/</span><a href="{{ www_root }}{{ path }}">{{ name }}</a>
{%- else -%}
<a href="{{ www_root }}{{ path }}">{{ name }}</a>
{%- endif -%}
{%- endfor -%}
</div>
</div>
{{ tree_menu(tree_tuples, tree) }}
</nav>
{% endblock %}

<div id="content" class="content">
Expand Down

0 comments on commit eab4342

Please sign in to comment.