Show More
@@ -0,0 +1,65 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | """ | |||
|
3 | rhodecode.controllers.pullrequests | |||
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||
|
5 | ||||
|
6 | pull requests controller for rhodecode for initializing pull requests | |||
|
7 | ||||
|
8 | :created_on: May 7, 2012 | |||
|
9 | :author: marcink | |||
|
10 | :copyright: (C) 2010-2012 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 | import traceback | |||
|
27 | ||||
|
28 | from pylons import request, response, session, tmpl_context as c, url | |||
|
29 | from pylons.controllers.util import abort, redirect | |||
|
30 | from pylons.i18n.translation import _ | |||
|
31 | ||||
|
32 | from rhodecode.lib.base import BaseRepoController, render | |||
|
33 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |||
|
34 | from webob.exc import HTTPNotFound | |||
|
35 | ||||
|
36 | log = logging.getLogger(__name__) | |||
|
37 | ||||
|
38 | ||||
|
39 | class PullrequestsController(BaseRepoController): | |||
|
40 | ||||
|
41 | @LoginRequired() | |||
|
42 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |||
|
43 | 'repository.admin') | |||
|
44 | def __before__(self): | |||
|
45 | super(PullrequestsController, self).__before__() | |||
|
46 | ||||
|
47 | def _get_repo_refs(self,repo): | |||
|
48 | hist_l = [] | |||
|
49 | ||||
|
50 | branches_group = ([(k, k) for k in repo.branches.keys()], _("Branches")) | |||
|
51 | bookmarks_group = ([(k, k) for k in repo.bookmarks.keys()], _("Bookmarks")) | |||
|
52 | tags_group = ([(k, k) for k in repo.tags.keys()], _("Tags")) | |||
|
53 | ||||
|
54 | hist_l.append(bookmarks_group) | |||
|
55 | hist_l.append(branches_group) | |||
|
56 | hist_l.append(tags_group) | |||
|
57 | ||||
|
58 | return hist_l | |||
|
59 | ||||
|
60 | def index(self): | |||
|
61 | c.org_refs = self._get_repo_refs(c.rhodecode_repo) | |||
|
62 | c.sources = [] | |||
|
63 | c.sources.append('%s/%s' % (c.rhodecode_db_repo.user.username, | |||
|
64 | c.repo_name)) | |||
|
65 | return render('/pullrequests/pullrequest.html') |
@@ -0,0 +1,91 b'' | |||||
|
1 | <%inherit file="/base/base.html"/> | |||
|
2 | ||||
|
3 | <%def name="title()"> | |||
|
4 | ${c.repo_name} ${_('Pull request')} | |||
|
5 | </%def> | |||
|
6 | ||||
|
7 | <%def name="breadcrumbs_links()"> | |||
|
8 | ${h.link_to(u'Home',h.url('/'))} | |||
|
9 | » | |||
|
10 | ${h.link_to(c.repo_name,h.url('changelog_home',repo_name=c.repo_name))} | |||
|
11 | » | |||
|
12 | ${_('Pull request')} | |||
|
13 | </%def> | |||
|
14 | ||||
|
15 | <%def name="main()"> | |||
|
16 | ||||
|
17 | <div class="box"> | |||
|
18 | <!-- box / title --> | |||
|
19 | <div class="title"> | |||
|
20 | ${self.breadcrumbs()} | |||
|
21 | </div> | |||
|
22 | <div style="padding:30px"> | |||
|
23 | ##ORG | |||
|
24 | <div style="float:left"> | |||
|
25 | <div class="fork_user"> | |||
|
26 | <div class="gravatar"> | |||
|
27 | <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> | |||
|
28 | </div> | |||
|
29 | <span style="font-size: 20px"> | |||
|
30 | ${h.select('other','',['%s/%s' % (c.rhodecode_db_repo.user.username,c.repo_name)])}:${h.select('other_ref','',c.org_refs)} | |||
|
31 | </span> | |||
|
32 | <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> | |||
|
33 | </div> | |||
|
34 | <div style="clear:both;padding-top: 10px"></div> | |||
|
35 | </div> | |||
|
36 | <div style="float:left;font-size:24px;padding:0px 20px"> | |||
|
37 | <img src="${h.url('/images/arrow_right_64.png')}"/> | |||
|
38 | </div> | |||
|
39 | ||||
|
40 | ##OTHER, most Probably the PARENT OF THIS FORK | |||
|
41 | <div style="float:left"> | |||
|
42 | <div class="fork_user"> | |||
|
43 | <div class="gravatar"> | |||
|
44 | <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/> | |||
|
45 | </div> | |||
|
46 | <span style="font-size: 20px"> | |||
|
47 | ${h.select('orther','',c.sources)}:${h.select('other_ref','',c.org_refs)} | |||
|
48 | </span> | |||
|
49 | <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div> | |||
|
50 | </div> | |||
|
51 | <div style="clear:both;padding-top: 10px"></div> | |||
|
52 | </div> | |||
|
53 | </div> | |||
|
54 | ||||
|
55 | <h3>${_('New pull request')} from USER:REF into PARENT:REF</h3> | |||
|
56 | ${h.form(url('#'),method='put')} | |||
|
57 | <div class="form"> | |||
|
58 | <!-- fields --> | |||
|
59 | ||||
|
60 | <div class="fields"> | |||
|
61 | ||||
|
62 | <div class="field"> | |||
|
63 | <div class="label"> | |||
|
64 | <label for="pullrequest_title">${_('Title')}:</label> | |||
|
65 | </div> | |||
|
66 | <div class="input"> | |||
|
67 | ${h.text('pullrequest_title',size=30)} | |||
|
68 | </div> | |||
|
69 | </div> | |||
|
70 | ||||
|
71 | <div class="field"> | |||
|
72 | <div class="label label-textarea"> | |||
|
73 | <label for="pullrequest_desc">${_('description')}:</label> | |||
|
74 | </div> | |||
|
75 | <div class="textarea text-area editor"> | |||
|
76 | ${h.textarea('pullrequest_desc',size=30)} | |||
|
77 | </div> | |||
|
78 | </div> | |||
|
79 | ||||
|
80 | <div class="buttons"> | |||
|
81 | ${h.submit('save',_('Send pull request'),class_="ui-button")} | |||
|
82 | ${h.reset('reset',_('Reset'),class_="ui-button")} | |||
|
83 | </div> | |||
|
84 | </div> | |||
|
85 | </div> | |||
|
86 | ${h.end_form()} | |||
|
87 | ||||
|
88 | ||||
|
89 | </div> | |||
|
90 | ||||
|
91 | </%def> |
@@ -0,0 +1,7 b'' | |||||
|
1 | from rhodecode.tests import * | |||
|
2 | ||||
|
3 | class TestPullrequestsController(TestController): | |||
|
4 | ||||
|
5 | def test_index(self): | |||
|
6 | response = self.app.get(url(controller='pullrequests', action='index')) | |||
|
7 | # Test response... |
@@ -417,6 +417,11 b' def make_map(config):' | |||||
417 | controller='compare', action='index', |
|
417 | controller='compare', action='index', | |
418 | conditions=dict(function=check_repo)) |
|
418 | conditions=dict(function=check_repo)) | |
419 |
|
419 | |||
|
420 | rmap.connect('pullrequest_home', | |||
|
421 | '/{repo_name:.*}/pull-request/new', | |||
|
422 | controller='pullrequests', action='index', | |||
|
423 | conditions=dict(function=check_repo)) | |||
|
424 | ||||
420 | rmap.connect('summary_home', '/{repo_name:.*}/summary', |
|
425 | rmap.connect('summary_home', '/{repo_name:.*}/summary', | |
421 | controller='summary', conditions=dict(function=check_repo)) |
|
426 | controller='summary', conditions=dict(function=check_repo)) | |
422 |
|
427 |
@@ -1281,6 +1281,7 b' class Notification(Base, BaseModel):' | |||||
1281 | TYPE_MESSAGE = u'message' |
|
1281 | TYPE_MESSAGE = u'message' | |
1282 | TYPE_MENTION = u'mention' |
|
1282 | TYPE_MENTION = u'mention' | |
1283 | TYPE_REGISTRATION = u'registration' |
|
1283 | TYPE_REGISTRATION = u'registration' | |
|
1284 | TYPE_PULL_REQUEST = u'pull_request' | |||
1284 |
|
1285 | |||
1285 | notification_id = Column('notification_id', Integer(), nullable=False, primary_key=True) |
|
1286 | notification_id = Column('notification_id', Integer(), nullable=False, primary_key=True) | |
1286 | subject = Column('subject', Unicode(512), nullable=True) |
|
1287 | subject = Column('subject', Unicode(512), nullable=True) |
@@ -25,6 +25,10 b'' | |||||
25 | ##</ul> |
|
25 | ##</ul> | |
26 | </div> |
|
26 | </div> | |
27 | %if c.notifications: |
|
27 | %if c.notifications: | |
|
28 | <div style="padding:14px 18px;text-align: right;float:left"> | |||
|
29 | <span id='all' class="ui-btn">${_('All')}</span> | |||
|
30 | <span id='pull_request' class="ui-btn">${_('Pull requests')}</span> | |||
|
31 | </div> | |||
28 | <div style="padding:14px 18px;text-align: right;float:right"> |
|
32 | <div style="padding:14px 18px;text-align: right;float:right"> | |
29 | <span id='mark_all_read' class="ui-btn">${_('Mark all read')}</span> |
|
33 | <span id='mark_all_read' class="ui-btn">${_('Mark all read')}</span> | |
30 | </div> |
|
34 | </div> |
@@ -31,6 +31,7 b'' | |||||
31 | <canvas id="graph_canvas"></canvas> |
|
31 | <canvas id="graph_canvas"></canvas> | |
32 | </div> |
|
32 | </div> | |
33 | <div id="graph_content"> |
|
33 | <div id="graph_content"> | |
|
34 | <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> | |||
34 | <div class="container_header"> |
|
35 | <div class="container_header"> | |
35 | ${h.form(h.url.current(),method='get')} |
|
36 | ${h.form(h.url.current(),method='get')} | |
36 | <div class="info_box" style="float:left"> |
|
37 | <div class="info_box" style="float:left"> |
@@ -1,7 +1,7 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | <li class="qfilter_rs"> |
|
3 | <li class="qfilter_rs"> | |
4 |
<input type="text" style="border:0" value="quick filter..." name="filter" size=" |
|
4 | <input type="text" style="border:0" value="quick filter..." name="filter" size="25" id="q_filter_rs" /> | |
5 | </li> |
|
5 | </li> | |
6 |
|
6 | |||
7 | %for repo in c.repos_list: |
|
7 | %for repo in c.repos_list: |
General Comments 0
You need to be logged in to leave comments.
Login now