Show More
@@ -1,209 +1,229 | |||||
1 | <%inherit file="/base/base.html"/> |
|
1 | <%inherit file="/base/base.html"/> | |
2 |
|
2 | |||
3 | <%def name="title()"> |
|
3 | <%def name="title()"> | |
4 | ${c.repo_name} ${_('New pull request')} |
|
4 | ${c.repo_name} ${_('New pull request')} | |
5 | </%def> |
|
5 | </%def> | |
6 |
|
6 | |||
7 | <%def name="breadcrumbs_links()"> |
|
7 | <%def name="breadcrumbs_links()"> | |
8 | ${_('New pull request')} |
|
8 | ${_('New pull request')} | |
9 | </%def> |
|
9 | </%def> | |
10 |
|
10 | |||
11 | <%def name="page_nav()"> |
|
11 | <%def name="page_nav()"> | |
12 | ${self.menu('repositories')} |
|
12 | ${self.menu('repositories')} | |
13 | </%def> |
|
13 | </%def> | |
14 |
|
14 | |||
15 | <%def name="main()"> |
|
15 | <%def name="main()"> | |
16 | ${self.context_bar('showpullrequest')} |
|
16 | ${self.context_bar('showpullrequest')} | |
17 | <div class="box"> |
|
17 | <div class="box"> | |
18 | <!-- box / title --> |
|
18 | <!-- box / title --> | |
19 | <div class="title"> |
|
19 | <div class="title"> | |
20 | ${self.breadcrumbs()} |
|
20 | ${self.breadcrumbs()} | |
21 | </div> |
|
21 | </div> | |
22 | ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')} |
|
|||
23 | <div style="float:left;padding:0px 30px 30px 30px"> |
|
|||
24 | ##ORG |
|
|||
25 | <div style="float:left"> |
|
|||
26 | <div> |
|
|||
27 | <span style="font-size: 20px"> |
|
|||
28 | ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')} |
|
|||
29 | </span> |
|
|||
30 | <div style="padding:5px 3px 3px 20px;">${c.rhodecode_db_repo.description}</div> |
|
|||
31 | </div> |
|
|||
32 | <div style="clear:both;padding-top: 10px"></div> |
|
|||
33 | </div> |
|
|||
34 | <div style="float:left;font-size:24px;padding:0px 20px"> |
|
|||
35 | <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/> |
|
|||
36 | </div> |
|
|||
37 |
|
22 | |||
38 | ##OTHER, most Probably the PARENT OF THIS FORK |
|
23 | ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')} | |
39 | <div style="float:left"> |
|
|||
40 | <div> |
|
|||
41 | <span style="font-size: 20px"> |
|
|||
42 | ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${c.default_other_repo_info['revs']} |
|
|||
43 | </span> |
|
|||
44 | <div id="other_repo_desc" style="padding:5px 3px 3px 20px;"></div> |
|
|||
45 | </div> |
|
|||
46 | <div style="clear:both;padding-top: 10px"></div> |
|
|||
47 | </div> |
|
|||
48 | <div style="clear:both;padding-top: 10px"></div> |
|
|||
49 | ## overview pulled by ajax |
|
|||
50 | <div style="float:left" id="pull_request_overview"></div> |
|
|||
51 | <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none"> |
|
|||
52 | <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a> |
|
|||
53 | </div> |
|
|||
54 | </div> |
|
|||
55 | <div style="float:left; border-left:1px dashed #eee"> |
|
|||
56 | <h4>${_('Pull request reviewers')}</h4> |
|
|||
57 | <div id="reviewers" style="padding:0px 0px 0px 15px"> |
|
|||
58 | ## members goes here ! |
|
|||
59 | <div class="group_members_wrap"> |
|
|||
60 | <ul id="review_members" class="group_members"> |
|
|||
61 | %for member in [c.default_other_repo_info['user']]: |
|
|||
62 | <li id="reviewer_${member['user_id']}"> |
|
|||
63 | <div class="reviewers_member"> |
|
|||
64 | <div class="gravatar"><img alt="gravatar" src="${member['gravatar_link']}"/> </div> |
|
|||
65 | <div style="float:left">${member['firstname']} ${member['lastname']} (${_('owner')})</div> |
|
|||
66 | <input type="hidden" value="${member['user_id']}" name="review_members" /> |
|
|||
67 | <span class="delete_icon action_button" onclick="removeReviewMember(${member['user_id']})"></span> |
|
|||
68 | </div> |
|
|||
69 | </li> |
|
|||
70 | %endfor |
|
|||
71 | </ul> |
|
|||
72 | </div> |
|
|||
73 |
|
24 | |||
74 | <div class='ac'> |
|
|||
75 | <div class="reviewer_ac"> |
|
|||
76 | ${h.text('user', class_='yui-ac-input')} |
|
|||
77 | <span class="help-block">${_('Add reviewer to this pull request.')}</span> |
|
|||
78 | <div id="reviewers_container"></div> |
|
|||
79 | </div> |
|
|||
80 | </div> |
|
|||
81 | </div> |
|
|||
82 | </div> |
|
|||
83 | <h3>${_('Create new pull request')}</h3> |
|
25 | <h3>${_('Create new pull request')}</h3> | |
84 |
|
26 | |||
85 | <div class="form"> |
|
27 | <div class="form"> | |
86 | <!-- fields --> |
|
28 | <!-- fields --> | |
87 |
|
29 | |||
88 | <div class="fields"> |
|
30 | <div class="fields" style="float:left;width:50%;padding-right:30px;"> | |
89 |
|
31 | |||
90 | <div class="field"> |
|
32 | <div class="field"> | |
91 | <div class="label"> |
|
33 | <div class="label"> | |
92 | <label for="pullrequest_title">${_('Title')}:</label> |
|
34 | <label for="pullrequest_title">${_('Title')}:</label> | |
93 | </div> |
|
35 | </div> | |
94 | <div class="input"> |
|
36 | <div class="input"> | |
95 | ${h.text('pullrequest_title',size=30)} |
|
37 | ${h.text('pullrequest_title',size=30)} | |
96 | </div> |
|
38 | </div> | |
97 | </div> |
|
39 | </div> | |
98 |
|
40 | |||
99 | <div class="field"> |
|
41 | <div class="field"> | |
100 | <div class="label label-textarea"> |
|
42 | <div class="label label-textarea"> | |
101 | <label for="pullrequest_desc">${_('Description')}:</label> |
|
43 | <label for="pullrequest_desc">${_('Description')}:</label> | |
102 | </div> |
|
44 | </div> | |
103 | <div class="textarea text-area editor"> |
|
45 | <div class="textarea text-area editor"> | |
104 | ${h.textarea('pullrequest_desc',size=30)} |
|
46 | ${h.textarea('pullrequest_desc',size=30)} | |
105 | </div> |
|
47 | </div> | |
106 | </div> |
|
48 | </div> | |
107 |
|
49 | |||
108 |
<div class=" |
|
50 | <div class="field"> | |
109 | ${h.submit('save',_('Send pull request'),class_="ui-btn large")} |
|
51 | <div class="label label-textarea"> | |
110 | ${h.reset('reset',_('Reset'),class_="ui-btn large")} |
|
52 | <label for="pullrequest_desc">${_('Changeset flow')}:</label> | |
|
53 | </div> | |||
|
54 | <div class="input"> | |||
|
55 | ##ORG | |||
|
56 | <div style="float:left"> | |||
|
57 | <div> | |||
|
58 | <span style="font-size: 20px"> | |||
|
59 | ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')} | |||
|
60 | </span> | |||
|
61 | <div style="padding:5px 3px 3px 20px;">${c.rhodecode_db_repo.description}</div> | |||
|
62 | </div> | |||
|
63 | </div> | |||
|
64 | <div style="float:left;font-size:24px;padding:0px 20px"> | |||
|
65 | <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/> | |||
|
66 | </div> | |||
|
67 | ||||
|
68 | ##OTHER, most Probably the PARENT OF THIS FORK | |||
|
69 | <div style="float:left"> | |||
|
70 | <div> | |||
|
71 | <span style="font-size: 20px"> | |||
|
72 | ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${c.default_other_repo_info['revs']} | |||
|
73 | </span> | |||
|
74 | <div id="other_repo_desc" style="padding:5px 3px 3px 20px;"></div> | |||
|
75 | </div> | |||
|
76 | </div> | |||
|
77 | <div style="clear:both"></div> | |||
|
78 | </div> | |||
|
79 | </div> | |||
|
80 | ||||
|
81 | <div class="field"> | |||
|
82 | <div class="buttons"> | |||
|
83 | ${h.submit('save',_('Send pull request'),class_="ui-btn large")} | |||
|
84 | ${h.reset('reset',_('Reset'),class_="ui-btn large")} | |||
|
85 | </div> | |||
|
86 | </div> | |||
|
87 | ||||
|
88 | </div> | |||
|
89 | ||||
|
90 | ## Reviewers | |||
|
91 | <div style="float:left; border-left:1px dashed #eee"> | |||
|
92 | <h4>${_('Pull request reviewers')}</h4> | |||
|
93 | <div id="reviewers" style="padding:0px 0px 0px 15px"> | |||
|
94 | ## members goes here ! | |||
|
95 | <div class="group_members_wrap"> | |||
|
96 | <ul id="review_members" class="group_members"> | |||
|
97 | %for member in [c.default_other_repo_info['user']]: | |||
|
98 | <li id="reviewer_${member['user_id']}"> | |||
|
99 | <div class="reviewers_member"> | |||
|
100 | <div class="gravatar"><img alt="gravatar" src="${member['gravatar_link']}"/> </div> | |||
|
101 | <div style="float:left">${member['firstname']} ${member['lastname']} (${_('owner')})</div> | |||
|
102 | <input type="hidden" value="${member['user_id']}" name="review_members" /> | |||
|
103 | <span class="delete_icon action_button" onclick="removeReviewMember(${member['user_id']})"></span> | |||
|
104 | </div> | |||
|
105 | </li> | |||
|
106 | %endfor | |||
|
107 | </ul> | |||
|
108 | </div> | |||
|
109 | ||||
|
110 | <div class='ac'> | |||
|
111 | <div class="reviewer_ac"> | |||
|
112 | ${h.text('user', class_='yui-ac-input')} | |||
|
113 | <span class="help-block">${_('Add reviewer to this pull request.')}</span> | |||
|
114 | <div id="reviewers_container"></div> | |||
|
115 | </div> | |||
|
116 | </div> | |||
|
117 | </div> | |||
|
118 | </div> | |||
|
119 | ||||
|
120 | <div style="clear:both;padding: 0 0 30px 0;"></div> | |||
|
121 | ||||
|
122 | <h4>${_('Changesets')}</h4> | |||
|
123 | <div style="float:left;padding:0px 30px 30px 30px"> | |||
|
124 | ## overview pulled by ajax | |||
|
125 | <div style="float:left" id="pull_request_overview"></div> | |||
|
126 | <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none"> | |||
|
127 | <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a> | |||
111 | </div> |
|
128 | </div> | |
112 | </div> |
|
129 | </div> | |
|
130 | <div style="clear:both;"></div> | |||
|
131 | ||||
113 | </div> |
|
132 | </div> | |
|
133 | ||||
114 | ${h.end_form()} |
|
134 | ${h.end_form()} | |
115 |
|
135 | |||
116 | </div> |
|
136 | </div> | |
117 |
|
137 | |||
118 | <script type="text/javascript"> |
|
138 | <script type="text/javascript"> | |
119 | var _USERS_AC_DATA = ${c.users_array|n}; |
|
139 | var _USERS_AC_DATA = ${c.users_array|n}; | |
120 | var _GROUPS_AC_DATA = ${c.users_groups_array|n}; |
|
140 | var _GROUPS_AC_DATA = ${c.users_groups_array|n}; | |
121 | PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA); |
|
141 | PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA); | |
122 |
|
142 | |||
123 | var other_repos_info = ${c.other_repos_info|n}; |
|
143 | var other_repos_info = ${c.other_repos_info|n}; | |
124 |
|
144 | |||
125 | var otherrepoChanged = function(){ |
|
145 | var otherrepoChanged = function(){ | |
126 | var sel_box = YUQ('#pull_request_form #other_repo')[0]; |
|
146 | var sel_box = YUQ('#pull_request_form #other_repo')[0]; | |
127 | var repo_name = sel_box.options[sel_box.selectedIndex].value; |
|
147 | var repo_name = sel_box.options[sel_box.selectedIndex].value; | |
128 |
|
148 | |||
129 | YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description']; |
|
149 | YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description']; | |
130 | // replace options of other_ref with the ones for the current other_repo |
|
150 | // replace options of other_ref with the ones for the current other_repo | |
131 | var other_ref_selector = YUD.get('other_ref'); |
|
151 | var other_ref_selector = YUD.get('other_ref'); | |
132 | var new_select = YUD.createElementFromMarkup(other_repos_info[repo_name]['revs']); |
|
152 | var new_select = YUD.createElementFromMarkup(other_repos_info[repo_name]['revs']); | |
133 | var new_selectedIndex = new_select.selectedIndex; |
|
153 | var new_selectedIndex = new_select.selectedIndex; | |
134 | other_ref_selector.innerHTML = ""; // clear old options |
|
154 | other_ref_selector.innerHTML = ""; // clear old options | |
135 | while (new_select.length > 0){ // children will be popped when appened to other_ref_selector |
|
155 | while (new_select.length > 0){ // children will be popped when appened to other_ref_selector | |
136 | other_ref_selector.appendChild(new_select.children[0]); |
|
156 | other_ref_selector.appendChild(new_select.children[0]); | |
137 | } |
|
157 | } | |
138 | // browsers lost track of selected when appendChild was used |
|
158 | // browsers lost track of selected when appendChild was used | |
139 | other_ref_selector.selectedIndex = new_selectedIndex; |
|
159 | other_ref_selector.selectedIndex = new_selectedIndex; | |
140 |
|
160 | |||
141 | // reset && add the reviewer based on selected repo |
|
161 | // reset && add the reviewer based on selected repo | |
142 | var _data = other_repos_info[repo_name]; |
|
162 | var _data = other_repos_info[repo_name]; | |
143 | YUD.get('review_members').innerHTML = ''; |
|
163 | YUD.get('review_members').innerHTML = ''; | |
144 | addReviewMember(_data.user.user_id, _data.user.firstname, |
|
164 | addReviewMember(_data.user.user_id, _data.user.firstname, | |
145 | _data.user.lastname, _data.user.username, |
|
165 | _data.user.lastname, _data.user.username, | |
146 | _data.user.gravatar_link); |
|
166 | _data.user.gravatar_link); | |
147 | } |
|
167 | } | |
148 |
|
168 | |||
149 | var loadPreview = function(){ |
|
169 | var loadPreview = function(){ | |
150 | //url template |
|
170 | //url template | |
151 | var url = "${h.url('compare_url', |
|
171 | var url = "${h.url('compare_url', | |
152 | repo_name='__other_repo__', |
|
172 | repo_name='__other_repo__', | |
153 | org_ref_type='__other_ref_type__', |
|
173 | org_ref_type='__other_ref_type__', | |
154 | org_ref='__other_ref__', |
|
174 | org_ref='__other_ref__', | |
155 | other_repo='__org_repo__', |
|
175 | other_repo='__org_repo__', | |
156 | other_ref_type='__org_ref_type__', |
|
176 | other_ref_type='__org_ref_type__', | |
157 | other_ref='__org_ref__', |
|
177 | other_ref='__org_ref__', | |
158 | as_form=True, |
|
178 | as_form=True, | |
159 | merge=True, |
|
179 | merge=True, | |
160 | )}"; |
|
180 | )}"; | |
161 | var org_repo = YUQ('#pull_request_form #org_repo')[0].value; |
|
181 | var org_repo = YUQ('#pull_request_form #org_repo')[0].value; | |
162 | var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':'); |
|
182 | var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':'); | |
163 |
|
183 | |||
164 | var other_repo = YUQ('#pull_request_form #other_repo')[0].value; |
|
184 | var other_repo = YUQ('#pull_request_form #other_repo')[0].value; | |
165 | var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':'); |
|
185 | var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':'); | |
166 |
|
186 | |||
167 | var select_refs = YUQ('#pull_request_form select.refs') |
|
187 | var select_refs = YUQ('#pull_request_form select.refs') | |
168 | var rev_data = { |
|
188 | var rev_data = { | |
169 | 'org_repo': org_repo, |
|
189 | 'org_repo': org_repo, | |
170 | 'org_ref': org_ref[2], |
|
190 | 'org_ref': org_ref[2], | |
171 | 'org_ref_type': 'rev', |
|
191 | 'org_ref_type': 'rev', | |
172 | 'other_repo': other_repo, |
|
192 | 'other_repo': other_repo, | |
173 | 'other_ref': other_ref[2], |
|
193 | 'other_ref': other_ref[2], | |
174 | 'other_ref_type': 'rev', |
|
194 | 'other_ref_type': 'rev', | |
175 | }; // gather the org/other ref and repo here |
|
195 | }; // gather the org/other ref and repo here | |
176 |
|
196 | |||
177 | for (k in rev_data){ |
|
197 | for (k in rev_data){ | |
178 | url = url.replace('__'+k+'__',rev_data[k]); |
|
198 | url = url.replace('__'+k+'__',rev_data[k]); | |
179 | } |
|
199 | } | |
180 |
|
200 | |||
181 | YUD.get('pull_request_overview').innerHTML = "${_('Loading ...')}"; |
|
201 | YUD.get('pull_request_overview').innerHTML = "${_('Loading ...')}"; | |
182 | ypjax(url,'pull_request_overview'); |
|
202 | ypjax(url,'pull_request_overview'); | |
183 |
|
203 | |||
184 | YUD.get('pull_request_overview_url').href = url; // shouldn't have as_form ... but ... |
|
204 | YUD.get('pull_request_overview_url').href = url; // shouldn't have as_form ... but ... | |
185 | YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display',''); |
|
205 | YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display',''); | |
186 | } |
|
206 | } | |
187 |
|
207 | |||
188 | ## refresh automatically when something changes (org_repo can't change) |
|
208 | ## refresh automatically when something changes (org_repo can't change) | |
189 |
|
209 | |||
190 | YUE.on('org_ref', 'change', function(e){ |
|
210 | YUE.on('org_ref', 'change', function(e){ | |
191 | loadPreview(); |
|
211 | loadPreview(); | |
192 | }); |
|
212 | }); | |
193 |
|
213 | |||
194 | YUE.on('other_repo', 'change', function(e){ |
|
214 | YUE.on('other_repo', 'change', function(e){ | |
195 | otherrepoChanged(); |
|
215 | otherrepoChanged(); | |
196 | loadPreview(); |
|
216 | loadPreview(); | |
197 | }); |
|
217 | }); | |
198 |
|
218 | |||
199 | YUE.on('other_ref', 'change', function(e){ |
|
219 | YUE.on('other_ref', 'change', function(e){ | |
200 | loadPreview(); |
|
220 | loadPreview(); | |
201 | }); |
|
221 | }); | |
202 |
|
222 | |||
203 | otherrepoChanged(); |
|
223 | otherrepoChanged(); | |
204 | //lazy load overview after 0.5s |
|
224 | //lazy load overview after 0.5s | |
205 | setTimeout(loadPreview, 500); |
|
225 | setTimeout(loadPreview, 500); | |
206 |
|
226 | |||
207 | </script> |
|
227 | </script> | |
208 |
|
228 | |||
209 | </%def> |
|
229 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now