Show More
@@ -1,238 +1,223 | |||
|
1 | 1 | import logging |
|
2 | 2 | import traceback |
|
3 | 3 | import formencode |
|
4 | 4 | |
|
5 | 5 | from formencode import htmlfill |
|
6 | 6 | from operator import itemgetter |
|
7 | 7 | |
|
8 | 8 | from pylons import request, response, session, tmpl_context as c, url |
|
9 | 9 | from pylons.controllers.util import abort, redirect |
|
10 | 10 | from pylons.i18n.translation import _ |
|
11 | 11 | |
|
12 | 12 | from rhodecode.lib import helpers as h |
|
13 | 13 | from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator, \ |
|
14 | 14 | HasPermissionAnyDecorator |
|
15 | 15 | from rhodecode.lib.base import BaseController, render |
|
16 | 16 | from rhodecode.model.db import Group |
|
17 | 17 | from rhodecode.model.repos_group import ReposGroupModel |
|
18 | 18 | from rhodecode.model.forms import ReposGroupForm |
|
19 | 19 | |
|
20 | 20 | log = logging.getLogger(__name__) |
|
21 | 21 | |
|
22 | 22 | |
|
23 | 23 | class ReposGroupsController(BaseController): |
|
24 | 24 | """REST Controller styled on the Atom Publishing Protocol""" |
|
25 | 25 | # To properly map this controller, ensure your config/routing.py |
|
26 | 26 | # file has a resource setup: |
|
27 | 27 | # map.resource('repos_group', 'repos_groups') |
|
28 | 28 | |
|
29 | 29 | @LoginRequired() |
|
30 | 30 | def __before__(self): |
|
31 | 31 | super(ReposGroupsController, self).__before__() |
|
32 | 32 | |
|
33 | 33 | def __load_defaults(self): |
|
34 | 34 | |
|
35 | 35 | c.repo_groups = [('', '')] |
|
36 | 36 | parents_link = lambda k: h.literal('»'.join( |
|
37 | 37 | map(lambda k: k.group_name, |
|
38 | 38 | k.parents + [k]) |
|
39 | 39 | ) |
|
40 | 40 | ) |
|
41 | 41 | |
|
42 | 42 | c.repo_groups.extend([(x.group_id, parents_link(x)) for \ |
|
43 | 43 | x in self.sa.query(Group).all()]) |
|
44 | 44 | |
|
45 | 45 | c.repo_groups = sorted(c.repo_groups, |
|
46 | 46 | key=lambda t: t[1].split('»')[0]) |
|
47 | 47 | c.repo_groups_choices = map(lambda k: unicode(k[0]), c.repo_groups) |
|
48 | 48 | |
|
49 | 49 | def __load_data(self, group_id): |
|
50 | 50 | """ |
|
51 | 51 | Load defaults settings for edit, and update |
|
52 | 52 | |
|
53 | 53 | :param group_id: |
|
54 | 54 | """ |
|
55 | 55 | self.__load_defaults() |
|
56 | 56 | |
|
57 | 57 | repo_group = Group.get(group_id) |
|
58 | 58 | |
|
59 | 59 | data = repo_group.get_dict() |
|
60 | 60 | |
|
61 | 61 | return data |
|
62 | 62 | |
|
63 | 63 | @HasPermissionAnyDecorator('hg.admin') |
|
64 | 64 | def index(self, format='html'): |
|
65 | 65 | """GET /repos_groups: All items in the collection""" |
|
66 | 66 | # url('repos_groups') |
|
67 | 67 | |
|
68 | 68 | sk = lambda g:g.parents[0].group_name if g.parents else g.group_name |
|
69 | 69 | c.groups = sorted(Group.query().all(), key=sk) |
|
70 | 70 | return render('admin/repos_groups/repos_groups_show.html') |
|
71 | 71 | |
|
72 | 72 | @HasPermissionAnyDecorator('hg.admin') |
|
73 | 73 | def create(self): |
|
74 | 74 | """POST /repos_groups: Create a new item""" |
|
75 | 75 | # url('repos_groups') |
|
76 | 76 | self.__load_defaults() |
|
77 | 77 | repos_group_model = ReposGroupModel() |
|
78 | 78 | repos_group_form = ReposGroupForm(available_groups= |
|
79 | 79 | c.repo_groups_choices)() |
|
80 | 80 | try: |
|
81 | 81 | form_result = repos_group_form.to_python(dict(request.POST)) |
|
82 | 82 | repos_group_model.create(form_result) |
|
83 | 83 | h.flash(_('created repos group %s') \ |
|
84 | 84 | % form_result['group_name'], category='success') |
|
85 | 85 | #TODO: in futureaction_logger(, '', '', '', self.sa) |
|
86 | 86 | except formencode.Invalid, errors: |
|
87 | 87 | |
|
88 | 88 | return htmlfill.render( |
|
89 | 89 | render('admin/repos_groups/repos_groups_add.html'), |
|
90 | 90 | defaults=errors.value, |
|
91 | 91 | errors=errors.error_dict or {}, |
|
92 | 92 | prefix_error=False, |
|
93 | 93 | encoding="UTF-8") |
|
94 | 94 | except Exception: |
|
95 | 95 | log.error(traceback.format_exc()) |
|
96 | 96 | h.flash(_('error occurred during creation of repos group %s') \ |
|
97 | 97 | % request.POST.get('group_name'), category='error') |
|
98 | 98 | |
|
99 | 99 | return redirect(url('repos_groups')) |
|
100 | 100 | |
|
101 | 101 | |
|
102 | 102 | @HasPermissionAnyDecorator('hg.admin') |
|
103 | 103 | def new(self, format='html'): |
|
104 | 104 | """GET /repos_groups/new: Form to create a new item""" |
|
105 | 105 | # url('new_repos_group') |
|
106 | 106 | self.__load_defaults() |
|
107 | 107 | return render('admin/repos_groups/repos_groups_add.html') |
|
108 | 108 | |
|
109 | 109 | @HasPermissionAnyDecorator('hg.admin') |
|
110 | 110 | def update(self, id): |
|
111 | 111 | """PUT /repos_groups/id: Update an existing item""" |
|
112 | 112 | # Forms posted to this method should contain a hidden field: |
|
113 | 113 | # <input type="hidden" name="_method" value="PUT" /> |
|
114 | 114 | # Or using helpers: |
|
115 | 115 | # h.form(url('repos_group', id=ID), |
|
116 | 116 | # method='put') |
|
117 | 117 | # url('repos_group', id=ID) |
|
118 | 118 | |
|
119 | 119 | self.__load_defaults() |
|
120 | 120 | c.repos_group = Group.get(id) |
|
121 | 121 | |
|
122 | 122 | repos_group_model = ReposGroupModel() |
|
123 | 123 | repos_group_form = ReposGroupForm(edit=True, |
|
124 | 124 | old_data=c.repos_group.get_dict(), |
|
125 | 125 | available_groups= |
|
126 | 126 | c.repo_groups_choices)() |
|
127 | 127 | try: |
|
128 | 128 | form_result = repos_group_form.to_python(dict(request.POST)) |
|
129 | 129 | repos_group_model.update(id, form_result) |
|
130 | 130 | h.flash(_('updated repos group %s') \ |
|
131 | 131 | % form_result['group_name'], category='success') |
|
132 | 132 | #TODO: in futureaction_logger(, '', '', '', self.sa) |
|
133 | 133 | except formencode.Invalid, errors: |
|
134 | 134 | |
|
135 | 135 | return htmlfill.render( |
|
136 | 136 | render('admin/repos_groups/repos_groups_edit.html'), |
|
137 | 137 | defaults=errors.value, |
|
138 | 138 | errors=errors.error_dict or {}, |
|
139 | 139 | prefix_error=False, |
|
140 | 140 | encoding="UTF-8") |
|
141 | 141 | except Exception: |
|
142 | 142 | log.error(traceback.format_exc()) |
|
143 | 143 | h.flash(_('error occurred during update of repos group %s') \ |
|
144 | 144 | % request.POST.get('group_name'), category='error') |
|
145 | 145 | |
|
146 | 146 | return redirect(url('repos_groups')) |
|
147 | 147 | |
|
148 | 148 | |
|
149 | 149 | @HasPermissionAnyDecorator('hg.admin') |
|
150 | 150 | def delete(self, id): |
|
151 | 151 | """DELETE /repos_groups/id: Delete an existing item""" |
|
152 | 152 | # Forms posted to this method should contain a hidden field: |
|
153 | 153 | # <input type="hidden" name="_method" value="DELETE" /> |
|
154 | 154 | # Or using helpers: |
|
155 | 155 | # h.form(url('repos_group', id=ID), |
|
156 | 156 | # method='delete') |
|
157 | 157 | # url('repos_group', id=ID) |
|
158 | 158 | |
|
159 | 159 | repos_group_model = ReposGroupModel() |
|
160 | 160 | gr = Group.get(id) |
|
161 | 161 | repos = gr.repositories.all() |
|
162 | 162 | if repos: |
|
163 | 163 | h.flash(_('This group contains %s repositores and cannot be ' |
|
164 | 164 | 'deleted' % len(repos)), |
|
165 | 165 | category='error') |
|
166 | 166 | return redirect(url('repos_groups')) |
|
167 | 167 | |
|
168 | ||
|
169 | 168 | try: |
|
170 | 169 | repos_group_model.delete(id) |
|
171 | 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 | 172 | except Exception: |
|
174 | 173 | log.error(traceback.format_exc()) |
|
175 | 174 | h.flash(_('error occurred during deletion of repos group %s' % gr.group_name), |
|
176 | 175 | category='error') |
|
177 | 176 | |
|
178 | 177 | return redirect(url('repos_groups')) |
|
179 | 178 | |
|
180 | 179 | def show(self, id, format='html'): |
|
181 | 180 | """GET /repos_groups/id: Show a specific item""" |
|
182 | 181 | # url('repos_group', id=ID) |
|
183 | 182 | |
|
184 |
|
|
|
183 | c.group = Group.get(id) | |
|
185 | 184 | |
|
186 | 185 | if c.group: |
|
187 | 186 | c.group_repos = c.group.repositories.all() |
|
188 | 187 | else: |
|
189 | 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 | 190 | #overwrite our cached list with current filter |
|
206 | 191 | gr_filter = c.group_repos |
|
207 | 192 | c.cached_repo_list = self.scm_model.get_repos(all_repos=gr_filter) |
|
208 | 193 | |
|
209 | 194 | c.repos_list = c.cached_repo_list |
|
210 | 195 | |
|
211 | 196 | c.repo_cnt = 0 |
|
212 | 197 | |
|
213 | 198 | c.groups = self.sa.query(Group).order_by(Group.group_name)\ |
|
214 | 199 | .filter(Group.group_parent_id == id).all() |
|
215 | 200 | |
|
216 | 201 | return render('admin/repos_groups/repos_groups.html') |
|
217 | 202 | |
|
218 | 203 | @HasPermissionAnyDecorator('hg.admin') |
|
219 | 204 | def edit(self, id, format='html'): |
|
220 | 205 | """GET /repos_groups/id/edit: Form to edit an existing item""" |
|
221 | 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) | |
|
226 | defaults = self.__load_data(id) | |
|
210 | c.repos_group = Group.get(id_) | |
|
211 | defaults = self.__load_data(id_) | |
|
227 | 212 | |
|
228 | 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 | 216 | return htmlfill.render( |
|
232 | 217 | render('admin/repos_groups/repos_groups_edit.html'), |
|
233 | 218 | defaults=defaults, |
|
234 | 219 | encoding="UTF-8", |
|
235 | 220 | force_defaults=False |
|
236 | 221 | ) |
|
237 | 222 | |
|
238 | 223 |
@@ -1,72 +1,60 | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """ |
|
3 | 3 | rhodecode.controllers.home |
|
4 | 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
5 | 5 | |
|
6 | 6 | Home controller for Rhodecode |
|
7 | 7 | |
|
8 | 8 | :created_on: Feb 18, 2010 |
|
9 | 9 | :author: marcink |
|
10 | 10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
11 | 11 | :license: GPLv3, see COPYING for more details. |
|
12 | 12 | """ |
|
13 | 13 | # This program is free software: you can redistribute it and/or modify |
|
14 | 14 | # it under the terms of the GNU General Public License as published by |
|
15 | 15 | # the Free Software Foundation, either version 3 of the License, or |
|
16 | 16 | # (at your option) any later version. |
|
17 | 17 | # |
|
18 | 18 | # This program is distributed in the hope that it will be useful, |
|
19 | 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 | 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 | 21 | # GNU General Public License for more details. |
|
22 | 22 | # |
|
23 | 23 | # You should have received a copy of the GNU General Public License |
|
24 | 24 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
25 | 25 | |
|
26 | 26 | import logging |
|
27 | 27 | from operator import itemgetter |
|
28 | 28 | |
|
29 | 29 | from pylons import tmpl_context as c, request |
|
30 | 30 | from paste.httpexceptions import HTTPBadRequest |
|
31 | 31 | |
|
32 | 32 | from rhodecode.lib.auth import LoginRequired |
|
33 | 33 | from rhodecode.lib.base import BaseController, render |
|
34 | 34 | from rhodecode.model.db import Group, Repository |
|
35 | 35 | |
|
36 | 36 | log = logging.getLogger(__name__) |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | class HomeController(BaseController): |
|
40 | 40 | |
|
41 | 41 | @LoginRequired() |
|
42 | 42 | def __before__(self): |
|
43 | 43 | super(HomeController, self).__before__() |
|
44 | 44 | |
|
45 | 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: | |
|
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) | |
|
47 | c.repos_list = self.scm_model.get_repos() | |
|
60 | 48 | |
|
61 | 49 | c.groups = Group.query().filter(Group.group_parent_id == None).all() |
|
62 | 50 | |
|
63 | 51 | return render('/index.html') |
|
64 | 52 | |
|
65 | 53 | def repo_switcher(self): |
|
66 | 54 | if request.is_xhr: |
|
67 | 55 | all_repos = Repository.query().order_by(Repository.repo_name).all() |
|
68 | 56 | c.repos_list = self.scm_model.get_repos(all_repos, |
|
69 | 57 | sort_key='name_sort') |
|
70 | 58 | return render('/repo_switcher_list.html') |
|
71 | 59 | else: |
|
72 | 60 | return HTTPBadRequest() |
@@ -1,244 +1,226 | |||
|
1 | 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}↑</a> | |
|
8 | %else: | |
|
9 | <a href="?sort=-${name_slug}">${name}↓</a> | |
|
10 | %endif: | |
|
11 | %else: | |
|
12 | <a href="?sort=${name_slug}">${name}</a> | |
|
13 | %endif | |
|
14 | </%def> | |
|
15 | ||
|
16 | 2 | <div class="box"> |
|
17 | 3 | <!-- box / title --> |
|
18 | 4 | <div class="title"> |
|
19 | 5 | <h5> |
|
20 | 6 | <input class="top-right-rounded-corner top-left-rounded-corner bottom-left-rounded-corner bottom-right-rounded-corner" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}"/> |
|
21 | 7 | ${parent.breadcrumbs()} <span id="repo_count"></span> ${_('repositories')} |
|
22 | 8 | </h5> |
|
23 | 9 | %if c.rhodecode_user.username != 'default': |
|
24 | 10 | %if h.HasPermissionAny('hg.admin','hg.create.repository')(): |
|
25 | 11 | <ul class="links"> |
|
26 | 12 | <li> |
|
27 | 13 | <span>${h.link_to(_('ADD NEW REPOSITORY'),h.url('admin_settings_create_repository'))}</span> |
|
28 | 14 | </li> |
|
29 | 15 | </ul> |
|
30 | 16 | %endif |
|
31 | 17 | %endif |
|
32 | 18 | </div> |
|
33 | 19 | <!-- end box / title --> |
|
34 | 20 | <div class="table"> |
|
35 | 21 | % if c.groups: |
|
36 | 22 | <table> |
|
37 | 23 | <thead> |
|
38 | 24 | <tr> |
|
39 | 25 | <th class="left"><a href="#">${_('Group name')}</a></th> |
|
40 | 26 | <th class="left"><a href="#">${_('Description')}</a></th> |
|
41 | 27 | ##<th class="left"><a href="#">${_('Number of repositories')}</a></th> |
|
42 | 28 | </tr> |
|
43 | 29 | </thead> |
|
44 | 30 | |
|
45 | 31 | ## REPO GROUPS |
|
46 | 32 | |
|
47 | 33 | % for gr in c.groups: |
|
48 | 34 | <tr> |
|
49 | 35 | <td> |
|
50 | 36 | <div style="white-space: nowrap"> |
|
51 | 37 | <img class="icon" alt="${_('Repositories group')}" src="${h.url('/images/icons/database_link.png')}"/> |
|
52 | 38 | ${h.link_to(gr.group_name,url('repos_group',id=gr.group_id))} |
|
53 | 39 | </div> |
|
54 | 40 | </td> |
|
55 | 41 | <td>${gr.group_description}</td> |
|
56 | 42 | ##<td><b>${gr.repositories.count()}</b></td> |
|
57 | 43 | </tr> |
|
58 | 44 | % endfor |
|
59 | 45 | |
|
60 | 46 | </table> |
|
61 | 47 | <div style="height: 20px"></div> |
|
62 | 48 | % endif |
|
63 | 49 | <div id="welcome" style="display:none;text-align:center"> |
|
64 | 50 | <h1><a href="${h.url('home')}">${c.rhodecode_name} ${c.rhodecode_version}</a></h1> |
|
65 | 51 | </div> |
|
66 | 52 | <table id="repos_list"> |
|
67 | 53 | <thead> |
|
68 | 54 | <tr> |
|
69 | 55 | <th class="left"></th> |
|
70 |
<th class="left">${ |
|
|
71 |
<th class="left">${ |
|
|
72 |
<th class="left">${ |
|
|
73 |
<th class="left">${ |
|
|
74 |
<th class="left">${ |
|
|
56 | <th class="left">${_('Name')}</th> | |
|
57 | <th class="left">${_('Description')}</th> | |
|
58 | <th class="left">${_('Last change')}</th> | |
|
59 | <th class="left">${_('Tip')}</th> | |
|
60 | <th class="left">${_('Owner')}</th> | |
|
75 | 61 | <th class="left">${_('RSS')}</th> |
|
76 | 62 | <th class="left">${_('Atom')}</th> |
|
77 | 63 | </tr> |
|
78 | 64 | </thead> |
|
79 | 65 | <tbody> |
|
80 | 66 | %for cnt,repo in enumerate(c.repos_list): |
|
81 | 67 | <tr class="parity${cnt%2}"> |
|
82 | 68 | <td class="quick_repo_menu"> |
|
83 | 69 | <ul class="menu_items hidden"> |
|
84 | 70 | <li> |
|
85 | 71 | <a title="${_('Summary')}" href="${h.url('summary_home',repo_name=repo['name'])}"> |
|
86 | 72 | <span class="icon"> |
|
87 | 73 | <img src="${h.url('/images/icons/clipboard_16.png')}" alt="${_('Summary')}" /> |
|
88 | 74 | </span> |
|
89 | 75 | <span>${_('Summary')}</span> |
|
90 | 76 | </a> |
|
91 | 77 | </li> |
|
92 | 78 | <li> |
|
93 | 79 | <a title="${_('Changelog')}" href="${h.url('changelog_home',repo_name=repo['name'])}"> |
|
94 | 80 | <span class="icon"> |
|
95 | 81 | <img src="${h.url('/images/icons/time.png')}" alt="${_('Changelog')}" /> |
|
96 | 82 | </span> |
|
97 | 83 | <span>${_('Changelog')}</span> |
|
98 | 84 | </a> |
|
99 | 85 | </li> |
|
100 | 86 | <li> |
|
101 | 87 | <a title="${_('Files')}" href="${h.url('files_home',repo_name=repo['name'])}"> |
|
102 | 88 | <span class="icon"> |
|
103 | 89 | <img src="${h.url('/images/icons/file.png')}" alt="${_('Files')}" /> |
|
104 | 90 | </span> |
|
105 | 91 | <span>${_('Files')}</span> |
|
106 | 92 | </a> |
|
107 | 93 | </li> |
|
108 | 94 | </ul> |
|
109 | 95 | </td> |
|
110 | 96 | <td> |
|
111 | 97 | ## TYPE OF REPO |
|
112 | 98 | <div style="white-space: nowrap"> |
|
113 | 99 | %if repo['dbrepo']['repo_type'] =='hg': |
|
114 | 100 | <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> |
|
115 | 101 | %elif repo['dbrepo']['repo_type'] =='git': |
|
116 | 102 | <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> |
|
117 | 103 | %endif |
|
118 | 104 | |
|
119 | 105 | ##PRIVATE/PUBLIC |
|
120 | 106 | %if repo['dbrepo']['private']: |
|
121 | 107 | <img class="icon" title="${_('private repository')}" alt="${_('private repository')}" src="${h.url('/images/icons/lock.png')}"/> |
|
122 | 108 | %else: |
|
123 | 109 | <img class="icon" title="${_('public repository')}" alt="${_('public repository')}" src="${h.url('/images/icons/lock_open.png')}"/> |
|
124 | 110 | %endif |
|
125 | 111 | |
|
126 | 112 | ##NAME |
|
127 | 113 | ${h.link_to(repo['name'], |
|
128 | 114 | h.url('summary_home',repo_name=repo['name']),class_="repo_name")} |
|
129 | 115 | %if repo['dbrepo_fork']: |
|
130 | 116 | <a href="${h.url('summary_home',repo_name=repo['dbrepo_fork']['repo_name'])}"> |
|
131 | 117 | <img class="icon" alt="${_('fork')}" |
|
132 | 118 | title="${_('Fork of')} ${repo['dbrepo_fork']['repo_name']}" |
|
133 | 119 | src="${h.url('/images/icons/arrow_divide.png')}"/></a> |
|
134 | 120 | %endif |
|
135 | 121 | </div> |
|
136 | 122 | </td> |
|
137 | 123 | ##DESCRIPTION |
|
138 | 124 | <td><span class="tooltip" title="${h.tooltip(repo['description'])}"> |
|
139 | 125 | ${h.truncate(repo['description'],60)}</span> |
|
140 | 126 | </td> |
|
141 | 127 | ##LAST CHANGE |
|
142 | 128 | <td> |
|
143 | 129 | <span class="tooltip" title="${repo['last_change']}"> |
|
144 | 130 | ${h.age(repo['last_change'])}</span> |
|
145 | 131 | </td> |
|
146 | 132 | <td> |
|
147 | 133 | %if repo['rev']>=0: |
|
148 | ${h.link_to('r%s:%s' % (repo['rev'],h.short_id(repo['tip'])), | |
|
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'])))} | |
|
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> | |
|
152 | 135 | %else: |
|
153 | 136 | ${_('No changesets yet')} |
|
154 | 137 | %endif |
|
155 | 138 | </td> |
|
156 | 139 | <td title="${repo['contact']}">${h.person(repo['contact'])}</td> |
|
157 | 140 | <td> |
|
158 | 141 | %if c.rhodecode_user.username != 'default': |
|
159 | 142 | <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a> |
|
160 | 143 | %else: |
|
161 | 144 | <a title="${_('Subscribe to %s rss feed')%repo['name']}" class="rss_icon" href="${h.url('rss_feed_home',repo_name=repo['name'])}"></a> |
|
162 | 145 | %endif: |
|
163 | 146 | </td> |
|
164 | 147 | <td> |
|
165 | 148 | %if c.rhodecode_user.username != 'default': |
|
166 | 149 | <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'],api_key=c.rhodecode_user.api_key)}"></a> |
|
167 | 150 | %else: |
|
168 | 151 | <a title="${_('Subscribe to %s atom feed')%repo['name']}" class="atom_icon" href="${h.url('atom_feed_home',repo_name=repo['name'])}"></a> |
|
169 | 152 | %endif: |
|
170 | 153 | </td> |
|
171 | 154 | </tr> |
|
172 | 155 | %endfor |
|
173 | ||
|
174 | 156 | </tbody> |
|
175 | 157 | </table> |
|
176 | 158 | </div> |
|
177 | 159 | </div> |
|
178 | 160 | |
|
179 | 161 | |
|
180 | 162 | <script type="text/javascript"> |
|
181 | 163 | var D = YAHOO.util.Dom; |
|
182 | 164 | var E = YAHOO.util.Event; |
|
183 | 165 | var S = YAHOO.util.Selector; |
|
184 | 166 | |
|
185 | 167 | var q_filter = D.get('q_filter'); |
|
186 | 168 | var F = YAHOO.namespace('q_filter'); |
|
187 | 169 | |
|
188 | 170 | E.on(q_filter,'click',function(){ |
|
189 | 171 | q_filter.value = ''; |
|
190 | 172 | }); |
|
191 | 173 | |
|
192 | 174 | F.filterTimeout = null; |
|
193 | 175 | |
|
194 | 176 | function set_count(count){ |
|
195 | 177 | |
|
196 | 178 | if(count == 0){ |
|
197 | 179 | YUD.setStyle('repos_list','display','none'); |
|
198 | 180 | YUD.setStyle('welcome','display',''); |
|
199 | 181 | } |
|
200 | 182 | else{ |
|
201 | 183 | YUD.setStyle('repos_list','display',''); |
|
202 | 184 | YUD.setStyle('welcome','display','none'); |
|
203 | 185 | } |
|
204 | 186 | YUD.get('repo_count').innerHTML = count; |
|
205 | 187 | |
|
206 | 188 | } |
|
207 | 189 | |
|
208 | 190 | |
|
209 | 191 | //set initial count for repos |
|
210 | 192 | var nodes = S.query('div.table tr td div a.repo_name'); |
|
211 | 193 | |
|
212 | 194 | set_count(nodes.length) |
|
213 | 195 | F.updateFilter = function() { |
|
214 | 196 | // Reset timeout |
|
215 | 197 | F.filterTimeout = null; |
|
216 | 198 | |
|
217 | 199 | var obsolete = []; |
|
218 | 200 | nodes = S.query('div.table tr td div a.repo_name'); |
|
219 | 201 | var req = q_filter.value.toLowerCase(); |
|
220 | 202 | for (n in nodes){ |
|
221 | 203 | D.setStyle(nodes[n].parentNode.parentNode.parentNode,'display','') |
|
222 | 204 | } |
|
223 | 205 | if (req){ |
|
224 | 206 | for (n in nodes){ |
|
225 | 207 | if (nodes[n].innerHTML.toLowerCase().indexOf(req) == -1) { |
|
226 | 208 | obsolete.push(nodes[n]); |
|
227 | 209 | } |
|
228 | 210 | } |
|
229 | 211 | if(obsolete){ |
|
230 | 212 | for (n in obsolete){ |
|
231 | 213 | D.setStyle(obsolete[n].parentNode.parentNode.parentNode,'display','none'); |
|
232 | 214 | } |
|
233 | 215 | } |
|
234 | 216 | } |
|
235 | 217 | // set new count into dashboard |
|
236 | 218 | set_count(nodes.length - obsolete.length) |
|
237 | 219 | } |
|
238 | 220 | |
|
239 | 221 | E.on(q_filter,'keyup',function(e){ |
|
240 | 222 | clearTimeout(F.filterTimeout); |
|
241 | 223 | F.filterTimeout = setTimeout(F.updateFilter,600); |
|
242 | 224 | }); |
|
243 | 225 | |
|
244 | 226 | </script> |
General Comments 0
You need to be logged in to leave comments.
Login now