Mercurial > kallithea
changeset 1748:a3ee2611e6e8 beta
implements #135 bookmark support for UI
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 02 Dec 2011 00:15:26 +0200 |
parents | 8804715404c9 |
children | 8ecc6b8229a5 |
files | rhodecode/config/routing.py rhodecode/controllers/bookmarks.py rhodecode/public/css/style.css rhodecode/templates/base/base.html rhodecode/templates/bookmarks/bookmarks.html rhodecode/templates/bookmarks/bookmarks_data.html rhodecode/templates/journal/journal.html rhodecode/templates/summary/summary.html rhodecode/templates/switch_to_list.html |
diffstat | 9 files changed, 189 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/config/routing.py Thu Dec 01 03:11:26 2011 +0200 +++ b/rhodecode/config/routing.py Fri Dec 02 00:15:26 2011 +0200 @@ -403,6 +403,9 @@ rmap.connect('tags_home', '/{repo_name:.*}/tags', controller='tags', conditions=dict(function=check_repo)) + rmap.connect('bookmarks_home', '/{repo_name:.*}/bookmarks', + controller='bookmarks', conditions=dict(function=check_repo)) + rmap.connect('changelog_home', '/{repo_name:.*}/changelog', controller='changelog', conditions=dict(function=check_repo))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/controllers/bookmarks.py Fri Dec 02 00:15:26 2011 +0200 @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +""" + rhodecode.controllers.bookmarks + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Bookmarks controller for rhodecode + + :created_on: Dec 1, 2011 + :author: marcink + :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> + :license: GPLv3, see COPYING for more details. +""" +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +import logging + +from pylons import tmpl_context as c + +from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator +from rhodecode.lib.base import BaseRepoController, render +from rhodecode.lib.compat import OrderedDict + +log = logging.getLogger(__name__) + + +class BookmarksController(BaseRepoController): + + @LoginRequired() + @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', + 'repository.admin') + def __before__(self): + super(BookmarksController, self).__before__() + + def index(self): + c.repo_bookmarks = OrderedDict() + + bookmarks = [(name, c.rhodecode_repo.get_changeset(hash_)) for \ + name, hash_ in c.rhodecode_repo._repo._bookmarks.items()] + ordered_tags = sorted(bookmarks, key=lambda x: x[1].date, reverse=True) + for name, cs_book in ordered_tags: + c.repo_bookmarks[name] = cs_book + + return render('bookmarks/bookmarks.html')
--- a/rhodecode/public/css/style.css Thu Dec 01 03:11:26 2011 +0200 +++ b/rhodecode/public/css/style.css Fri Dec 02 00:15:26 2011 +0200 @@ -616,16 +616,24 @@ padding: 12px 9px 7px 24px; } -#header #header-inner #quick li ul li a.tags,#header #header-inner #quick li ul li a.tags:hover - { +#header #header-inner #quick li ul li a.tags, +#header #header-inner #quick li ul li a.tags:hover{ background: #FFF url("../images/icons/tag_blue.png") no-repeat 4px 9px; width: 167px; margin: 0; padding: 12px 9px 7px 24px; } -#header #header-inner #quick li ul li a.admin,#header #header-inner #quick li ul li a.admin:hover - { +#header #header-inner #quick li ul li a.bookmarks, +#header #header-inner #quick li ul li a.bookmarks:hover{ + background: #FFF url("../images/icons/tag_green.png") no-repeat 4px 9px; + width: 167px; + margin: 0; + padding: 12px 9px 7px 24px; +} + +#header #header-inner #quick li ul li a.admin, +#header #header-inner #quick li ul li a.admin:hover{ background: #FFF url("../images/icons/cog_edit.png") no-repeat 4px 9px; width: 167px; margin: 0; @@ -1084,6 +1092,11 @@ padding: 7px 7px 6px; } +#content div.box div.form div.fields div.field div.input input#clone_url{ + font-size: 16px; + padding: 2px 7px 2px; +} + #content div.box div.form div.fields div.field div.file input { background: none repeat scroll 0 0 #FFFFFF; border-color: #B3B3B3 #EAEAEA #EAEAEA #B3B3B3; @@ -2089,8 +2102,12 @@ border-radius: 3px; padding-left:4px; } +.right .logtags .branchtag a:hover,.logtags .branchtag a{ + color: #ffffff; +} .right .logtags .branchtag a:hover,.logtags .branchtag a:hover{ text-decoration: none; + color: #ffffff; } .right .logtags .tagtag,.logtags .tagtag { padding: 1px 3px 2px; @@ -2104,8 +2121,31 @@ -moz-border-radius: 3px; border-radius: 3px; } +.right .logtags .tagtag a:hover,.logtags .tagtag a{ + color: #ffffff; +} .right .logtags .tagtag a:hover,.logtags .tagtag a:hover{ text-decoration: none; + color: #ffffff; +} +.right .logbooks .bookbook,.logbooks .bookbook { + padding: 1px 3px 2px; + background-color: #46A546; + font-size: 9.75px; + font-weight: bold; + color: #ffffff; + text-transform: uppercase; + white-space: nowrap; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.right .logbooks .bookbook,.logbooks .bookbook a{ + color: #ffffff; +} +.right .logbooks .bookbook,.logbooks .bookbook a:hover{ + text-decoration: none; + color: #ffffff; } div.browserblock { overflow: hidden;
--- a/rhodecode/templates/base/base.html Thu Dec 01 03:11:26 2011 +0200 +++ b/rhodecode/templates/base/base.html Fri Dec 02 00:15:26 2011 +0200 @@ -63,8 +63,7 @@ </li> %if c.rhodecode_user.username != 'default': <li> - <a href="${h.url('journal')}">${_('Journal')}</a> - ##(${c.unread_journal} + <a href="${h.url('journal')}">${_('Journal')}</a> </li> %endif %if c.rhodecode_user.username == 'default':
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/templates/bookmarks/bookmarks.html Fri Dec 02 00:15:26 2011 +0200 @@ -0,0 +1,40 @@ +## -*- coding: utf-8 -*- +<%inherit file="/base/base.html"/> + +<%def name="title()"> + ${c.repo_name} ${_('Bookmarks')} - ${c.rhodecode_name} +</%def> + + +<%def name="breadcrumbs_links()"> + <input class="q_filter_box" id="q_filter_bookmarks" size="15" type="text" name="filter" value="${_('quick filter...')}"/> + ${h.link_to(u'Home',h.url('/'))} + » + ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} + » + ${_('bookmarks')} +</%def> + +<%def name="page_nav()"> + ${self.menu('bookmarks')} +</%def> +<%def name="main()"> +<div class="box"> + <!-- box / title --> + <div class="title"> + ${self.breadcrumbs()} + </div> + <!-- end box / title --> + <div class="table"> + <%include file='bookmarks_data.html'/> + </div> +</div> +<script type="text/javascript"> +var nodes = YUQ('div.table tr td .logtags .tagtag a'); +var target = 'q_filter_bookmarks'; +var func = function(node){ + return node.parentNode.parentNode.parentNode.parentNode; +} +q_filter(target,nodes,func); +</script> +</%def> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/templates/bookmarks/bookmarks_data.html Fri Dec 02 00:15:26 2011 +0200 @@ -0,0 +1,33 @@ +%if c.repo_bookmarks: + <table> + <tr> + <th class="left">${_('date')}</th> + <th class="left">${_('name')}</th> + <th class="left">${_('author')}</th> + <th class="left">${_('revision')}</th> + <th class="left">${_('links')}</th> + </tr> + %for cnt,book in enumerate(c.repo_bookmarks.items()): + <tr class="parity${cnt%2}"> + <td><span class="tooltip" title="${h.age(book[1].date)}"> + ${book[1].date}</span> + </td> + <td> + <span class="logbooks"> + <span class="bookbook">${h.link_to(book[0], + h.url('changeset_home',repo_name=c.repo_name,revision=book[1].raw_id))}</span> + </span> + </td> + <td title="${book[1].author}">${h.person(book[1].author)}</td> + <td>r${book[1].revision}:${h.short_id(book[1].raw_id)}</td> + <td class="nowrap"> + ${h.link_to(_('changeset'),h.url('changeset_home',repo_name=c.repo_name,revision=book[1].raw_id),class_="ui-button-small xsmall")} + <span style="color:#515151">|</span> + ${h.link_to(_('files'),h.url('files_home',repo_name=c.repo_name,revision=book[1].raw_id),class_="ui-button-small xsmall")} + </td> + </tr> + %endfor + </table> +%else: + ${_('There are no bookmarks yet')} +%endif \ No newline at end of file
--- a/rhodecode/templates/journal/journal.html Thu Dec 01 03:11:26 2011 +0200 +++ b/rhodecode/templates/journal/journal.html Fri Dec 02 00:15:26 2011 +0200 @@ -17,7 +17,7 @@ <h5>${_('Journal')}</h5> <ul class="links"> <li> - <span><a href="#"><img id="refresh" class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/> + <span><a id="refresh" href="${h.url('journal')}"><img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/> </a></span> </li> </ul> @@ -170,7 +170,7 @@ YUE.preventDefault(e); }) YUE.on('refresh','click',function(e){ - ypjax(e.target.href,"journal",function(){show_more_event();tooltip_activate();}); + ypjax(e.currentTarget.href,"journal",function(){show_more_event();tooltip_activate();}); YUE.preventDefault(e); }) </script>
--- a/rhodecode/templates/summary/summary.html Thu Dec 01 03:11:26 2011 +0200 +++ b/rhodecode/templates/summary/summary.html Fri Dec 02 00:15:26 2011 +0200 @@ -118,23 +118,10 @@ <div class="field"> <div class="label-summary"> - <label>${_('Last change')}:</label> - </div> - <div class="input ${summary(c.show_stats)}"> - <b>${'r%s:%s' % (h.get_changeset_safe(c.rhodecode_repo,'tip').revision, - h.get_changeset_safe(c.rhodecode_repo,'tip').short_id)}</b> - - <span class="tooltip" title="${c.rhodecode_repo.last_change}"> - ${h.age(c.rhodecode_repo.last_change)}</span> - ${_('by')} ${h.get_changeset_safe(c.rhodecode_repo,'tip').author} - </div> - </div> - - <div class="field"> - <div class="label-summary"> <label>${_('Clone url')}:</label> </div> <div class="input ${summary(c.show_stats)}"> - <input type="text" id="clone_url" readonly="readonly" value="${c.rhodecode_repo.alias} clone ${c.clone_repo_url}" size="70"/> + <input type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}" size="70"/> </div> </div>
--- a/rhodecode/templates/switch_to_list.html Thu Dec 01 03:11:26 2011 +0200 +++ b/rhodecode/templates/switch_to_list.html Fri Dec 02 00:15:26 2011 +0200 @@ -22,4 +22,16 @@ <li>${h.link_to(_('There are no tags yet'),'#')}</li> %endif </ul> +</li> +<li> + ${h.link_to('%s (%s)' % (_('bookmarks'),len(c.rhodecode_repo.bookmarks.values()),),h.url('bookmarks_home',repo_name=c.repo_name),class_='bookmarks childs')} + <ul> + %if c.rhodecode_repo.bookmarks.values(): + %for cnt,book in enumerate(c.rhodecode_repo.bookmarks.items()): + <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> + %endfor + %else: + <li>${h.link_to(_('There are no bookmarks yet'),'#')}</li> + %endif + </ul> </li> \ No newline at end of file