changeset 1737:61eda8bf70d0 beta

new files views - compated space - nicer gui - code garden
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 27 Nov 2011 03:17:17 +0200
parents e2d76554d2c6
children 1a2f10b368a9
files rhodecode/controllers/files.py rhodecode/public/css/pygments.css rhodecode/public/css/style.css rhodecode/templates/files/files.html rhodecode/templates/files/files_annotate.html rhodecode/templates/files/files_browser.html rhodecode/templates/files/files_edit.html rhodecode/templates/files/files_source.html rhodecode/templates/files/files_ypjax.html rhodecode/templates/index_base.html rhodecode/tests/functional/test_files.py
diffstat 11 files changed, 137 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/controllers/files.py	Sun Nov 27 03:17:17 2011 +0200
@@ -162,9 +162,9 @@
 
         #files or dirs
         try:
-            c.files_list = c.changeset.get_node(f_path)
+            c.file = c.changeset.get_node(f_path)
 
-            if c.files_list.is_file():
+            if c.file.is_file():
                 c.file_history = self._get_node_history(c.changeset, f_path)
             else:
                 c.file_history = []
--- a/rhodecode/public/css/pygments.css	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/public/css/pygments.css	Sun Nov 27 03:17:17 2011 +0200
@@ -7,15 +7,47 @@
     line-height: 100%;
     /* new */
     line-height: 125%;
+    -webkit-border-radius: 4px;
+    -moz-border-radius: 4px;
+    border-radius: 4px;     
 }
 div.codeblock .code-header{
 	border-bottom: 1px solid #CCCCCC;
 	background: #EEEEEE;
 	padding:10px 0 10px 0;
 }
-div.codeblock .code-header .revision{
+
+div.codeblock .code-header .stats{
+	clear: both;
+	margin-top:-3px; 
+	padding-left: 8px; 
+	border-bottom: 1px solid rgb(204, 204, 204); 
+	margin-bottom: 5px; height: 23px;
+}
+
+div.codeblock .code-header .stats .left{
+	float:left;
+}
+div.codeblock .code-header .stats .left.item{
+	float:left;
+	padding: 0 9px 0 9px;
+	border-right:1px solid #ccc;
+}
+div.codeblock .code-header .stats .left.item.last{
+	border-right:none;
+}
+div.codeblock .code-header .stats .buttons{
+	float:right;
+	padding-right:4px;
+}
+
+div.codeblock .code-header .author{
 	margin-left:25px;
 	font-weight: bold;
+	height: 25px;
+}
+div.codeblock .code-header .author .user{
+	padding-top:3px;
 }
 div.codeblock .code-header .commit{
 	margin-left:25px;
--- a/rhodecode/public/css/style.css	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/public/css/style.css	Sun Nov 27 03:17:17 2011 +0200
@@ -642,20 +642,22 @@
 }
 
 .quick_repo_menu {
-	background: #FFF url("../images/vertical-indicator.png") 8px 50%
-		no-repeat !important;
+	background: #FFF url("../images/vertical-indicator.png") 8px 50% no-repeat !important;
 	cursor: pointer;
 	width: 8px;
+	border: 1px solid transparent;
 }
 
 .quick_repo_menu.active {
-	background: #FFF url("../images/horizontal-indicator.png") 4px 50%
-		no-repeat !important;
-	cursor: pointer;
+    background: url("../images/horizontal-indicator.png") no-repeat scroll 5px 50% #FFFFFF !important;
+    border: 1px solid #003367;
+    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
+    cursor: pointer;
 }
 
 .quick_repo_menu .menu_items {
-	margin-top: 6px;
+	margin-top: 10px;
+	margin-left:-6px;
 	width: 150px;
 	position: absolute;
 	background-color: #FFF;
@@ -664,7 +666,8 @@
 	border-right: 1px solid #666666;
 	border-style: solid;
 	border-width: 1px;
-	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
+	box-shadow: 2px 8px 4px rgba(0, 0, 0, 0.2);
+	border-top-style: none;
 }
 
 .quick_repo_menu .menu_items li {
@@ -807,7 +810,7 @@
 }
 
 #content div.box dl {
-	margin: 10px 24px;
+	margin: 10px 0px;
 }
 
 #content div.box dt {
@@ -1825,7 +1828,7 @@
 
 #files_data dl dt {
 	float: left;
