##// END OF EJS Templates
file-browser: refactor how we load metadata for file trees....
file-browser: refactor how we load metadata for file trees. Before we used to use JSON data to map the nodes to json and fill in metadata. Now we use rendered parts of html. This is nicer for caching as it would allow us to replace the view with cached tree and then after ajax load replace it again with cached with metadata. On the next request we'll get the cached with metadata and thus we can skip entirely second ajax call for metadata. This is part of #4083

File last commit:

r423:9930e2c8 default
r423:9930e2c8 default
Show More
files_browser_tree.html
78 lines | 3.1 KiB | text/html | HtmlLexer
<div id="file-tree-wrapper" class="browser-body ${'full-load' if c.full_load else ''}">
<table class="code-browser rctable">
<thead>
<tr>
<th>${_('Name')}</th>
<th>${_('Size')}</th>
<th>${_('Modified')}</th>
<th>${_('Last Commit')}</th>
<th>${_('Author')}</th>
</tr>
</thead>
<tbody id="tbody">
%if c.file.parent:
<tr class="parity0">
<td class="td-componentname">
<a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id,f_path=c.file.parent.path)}" class="pjax-link">
<i class="icon-folder"></i>..
</a>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
%endif
%for cnt,node in enumerate(c.file):
<tr class="parity${cnt%2}">
<td class="td-componentname">
%if node.is_submodule():
<span class="submodule-dir">
${h.link_to_if(
node.url.startswith('http://') or node.url.startswith('https://'),
node.name, node.url)}
</span>
%else:
<a href="${h.url('files_home',repo_name=c.repo_name,revision=c.commit.raw_id,f_path=h.safe_unicode(node.path))}" class="pjax-link">
<i class="${'icon-file browser-file' if node.is_file() else 'icon-folder browser-dir'}"></i>${node.name}
</a>
%endif
</td>
%if node.is_file():
<td class="td-size" data-attr-name="size">
% if c.full_load:
<span data-size="${node.size}">${h.format_byte_size_binary(node.size)}</span>
% else:
${_('Loading ...')}
% endif
</td>
<td class="td-time" data-attr-name="modified_at">
% if c.full_load:
<span data-date="${node.last_commit.date}">${h.age_component(node.last_commit.date)}</span>
% endif
</td>
<td class="td-hash" data-attr-name="commit_id">
% if c.full_load:
<div class="tooltip" title="${node.last_commit.message}">
<pre data-commit-id="${node.last_commit.raw_id}">r${node.last_commit.revision}:${node.last_commit.short_id}</pre>
</div>
% endif
</td>
<td class="td-user" data-attr-name="author">
% if c.full_load:
<span data-author="${node.last_commit.author}" title="${node.last_commit.author}">${h.gravatar_with_user(node.last_commit.author)|n}</span>
% endif
</td>
%else:
<td></td>
<td></td>
<td></td>
<td></td>
%endif
</tr>
%endfor
</tbody>
<tbody id="tbody_filtered"></tbody>
</table>
</div>