Mercurial > kallithea
changeset 2244:77e376fdc4c6 codereview
pull requests draft UI
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 08 May 2012 02:04:28 +0200 |
parents | f6cdfc730831 |
children | 2d35bbff7c35 |
files | rhodecode/config/routing.py rhodecode/controllers/pullrequests.py rhodecode/model/db.py rhodecode/templates/admin/notifications/notifications.html rhodecode/templates/changelog/changelog.html rhodecode/templates/pullrequests/pullrequest.html rhodecode/templates/repo_switcher_list.html rhodecode/tests/functional/test_pullrequests.py |
diffstat | 8 files changed, 175 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/config/routing.py Mon May 07 22:51:26 2012 +0200 +++ b/rhodecode/config/routing.py Tue May 08 02:04:28 2012 +0200 @@ -417,6 +417,11 @@ controller='compare', action='index', conditions=dict(function=check_repo)) + rmap.connect('pullrequest_home', + '/{repo_name:.*}/pull-request/new', + controller='pullrequests', action='index', + conditions=dict(function=check_repo)) + rmap.connect('summary_home', '/{repo_name:.*}/summary', controller='summary', conditions=dict(function=check_repo))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/controllers/pullrequests.py Tue May 08 02:04:28 2012 +0200 @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +""" + rhodecode.controllers.pullrequests + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + pull requests controller for rhodecode for initializing pull requests + + :created_on: May 7, 2012 + :author: marcink + :copyright: (C) 2010-2012 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 +import traceback + +from pylons import request, response, session, tmpl_context as c, url +from pylons.controllers.util import abort, redirect +from pylons.i18n.translation import _ + +from rhodecode.lib.base import BaseRepoController, render +from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator +from webob.exc import HTTPNotFound + +log = logging.getLogger(__name__) + + +class PullrequestsController(BaseRepoController): + + @LoginRequired() + @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', + 'repository.admin') + def __before__(self): + super(PullrequestsController, self).__before__() + + def _get_repo_refs(self,repo): + hist_l = [] + + branches_group = ([(k, k) for k in repo.branches.keys()], _("Branches")) + bookmarks_group = ([(k, k) for k in repo.bookmarks.keys()], _("Bookmarks")) + tags_group = ([(k, k) for k in repo.tags.keys()], _("Tags")) + + hist_l.append(bookmarks_group) + hist_l.append(branches_group) + hist_l.append(tags_group) + + return hist_l + + def index(self): + c.org_refs = self._get_repo_refs(c.rhodecode_repo) + c.sources = [] + c.sources.append('%s/%s' % (c.rhodecode_db_repo.user.username, + c.repo_name)) + return render('/pullrequests/pullrequest.html')
--- a/rhodecode/model/db.py Mon May 07 22:51:26 2012 +0200 +++ b/rhodecode/model/db.py Tue May 08 02:04:28 2012 +0200 @@ -1281,6 +1281,7 @@ TYPE_MESSAGE = u'message' TYPE_MENTION = u'mention' TYPE_REGISTRATION = u'registration' + TYPE_PULL_REQUEST = u'pull_request' notification_id = Column('notification_id', Integer(), nullable=False, primary_key=True) subject = Column('subject', Unicode(512), nullable=True)
--- a/rhodecode/templates/admin/notifications/notifications.html Mon May 07 22:51:26 2012 +0200 +++ b/rhodecode/templates/admin/notifications/notifications.html Tue May 08 02:04:28 2012 +0200 @@ -25,6 +25,10 @@ ##</ul> </div> %if c.notifications: + <div style="padding:14px 18px;text-align: right;float:left"> + <span id='all' class="ui-btn">${_('All')}</span> + <span id='pull_request' class="ui-btn">${_('Pull requests')}</span> + </div> <div style="padding:14px 18px;text-align: right;float:right"> <span id='mark_all_read' class="ui-btn">${_('Mark all read')}</span> </div>
--- a/rhodecode/templates/changelog/changelog.html Mon May 07 22:51:26 2012 +0200 +++ b/rhodecode/templates/changelog/changelog.html Tue May 08 02:04:28 2012 +0200 @@ -31,6 +31,7 @@ <canvas id="graph_canvas"></canvas> </div> <div id="graph_content"> + <div class="info_box" style="clear: both;padding: 10px 6px;vertical-align: right;text-align: right;"><a href="${h.url('pullrequest_home',repo_name=c.repo_name)}" class="ui-btn small">${_('Open new pull request')}</a></div> <div class="container_header"> ${h.form(h.url.current(),method='get')} <div class="info_box" style="float:left">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/templates/pullrequests/pullrequest.html Tue May 08 02:04:28 2012 +0200 @@ -0,0 +1,91 @@ +<%inherit file="/base/base.html"/> + +<%def name="title()"> + ${c.repo_name} ${_('Pull request')} +</%def> + +<%def name="breadcrumbs_links()"> + ${h.link_to(u'Home',h.url('/'))} + » + ${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))} + » + ${_('Pull request')} +</%def> + +<%def name="main()"> + +<div class="box"> + <!-- box / title --> + <div class="title"> + ${self.breadcrumbs()} + </div> + <div style="padding:30px"> + ##ORG + <div style="float:left"> + <div class="fork_user"> + <div class="gravatar"> + <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> + </div> + <span style="font-size: 20px"> + ${h.select('other','',['%s/%s' % (c.rhodecode_db_repo.user.username,c.repo_name)])}:${h.select('other_ref','',c.org_refs)} + </span> + <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> + </div> + <div style="clear:both;padding-top: 10px"></div> + </div> + <div style="float:left;font-size:24px;padding:0px 20px"> + <img src="${h.url('/images/arrow_right_64.png')}"/> + </div> + + ##OTHER, most Probably the PARENT OF THIS FORK + <div style="float:left"> + <div class="fork_user"> + <div class="gravatar"> + <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> + </div> + <span style="font-size: 20px"> + ${h.select('orther','',c.sources)}:${h.select('other_ref','',c.org_refs)} + </span> + <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> + </div> + <div style="clear:both;padding-top: 10px"></div> + </div> + </div> + + <h3>${_('New pull request')} from USER:REF into PARENT:REF</h3> + ${h.form(url('#'),method='put')} + <div class="form"> + <!-- fields --> + + <div class="fields"> + + <div class="field"> + <div class="label"> + <label for="pullrequest_title">${_('Title')}:</label> + </div> + <div class="input"> + ${h.text('pullrequest_title',size=30)} + </div> + </div> + + <div class="field"> + <div class="label label-textarea"> + <label for="pullrequest_desc">${_('description')}:</label> + </div> + <div class="textarea text-area editor"> + ${h.textarea('pullrequest_desc',size=30)} + </div> + </div> + + <div class="buttons"> + ${h.submit('save',_('Send pull request'),class_="ui-button")} + ${h.reset('reset',_('Reset'),class_="ui-button")} + </div> + </div> + </div> + ${h.end_form()} + + +</div> + +</%def>
--- a/rhodecode/templates/repo_switcher_list.html Mon May 07 22:51:26 2012 +0200 +++ b/rhodecode/templates/repo_switcher_list.html Tue May 08 02:04:28 2012 +0200 @@ -1,7 +1,7 @@ ## -*- coding: utf-8 -*- <li class="qfilter_rs"> - <input type="text" style="border:0" value="quick filter..." name="filter" size="15" id="q_filter_rs" /> + <input type="text" style="border:0" value="quick filter..." name="filter" size="25" id="q_filter_rs" /> </li> %for repo in c.repos_list:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/tests/functional/test_pullrequests.py Tue May 08 02:04:28 2012 +0200 @@ -0,0 +1,7 @@ +from rhodecode.tests import * + +class TestPullrequestsController(TestController): + + def test_index(self): + response = self.app.get(url(controller='pullrequests', action='index')) + # Test response...