-	width: 115px;
+	width: 60px;
 	margin: 0 !important;
 	padding: 5px;
 }
--- a/rhodecode/templates/files/files.html	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/templates/files/files.html	Sun Nov 27 03:17:17 2011 +0200
@@ -10,7 +10,7 @@
     ${h.link_to(c.repo_name,h.url('files_home',repo_name=c.repo_name))}
     &raquo;
     ${_('files')}
-    %if c.files_list:
+    %if c.file:
         @ r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
     %endif        
 </%def>
@@ -39,8 +39,8 @@
 <script type="text/javascript">
 var YPJAX_TITLE = "${c.repo_name} ${_('Files')} - ${c.rhodecode_name}";
 var current_url = "${h.url.current()}";
-var node_list_url = '${h.url("files_home",repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.files_list.path)}';
-var url_base = '${h.url("files_nodelist_home",repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.files_list.path)}';
+var node_list_url = '${h.url("files_home",repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.path)}';
+var url_base = '${h.url("files_nodelist_home",repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.path)}';
 var truncated_lbl = "${_('search truncated')}";
 var nomatch_lbl = "${_('no matching files')}";
 fileBrowserListeners(current_url, node_list_url, url_base, truncated_lbl, nomatch_lbl);
--- a/rhodecode/templates/files/files_annotate.html	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/templates/files/files_annotate.html	Sun Nov 27 03:17:17 2011 +0200
@@ -29,29 +29,8 @@
     <div class="table">
 		<div id="files_data">
 			<h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.revision,c.file.path)}</h3>
-			<dl class="overview">
-				<dt>${_('Revision')}</dt>
-				<dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,h.short_id(c.file.last_changeset.raw_id)),
-						h.url('changeset_home',repo_name=c.repo_name,revision=c.file.last_changeset.raw_id))} </dd>
-				<dt>${_('Size')}</dt>
-				<dd>${h.format_byte_size(c.file.size,binary=True)}</dd>
-    			<dt>${_('Mimetype')}</dt>
-				<dd>${c.file.mimetype}</dd>				
-				<dt>${_('Options')}</dt>
-				<dd>${h.link_to(_('show source'),
-						h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}  
-					/ ${h.link_to(_('show as raw'),
-						h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}
-					/ ${h.link_to(_('download as raw'),
-						h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}
-                    % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
-                     % if not c.file.is_binary:                   
-                    / ${h.link_to(_('edit'),
-                        h.url('files_edit_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path))}
-                     % endif 
-                    % endif						
-				</dd>
-			    <dt>${_('History')}</dt>
+			<dl>
+			    <dt style="padding-top:10px;font-size:16px">${_('History')}</dt>
 			    <dd>
 			        <div>
 			        ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
@@ -64,10 +43,31 @@
 			    </dd>					
 			</dl>
 			<div id="body" class="codeblock">
-				<div class="code-header">
-					<div class="revision">${c.file.name}@r${c.file.last_changeset.revision}:${h.short_id(c.file.last_changeset.raw_id)}</div>
-					<div class="commit">"${c.file.message}"</div>
-				</div>
+                <div class="code-header">
+                    <div class="stats">
+                        <div class="left"><img src="${h.url('/images/icons/file.png')}"/></div>
+                        <div class="left item">${h.link_to("r%s:%s" % (c.file.last_changeset.revision,h.short_id(c.file.last_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.last_changeset.raw_id))}</div>      
+                        <div class="left item">${h.format_byte_size(c.file.size,binary=True)}</div>
+                        <div class="left item last">${c.file.mimetype}</div>
+                        <div class="buttons">
+                          ${h.link_to(_('show source'),h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}
+                          ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}           
+                          ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}
+                          % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):            
+                           % if not c.file.is_binary:
+                            ${h.link_to(_('edit'),h.url('files_edit_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}
+                           % endif
+                          % endif            
+                        </div>
+                    </div>
+                    <div class="author">
+                        <div class="gravatar">
+                            <img alt="gravatar" src="${h.gravatar_url(h.email(c.cs.author),16)}"/>
+                        </div>
+                        <div title="${h.email_or_none(c.cs.author)}" class="user">${h.person(c.cs.author)}</div>
+                    </div>
+                    <div class="commit">${c.file.last_changeset.message}</div>
+                </div>
 				<div class="code-body">
 			       %if c.file.is_binary:
 			           ${_('Binary file (%s)') % c.file.mimetype}
--- a/rhodecode/templates/files/files_browser.html	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/templates/files/files_browser.html	Sun Nov 27 03:17:17 2011 +0200
@@ -34,7 +34,7 @@
         <div>
             <div id="node_filter_box_loading" style="display:none">${_('Loading file list...')}</div>
             <div id="node_filter_box" style="display:none">
-            ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)}/<input type="text" value="type to search..." name="filter" size="25" id="node_filter" autocomplete="off">
+            ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)}/<input type="text" value="type to search..." name="filter" size="25" id="node_filter" autocomplete="off">
             </div>        
         </div>
         </div>      
@@ -54,10 +54,10 @@
 		         </thead>
                 
                 <tbody id="tbody">
-          		%if c.files_list.parent:
+          		%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.files_list.parent.path),class_="browser-dir ypjax-link")}
+	          			${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")}
 	          		</td>
 	          		<td></td>
 	          		<td></td>
@@ -67,7 +67,7 @@
 				</tr>
           		%endif
 		         	
-		    %for cnt,node in enumerate(c.files_list):
+		    %for cnt,node in enumerate(c.file):
 				<tr class="parity${cnt%2}">
 		             <td>
 						${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=h.safe_unicode(node.path)),class_=file_class(node)+" ypjax-link")}
