##// 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,67 +14,69 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 -->
27 <div class="fields">
26 <div class="fields">
28 <div class="field">
27 <div class="field">
29 <div class="label">
28 <div class="label">
30 <label for="username">${_('Username')}:</label>
29 <label for="username">${_('Username')}:</label>
31 </div>
30 </div>
32 <div class="input">
31 <div class="input">
33 ${h.text('username')}
32 ${h.text('username')}
34 </div>
33 </div>
35 </div>
34 </div>
36
35
37 <div class="field">
36 <div class="field">
38 <div class="label">
37 <div class="label">
39 <label for="new_password">${_('New password')}:</label>
38 <label for="new_password">${_('New password')}:</label>
40 </div>
39 </div>
41 <div class="input">
40 <div class="input">
42 ${h.password('new_password')}
41 ${h.password('new_password')}
43 </div>
42 </div>
44 </div>
43 </div>
45
44
46 <div class="field">
45 <div class="field">
47 <div class="label">
46 <div class="label">
48 <label for="name">${_('Name')}:</label>
47 <label for="name">${_('Name')}:</label>
49 </div>
48 </div>
50 <div class="input">
49 <div class="input">
51 ${h.text('name')}
50 ${h.text('name')}
52 </div>
51 </div>
53 </div>
52 </div>
54
53
55 <div class="field">
54 <div class="field">
56 <div class="label">
55 <div class="label">
57 <label for="lastname">${_('Lastname')}:</label>
56 <label for="lastname">${_('Lastname')}:</label>
58 </div>
57 </div>
59 <div class="input">
58 <div class="input">
60 ${h.text('lastname')}
59 ${h.text('lastname')}
61 </div>
60 </div>
62 </div>
61 </div>
63
62
64 <div class="field">
63 <div class="field">
65 <div class="label">
64 <div class="label">
66 <label for="email">${_('Email')}:</label>
65 <label for="email">${_('Email')}:</label>
67 </div>
66 </div>
68 <div class="input">
67 <div class="input">
69 ${h.text('email')}
68 ${h.text('email')}
70 </div>
69 </div>
71 </div>
70 </div>
72
71
73 <div class="buttons">
72 <div class="buttons">
74 ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
73 ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
75 </div>
74 </div>
76 </div>
75 </div>
77 </div>
78 ${h.end_form()}
76 </div>
79 </div>
77 ${h.end_form()}
78 </div>
80 </div>
79
81
80 <div class="box box-right">
82 <div class="box box-right">
@@ -84,25 +86,25 b''
84 </div>
86 </div>
85 <!-- end box / title -->
87 <!-- end box / title -->
86 <div class="table">
88 <div class="table">
87 <table>
89 <table>
88 <tbody>
90 <tbody>
89 %for repo in c.user_repos:
91 %for repo in c.user_repos:
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>
105 </table>
107 </table>
106 </div>
108 </div>
107
109
108 </div>
110 </div>
@@ -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>
19 %else:
20 <a href="?sort=-${name_slug}">${name}&darr;</a>
21 %endif:
17 %else:
22 %else:
18 <span style="font-weight: bold">${name}</span>
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