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