--- a/rhodecode/templates/files/files_edit.html	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/templates/files/files_edit.html	Sun Nov 27 03:17:17 2011 +0200
@@ -39,6 +39,25 @@
 			<h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.revision,c.file.path)}</h3>
 			${h.form(h.url.current(),method='post',id='eform')}
 			<div id="body" class="codeblock">
+            <div class="code-header">
+                <div class="stats">
+                    <div class="left"><img src="${h.url('/images/icons/file.png')}"/></div>
+                    <div class="left item">${h.link_to("r%s:%s" % (c.file.last_changeset.revision,h.short_id(c.file.last_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.last_changeset.raw_id))}</div>      
+                    <div class="left item">${h.format_byte_size(c.file.size,binary=True)}</div>
+                    <div class="left item last">${c.file.mimetype}</div>
+                    <div class="buttons">
+                      ${h.link_to(_('show annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}
+                      ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}           
+                      ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}
+                      % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):            
+                       % if not c.file.is_binary:
+                        ${h.link_to(_('source'),h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="ui-button-small")}
+                       % endif
+                      % endif            
+                    </div>
+                </div>
+                <div class="commit">${_('Editing file')}: ${c.file.path}</div>
+            </div>      
 			    <pre id="editor_pre"></pre>
 				<textarea id="editor" name="content" style="display:none">${c.file.content|n}</textarea>
 				<div style="padding: 10px;color:#666666">${_('commit message')}</div>
--- a/rhodecode/templates/files/files_source.html	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/templates/files/files_source.html	Sun Nov 27 03:17:17 2011 +0200
@@ -1,52 +1,50 @@
 <dl>
-	<dt>${_('Revision')}</dt>
-	<dd>
-		${h.link_to("r%s:%s" % (c.files_list.last_changeset.revision,h.short_id(c.files_list.last_changeset.raw_id)),
-						h.url('changeset_home',repo_name=c.repo_name,revision=c.files_list.last_changeset.raw_id))} 
-	</dd>
-	<dt>${_('Size')}</dt>
-	<dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd>
-	<dt>${_('Mimetype')}</dt>
-	<dd>${c.files_list.mimetype}</dd>
-	<dt>${_('Options')}</dt>
-	<dd>${h.link_to(_('show annotation'),
-			h.url('files_annotate_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
-		 / ${h.link_to(_('show as raw'),
-			h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}			
-		 / ${h.link_to(_('download as raw'),
-			h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
-        % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):			
-         % if not c.files_list.is_binary:
-         / ${h.link_to(_('edit'),
-            h.url('files_edit_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
-         % endif
-        % endif			
-	</dd>
-	<dt>${_('History')}</dt>
+	<dt style="padding-top:10px;font-size:16px">${_('History')}</dt>
 	<dd>
 		<div>
 		${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')}
-		${h.hidden('diff2',c.files_list.last_changeset.raw_id)}
-		${h.select('diff1',c.files_list.last_changeset.raw_id,c.file_history)}
+		${h.hidden('diff2',c.file.last_changeset.raw_id)}
+		${h.select('diff1',c.file.last_changeset.raw_id,c.file_history)}
 		${h.submit('diff','diff to revision',class_="ui-button-small")}
 		${h.submit('show_rev','show at revision',class_="ui-button-small")}
 		${h.end_form()}
 		</div>
 	</dd>
-</dl>	
+</dl>
 
 	
 <div id="body" class="codeblock">
 	<div class="code-header">
-		<div class="revision">${c.files_list.name}@r${c.files_list.last_changeset.revision}:${h.short_id(c.files_list.last_changeset.raw_id)}</div>
-		<div class="commit">"${c.files_list.last_changeset.message}"</div>
+        <div class="stats">
+            <div class="left"><img src="${h.url('/images/icons/file.png')}"/></div>
+            <div class="left item">${h.link_to("r%s:%s" % (c.file.last_changeset.revision,h.short_id(c.file.last_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.last_changeset.raw_id))}</div>      
+            <div class="left item">${h.format_byte_size(c.file.size,binary=True)}</div>
+            <div class="left item last">${c.file.mimetype}</div>
+            <div class="buttons">
+              ${h.link_to(_('show annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path),class_="ui-button-small")}
+              ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path),class_="ui-button-small")}           
+              ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path),class_="ui-button-small")}
+              % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):            
+               % if not c.file.is_binary:
+                ${h.link_to(_('edit'),h.url('files_edit_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path),class_="ui-button-small")}
+               % endif
+              % endif            
+            </div>
+        </div>
+        <div class="author">
+            <div class="gravatar">
+                <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),16)}"/>
+            </div>
+            <div title="${h.email_or_none(c.changeset.author)}" class="user">${h.person(c.changeset.author)}</div>
+        </div>
+		<div class="commit">${c.file.last_changeset.message}</div>
 	</div>
 	<div class="code-body">
-	   %if c.files_list.is_binary:
-	       ${_('Binary file (%s)') % c.files_list.mimetype}
+	   %if c.file.is_binary:
+	       ${_('Binary file (%s)') % c.file.mimetype}
 	   %else:
-		% if c.files_list.size < c.cut_off_limit:
-			${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
+		% if c.file.size < c.cut_off_limit:
+			${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
 		%else:
 			${_('File is too big to display')} ${h.link_to(_('show as raw'),
 			h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
--- a/rhodecode/templates/files/files_ypjax.html	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/templates/files/files_ypjax.html	Sun Nov 27 03:17:17 2011 +0200
@@ -1,8 +1,8 @@
-%if c.files_list:
+%if c.file:
     <h3 class="files_location">
-        ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)}
+        ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.file.path)}
     </h3>
-        %if c.files_list.is_dir():
+        %if c.file.is_dir():
             <%include file='files_browser.html'/>
         %else:
             <%include file='files_source.html'/>            
--- a/rhodecode/templates/index_base.html	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/templates/index_base.html	Sun Nov 27 03:17:17 2011 +0200
@@ -66,6 +66,7 @@
                 <tr class="parity${cnt%2}">
                     <td class="quick_repo_menu">
                     <ul class="menu_items hidden">
+                      <li style="border-top:1px solid #003367;margin-left:18px;padding-left:-99px"></li>
                       <li>
                          <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=repo['name'])}">
                          <span class="icon">
--- a/rhodecode/tests/functional/test_files.py	Sun Nov 27 01:36:39 2011 +0200
+++ b/rhodecode/tests/functional/test_files.py	Sun Nov 27 03:17:17 2011 +0200
@@ -129,11 +129,11 @@
 </optgroup>""" in response.body
 
 
-        assert """<div class="commit">"Partially implemented #16. filecontent/commit message/author/node name are safe_unicode now.
+        assert """<div class="commit">Partially implemented #16. filecontent/commit message/author/node name are safe_unicode now.
 In addition some other __str__ are unicode as well
 Added test for unicode
 Improved test to clone into uniq repository.
-removed extra unicode conversion in diff."</div>""" in response.body
+removed extra unicode conversion in diff.</div>""" in response.body
 
         assert """<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""" in response.body, 'missing or wrong branch info'