changeset 447:70c2750531d3

rewrote sorting on main page, to clickable headers. Update my account with better repo list some css fixes
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 03 Sep 2010 07:34:38 +0200
parents a0a93357f954
children 4679105ef03e
files pylons_app/controllers/hg.py pylons_app/public/css/style.css pylons_app/templates/admin/users/user_edit_my_account.html pylons_app/templates/index.html pylons_app/templates/summary/summary.html
diffstat 5 files changed, 99 insertions(+), 91 deletions(-) [+]
line wrap: on
line diff
--- a/pylons_app/controllers/hg.py	Fri Sep 03 00:46:07 2010 +0200
+++ b/pylons_app/controllers/hg.py	Fri Sep 03 07:34:38 2010 +0200
@@ -37,19 +37,20 @@
         super(HgController, self).__before__()
         
     def index(self):
-        c.current_sort = request.GET.get('sort', 'name')
-        sort_by = c.current_sort
         sortables = ['name', 'description', 'last_change', 'tip', 'contact']
+        current_sort = request.GET.get('sort', 'name')
+        current_sort_slug = current_sort.replace('-', '')
         
-        c.cs_slug = sort_by.replace('-', '')
-        
-        if c.cs_slug not in sortables:
-            sort_by = 'name'
-        
+        if current_sort_slug not in sortables:
+            c.sort_by = 'name'
+            current_sort_slug = c.sort_by
+        else:
+            c.sort_by = current_sort
+        c.sort_slug = current_sort_slug
         cached_repo_list = HgModel().get_repos()
         
-        sort_key = c.cs_slug + '_sort'
-        if sort_by.startswith('-'):
+        sort_key = current_sort_slug + '_sort'
+        if c.sort_by.startswith('-'):
             c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
         else:
             c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
--- a/pylons_app/public/css/style.css	Fri Sep 03 00:46:07 2010 +0200
+++ b/pylons_app/public/css/style.css	Fri Sep 03 07:34:38 2010 +0200
@@ -26,6 +26,10 @@
 	border: none;	
 }
 
+img.icon{
+    vertical-align: bottom;
+
+}
 /* -----------------------------------------------------------
 	anchors
 ----------------------------------------------------------- */ 
--- a/pylons_app/templates/admin/users/user_edit_my_account.html	Fri Sep 03 00:46:07 2010 +0200
+++ b/pylons_app/templates/admin/users/user_edit_my_account.html	Fri Sep 03 07:34:38 2010 +0200
@@ -14,67 +14,69 @@
 </%def>
 
 <%def name="main()">
+
 <div class="box box-left">
     <!-- box / title -->
     <div class="title">
         ${self.breadcrumbs()}       
     </div>
     <!-- end box / title -->
+    <div class="ui-tabs-panel ui-widget-content ui-corner-bottom">
     ${h.form(url('admin_settings_my_account_update'),method='put')}
-    <div class="form">
-        <!-- fields -->
-        <div class="fields">
-             <div class="field">
-                <div class="label">
-                    <label for="username">${_('Username')}:</label>
-                </div>
-                <div class="input">
-                    ${h.text('username')}
-                </div>
-             </div>
-            
-             <div class="field">
-                <div class="label">
-                    <label for="new_password">${_('New password')}:</label>
-                </div>
-                <div class="input">
-                    ${h.password('new_password')}
-                </div>
-             </div>
-            
-             <div class="field">
-                <div class="label">
-                    <label for="name">${_('Name')}:</label>
-                </div>
-                <div class="input">
-                    ${h.text('name')}
-                </div>
-             </div>
-            
-             <div class="field">
-                <div class="label">
-                    <label for="lastname">${_('Lastname')}:</label>
-                </div>
-                <div class="input">
-                    ${h.text('lastname')}
-                </div>
-             </div>
-            
-             <div class="field">
-                <div class="label">
-                    <label for="email">${_('Email')}:</label>
-                </div>
-                <div class="input">
-                    ${h.text('email')}
-                </div>
-             </div>
-            
-            <div class="buttons">
-              ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
-            </div>             
-    	</div>    
+	    <div class="form">
+	        <div class="fields">
+	             <div class="field">
+	                <div class="label">
+	                    <label for="username">${_('Username')}:</label>
+	                </div>
+	                <div class="input">
+	                    ${h.text('username')}
+	                </div>
+	             </div>
+	            
+	             <div class="field">
+	                <div class="label">
+	                    <label for="new_password">${_('New password')}:</label>
+	                </div>
+	                <div class="input">
+	                    ${h.password('new_password')}
+	                </div>
+	             </div>
+	            
+	             <div class="field">
+	                <div class="label">
+	                    <label for="name">${_('Name')}:</label>
+	                </div>
+	                <div class="input">
+	                    ${h.text('name')}
+	                </div>
+	             </div>
+	            
+	             <div class="field">
+	                <div class="label">
+	                    <label for="lastname">${_('Lastname')}:</label>
+	                </div>
+	                <div class="input">
+	                    ${h.text('lastname')}
+	                </div>
+	             </div>
+	            
+	             <div class="field">
+	                <div class="label">
+	                    <label for="email">${_('Email')}:</label>
+	                </div>
+	                <div class="input">
+	                    ${h.text('email')}
+	                </div>
+	             </div>
+	            
+	            <div class="buttons">
+	              ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
+	            </div>             
+	    	</div>
+	    </div>    	
+    ${h.end_form()}
     </div>
