annotate rhodecode/templates/pullrequests/pullrequest.html @ 3512:ff3f10a6a203 beta

pullrequest: just replace children of other_ref when other_repo changes We were inserting a full select statement as innerHTML of a select and would thus get nested select statements. IE did not render that correctly ... and other browsers did strange things. Instead we now create a in memory DOM object and move the optgroups. After appending children to the selector we have to set selectedIndex on all browsers.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 07 Mar 2013 19:00:28 +0100
parents 2053053e0882
children a2a61978752f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 <%inherit file="/base/base.html"/>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 <%def name="title()">
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
4 ${c.repo_name} ${_('New pull request')}
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 </%def>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 <%def name="breadcrumbs_links()">
2492
79818f546538 i18n 'Home' in breadcrumbs
Takumi IINO <trot.thunder@gmail.com>
parents: 2434
diff changeset
8 ${h.link_to(_(u'Home'),h.url('/'))}
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 &raquo;
3392
f74be3359044 unified breadcrumbs display
Marcin Kuzminski <marcin@python-works.com>
parents: 3388
diff changeset
10 ${h.repo_link(c.rhodecode_db_repo.groups_and_repo)}
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 &raquo;
3392
f74be3359044 unified breadcrumbs display
Marcin Kuzminski <marcin@python-works.com>
parents: 3388
diff changeset
12 ${_('new pull request')}
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 </%def>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 <%def name="main()">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 <div class="box">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 <!-- box / title -->
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 <div class="title">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 ${self.breadcrumbs()}
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 </div>
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
22 ${h.form(url('pullrequest', repo_name=c.repo_name), method='post', id='pull_request_form')}
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
23 <div style="float:left;padding:0px 30px 30px 30px">
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 ##ORG
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 <div style="float:left">
3330
dcd1c159a132 pull request: don't show fake path with owner names - and owner avatars is also not relevant
Mads Kiilerich <madski@unity3d.com>
parents: 3329
diff changeset
26 <div>
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 <span style="font-size: 20px">
3329
f8c55b487c9a pull request: select 'tip' by default ... and show what it means right now
Mads Kiilerich <madski@unity3d.com>
parents: 3327
diff changeset
28 ${h.select('org_repo','',c.org_repos,class_='refs')}:${h.select('org_ref',c.default_org_ref,c.org_refs,class_='refs')}
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 </span>
3430
bbe21df7ad48 notifications changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3392
diff changeset
30 <div style="padding:5px 3px 3px 20px;">${c.rhodecode_db_repo.description}</div>
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 <div style="clear:both;padding-top: 10px"></div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 <div style="float:left;font-size:24px;padding:0px 20px">
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
35 <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/>
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 </div>
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
37
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 ##OTHER, most Probably the PARENT OF THIS FORK
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39 <div style="float:left">
3330
dcd1c159a132 pull request: don't show fake path with owner names - and owner avatars is also not relevant
Mads Kiilerich <madski@unity3d.com>
parents: 3329
diff changeset
40 <div>
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 <span style="font-size: 20px">
3327
f285faa3a602 pull request: move code around and rename default variables
Mads Kiilerich <madski@unity3d.com>
parents: 3326
diff changeset
42 ${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')}
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 </span>
3430
bbe21df7ad48 notifications changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3392
diff changeset
44 <div id="other_repo_desc" style="padding:5px 3px 3px 20px;"></div>
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 <div style="clear:both;padding-top: 10px"></div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 </div>
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
48 <div style="clear:both;padding-top: 10px"></div>
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
49 ## overview pulled by ajax
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
50 <div style="float:left" id="pull_request_overview"></div>
2396
51e3d60fed2f added link for detailed overview in pull-request form
Marcin Kuzminski <marcin@python-works.com>
parents: 2395
diff changeset
51 <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none">
51e3d60fed2f added link for detailed overview in pull-request form
Marcin Kuzminski <marcin@python-works.com>
parents: 2395
diff changeset
52 <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a>
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
53 </div>
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
54 </div>
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
55 <div style="float:left; border-left:1px dashed #eee">
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
56 <h4>${_('Pull request reviewers')}</h4>
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
57 <div id="reviewers" style="padding:0px 0px 0px 15px">
2612
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
58 ## members goes here !
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
59 <div class="group_members_wrap">
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
60 <ul id="review_members" class="group_members">
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
61 %for member in c.review_members:
2613
ad3573d744ef added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents: 2612
diff changeset
62 <li id="reviewer_${member.user_id}">
ad3573d744ef added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents: 2612
diff changeset
63 <div class="reviewers_member">
ad3573d744ef added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents: 2612
diff changeset
64 <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
ad3573d744ef added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents: 2612
diff changeset
65 <div style="float:left">${member.full_name} (${_('owner')})</div>
ad3573d744ef added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents: 2612
diff changeset
66 <input type="hidden" value="${member.user_id}" name="review_members" />
3388
cb40b3f6428c review members are dynamically changed based on selected other_repo owner
Marcin Kuzminski <marcin@python-works.com>
parents: 3380
diff changeset
67 <span class="delete_icon action_button" onclick="removeReviewMember(${member.user_id})"></span>
2613
ad3573d744ef added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents: 2612
diff changeset
68 </div>
ad3573d744ef added option to remove members added using autocomplete widget from pull
Marcin Kuzminski <marcin@python-works.com>
parents: 2612
diff changeset
69 </li>
2612
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
70 %endfor
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
71 </ul>
2673
d5e42c00f3c1 white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2613
diff changeset
72 </div>
d5e42c00f3c1 white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2613
diff changeset
73
2612
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
74 <div class='ac'>
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
75 <div class="reviewer_ac">
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
76 ${h.text('user', class_='yui-ac-input')}
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
77 <span class="help-block">${_('Add reviewer to this pull request.')}</span>
2673
d5e42c00f3c1 white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2613
diff changeset
78 <div id="reviewers_container"></div>
2612
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
79 </div>
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
80 </div>
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
81 </div>
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
82 </div>
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
83 <h3>${_('Create new pull request')}</h3>
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
84
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
85 <div class="form">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
86 <!-- fields -->
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
87
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
88 <div class="fields">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
89
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
90 <div class="field">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
91 <div class="label">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
92 <label for="pullrequest_title">${_('Title')}:</label>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
93 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
94 <div class="input">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
95 ${h.text('pullrequest_title',size=30)}
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
96 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
97 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
98
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
99 <div class="field">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
100 <div class="label label-textarea">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
101 <label for="pullrequest_desc">${_('description')}:</label>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
102 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
103 <div class="textarea text-area editor">
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
104 ${h.textarea('pullrequest_desc',size=30)}
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
105 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
106 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
107
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
108 <div class="buttons">
2607
7ae36df760ce removed deprecated ui-button
Marcin Kuzminski <marcin@python-works.com>
parents: 2541
diff changeset
109 ${h.submit('save',_('Send pull request'),class_="ui-btn large")}
7ae36df760ce removed deprecated ui-button
Marcin Kuzminski <marcin@python-works.com>
parents: 2541
diff changeset
110 ${h.reset('reset',_('Reset'),class_="ui-btn large")}
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
111 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
112 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
113 </div>
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
114 ${h.end_form()}
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
115
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
116 </div>
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
117
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
118 <script type="text/javascript">
2612
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
119 var _USERS_AC_DATA = ${c.users_array|n};
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
120 var _GROUPS_AC_DATA = ${c.users_groups_array|n};
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
121 PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
9364776d1331 Added autocomplete widget for pull request reviewers, in exchange of 90s style
Marcin Kuzminski <marcin@python-works.com>
parents: 2607
diff changeset
122
2541
1c2ba03c42b4 Added dynamic data loading for other repo we open pull request against
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
123 var other_repos_info = ${c.other_repos_info|n};
2907
0b86972de820 white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2892
diff changeset
124
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
125 var loadPreview = function(){
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
126 YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','none');
3321
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
127 //url template
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
128 var url = "${h.url('compare_url',
3322
c9b0f1d363c7 compare: swap org and other when they refer to different repos, ie are pull request style
Mads Kiilerich <madski@unity3d.com>
parents: 3321
diff changeset
129 repo_name='__other_repo__',
c9b0f1d363c7 compare: swap org and other when they refer to different repos, ie are pull request style
Mads Kiilerich <madski@unity3d.com>
parents: 3321
diff changeset
130 org_ref_type='__other_ref_type__',
c9b0f1d363c7 compare: swap org and other when they refer to different repos, ie are pull request style
Mads Kiilerich <madski@unity3d.com>
parents: 3321
diff changeset
131 org_ref='__other_ref__',
c9b0f1d363c7 compare: swap org and other when they refer to different repos, ie are pull request style
Mads Kiilerich <madski@unity3d.com>
parents: 3321
diff changeset
132 other_repo='__org_repo__',
c9b0f1d363c7 compare: swap org and other when they refer to different repos, ie are pull request style
Mads Kiilerich <madski@unity3d.com>
parents: 3321
diff changeset
133 other_ref_type='__org_ref_type__',
c9b0f1d363c7 compare: swap org and other when they refer to different repos, ie are pull request style
Mads Kiilerich <madski@unity3d.com>
parents: 3321
diff changeset
134 other_ref='__org_ref__',
3304
70309536c143 compare and diff: remove unused "bundle" functionality
Mads Kiilerich <madski@unity3d.com>
parents: 3197
diff changeset
135 as_form=True,
3486
2053053e0882 compare/pullrequest: introduce merge parameter
Mads Kiilerich <madski@unity3d.com>
parents: 3484
diff changeset
136 merge=True,
3484
75e563531350 compare: drop unused rev_start and rev_end
Mads Kiilerich <madski@unity3d.com>
parents: 3449
diff changeset
137 )}";
3321
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
138 var org_repo = YUQ('#pull_request_form #org_repo')[0].value;
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
139 var org_ref = YUQ('#pull_request_form #org_ref')[0].value.split(':');
3338
cfc0fef66ddd whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 3330
diff changeset
140
3321
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
141 var other_repo = YUQ('#pull_request_form #other_repo')[0].value;
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
142 var other_ref = YUQ('#pull_request_form #other_ref')[0].value.split(':');
3338
cfc0fef66ddd whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 3330
diff changeset
143
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
144 var select_refs = YUQ('#pull_request_form select.refs')
3321
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
145 var rev_data = {
3441
c4bb2b22110e pullrequests: use stable revisions in compare urls instead of bookmark/branch/tag
Mads Kiilerich <madski@unity3d.com>
parents: 3439
diff changeset
146 'org_repo': org_repo,
c4bb2b22110e pullrequests: use stable revisions in compare urls instead of bookmark/branch/tag
Mads Kiilerich <madski@unity3d.com>
parents: 3439
diff changeset
147 'org_ref': org_ref[2],
c4bb2b22110e pullrequests: use stable revisions in compare urls instead of bookmark/branch/tag
Mads Kiilerich <madski@unity3d.com>
parents: 3439
diff changeset
148 'org_ref_type': 'rev',
c4bb2b22110e pullrequests: use stable revisions in compare urls instead of bookmark/branch/tag
Mads Kiilerich <madski@unity3d.com>
parents: 3439
diff changeset
149 'other_repo': other_repo,
c4bb2b22110e pullrequests: use stable revisions in compare urls instead of bookmark/branch/tag
Mads Kiilerich <madski@unity3d.com>
parents: 3439
diff changeset
150 'other_ref': other_ref[2],
c4bb2b22110e pullrequests: use stable revisions in compare urls instead of bookmark/branch/tag
Mads Kiilerich <madski@unity3d.com>
parents: 3439
diff changeset
151 'other_ref_type': 'rev',
3321
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
152 }; // gather the org/other ref and repo here
3338
cfc0fef66ddd whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 3330
diff changeset
153
3321
a91fa221a3b8 be more explicit about constructing compare url
Marcin Kuzminski <marcin@python-works.com>
parents: 3317
diff changeset
154 for (k in rev_data){
3449
95a226b35b91 codecleaner, fix tabs -> spaces
Marcin Kuzminski <marcin@python-works.com>
parents: 3441
diff changeset
155 url = url.replace('__'+k+'__',rev_data[k]);
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
156 }
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
157
3438
cf3c2fce197e pullrequest: show 'loading' while waiting for compare_url to load
Mads Kiilerich <madski@unity3d.com>
parents: 3430
diff changeset
158 YUD.get('pull_request_overview').innerHTML = "${_('Loading ...')}";
3439
0153f5514aa3 pullrequest: show 'details' link immediately - don't wait for changeset list
Mads Kiilerich <madski@unity3d.com>
parents: 3438
diff changeset
159 YUD.get('pull_request_overview_url').href = url; // shouldn't have as_form ... but ...
0153f5514aa3 pullrequest: show 'details' link immediately - don't wait for changeset list
Mads Kiilerich <madski@unity3d.com>
parents: 3438
diff changeset
160 YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','');
2396
51e3d60fed2f added link for detailed overview in pull-request form
Marcin Kuzminski <marcin@python-works.com>
parents: 2395
diff changeset
161 ypjax(url,'pull_request_overview', function(data){
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
162 var sel_box = YUQ('#pull_request_form #other_repo')[0];
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
163 var repo_name = sel_box.options[sel_box.selectedIndex].value;
3512
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
164 YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
165 // replace options of other_ref with the ones for the current other_repo
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
166 var other_ref_selector = YUD.get('other_ref');
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
167 var new_select = YUD.createElementFromMarkup(other_repos_info[repo_name]['revs']);
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
168 var new_selectedIndex = new_select.selectedIndex;
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
169 other_ref_selector.innerHTML = ""; // clear old options
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
170 while (new_select.length > 0){ // children will be popped when appened to other_ref_selector
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
171 other_ref_selector.appendChild(new_select.children[0]);
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
172 }
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
173 // browsers lost track of selected when appendChild was used
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
174 other_ref_selector.selectedIndex = new_selectedIndex;
ff3f10a6a203 pullrequest: just replace children of other_ref when other_repo changes
Mads Kiilerich <madski@unity3d.com>
parents: 3486
diff changeset
175 // reset && add the reviewer based on selected repo
3388
cb40b3f6428c review members are dynamically changed based on selected other_repo owner
Marcin Kuzminski <marcin@python-works.com>
parents: 3380
diff changeset
176 var _data = other_repos_info[repo_name];
cb40b3f6428c review members are dynamically changed based on selected other_repo owner
Marcin Kuzminski <marcin@python-works.com>
parents: 3380
diff changeset
177 YUD.get('review_members').innerHTML = '';
cb40b3f6428c review members are dynamically changed based on selected other_repo owner
Marcin Kuzminski <marcin@python-works.com>
parents: 3380
diff changeset
178 addReviewMember(_data.user.user_id, _data.user.firstname,
3449
95a226b35b91 codecleaner, fix tabs -> spaces
Marcin Kuzminski <marcin@python-works.com>
parents: 3441
diff changeset
179 _data.user.lastname, _data.user.username,
95a226b35b91 codecleaner, fix tabs -> spaces
Marcin Kuzminski <marcin@python-works.com>
parents: 3441
diff changeset
180 _data.user.gravatar_link);
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
181 })
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
182 }
3325
c5dde6b5e976 pull request: only bind action to other_repo change once
Mads Kiilerich <madski@unity3d.com>
parents: 3322
diff changeset
183
3326
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
184 ## refresh automatically when something changes (org_repo can't change)
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
185
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
186 YUE.on('org_ref', 'change', function(e){
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
187 loadPreview();
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
188 });
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
189
3325
c5dde6b5e976 pull request: only bind action to other_repo change once
Mads Kiilerich <madski@unity3d.com>
parents: 3322
diff changeset
190 YUE.on('other_repo', 'change', function(e){
c5dde6b5e976 pull request: only bind action to other_repo change once
Mads Kiilerich <madski@unity3d.com>
parents: 3322
diff changeset
191 var repo_name = e.currentTarget.value;
3326
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
192 loadPreview();
3325
c5dde6b5e976 pull request: only bind action to other_repo change once
Mads Kiilerich <madski@unity3d.com>
parents: 3322
diff changeset
193 });
c5dde6b5e976 pull request: only bind action to other_repo change once
Mads Kiilerich <madski@unity3d.com>
parents: 3322
diff changeset
194
3326
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
195 YUE.on('other_ref', 'change', function(e){
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
196 loadPreview();
5ef64956c385 pull request: update changeset list automatically - remove refresh icon
Mads Kiilerich <madski@unity3d.com>
parents: 3325
diff changeset
197 });
2434
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
198
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
199 //lazy load overview after 0.5s
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
200 setTimeout(loadPreview, 500)
f29469677319 Added basic models for saving open pull requests
Marcin Kuzminski <marcin@python-works.com>
parents: 2396
diff changeset
201
2395
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
202 </script>
b262e349a7a5 created pull-request overview
Marcin Kuzminski <marcin@python-works.com>
parents: 2244
diff changeset
203
2244
77e376fdc4c6 pull requests draft UI
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
204 </%def>