##// 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 37 super(HgController, self).__before__()
38 38
39 39 def index(self):
40 c.current_sort = request.GET.get('sort', 'name')
41 sort_by = c.current_sort
42 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('-', '')
45
46 if c.cs_slug not in sortables:
47 sort_by = 'name'
48
44 if current_sort_slug not in sortables:
45 c.sort_by = 'name'
46 current_sort_slug = c.sort_by
47 else:
48 c.sort_by = current_sort
49 c.sort_slug = current_sort_slug
49 50 cached_repo_list = HgModel().get_repos()
50 51
51 sort_key = c.cs_slug + '_sort'
52 if sort_by.startswith('-'):
52 sort_key = current_sort_slug + '_sort'
53 if c.sort_by.startswith('-'):
53 54 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=True)
54 55 else:
55 56 c.repos_list = sorted(cached_repo_list, key=itemgetter(sort_key), reverse=False)
@@ -26,6 +26,10 b' img'
26 26 border: none;
27 27 }
28 28
29 img.icon{
30 vertical-align: bottom;
31
32 }
29 33 /* -----------------------------------------------------------
30 34 anchors
31 35 ----------------------------------------------------------- */
@@ -14,67 +14,69 b''
14 14 </%def>
15 15
16 16 <%def name="main()">
17
17 18 <div class="box box-left">
18 19 <!-- box / title -->
19 20 <div class="title">
20 21 ${self.breadcrumbs()}
21 22 </div>
22 23 <!-- end box / title -->
24 <div class="ui-tabs-panel ui-widget-content ui-corner-bottom">
23 25 ${h.form(url('admin_settings_my_account_update'),method='put')}
24 <div class="form">
25 <!-- fields -->
26 <div class="fields">
27 <div class="field">
28 <div class="label">
29 <label for="username">${_('Username')}:</label>
30 </div>
31 <div class="input">
32 ${h.text('username')}
33 </div>
34 </div>
35
36 <div class="field">
37 <div class="label">
38 <label for="new_password">${_('New password')}:</label>
39 </div>
40 <div class="input">
41 ${h.password('new_password')}
42 </div>
43 </div>
44
45 <div class="field">
46 <div class="label">
47 <label for="name">${_('Name')}:</label>
48 </div>
49 <div class="input">
50 ${h.text('name')}
51 </div>
52 </div>
53
54 <div class="field">
55 <div class="label">
56 <label for="lastname">${_('Lastname')}:</label>
57 </div>
58 <div class="input">
59 ${h.text('lastname')}
60 </div>
61 </div>
62
63 <div class="field">
64 <div class="label">
65 <label for="email">${_('Email')}:</label>
66 </div>
67 <div class="input">
68 ${h.text('email')}
69 </div>
70 </div>
71
72 <div class="buttons">
73 ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
74 </div>
75 </div>
26 <div class="form">
27 <div class="fields">
28 <div class="field">
29 <div class="label">
30 <label for="username">${_('Username')}:</label>
31 </div>
32 <div class="input">
33 ${h.text('username')}
34 </div>
35 </div>
36
37 <div class="field">
38 <div class="label">
39 <label for="new_password">${_('New password')}:</label>
40 </div>
41 <div class="input">
42 ${h.password('new_password')}
43 </div>
44 </div>
45
46 <div class="field">
47 <div class="label">
48 <label for="name">${_('Name')}:</label>
49 </div>
50 <div class="input">
51 ${h.text('name')}
52 </div>
53 </div>
54
55 <div class="field">
56 <div class="label">
57 <label for="lastname">${_('Lastname')}:</label>
58 </div>
59 <div class="input">
60 ${h.text('lastname')}
61 </div>
62 </div>
63
64 <div class="field">
65 <div class="label">
66 <label for="email">${_('Email')}:</label>
67 </div>
68 <div class="input">
69 ${h.text('email')}
70 </div>
71 </div>
72
73 <div class="buttons">
74 ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
75 </div>
76 </div>
77 </div>
78 ${h.end_form()}
76 79 </div>
77 ${h.end_form()}
78 80 </div>
79 81
80 82 <div class="box box-right">
@@ -84,25 +86,25 b''
84 86 </div>
85 87 <!-- end box / title -->
86 88 <div class="table">
87 <table>
88 <tbody>
89 %for repo in c.user_repos:
90 <tr>
91 <td>
92 %if repo.dbrepo.private:
93 <img alt="${_('private')}" src="/images/icons/lock.png"/>
94 %else:
95 <img alt="${_('public')}" src="/images/icons/lock_open.png"/>
96 %endif
97
98 ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td>
99 ##<td>${_('created')} ${repo.dbrepo.}</td>
100 <td>${_('last changed')} ${h.age(repo.last_change)}</td>
101 <td>${h.link_to(_('[edit]'),h.url('edit_repo',repo_name=repo.name))}</td>
102 </tr>
103 %endfor
104 </tbody>
105 </table>
89 <table>
90 <tbody>
91 %for repo in c.user_repos:
92 <tr>
93 <td>
94 %if repo.dbrepo.private:
95 <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/>
96 %else:
97 <img class="icon" alt="${_('public')}" src="/images/icons/lock_open.png"/>
98 %endif
99
100 ${h.link_to(repo.name, h.url('summary_home',repo_name=repo.name))}</td>
101 <td>${_('revision')}: ${repo.revisions[-1]}</td>
102 <td>${_('last changed')}: ${h.age(repo.last_change)}</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>
104 </tr>
105 %endfor
106 </tbody>
107 </table>
106 108 </div>
107 109
108 110 </div>
@@ -12,17 +12,18 b''
12 12 <%def name="main()">
13 13 <%def name="get_sort(name)">
14 14 <%name_slug = name.lower().replace(' ','_') %>
15 %if name_slug == c.cs_slug:
16 <span style="font-weight: bold;text-decoration: underline;">${name}</span>
15
16 %if name_slug == c.sort_slug:
17 %if c.sort_by.startswith('-'):
18 <a href="?sort=${name_slug}">${name}&uarr;</a>
19 %else:
20 <a href="?sort=-${name_slug}">${name}&darr;</a>
21 %endif:
17 22 %else:
18 <span style="font-weight: bold">${name}</span>
23 <a href="?sort=${name_slug}">${name}</a>
19 24 %endif
20 <a href="?sort=${name_slug}">&darr;</a>
21 <a href="?sort=-${name_slug}">&uarr;</a>
22 25 </%def>
23 26
24
25
26 27 <div class="box">
27 28 <!-- box / title -->
28 29 <div class="title">
@@ -55,9 +56,9 b''
55 56 <tr class="parity${cnt%2}">
56 57 <td>
57 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 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 62 %endif
62 63 ${h.link_to(repo['name'],
63 64 h.url('summary_home',repo_name=repo['name']))}</td>
@@ -42,7 +42,7 b' E.onDOMReady(function(e){'
42 42 <label>${_('Name')}:</label>
43 43 </div>
44 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 46 </div>
47 47 </div>
48 48
General Comments 0
You need to be logged in to leave comments. Login now