Changeset - 2dc0c8e4f384
[Not reviewed]
default
2 4 3
Marcin Kuzminski - 16 years ago 2010-04-25 18:42:58
marcin@python-works.com
Updated tempaltes, added file browser breadcrumbs, and feed icons
8 files changed with 99 insertions and 579 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/helpers.py
Show inline comments
 
@@ -48,38 +48,48 @@ class _GetError(object):
 
    def __call__(self, field_name, form_errors):
 
        tmpl = """<span class="error_msg">%s</span>"""
 
        if form_errors and form_errors.has_key(field_name):
 
            return literal(tmpl % form_errors.get(field_name))
 

	
 
class _FileSizeFormat(object):
 
    """
 
    Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB,
 
    102 bytes, etc).
 
    """
 
    def __call__(self, bytes):
 
        try:
 
            bytes = float(bytes)
 
        except TypeError:
 
            return u"0 bytes"
 
    
 
        if bytes < 1024:
 
            return ungettext("%(size)d byte", "%(size)d bytes", bytes) % {'size': bytes}
 
        if bytes < 1024 * 1024:
 
            return _("%.1f KB") % (bytes / 1024)
 
        if bytes < 1024 * 1024 * 1024:
 
            return _("%.1f MB") % (bytes / (1024 * 1024))
 
        return _("%.1f GB") % (bytes / (1024 * 1024 * 1024))
 

	
 
class _FilesBreadCrumbs(object):
 
    
 
    def __call__(self, repo_name, rev, paths):
 
        url_l = [link_to(repo_name, url('files_home', repo_name=repo_name, f_path=''))]
 
        paths_l = paths.split('/')
 
        
 
        for cnt, p in enumerate(paths_l, 1):
 
            if p != '':
 
                url_l.append(link_to(p, url('files_home', repo_name=repo_name, f_path='/'.join(paths_l[:cnt]))))
 

	
 
        return literal(' / '.join(url_l))
 

	
 
def pygmentize(code, **kwargs):
 
    '''
 
    Filter for chunks of html to replace code tags with pygmented code
 
    '''
 
    return literal(highlight(code, guess_lexer(code), HtmlFormatter(**kwargs)))
 

	
 

	
 

	
 
files_breadcrumbs = _FilesBreadCrumbs()
 
filesizeformat = _FileSizeFormat()
 
link = _Link()
 
flash = _Flash()
 
get_error = _GetError()
pylons_app/public/css/monoblue_custom.css
Show inline comments
 
file renamed from pylons_app/public/css/style-monoblue_custom.css to pylons_app/public/css/monoblue_custom.css
 
/*** Initial Settings ***/
 
* {
 
  margin: 0;
 
  padding: 0;
 
  font-weight: normal;
 
  font-style: normal;
 
}
 

	
 
html {
 
  font-size: 100%;
 
  font-family: sans-serif;
 
}
 

	
 
body {
 
  font-size: 77%;
 
  margin: 15px 50px;
 
  background: #4B4B4C;
 
  background: #DBD4C6;
 
}
 

	
 
a {
 
  color:#0000cc;
 
  text-decoration: none;
 
}
 
/*** end of Initial Settings ***/
 

	
 

	
 
/** common settings **/
 
div#container {
 
  background: #FFFFFF;
 
  position: relative;
 
  color: #666;
 
}
 

	
 
div.page-header {
 
  padding: 50px 20px 0;
 
  background: #006699 top left repeat-x;
 
  background: #556cb5 top left repeat-x;
 
  position: relative;
 
}
 
  div.page-header h1 {
 
    margin: 10px 0 30px;
 
    font-size: 1.8em;
 
    font-weight: bold;
 
    font-family: osaka,'MS P Gothic', Georgia, serif;
 
    letter-spacing: 1px;
 
    color: #DDD;
 
  }
 
  div.page-header h1 a {
 
    font-weight: bold;
 
    color: #FFF;
 
  }
 
  div.page-header a {
 
    text-decoration: none;
 
  }
 

	
 
  div.page-header form {
 
    position: absolute;
 
    margin-bottom: 2px;
 
    bottom: 0;
 
    right: 20px;
 
  }
 
