##// END OF EJS Templates
created pull-request overview
marcink -
r2395:b262e349 codereview
parent child Browse files
Show More
@@ -0,0 +1,23 b''
1 ## Changesets table !
2 <div class="container">
3 <table class="compare_view_commits noborder">
4 %if not c.cs_ranges:
5 <tr><td>${_('No changesets')}</td></tr>
6 %else:
7 %for cnt, cs in enumerate(c.cs_ranges):
8 <tr>
9 <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),14)}"/></div></td>
10 <td>
11 %if cs.raw_id in c.statuses:
12 <div title="${c.statuses[cs.raw_id][1]}" class="changeset-status-ico"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cs.raw_id][0])}" /></div>
13 %endif
14 </td>
15 <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
16 <td><div class="author">${h.person(cs.author)}</div></td>
17 <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
18 <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}</div></td>
19 </tr>
20 %endfor
21 %endif
22 </table>
23 </div> No newline at end of file
@@ -120,7 +120,8 b' class CompareController(BaseRepoControll'
120
120
121 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
121 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
122 c.cs_ranges])
122 c.cs_ranges])
123
123 if request.environ.get('HTTP_X_PARTIAL_XHR'):
124 return render('compare/compare_cs.html')
124
125
125 c.org_ref = org_ref[1]
126 c.org_ref = org_ref[1]
126 c.other_ref = other_ref[1]
127 c.other_ref = other_ref[1]
@@ -31,7 +31,7 b' from pylons.i18n.translation import _'
31
31
32 from rhodecode.lib.base import BaseRepoController, render
32 from rhodecode.lib.base import BaseRepoController, render
33 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
33 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
34 from webob.exc import HTTPNotFound
34 from rhodecode.model.db import User
35
35
36 log = logging.getLogger(__name__)
36 log = logging.getLogger(__name__)
37
37
@@ -44,12 +44,15 b' class PullrequestsController(BaseRepoCon'
44 def __before__(self):
44 def __before__(self):
45 super(PullrequestsController, self).__before__()
45 super(PullrequestsController, self).__before__()
46
46
47 def _get_repo_refs(self,repo):
47 def _get_repo_refs(self, repo):
48 hist_l = []
48 hist_l = []
49
49
50 branches_group = ([(k, k) for k in repo.branches.keys()], _("Branches"))
50 branches_group = ([('branch:' + k, k) for k in repo.branches.keys()],
51 bookmarks_group = ([(k, k) for k in repo.bookmarks.keys()], _("Bookmarks"))
51 _("Branches"))
52 tags_group = ([(k, k) for k in repo.tags.keys()], _("Tags"))
52 bookmarks_group = ([('book:' + k, k) for k in repo.bookmarks.keys()],
53 _("Bookmarks"))
54 tags_group = ([('tag:' + k, k) for k in repo.tags.keys()],
55 _("Tags"))
53
56
54 hist_l.append(bookmarks_group)
57 hist_l.append(bookmarks_group)
55 hist_l.append(branches_group)
58 hist_l.append(branches_group)
@@ -58,8 +61,30 b' class PullrequestsController(BaseRepoCon'
58 return hist_l
61 return hist_l
59
62
60 def index(self):
63 def index(self):
64 org_repo = c.rhodecode_db_repo
61 c.org_refs = self._get_repo_refs(c.rhodecode_repo)
65 c.org_refs = self._get_repo_refs(c.rhodecode_repo)
62 c.sources = []
66 c.org_repos = []
63 c.sources.append('%s/%s' % (c.rhodecode_db_repo.user.username,
67 c.other_repos = []
64 c.repo_name))
68 c.org_repos.append((org_repo.repo_name, '%s/%s' % (
69 org_repo.user.username, c.repo_name))
70 )
71
72 c.other_refs = c.org_refs
73 c.other_repos.extend(c.org_repos)
74
75 #gather forks and add to this list
76 for fork in org_repo.forks:
77 c.other_repos.append((fork.repo_name, '%s/%s' % (
78 fork.user.username, fork.repo_name))
79 )
80 #add parents of this fork also
81 c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % (
82 org_repo.parent.user.username,
83 org_repo.parent.repo_name))
84 )
85
86 #TODO: maybe the owner should be default ?
87 c.review_members = []
88 c.available_members = [(x.user_id, x.username) for x in
89 User.query().filter(User.username != 'default').all()]
65 return render('/pullrequests/pullrequest.html')
90 return render('/pullrequests/pullrequest.html')
@@ -603,6 +603,20 b' class Repository(Base, BaseModel):'
603 return q.one().ui_value
603 return q.one().ui_value
604
604
605 @property
605 @property
606 def forks(self):
607 """
608 Return forks of this repo
609 """
610 return Repository.get_repo_forks(self.repo_id)
611
612 @property
613 def parent(self):
614 """
615 Returns fork parent
616 """
617 return self.fork
618
619 @property
606 def just_name(self):
620 def just_name(self):
607 return self.repo_name.split(Repository.url_sep())[-1]
621 return self.repo_name.split(Repository.url_sep())[-1]
608
622
@@ -33,24 +33,11 b''
33 </div>
33 </div>
34 </div>
34 </div>
35 <div id="changeset_compare_view_content">
35 <div id="changeset_compare_view_content">
36 <div class="container">
36 ##CS
37 <table class="compare_view_commits noborder">
37 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Changesets')}</div>
38 %for cnt, cs in enumerate(c.cs_ranges):
38 <%include file="compare_cs.html" />
39 <tr>
39
40 <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),14)}"/></div></td>
40 ## FILES
41 <td>
42 %if cs.raw_id in c.statuses:
43 <div title="${c.statuses[cs.raw_id][1]}" class="changeset-status-ico"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cs.raw_id][0])}" /></div>
44 %endif
45 </td>
46 <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
47 <td><div class="author">${h.person(cs.author)}</div></td>
48 <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
49 <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}</div></td>
50 </tr>
51 %endfor
52 </table>
53 </div>
54 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
41 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
55 <div class="cs_files">
42 <div class="cs_files">
56 %for fid, change, f, stat in c.files:
43 %for fid, change, f, stat in c.files:
@@ -19,7 +19,8 b''
19 <div class="title">
19 <div class="title">
20 ${self.breadcrumbs()}
20 ${self.breadcrumbs()}
21 </div>
21 </div>
22 <div style="padding:30px">
22 ${h.form(url('#'),method='put', id='pull_request_form')}
23 <div style="float:left;padding:30px">
23 ##ORG
24 ##ORG
24 <div style="float:left">
25 <div style="float:left">
25 <div class="fork_user">
26 <div class="fork_user">
@@ -27,14 +28,14 b''
27 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/>
28 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/>
28 </div>
29 </div>
29 <span style="font-size: 20px">
30 <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 ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref','',c.org_refs,class_='refs')}
31 </span>
32 </span>
32 <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div>
33 <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div>
33 </div>
34 </div>
34 <div style="clear:both;padding-top: 10px"></div>
35 <div style="clear:both;padding-top: 10px"></div>
35 </div>
36 </div>
36 <div style="float:left;font-size:24px;padding:0px 20px">
37 <div style="float:left;font-size:24px;padding:0px 20px">
37 <img src="${h.url('/images/arrow_right_64.png')}"/>
38 <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/>
38 </div>
39 </div>
39
40
40 ##OTHER, most Probably the PARENT OF THIS FORK
41 ##OTHER, most Probably the PARENT OF THIS FORK
@@ -44,16 +45,65 b''
44 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/>
45 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_db_repo.user.email,24)}"/>
45 </div>
46 </div>
46 <span style="font-size: 20px">
47 <span style="font-size: 20px">
47 ${h.select('orther','',c.sources)}:${h.select('other_ref','',c.org_refs)}
48 ${h.select('other_repo','',c.other_repos,class_='refs')}:${h.select('other_ref','',c.other_refs,class_='refs')}
48 </span>
49 </span>
49 <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div>
50 <div style="padding:5px 3px 3px 42px;">${c.rhodecode_db_repo.description}</div>
50 </div>
51 </div>
51 <div style="clear:both;padding-top: 10px"></div>
52 <div style="clear:both;padding-top: 10px"></div>
52 </div>
53 </div>
54 <div style="float:left;padding:5px 5px 5px 15px">
55 <span>
56 <a id="refresh" href="#">
57 <img class="icon" title="${_('Refresh')}" alt="${_('Refresh')}" src="${h.url('/images/icons/arrow_refresh.png')}"/>
58 ${_('refresh overview')}
59 </a>
60 </span>
61 </div>
62 <div style="clear:both;padding-top: 10px"></div>
63 <div style="float:left" id="pull_request_overview">
64 </div>
53 </div>
65 </div>
54
66 <div style="float:left; border-left:1px dashed #eee">
55 <h3>${_('New pull request')} from USER:REF into PARENT:REF</h3>
67 <h4>${_('Pull request reviewers')}</h4>
56 ${h.form(url('#'),method='put')}
68 <div id="reviewers" style="padding:0px 0px 0px 15px">
69 ##TODO: make this nicer :)
70 <table class="table noborder">
71 <tr>
72 <td>
73 <div>
74 <div style="float:left">
75 <div class="text" style="padding: 0px 0px 6px;">${_('Choosen reviewers')}</div>
76 ${h.select('review_members',[x[0] for x in c.review_members],c.review_members,multiple=True,size=8,style="min-width:210px")}
77 <div id="remove_all_elements" style="cursor:pointer;text-align:center">
78 ${_('Remove all elements')}
79 <img alt="remove" style="vertical-align:text-bottom" src="${h.url('/images/icons/arrow_right.png')}"/>
80 </div>
81 </div>
82 <div style="float:left;width:20px;padding-top:50px">
83 <img alt="add" id="add_element"
84 style="padding:2px;cursor:pointer"
85 src="${h.url('/images/icons/arrow_left.png')}"/>
86 <br />
87 <img alt="remove" id="remove_element"
88 style="padding:2px;cursor:pointer"
89 src="${h.url('/images/icons/arrow_right.png')}"/>
90 </div>
91 <div style="float:left">
92 <div class="text" style="padding: 0px 0px 6px;">${_('Available reviewers')}</div>
93 ${h.select('available_members',[],c.available_members,multiple=True,size=8,style="min-width:210px")}
94 <div id="add_all_elements" style="cursor:pointer;text-align:center">
95 <img alt="add" style="vertical-align:text-bottom" src="${h.url('/images/icons/arrow_left.png')}"/>
96 ${_('Add all elements')}
97 </div>
98 </div>
99 </div>
100 </td>
101 </tr>
102 </table>
103 </div>
104 </div>
105 <h3>${_('Create new pull request')}</h3>
106
57 <div class="form">
107 <div class="form">
58 <!-- fields -->
108 <!-- fields -->
59
109
@@ -85,7 +135,51 b''
85 </div>
135 </div>
86 ${h.end_form()}
136 ${h.end_form()}
87
137
88
89 </div>
138 </div>
90
139
140 <script type="text/javascript">
141 MultiSelectWidget('review_members','available_members','pull_request_form');
142
143 var loadPreview = function(){
144 var url = "${h.url('compare_url',
145 repo_name='org_repo',
146 org_ref_type='branch', org_ref='org_ref',
147 other_ref_type='branch', other_ref='other_ref',
148 repo='other_repo')}";
149
150 var select_refs = YUQ('#pull_request_form select.refs')
151
152 for(var i=0;i<select_refs.length;i++){
153 var select_ref = select_refs[i];
154 var select_ref_data = select_ref.value.split(':');
155 var key = null;
156 var val = null;
157 if(select_ref_data.length>1){
158 key = select_ref.name+"_type";
159 val = select_ref_data[0];
160 url = url.replace(key,val);
161
162 key = select_ref.name;
163 val = select_ref_data[1];
164 url = url.replace(key,val);
165
166 }else{
167 key = select_ref.name;
168 val = select_ref.value;
169 url = url.replace(key,val);
170 }
171 }
172
173 ypjax(url,'pull_request_overview', function(data){})
174 }
175 YUE.on('refresh','click',function(e){
176 loadPreview()
177 })
178
179 //lazy load after 0.5
180
181 setTimeout(loadPreview,500)
182
183 </script>
184
91 </%def>
185 </%def>
General Comments 0
You need to be logged in to leave comments. Login now