##// END OF EJS Templates
rewrote sorting on main page, to clickable headers....
marcink -
r447:70c27505 default
parent child Browse files
Show More
@@ -37,19 +37,20 b' class HgController(BaseController):'
37 super(HgController, self).__before__()
37 super(HgController, self).__before__()
38
38
39 def index(self):
39 def index(self):
40 c.current_sort = request.GET.get('sort', 'name')
41 sort_by = c.current_sort
42 sortables = ['name', 'description', 'last_change', 'tip', 'contact']
40 sortables = ['name', 'description', 'last_change', 'tip', 'contact']
41 current_sort = request.GET.get('sort', 'name')
42 current_sort_slug = current_sort.replace('-', '')
43
43
44 c.cs_slug = sort_by.replace('-', '')
44 if current_sort_slug not in sortables:
45
45 c.sort_by = 'name'
46 if c.cs_slug not in sortables:
46 current_sort_slug = c.sort_by
47 sort_by = 'name'
47 else:
48
48 c.sort_by = current_sort
49 c.sort_slug = current_sort_slug
49 cached_repo_list = HgModel().get_repos()
50 cached_repo_list = HgModel().get_repos()
50
51
51 sort_key = c.cs_slug + '_sort'
52 sort_key = current_sort_slug + '_sort'
52 if sort_by.startswith('-'):
53 if c.sort_by.startswith('-'):
53 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
54 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
54 else:
55 else:
55 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
56 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
@@ -26,6 +26,10 b' img'
26 border: none;
26 border: none;
27 }
27 }
28
28
29 img.icon{
30 vertical-align: bottom;
31
32 }
29 /* -----------------------------------------------------------
33 /* -----------------------------------------------------------
30 anchors
34 anchors
31 ----------------------------------------------------------- */
35 ----------------------------------------------------------- */
@@ -14,15 +14,16 b''
14 </%def>
14 </%def>
15
15
16 <%def name="main()">
16 <%def name="main()">
17
17 <div class="box box-left">
18 <div class="box box-left">
18 <!-- box / title -->
19 <!-- box / title -->
19 <div class="title">
20 <div class="title">
20 ${self.breadcrumbs()}
21 ${self.breadcrumbs()}
21 </div>
22 </div>
22 <!-- end box / title -->
23 <!-- end box / title -->
24 <div class="ui-tabs-panel ui-widget-content ui-corner-bottom">
23 ${h.form(url('admin_settings_my_account_update'),method='put')}
25 ${h.form(url('admin_settings_my_account_update'),method='put')}
24 <div class="form">
26 <div class="form">
25 <!-- fields -->
26 <div class="fields">
27 <div class="fields">
27 <div class="field">
28 <div class="field">
28 <div class="label">
29 <div class="label">
@@ -76,6 +77,7 b''
76 </div>
77 </div>
77 ${h.end_form()}
78 ${h.end_form()}
78 </div>
79 </div>
80 </div>
79
81
80 <div class="box box-right">
82 <div class="box box-right">
81 <!-- box / title -->
83 <!-- box / title -->
@@ -90,15 +92,15 b''
90 <tr>
92 <tr>
91 <td>
93 <td>
92 %if repo.dbrepo.private:
94 %if repo.dbrepo.private:
93 <img alt="${_('private')}" src="/images/icons/lock.png"/>
95 <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
94 %else:
96 %else:
95 <img alt="${_('public')}" src="/images/icons/lock_open.png"/>
97 <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
96 %endif
98 %endif
97
99
98 ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td>
100 ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td>
99 ##<td>${_('created')} ${repo.dbrepo.}</td>
101 <td>${_('revision')}: ${repo.revisions[-1]}</td>
100 <td>${_('last changed')} ${h.age(repo.last_change)}</td>
102 <td>${_('last changed')}: ${h.age(repo.last_change)}</td>
101 <td>${h.link_to(_('[edit]'),h.url('edit_repo',repo_name=repo.name))}</td>
103 <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>
102 </tr>
104 </tr>
103 %endfor
105 %endfor
104 </tbody>
106 </tbody>
@@ -12,17 +12,18 b''
12 <%def name="main()">
12 <%def name="main()">
13 <%def name="get_sort(name)">
13 <%def name="get_sort(name)">
14 <%name_slug = name.lower().replace(' ','_') %>
14 <%name_slug = name.lower().replace(' ','_') %>
15 %if name_slug == c.cs_slug:
15
16 <span style="font-weight: bold;text-decoration: underline;">${name}</span>
16 %if name_slug == c.sort_slug:
17 %if c.sort_by.startswith('-'):
18 <a href="?sort=${name_slug}">${name}&uarr;</a>
17 %else:
19 %else:
18 <span style="font-weight: bold">${name}</span>
20 <a href="?sort=-${name_slug}">${name}&darr;</a>
21 %endif:
22 %else:
23 <a href="?sort=${name_slug}">${name}</a>
19 %endif
24 %endif
20 <a href="?sort=${name_slug}">&darr;</a>
21 <a href="?sort=-${name_slug}">&uarr;</a>
22 </%def>
25 </%def>
23
26
24
25
26 <div class="box">
27 <div class="box">
27 <!-- box / title -->
28 <!-- box / title -->
28 <div class="title">
29 <div class="title">
@@ -55,9 +56,9 b''
55 <tr class="parity${cnt%2}">
56 <tr class="parity${cnt%2}">
56 <td>
57 <td>
57 %if repo['repo'].dbrepo.private:
58 %if repo['repo'].dbrepo.private:
58 <img alt="${_('private')}" src="/images/icons/lock.png"/>
59 <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
59 %else:
60 %else:
60 <img alt="${_('public')}" src="/images/icons/lock_open.png"/>
61 <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
61 %endif
62 %endif
62 ${h.link_to(repo['name'],
63 ${h.link_to(repo['name'],
63 h.url('summary_home',repo_name=repo['name']))}</td>
64 h.url('summary_home',repo_name=repo['name']))}</td>
@@ -42,7 +42,7 b' E.onDOMReady(function(e){'
42 <label>${_('Name')}:</label>
42 <label>${_('Name')}:</label>
43 </div>
43 </div>
44 <div class="input-short">
44 <div class="input-short">
45 ${c.repo_info.name}
45 <span style="font-size: 1.6em;font-weight: bold">${c.repo_info.name}</span>
46 </div>
46 </div>
47 </div>
47 </div>
48
48
General Comments 0
You need to be logged in to leave comments. Login now