Mercurial > kallithea
changeset 4614:603a53c56cdc
files_browser: use font for file, folder, and submodule icons
This patch introduces a def that returns the <i> element corresponding to the
type (i.e. file, folder, or submodule) and a span for the text. Tests have been
updated. Old png icons have been removed.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Fri, 31 Oct 2014 18:48:02 -0700 |
parents | 11f01d4cdacd |
children | d188d646c0fa |
files | kallithea/public/css/style.css kallithea/public/images/icons/disconnect.png kallithea/public/images/icons/document_16.png kallithea/public/images/icons/folder_16.png kallithea/templates/files/files_browser.html kallithea/tests/functional/test_files.py |
diffstat | 6 files changed, 31 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/public/css/style.css Fri Oct 31 14:10:21 2014 -0700 +++ b/kallithea/public/css/style.css Fri Oct 31 18:48:02 2014 -0700 @@ -2998,9 +2998,8 @@ } table.code-browser .browser-file { - background: url("../images/icons/document_16.png") no-repeat scroll 3px; height: 16px; - padding-left: 20px; + padding-left: 5px; text-align: left; } .diffblock .changeset_header { @@ -3041,16 +3040,14 @@ background-color: #EEEEEE; } table.code-browser .browser-dir { - background: url("../images/icons/folder_16.png") no-repeat scroll 3px; height: 16px; - padding-left: 20px; + padding-left: 5px; text-align: left; } table.code-browser .submodule-dir { - background: url("../images/icons/disconnect.png") no-repeat scroll 3px; height: 16px; - padding-left: 20px; + padding-left: 5px; text-align: left; }
--- a/kallithea/templates/files/files_browser.html Fri Oct 31 14:10:21 2014 -0700 +++ b/kallithea/templates/files/files_browser.html Fri Oct 31 18:48:02 2014 -0700 @@ -14,6 +14,16 @@ <%return h.url('files_home', repo_name=c.repo_name, revision=c.changeset.raw_id, f_path=h.safe_unicode(node.path))%> %endif </%def> +<%def name="file_name(node)"> + <% + c = "icon-folder-open" + if node.is_file(): + c = "icon-doc" + elif node.is_submodule(): + c = "icon-file-submodule" + %> + <%return h.literal('<i class="%s"></i><span>%s</span>' % (c, node.name))%> +</%def> <div id="body" class="browserblock"> <div class="browser-header"> <div class="browser-nav"> @@ -60,7 +70,7 @@ %if c.file.parent: <tr class="parity0"> <td> - ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.parent.path),class_="browser-dir ypjax-link")} + ${h.link_to(h.literal('<i class="icon-folder-open"></i><span>..</span>'),h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.parent.path),class_="browser-dir ypjax-link")} </td> <td></td> <td></td> @@ -73,7 +83,7 @@ %for cnt,node in enumerate(c.file): <tr class="parity${cnt%2}"> <td> - ${h.link_to(node.name,file_url(node,c),class_=file_class(node)+" ypjax-link")} + ${h.link_to(file_name(node),file_url(node,c),class_=file_class(node)+" ypjax-link")} </td> <td> %if node.is_file():
--- a/kallithea/tests/functional/test_files.py Fri Oct 31 14:10:21 2014 -0700 +++ b/kallithea/tests/functional/test_files.py Fri Oct 31 18:48:02 2014 -0700 @@ -33,19 +33,19 @@ revision='tip', f_path='/')) # Test response... - response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/docs">docs</a>') - response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/vcs">vcs</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.gitignore">.gitignore</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgignore">.hgignore</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgtags">.hgtags</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.travis.yml">.travis.yml</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/MANIFEST.in">MANIFEST.in</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/README.rst">README.rst</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/run_test_and_report.sh">run_test_and_report.sh</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.cfg">setup.cfg</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.py">setup.py</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/test_and_report.sh">test_and_report.sh</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/tox.ini">tox.ini</a>') + response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/docs"><i class="icon-folder-open"></i><span>docs</span></a>') + response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/vcs"><i class="icon-folder-open"></i><span>vcs</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.gitignore"><i class="icon-doc"></i><span>.gitignore</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgignore"><i class="icon-doc"></i><span>.hgignore</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.hgtags"><i class="icon-doc"></i><span>.hgtags</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/.travis.yml"><i class="icon-doc"></i><span>.travis.yml</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/MANIFEST.in"><i class="icon-doc"></i><span>MANIFEST.in</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/README.rst"><i class="icon-doc"></i><span>README.rst</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/run_test_and_report.sh"><i class="icon-doc"></i><span>run_test_and_report.sh</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.cfg"><i class="icon-doc"></i><span>setup.cfg</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/setup.py"><i class="icon-doc"></i><span>setup.py</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/test_and_report.sh"><i class="icon-doc"></i><span>test_and_report.sh</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/96507bd11ecc815ebc6270fdf6db110928c09c1e/tox.ini"><i class="icon-doc"></i><span>tox.ini</span></a>') def test_index_revision(self): self.log_user() @@ -59,9 +59,9 @@ #Test response... - response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>') - response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>') - response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>') + response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs"><i class="icon-folder-open"></i><span>docs</span></a>') + response.mustcontain('<a class="browser-dir ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests"><i class="icon-folder-open"></i><span>tests</span></a>') + response.mustcontain('<a class="browser-file ypjax-link" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst"><i class="icon-doc"></i><span>README.rst</span></a>') response.mustcontain('1.1 KiB') response.mustcontain('text/x-python')