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