-    ${h.end_form()}
 </div>    
 
 <div class="box box-right">
@@ -84,25 +86,25 @@
     </div>
     <!-- end box / title -->
     <div class="table">
-    <table>
-     <tbody>
-     %for repo in c.user_repos:
-        <tr>
-            <td>
-             %if repo.dbrepo.private:
-                <img alt="${_('private')}" src="/images/icons/lock.png"/>
-             %else:
-                <img alt="${_('public')}" src="/images/icons/lock_open.png"/>
-             %endif
-                                             
-            ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td> 
-            ##<td>${_('created')} ${repo.dbrepo.}</td>
-            <td>${_('last changed')}  ${h.age(repo.last_change)}</td>
-            <td>${h.link_to(_('[edit]'),h.url('edit_repo',repo_name=repo.name))}</td>
-        </tr>
-     %endfor
-     </tbody>
-     </table>
+	    <table>
+	     <tbody>
+	     %for repo in c.user_repos:
+	        <tr>
+	            <td>
+	             %if repo.dbrepo.private:
+	                <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
+	             %else:
+	                <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
+	             %endif
+	                                             
+	            ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td> 
+	            <td>${_('revision')}: ${repo.revisions[-1]}</td>
+	            <td>${_('last changed')}: ${h.age(repo.last_change)}</td>
+	            <td><img class="icon" alt="${_('private')}" src="/images/icons/application_form_edit.png"/> ${h.link_to(_('edit'),h.url('edit_repo',repo_name=repo.name))}</td>
+	        </tr>
+	     %endfor
+	     </tbody>
+	     </table>
     </div>
     
 </div>
--- a/pylons_app/templates/index.html	Fri Sep 03 00:46:07 2010 +0200
+++ b/pylons_app/templates/index.html	Fri Sep 03 07:34:38 2010 +0200
@@ -12,17 +12,18 @@
 <%def name="main()">
 	<%def name="get_sort(name)">
 		<%name_slug = name.lower().replace(' ','_') %>
-		%if name_slug == c.cs_slug:
-			<span style="font-weight: bold;text-decoration: underline;">${name}</span>
+		
+		%if name_slug == c.sort_slug:
+		  %if c.sort_by.startswith('-'):
+		    <a href="?sort=${name_slug}">${name}&uarr;</a>
+		  %else:
+		    <a href="?sort=-${name_slug}">${name}&darr;</a>
+		  %endif:
 		%else:
-			<span style="font-weight: bold">${name}</span>
+		    <a href="?sort=${name_slug}">${name}</a>
 		%endif
-		<a href="?sort=${name_slug}">&darr;</a>
-		<a href="?sort=-${name_slug}">&uarr;</a>
 	</%def>
 	
-	
-	
     <div class="box">
 	    <!-- box / title -->
 	    <div class="title">
@@ -55,9 +56,9 @@
 					        <tr class="parity${cnt%2}">
 					            <td>
 					             %if repo['repo'].dbrepo.private:
-					                <img alt="${_('private')}" src="/images/icons/lock.png"/>
+					                <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
 					             %else:
-					                <img alt="${_('public')}" src="/images/icons/lock_open.png"/>
+					                <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
 					             %endif  
 					            ${h.link_to(repo['name'],
 					                h.url('summary_home',repo_name=repo['name']))}</td>
--- a/pylons_app/templates/summary/summary.html	Fri Sep 03 00:46:07 2010 +0200
+++ b/pylons_app/templates/summary/summary.html	Fri Sep 03 07:34:38 2010 +0200
@@ -42,7 +42,7 @@
 			      <label>${_('Name')}:</label>
 			  </div>
 			  <div class="input-short">
-			      ${c.repo_info.name}
+			      <span style="font-size: 1.6em;font-weight: bold">${c.repo_info.name}</span>
 			  </div>
 			 </div>