##// END OF EJS Templates
implements #135 bookmark support for UI
marcink -
r1748:a3ee2611 beta
parent child Browse files
Show More
@@ -0,0 +1,53 b''
1 # -*- coding: utf-8 -*-
2 """
3 rhodecode.controllers.bookmarks
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6 Bookmarks controller for rhodecode
7
8 :created_on: Dec 1, 2011
9 :author: marcink
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
12 """
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation, either version 3 of the License, or
16 # (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 import logging
26
27 from pylons import tmpl_context as c
28
29 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
30 from rhodecode.lib.base import BaseRepoController, render
31 from rhodecode.lib.compat import OrderedDict
32
33 log = logging.getLogger(__name__)
34
35
36 class BookmarksController(BaseRepoController):
37
38 @LoginRequired()
39 @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
40 'repository.admin')
41 def __before__(self):
42 super(BookmarksController, self).__before__()
43
44 def index(self):
45 c.repo_bookmarks = OrderedDict()
46
47 bookmarks = [(name, c.rhodecode_repo.get_changeset(hash_)) for \
48 name, hash_ in c.rhodecode_repo._repo._bookmarks.items()]
49 ordered_tags = sorted(bookmarks, key=lambda x: x[1].date, reverse=True)
50 for name, cs_book in ordered_tags:
51 c.repo_bookmarks[name] = cs_book
52
53 return render('bookmarks/bookmarks.html')
@@ -0,0 +1,40 b''
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
3
4 <%def name="title()">
5 ${c.repo_name} ${_('Bookmarks')} - ${c.rhodecode_name}
6 </%def>
7
8
9 <%def name="breadcrumbs_links()">
10 <input class="q_filter_box" id="q_filter_bookmarks" size="15" type="text" name="filter" value="${_('quick filter...')}"/>
11 ${h.link_to(u'Home',h.url('/'))}
12 &raquo;
13 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
14 &raquo;
15 ${_('bookmarks')}
16 </%def>
17
18 <%def name="page_nav()">
19 ${self.menu('bookmarks')}
20 </%def>
21 <%def name="main()">
22 <div class="box">
23 <!-- box / title -->
24 <div class="title">
25 ${self.breadcrumbs()}
26 </div>
27 <!-- end box / title -->
28 <div class="table">
29 <%include file='bookmarks_data.html'/>
30 </div>
31 </div>
32 <script type="text/javascript">
33 var nodes = YUQ('div.table tr td .logtags .tagtag a');
34 var target = 'q_filter_bookmarks';
35 var func = function(node){
36 return node.parentNode.parentNode.parentNode.parentNode;
37 }
38 q_filter(target,nodes,func);
39 </script>
40 </%def> No newline at end of file
@@ -0,0 +1,33 b''
1 %if c.repo_bookmarks:
2 <table>
3 <tr>
4 <th class="left">${_('date')}</th>
5 <th class="left">${_('name')}</th>
6 <th class="left">${_('author')}</th>
7 <th class="left">${_('revision')}</th>
8 <th class="left">${_('links')}</th>
9 </tr>
10 %for cnt,book in enumerate(c.repo_bookmarks.items()):
11 <tr class="parity${cnt%2}">
12 <td><span class="tooltip" title="${h.age(book[1].date)}">
13 ${book[1].date}</span>
14 </td>
15 <td>
16 <span class="logbooks">
17 <span class="bookbook">${h.link_to(book[0],
18 h.url('changeset_home',repo_name=c.repo_name,revision=book[1].raw_id))}</span>
19 </span>
20 </td>
21 <td title="${book[1].author}">${h.person(book[1].author)}</td>
22 <td>r${book[1].revision}:${h.short_id(book[1].raw_id)}</td>
23 <td class="nowrap">
24 ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=book[1].raw_id),class_="ui-button-small xsmall")}
25 <span style="color:#515151">|</span>
26 ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id),class_="ui-button-small xsmall")}
27 </td>
28 </tr>
29 %endfor
30 </table>
31 %else:
32 ${_('There are no bookmarks yet')}
33 %endif No newline at end of file
@@ -403,6 +403,9 b' def make_map(config):'
403 rmap.connect('tags_home', '/{repo_name:.*}/tags',
403 rmap.connect('tags_home', '/{repo_name:.*}/tags',
404 controller='tags', conditions=dict(function=check_repo))
404 controller='tags', conditions=dict(function=check_repo))
405
405
406 rmap.connect('bookmarks_home', '/{repo_name:.*}/bookmarks',
407 controller='bookmarks', conditions=dict(function=check_repo))
408
406 rmap.connect('changelog_home', '/{repo_name:.*}/changelog',
409 rmap.connect('changelog_home', '/{repo_name:.*}/changelog',
407 controller='changelog', conditions=dict(function=check_repo))
410 controller='changelog', conditions=dict(function=check_repo))
408
411
@@ -616,16 +616,24 b' div.options a {'
616 padding: 12px 9px 7px 24px;
616 padding: 12px 9px 7px 24px;
617 }
617 }
618
618
619 #header #header-inner #quick li ul li a.tags,#header #header-inner #quick li ul li a.tags:hover
619 #header #header-inner #quick li ul li a.tags,
620 {
620 #header #header-inner #quick li ul li a.tags:hover{
621 background: #FFF url("../images/icons/tag_blue.png") no-repeat 4px 9px;
621 background: #FFF url("../images/icons/tag_blue.png") no-repeat 4px 9px;
622 width: 167px;
622 width: 167px;
623 margin: 0;
623 margin: 0;
624 padding: 12px 9px 7px 24px;
624 padding: 12px 9px 7px 24px;
625 }
625 }
626
626
627 #header #header-inner #quick li ul li a.admin,#header #header-inner #quick li ul li a.admin:hover
627 #header #header-inner #quick li ul li a.bookmarks,
628 {
628 #header #header-inner #quick li ul li a.bookmarks:hover{
629 background: #FFF url("../images/icons/tag_green.png") no-repeat 4px 9px;
630 width: 167px;
631 margin: 0;
632 padding: 12px 9px 7px 24px;
633 }
634
635 #header #header-inner #quick li ul li a.admin,
636 #header #header-inner #quick li ul li a.admin:hover{
629 background: #FFF url("../images/icons/cog_edit.png") no-repeat 4px 9px;
637 background: #FFF url("../images/icons/cog_edit.png") no-repeat 4px 9px;
630 width: 167px;
638 width: 167px;
631 margin: 0;
639 margin: 0;
@@ -1084,6 +1092,11 b' div.options a {'
1084 padding: 7px 7px 6px;
1092 padding: 7px 7px 6px;
1085 }
1093 }
1086
1094
1095 #content div.box div.form div.fields div.field div.input input#clone_url{
1096 font-size: 16px;
1097 padding: 2px 7px 2px;
1098 }
1099
1087 #content div.box div.form div.fields div.field div.file input {
1100 #content div.box div.form div.fields div.field div.file input {
1088 background: none repeat scroll 0 0 #FFFFFF;
1101 background: none repeat scroll 0 0 #FFFFFF;
1089 border-color: #B3B3B3 #EAEAEA #EAEAEA #B3B3B3;
1102 border-color: #B3B3B3 #EAEAEA #EAEAEA #B3B3B3;
@@ -2089,8 +2102,12 b' h3.files_location {'
2089 border-radius: 3px;
2102 border-radius: 3px;
2090 padding-left:4px;
2103 padding-left:4px;
2091 }
2104 }
2105 .right .logtags .branchtag a:hover,.logtags .branchtag a{
2106 color: #ffffff;
2107 }
2092 .right .logtags .branchtag a:hover,.logtags .branchtag a:hover{
2108 .right .logtags .branchtag a:hover,.logtags .branchtag a:hover{
2093 text-decoration: none;
2109 text-decoration: none;
2110 color: #ffffff;
2094 }
2111 }
2095 .right .logtags .tagtag,.logtags .tagtag {
2112 .right .logtags .tagtag,.logtags .tagtag {
2096 padding: 1px 3px 2px;
2113 padding: 1px 3px 2px;
@@ -2104,8 +2121,31 b' h3.files_location {'
2104 -moz-border-radius: 3px;
2121 -moz-border-radius: 3px;
2105 border-radius: 3px;
2122 border-radius: 3px;
2106 }
2123 }
2124 .right .logtags .tagtag a:hover,.logtags .tagtag a{
2125 color: #ffffff;
2126 }
2107 .right .logtags .tagtag a:hover,.logtags .tagtag a:hover{
2127 .right .logtags .tagtag a:hover,.logtags .tagtag a:hover{
2108 text-decoration: none;
2128 text-decoration: none;
2129 color: #ffffff;
2130 }
2131 .right .logbooks .bookbook,.logbooks .bookbook {
2132 padding: 1px 3px 2px;
2133 background-color: #46A546;
2134 font-size: 9.75px;
2135 font-weight: bold;
2136 color: #ffffff;
2137 text-transform: uppercase;
2138 white-space: nowrap;
2139 -webkit-border-radius: 3px;
2140 -moz-border-radius: 3px;
2141 border-radius: 3px;
2142 }
2143 .right .logbooks .bookbook,.logbooks .bookbook a{
2144 color: #ffffff;
2145 }
2146 .right .logbooks .bookbook,.logbooks .bookbook a:hover{
2147 text-decoration: none;
2148 color: #ffffff;
2109 }
2149 }
2110 div.browserblock {
2150 div.browserblock {
2111 overflow: hidden;
2151 overflow: hidden;
@@ -63,8 +63,7 b''
63 </li>
63 </li>
64 %if c.rhodecode_user.username != 'default':
64 %if c.rhodecode_user.username != 'default':
65 <li>
65 <li>
66 <a href="${h.url('journal')}">${_('Journal')}</a>
66 <a href="${h.url('journal')}">${_('Journal')}</a>
67 ##(${c.unread_journal}
68 </li>
67 </li>
69 %endif
68 %endif
70 %if c.rhodecode_user.username == 'default':
69 %if c.rhodecode_user.username == 'default':
@@ -17,7 +17,7 b''
17 <h5>${_('Journal')}</h5>
17 <h5>${_('Journal')}</h5>
18 <ul class="links">
18 <ul class="links">
19 <li>
19 <li>
20 <span><a href="#"><img id="refresh" class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/>
20 <span><a id="refresh" href="${h.url('journal')}"><img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/>
21 </a></span>
21 </a></span>
22 </li>
22 </li>
23 </ul>
23 </ul>
@@ -170,7 +170,7 b''
170 YUE.preventDefault(e);
170 YUE.preventDefault(e);
171 })
171 })
172 YUE.on('refresh','click',function(e){
172 YUE.on('refresh','click',function(e){
173 ypjax(e.target.href,"journal",function(){show_more_event();tooltip_activate();});
173 ypjax(e.currentTarget.href,"journal",function(){show_more_event();tooltip_activate();});
174 YUE.preventDefault(e);
174 YUE.preventDefault(e);
175 })
175 })
176 </script>
176 </script>
@@ -118,23 +118,10 b''
118
118
119 <div class="field">
119 <div class="field">
120 <div class="label-summary">
120 <div class="label-summary">
121 <label>${_('Last change')}:</label>
122 </div>
123 <div class="input ${summary(c.show_stats)}">
124 <b>${'r%s:%s' % (h.get_changeset_safe(c.rhodecode_repo,'tip').revision,
125 h.get_changeset_safe(c.rhodecode_repo,'tip').short_id)}</b> -
126 <span class="tooltip" title="${c.rhodecode_repo.last_change}">
127 ${h.age(c.rhodecode_repo.last_change)}</span>
128 ${_('by')} ${h.get_changeset_safe(c.rhodecode_repo,'tip').author}
129 </div>
130 </div>
131
132 <div class="field">
133 <div class="label-summary">
134 <label>${_('Clone url')}:</label>
121 <label>${_('Clone url')}:</label>
135 </div>
122 </div>
136 <div class="input ${summary(c.show_stats)}">
123 <div class="input ${summary(c.show_stats)}">
137 <input type="text" id="clone_url" readonly="readonly" value="${c.rhodecode_repo.alias} clone ${c.clone_repo_url}" size="70"/>
124 <input type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}" size="70"/>
138 </div>
125 </div>
139 </div>
126 </div>
140
127
@@ -22,4 +22,16 b''
22 <li>${h.link_to(_('There are no tags yet'),'#')}</li>
22 <li>${h.link_to(_('There are no tags yet'),'#')}</li>
23 %endif
23 %endif
24 </ul>
24 </ul>
25 </li>
26 <li>
27 ${h.link_to('%s (%s)' % (_('bookmarks'),len(c.rhodecode_repo.bookmarks.values()),),h.url('bookmarks_home',repo_name=c.repo_name),class_='bookmarks childs')}
28 <ul>
29 %if c.rhodecode_repo.bookmarks.values():
30 %for cnt,book in enumerate(c.rhodecode_repo.bookmarks.items()):
31 <li>${h.link_to('%s - %s' % (book[0],h.short_id(book[1])),h.url('files_home',repo_name=c.repo_name,revision=book[1]))}</li>
32 %endfor
33 %else:
34 <li>${h.link_to(_('There are no bookmarks yet'),'#')}</li>
35 %endif
36 </ul>
25 </li> No newline at end of file
37 </li>
General Comments 0
You need to be logged in to leave comments. Login now