@@ -173,75 +173,74 @@ div.page-footer {
 
  }
 
  ul.rss-logo li a {
 
    padding: 3px 6px;
 
    line-height: 10px;
 
    border:1px solid;
 
    border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;
 
    color:#ffffff;
 
    background-color:#ff6600;
 
    font-weight:bold;
 
    font-family:sans-serif;
 
    font-size:10px;
 
    text-align:center;
 
    text-decoration:none;
 
  }
 
  div.rss-logo li a:hover {
 
    background-color:#ee5500;
 
  }
 

	
 
p.normal {
 
  margin: 20px 0 20px 30px;
 
  font-size: 1.2em;
 
}
 

	
 
table {
 
  margin: 10px 0 0 20px;
 
  width: 95%;
 
  margin: 0 0 0 0;  
 
  border-collapse: collapse;
 
}
 
/*
 
table tr td {
 
  font-size: 1.1em;
 
}
 
table tr td.nowrap {
 
  white-space: nowrap;
 
}
 
/*
 
table tr.parity0:hover,
 
table tr.parity1:hover {
 
*/
 
table tr.parity0:hover,table tr.parity1:hover {
 
  background: #D5E1E6;
 
}
 
*/
 

	
 
table tr.parity0 {
 
  background: #F1F6F7;
 
  background: #EAEAE9;
 
}
 
table tr.parity1 {
 
  background: #FFFFFF;
 
}
 
table tr td {
 
  padding: 5px 5px;
 
  padding: 3px 3px;
 
}
 
table.annotated tr td {
 
  padding: 0px 5px;
 
  padding: 0px 3px;
 
}
 

	
 
span.logtags span {
 
  padding: 2px 6px;
 
  font-weight: normal;
 
  font-size: 11px;
 
  border: 1px solid;
 
  background-color: #ffaaff;
 
  border-color: #ffccff #ff00ee #ff00ee #ffccff;
 
}
 
span.logtags span.tagtag {
 
  background-color: #ffffaa;
 
  border-color: #ffffcc #ffee00 #ffee00 #ffffcc;
 
}
 
span.logtags span.branchtag {
 
  background-color: #aaffaa;
 
  border-color: #ccffcc #00cc33 #00cc33 #ccffcc;
 
}
 
span.logtags span.inbranchtag {
 
  background-color: #d5dde6;
 
  border-color: #e3ecf4 #9398f4 #9398f4 #e3ecf4;
 
}
 

	
 
div.diff pre {
 
@@ -450,42 +449,81 @@ ul#nodebgs li.parity1 {
 
    background: #FFFFFF;
 
}
 

	
 
ul#graphnodes {
 
	position: absolute;
 
	z-index: 10;
 
	top: 7px;
 
	list-style: none inside none;
 
}
 

	
 
ul#nodebgs {
 
	list-style: none inside none;
 
}
 

	
 
ul#graphnodes li, ul#nodebgs li {
 
	height: 39px;
 
}
 

	
 
ul#graphnodes li .info {
 
	display: block;
 
	position: relative;
 
}
 
/** end of canvas **/
 

	
 
table.code-browser{
 
	
 
}
 
table.code-browser thead th {
 
	background-color:#EEEEEE;
 
	border:1px solid #999999;
 
	height:20px;
 
	font-size: 1.1em;
 
	font-weight: bold;
 
}
 
table.code-browser tbody td {
 
	border:1px solid #999999;
 
	height:20px;
 
}
 
.info-table {
 
	background:none repeat scroll 0 0 #FAFAFA;
 
	border-bottom:1px solid #DDDDDD;
 
	width:100%;
 
}
 
.rss_logo{
 
	background-image:url("/images/feed.png");
 
	background-repeat:no-repeat;
 
	display:block;
 
	height:16px;
 
	padding-left:20px;
 
	padding-top:0px;
 
	text-align:left;
 
	
 
}
 
.atom_logo{
 
	background-image:url("/images/atom.png");
 
	background-repeat:no-repeat;
 
	display:block;
 
	height:16px;
 
	padding-left:20px;
 
	padding-top:0px;
 
	text-align:left;
 
	
 
}
 
.browser-file {
 
	background-image:url("/images/file.png");
 
	background-repeat:no-repeat;
 
	display:block;
 
	height:16px;
 
	padding-left:20px;
 
	padding-top:5px;
 
	text-align:left;
 
}
 
.browser-dir {
 
	background-image:url("/images/folder.png");
 
	background-repeat:no-repeat;
 
	display:block;
 
	height:16px;
 
	padding-left:20px;
 
	padding-top:5px;
 
	text-align:left;
 
}
 
\ No newline at end of file
pylons_app/public/css/style.css
Show inline comments
 
