##// END OF EJS Templates
removed obsolete sort code
marcink -
r1482:a39c0e5f beta
parent child Browse files
Show More
@@ -165,11 +165,10 b' class ReposGroupsController(BaseControll'
165 category='error')
165 category='error')
166 return redirect(url('repos_groups'))
166 return redirect(url('repos_groups'))
167
167
168
169 try:
168 try:
170 repos_group_model.delete(id)
169 repos_group_model.delete(id)
171 h.flash(_('removed repos group %s' % gr.group_name), category='success')
170 h.flash(_('removed repos group %s' % gr.group_name), category='success')
172 #TODO: in futureaction_logger(, '', '', '', self.sa)
171 #TODO: in future action_logger(, '', '', '', self.sa)
173 except Exception:
172 except Exception:
174 log.error(traceback.format_exc())
173 log.error(traceback.format_exc())
175 h.flash(_('error occurred during deletion of repos group %s' % gr.group_name),
174 h.flash(_('error occurred during deletion of repos group %s' % gr.group_name),
@@ -181,27 +180,13 b' class ReposGroupsController(BaseControll'
181 """GET /repos_groups/id: Show a specific item"""
180 """GET /repos_groups/id: Show a specific item"""
182 # url('repos_group', id=ID)
181 # url('repos_group', id=ID)
183
182
184 gr = c.group = Group.get(id)
183 c.group = Group.get(id)
185
184
186 if c.group:
185 if c.group:
187 c.group_repos = c.group.repositories.all()
186 c.group_repos = c.group.repositories.all()
188 else:
187 else:
189 return redirect(url('home'))
188 return redirect(url('home'))
190
189
191
192 sortables = ['name', 'description', 'last_change', 'tip', 'owner']
193 current_sort = request.GET.get('sort', 'name')
194 current_sort_slug = current_sort.replace('-', '')
195
196 if current_sort_slug not in sortables:
197 c.sort_by = 'name'
198 current_sort_slug = c.sort_by
199 else:
200 c.sort_by = current_sort
201 c.sort_slug = current_sort_slug
202
203 sort_key = current_sort_slug + '_sort'
204
205 #overwrite our cached list with current filter
190 #overwrite our cached list with current filter
206 gr_filter = c.group_repos
191 gr_filter = c.group_repos
207 c.cached_repo_list = self.scm_model.get_repos(all_repos=gr_filter)
192 c.cached_repo_list = self.scm_model.get_repos(all_repos=gr_filter)
@@ -220,13 +205,13 b' class ReposGroupsController(BaseControll'
220 """GET /repos_groups/id/edit: Form to edit an existing item"""
205 """GET /repos_groups/id/edit: Form to edit an existing item"""
221 # url('edit_repos_group', id=ID)
206 # url('edit_repos_group', id=ID)
222
207
223 id = int(id)
208 id_ = int(id)
224
209
225 c.repos_group = Group.get(id)
210 c.repos_group = Group.get(id_)
226 defaults = self.__load_data(id)
211 defaults = self.__load_data(id_)
227
212
228 # we need to exclude this group from the group list for editing
213 # we need to exclude this group from the group list for editing
229 c.repo_groups = filter(lambda x:x[0] != id, c.repo_groups)
214 c.repo_groups = filter(lambda x:x[0] != id_, c.repo_groups)
230
215
231 return htmlfill.render(
216 return htmlfill.render(
232 render('admin/repos_groups/repos_groups_edit.html'),
217 render('admin/repos_groups/repos_groups_edit.html'),
@@ -43,20 +43,8 b' class HomeController(BaseController):'
43 super(HomeController, self).__before__()
43 super(HomeController, self).__before__()
44
44
45 def index(self):
45 def index(self):
46 sortables = ['name', 'description', 'last_change', 'tip', 'owner']
47 current_sort = request.GET.get('sort', 'name')
48 current_sort_slug = current_sort.replace('-', '')
49
46
50 if current_sort_slug not in sortables:
47 c.repos_list = self.scm_model.get_repos()
51 c.sort_by = 'name'
52 current_sort_slug = c.sort_by
53 else:
54 c.sort_by = current_sort
55 c.sort_slug = current_sort_slug
56
57 sort_key = current_sort_slug + '_sort'
58
59 c.repos_list = self.scm_model.get_repos(sort_key=sort_key)
60
48
61 c.groups = Group.query().filter(Group.group_parent_id == None).all()
49 c.groups = Group.query().filter(Group.group_parent_id == None).all()
62
50
@@ -1,18 +1,4 b''
1 <%page args="parent" />
1 <%page args="parent" />
2 <%def name="get_sort(name)">
3 <%name_slug = name.lower().replace(' ','_') %>
4
5 %if name_slug == c.sort_slug:
6 %if c.sort_by.startswith('-'):
7 <a href="?sort=${name_slug}">${name}&uarr;</a>
8 %else:
9 <a href="?sort=-${name_slug}">${name}&darr;</a>
10 %endif:
11 %else:
12 <a href="?sort=${name_slug}">${name}</a>
13 %endif
14 </%def>
15
16 <div class="box">
2 <div class="box">
17 <!-- box / title -->
3 <!-- box / title -->
18 <div class="title">
4 <div class="title">
@@ -67,11 +53,11 b''
67 <thead>
53 <thead>
68 <tr>
54 <tr>
69 <th class="left"></th>
55 <th class="left"></th>
70 <th class="left">${get_sort(_('Name'))}</th>
56 <th class="left">${_('Name')}</th>
71 <th class="left">${get_sort(_('Description'))}</th>
57 <th class="left">${_('Description')}</th>
72 <th class="left">${get_sort(_('Last change'))}</th>
58 <th class="left">${_('Last change')}</th>
73 <th class="left">${get_sort(_('Tip'))}</th>
59 <th class="left">${_('Tip')}</th>
74 <th class="left">${get_sort(_('Owner'))}</th>
60 <th class="left">${_('Owner')}</th>
75 <th class="left">${_('RSS')}</th>
61 <th class="left">${_('RSS')}</th>
76 <th class="left">${_('Atom')}</th>
62 <th class="left">${_('Atom')}</th>
77 </tr>
63 </tr>
@@ -145,10 +131,7 b''
145 </td>
131 </td>
146 <td>
132 <td>
147 %if repo['rev']>=0:
133 %if repo['rev']>=0:
148 ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])),
134 <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>
149 h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']),
150 class_="tooltip",
151 title=h.tooltip('%s\n%s' % (repo['author'],repo['last_msg'])))}
152 %else:
135 %else:
153 ${_('No changesets yet')}
136 ${_('No changesets yet')}
154 %endif
137 %endif
@@ -170,7 +153,6 b''
170 </td>
153 </td>
171 </tr>
154 </tr>
172 %endfor
155 %endfor
173
174 </tbody>
156 </tbody>
175 </table>
157 </table>
176 </div>
158 </div>
General Comments 0
You need to be logged in to leave comments. Login now