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