deleted file
pylons_app/public/images/atom.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
pylons_app/public/images/feed.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
pylons_app/templates/base/base.html
Show inline comments
 
@@ -63,30 +63,30 @@
 
            <li 
 
            %if current=='branches':
 
            	class='current' 
 
            %endif
 
            >${h.link_to_unless(current=='branches',_('branches'),h.url('branches_home',repo_name=c.repo_name))}</li>
 
            <li 
 
            %if current=='tags':
 
            	class='current' 
 
            %endif
 
            >${h.link_to_unless(current=='tags',_('tags'),h.url('tags_home',repo_name=c.repo_name))}</li>
 
            <li 
 
            %if current=='graph':
 
            	class='current' 
 
            %endif
 
            >${h.link_to_unless(current=='graph',_('graph'),h.url('graph_home',repo_name=c.repo_name))}</li>
 
            <li 
 
            %if current=='files':
 
            	class='current' 
 
            %endif
 
            >${h.link_to_unless(current=='files',_('files'),h.url('files_home',repo_name=c.repo_name))}</li>
 
        </ul>
 
</%def>
 

	
 
<%def name="css()">
 
<link rel="stylesheet" href="/css/style-monoblue_custom.css" type="text/css" />
 
<link rel="stylesheet" href="/css/monoblue_custom.css" type="text/css" />
 
</%def>
 

	
 
<%def name="js()">
 
<script type="text/javascript" src="/js/yui/utilities/utilities.js"></script>
 
</%def>
 
\ No newline at end of file
pylons_app/templates/files.html
Show inline comments
 
<%inherit file="base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Repository managment')}
 
</%def>
 
<%def name="breadcrumbs()">
 
    ${h.link_to(u'Home',h.url('/'))}
 
    / 
 
    ${h.link_to(c.repo_name,h.url('files_home',repo_name=c.repo_name))}
 
    /
 
    ${_('files')}
 
</%def>
 
<%def name="page_nav()">
 
        <form action="log">
 
            <dl class="search">
 
                <dt><label>Search: </label></dt>
 
                <dd><input type="text" name="rev" /></dd>
 
            </dl>
 
        </form>
 

	
 
		${self.menu('files')}     
 
</%def>
 
<%def name="css()">
 
<link rel="stylesheet" href="/css/style-monoblue_custom.css" type="text/css" />
 
<link rel="stylesheet" href="/css/monoblue_custom.css" type="text/css" />
 
<link rel="stylesheet" href="/css/pygments.css" type="text/css" />
 
</%def>
 
<%def name="main()">
 

	
 
    <h2 class="no-link no-border">${_('Files')}</h2>
 
	<div id="files_data">
 
		<h2>${_('File')}: ${c.repo_name}/${c.f_path}</h2>
 
		<h2>${_('File')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.files_list.path)}</h2>
 
		%if c.files_list.is_dir():
 
        <table class="code-browser">
 
            <thead>
 
                <tr>
 
                    <th class="width-50 lefted">${_('Name')}</th>
 
                    <th class="width-10 righted">${_('Size')}</th>
 
                    <th class="width-10 righted">${_('Revision')}</th>
 
                    <th class="width-15 righted">${_('Last modified')}</th>
 
                    <th class="width-15 righted">${_('Last commiter')}</th>
 
                </tr>
 
            </thead>
 
            	<tr>
 
            		% if c.files_list.parent:
 
            		<td colspan="5" class="browser-dir">
 
            		${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent))}
 
            		<td>
 
            		${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent),class_="browser-dir")}
 
            		</td>
 
            		<td></td>
 
            		<td></td>
 
            		<td></td>
 
            		<td></td>
 
            		%endif
 
            	</tr>
 
					<%def name="file_class(node)">
 
						%if node.is_file():
 
							browser-file
 
							<%return "browser-file" %>
 
						%else:
 
							browser-dir
 
							<%return "browser-dir"%>
 
						%endif
 
					</%def>
 
			
 

	
 
	            %for cnt,node in enumerate(c.files_list):
 
					<tr class="parity${cnt%2}">
 
	
 
	                    <td class="${file_class(node)}">
 
							${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_='file or dir')}
 
	                    <td>
 
							${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_=file_class(node))}
 
	                    </td>
 
	                    <td>
 
	                        %if node.is_file():
 
	                    		${h.filesizeformat(node.size)}
 
	                    	%endif
 
	                    </td>
 
	                    <td>
 
	                    	%if node.is_file():
 
	                    		${node.last_changeset.revision}
 
	                    	%endif
 
	                    </td>
 
	                    <td>
 
	                    	%if node.is_file():
 
	                    		${node.last_changeset.date}
 
	                    	%endif
 
	                    </td>
 
	                    <td>
 
	                    	%if node.is_file():
 
	                    		${node.last_changeset.author}
 
	                    	%endif                    
 
	                    	
 
	                    </td>
 
					</tr>
 
				%endfor
 
			</table>
 
			%else:
 
			<table class="info-table">
 
				<tr>
 
					<td>r70:17ecc1c97401</td>
 
					<td>374 loc</td>
 
					<td>12.5 KB</td>
 
					<td>
 
						<a href="/marcinkuzminski/vcs/history/vcs/backends/hg.py">history</a> / 
 
						<a href="/marcinkuzminski/vcs/annotate/17ecc1c97401/vcs/backends/hg.py">annotate</a> / 
 
						<a href="/marcinkuzminski/vcs/raw/17ecc1c97401/vcs/backends/hg.py">raw</a> / 
 
						<form class="source-view-form" method="get" action="/marcinkuzminski/vcs/diff/vcs/backends/hg.py">
 
							
 
							<input type="hidden" value="17ecc1c97401" name="diff2">
 
								<select class="smaller" name="diff1">
 
									<option>history</option>							
 
								</select>
 
								<input type="submit" class="smaller" value="diff">
 
							
 
						</form>
 
					</td>
 
				</tr>
 
			</table>			
 
				<div id="body" class="codeblock">
 
				${h.pygmentize(c.files_list.content,linenos=True,anchorlinenos=True,cssclass="code-highlight")}
 
				</div>				
 
			%endif
 
	</div>
 
