changeset 1482:a39c0e5fca89 beta

removed obsolete sort code
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 22 Sep 2011 03:08:02 +0300
parents 605707b50d7c
children 7b67b0dcad6d
files rhodecode/controllers/admin/repos_groups.py rhodecode/controllers/home.py rhodecode/templates/index_base.html
diffstat 3 files changed, 13 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/repos_groups.py	Thu Sep 22 03:06:08 2011 +0300
+++ b/rhodecode/controllers/admin/repos_groups.py	Thu Sep 22 03:08:02 2011 +0300
@@ -165,11 +165,10 @@
                     category='error')
             return redirect(url('repos_groups'))
 
-
         try:
             repos_group_model.delete(id)
             h.flash(_('removed repos group %s' % gr.group_name), category='success')
-            #TODO: in futureaction_logger(, '', '', '', self.sa)
+            #TODO: in future action_logger(, '', '', '', self.sa)
         except Exception:
             log.error(traceback.format_exc())
             h.flash(_('error occurred during deletion of repos group %s' % gr.group_name),
@@ -181,27 +180,13 @@
         """GET /repos_groups/id: Show a specific item"""
         # url('repos_group', id=ID)
 
-        gr = c.group = Group.get(id)
+        c.group = Group.get(id)
 
         if c.group:
             c.group_repos = c.group.repositories.all()
         else:
             return redirect(url('home'))
 
-
-        sortables = ['name', 'description', 'last_change', 'tip', 'owner']
-        current_sort = request.GET.get('sort', 'name')
-        current_sort_slug = current_sort.replace('-', '')
-
-        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
-
-        sort_key = current_sort_slug + '_sort'
-
         #overwrite our cached list with current filter
         gr_filter = c.group_repos
         c.cached_repo_list = self.scm_model.get_repos(all_repos=gr_filter)
@@ -220,13 +205,13 @@
         """GET /repos_groups/id/edit: Form to edit an existing item"""
         # url('edit_repos_group', id=ID)
 
-        id = int(id)
+        id_ = int(id)
 
-        c.repos_group = Group.get(id)
-        defaults = self.__load_data(id)
+        c.repos_group = Group.get(id_)
+        defaults = self.__load_data(id_)
 
         # we need to exclude this group from the group list for editing
-        c.repo_groups = filter(lambda x:x[0] != id, c.repo_groups)
+        c.repo_groups = filter(lambda x:x[0] != id_, c.repo_groups)
 
         return htmlfill.render(
             render('admin/repos_groups/repos_groups_edit.html'),
--- a/rhodecode/controllers/home.py	Thu Sep 22 03:06:08 2011 +0300
+++ b/rhodecode/controllers/home.py	Thu Sep 22 03:08:02 2011 +0300
@@ -43,20 +43,8 @@
         super(HomeController, self).__before__()
 
     def index(self):
-        sortables = ['name', 'description', 'last_change', 'tip', 'owner']
-        current_sort = request.GET.get('sort', 'name')
-        current_sort_slug = current_sort.replace('-', '')
 
-        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
-
-        sort_key = current_sort_slug + '_sort'
-
-        c.repos_list = self.scm_model.get_repos(sort_key=sort_key)
+        c.repos_list = self.scm_model.get_repos()
 
         c.groups = Group.query().filter(Group.group_parent_id == None).all()
 
--- a/rhodecode/templates/index_base.html	Thu Sep 22 03:06:08 2011 +0300
+++ b/rhodecode/templates/index_base.html	Thu Sep 22 03:08:02 2011 +0300
@@ -1,18 +1,4 @@
 <%page args="parent" /> 
-    <%def name="get_sort(name)">
-        <%name_slug = name.lower().replace(' ','_') %>
-        
-        %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:
-            <a href="?sort=${name_slug}">${name}</a>
-        %endif
-    </%def>
-    
     <div class="box">
         <!-- box / title -->
         <div class="title">
@@ -67,11 +53,11 @@
             <thead>
                 <tr>
                     <th class="left"></th>
-                    <th class="left">${get_sort(_('Name'))}</th>
-                    <th class="left">${get_sort(_('Description'))}</th>
-                    <th class="left">${get_sort(_('Last change'))}</th>
-                    <th class="left">${get_sort(_('Tip'))}</th>
-                    <th class="left">${get_sort(_('Owner'))}</th>
+                    <th class="left">${_('Name')}</th>
+                    <th class="left">${_('Description')}</th>
+                    <th class="left">${_('Last change')}</th>
+                    <th class="left">${_('Tip')}</th>
+                    <th class="left">${_('Owner')}</th>
                     <th class="left">${_('RSS')}</th>
                     <th class="left">${_('Atom')}</th>
                 </tr>
@@ -145,10 +131,7 @@
                     </td>
                     <td>
                         %if repo['rev']>=0:
-                        ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
-                        h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
-                        class_="tooltip",
-                        title=h.tooltip('%s\n%s' % (repo['author'],repo['last_msg'])))}
+                        <a title="${h.tooltip('%s\n%s' % (repo['author'],repo['last_msg']))}" class="tooltip" href="${h.url('changeset_home',repo_name=repo['name'],revision=repo['tip'])}">${'r%s:%s' % (repo['rev'],h.short_id(repo['tip']))}</a>
                         %else:
                             ${_('No changesets yet')}
                         %endif    
@@ -170,7 +153,6 @@
                     </td>
                 </tr>
             %endfor
-            
             </tbody>
             </table>
             </div>