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