</%def>    
 
\ No newline at end of file
pylons_app/templates/index.html
Show inline comments
 
@@ -14,47 +14,48 @@ from pylons_app.lib import filters
 
	<li>${h.link_to(u'Admin',h.url('admin_home'))}</li>
 
</%def>
 
<%def name="main()">
 
	<%def name="get_sort(name)">
 
		<%name_slug = name.lower().replace(' ','_') %>
 
		%if name_slug == c.cs_slug:
 
			<span style="font-weight: bold;color:#006699">${name}</span>
 
		%else:
 
			<span style="font-weight: bold">${name}</span>
 
		%endif
 
		
 
		<a href="?sort=${name_slug}">&darr;</a>
 
		<a href="?sort=-${name_slug}">&uarr;</a>
 
		
 
	</%def>
 
	<table>
 
	  <tr>
 
	    <td>${get_sort(_('Name'))}</td>
 
	    <td>${get_sort(_('Description'))}</td>
 
	    <td>${get_sort(_('Last change'))}</td>
 
	    <td>${get_sort(_('Tip'))}</td>
 
	    <td>${get_sort(_('Contact'))}</td>
 
	    <td></td>
 
	    <td></td>
 
	    <td></td>
 
	  </tr>	
 
	%for cnt,repo in enumerate(c.repos_list):
 
 		<tr class="parity${cnt%2}">
 
		    <td>${h.link(repo['name'],h.url('summary_home',repo_name=repo['name']))}</td>
 
		    <td>${repo['description']}</td>
 
	        <td>${repo['last_change']|n,filters.age}</td>
 
	        <td>r${repo['rev']}:<a href="/${repo['name']}/rev/${repo['tip']}/">${repo['tip']}</a></td>
 
	        <td>${repo['contact']}</td>
 
	        <td class="indexlinks">
 
	        	%for archive in repo['repo_archives']:
 
					<a href="/${repo['name']}/archive/${archive['node']}${archive['extension']}">${archive['type']}</a>
 
				%endfor
 
	        </td>
 
			<td>
 
				<div class="rss_logo">
 
				<a href="/${repo['name']}/rss-log">RSS</a>
 
				<a href="/${repo['name']}/atom-log">Atom</a>
 
				</div>
 
				<a  class="rss_logo" href="/${repo['name']}/rss-log">RSS</a>
 
			</td>        
 
			<td>
 
				<a  class="atom_logo" href="/${repo['name']}/atom-log">Atom</a>
 
			</td>
 
		</tr>
 
	%endfor
 
	</table>
 
</%def>    
0 comments (0 inline, 0 general)