Show More
@@ -1,252 +1,252 b'' | |||||
1 | <%inherit file="/base/base.html"/> |
|
1 | <%inherit file="/base/base.html"/> | |
2 |
|
2 | |||
3 | <%def name="title()"> |
|
3 | <%def name="title()"> | |
4 | ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)} · ${c.rhodecode_name} |
|
4 | ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)} · ${c.rhodecode_name} | |
5 | </%def> |
|
5 | </%def> | |
6 |
|
6 | |||
7 | <%def name="breadcrumbs_links()"> |
|
7 | <%def name="breadcrumbs_links()"> | |
8 | ${_('Pull request #%s') % c.pull_request.pull_request_id} |
|
8 | ${_('Pull request #%s') % c.pull_request.pull_request_id} | |
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 | <h3 class="${'closed' if c.pull_request.is_closed() else ''}"> |
|
23 | <h3 class="${'closed' if c.pull_request.is_closed() else ''}"> | |
24 |
|
|
24 | <img src="${h.url('/images/icons/flag_status_%s.png' % str(c.pull_request.last_review_status))}" /> | |
25 |
|
|
25 | ${_('Title')}: ${c.pull_request.title} | |
26 |
|
|
26 | %if c.pull_request.is_closed(): | |
27 |
|
|
27 | (${_('Closed')}) | |
28 |
|
|
28 | %endif | |
29 | </h3> |
|
29 | </h3> | |
30 |
|
30 | |||
31 | <div class="form"> |
|
31 | <div class="form"> | |
32 | <div id="summary" class="fields"> |
|
32 | <div id="summary" class="fields"> | |
33 | <div class="field"> |
|
33 | <div class="field"> | |
34 | <div class="label-summary"> |
|
34 | <div class="label-summary"> | |
35 | <label>${_('Review status')}:</label> |
|
35 | <label>${_('Review status')}:</label> | |
36 | </div> |
|
36 | </div> | |
37 | <div class="input"> |
|
37 | <div class="input"> | |
38 | <div class="changeset-status-container" style="float:none;clear:both"> |
|
38 | <div class="changeset-status-container" style="float:none;clear:both"> | |
39 | %if c.current_changeset_status: |
|
39 | %if c.current_changeset_status: | |
40 | <div title="${_('Pull request status')}" class="changeset-status-lbl"> |
|
40 | <div title="${_('Pull request status')}" class="changeset-status-lbl"> | |
41 |
|
|
41 | %if c.pull_request.is_closed(): | |
42 |
|
|
42 | ${_('Closed')}, | |
43 | %endif |
|
43 | %endif | |
44 | ${h.changeset_status_lbl(c.current_changeset_status)} |
|
44 | ${h.changeset_status_lbl(c.current_changeset_status)} | |
45 | </div> |
|
45 | </div> | |
46 | <div class="changeset-status-ico" style="padding:1px 4px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" /></div> |
|
46 | <div class="changeset-status-ico" style="padding:1px 4px"><img src="${h.url('/images/icons/flag_status_%s.png' % c.current_changeset_status)}" /></div> | |
47 | %endif |
|
47 | %endif | |
48 | </div> |
|
48 | </div> | |
49 | </div> |
|
49 | </div> | |
50 | </div> |
|
50 | </div> | |
51 | <div class="field"> |
|
51 | <div class="field"> | |
52 | <div class="label-summary"> |
|
52 | <div class="label-summary"> | |
53 | <label>${_('Still not reviewed by')}:</label> |
|
53 | <label>${_('Still not reviewed by')}:</label> | |
54 | </div> |
|
54 | </div> | |
55 | <div class="input"> |
|
55 | <div class="input"> | |
56 | % if len(c.pull_request_pending_reviewers) > 0: |
|
56 | % if len(c.pull_request_pending_reviewers) > 0: | |
57 | <div class="tooltip" title="${h.tooltip(','.join([x.username for x in c.pull_request_pending_reviewers]))}">${ungettext('%d reviewer', '%d reviewers',len(c.pull_request_pending_reviewers)) % len(c.pull_request_pending_reviewers)}</div> |
|
57 | <div class="tooltip" title="${h.tooltip(','.join([x.username for x in c.pull_request_pending_reviewers]))}">${ungettext('%d reviewer', '%d reviewers',len(c.pull_request_pending_reviewers)) % len(c.pull_request_pending_reviewers)}</div> | |
58 | %else: |
|
58 | %else: | |
59 | <div>${_('Pull request was reviewed by all reviewers')}</div> |
|
59 | <div>${_('Pull request was reviewed by all reviewers')}</div> | |
60 | %endif |
|
60 | %endif | |
61 | </div> |
|
61 | </div> | |
62 | </div> |
|
62 | </div> | |
63 | <div class="field"> |
|
63 | <div class="field"> | |
64 | <div class="label-summary"> |
|
64 | <div class="label-summary"> | |
65 | <label>${_('Origin repository')}:</label> |
|
65 | <label>${_('Origin repository')}:</label> | |
66 | </div> |
|
66 | </div> | |
67 | <div class="input"> |
|
67 | <div class="input"> | |
68 | <div> |
|
68 | <div> | |
69 | ##%if h.is_hg(c.pull_request.org_repo): |
|
69 | ##%if h.is_hg(c.pull_request.org_repo): | |
70 | ## <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> |
|
70 | ## <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> | |
71 | ##%elif h.is_git(c.pull_request.org_repo): |
|
71 | ##%elif h.is_git(c.pull_request.org_repo): | |
72 | ## <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> |
|
72 | ## <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> | |
73 | ##%endif |
|
73 | ##%endif | |
74 | <span class="spantag">${c.pull_request.org_ref_parts[0]}: ${c.pull_request.org_ref_parts[1]}</span> |
|
74 | <span class="spantag">${c.pull_request.org_ref_parts[0]}: ${c.pull_request.org_ref_parts[1]}</span> | |
75 | <span><a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name)}">${c.pull_request.org_repo.clone_url()}</a></span> |
|
75 | <span><a href="${h.url('summary_home', repo_name=c.pull_request.org_repo.repo_name)}">${c.pull_request.org_repo.clone_url()}</a></span> | |
76 | </div> |
|
76 | </div> | |
77 | </div> |
|
77 | </div> | |
78 | </div> |
|
78 | </div> | |
79 | <div class="field"> |
|
79 | <div class="field"> | |
80 | <div class="label-summary"> |
|
80 | <div class="label-summary"> | |
81 | <label>${_('Summary')}:</label> |
|
81 | <label>${_('Summary')}:</label> | |
82 | </div> |
|
82 | </div> | |
83 | <div class="input"> |
|
83 | <div class="input"> | |
84 | <div style="white-space:pre-wrap">${h.literal(c.pull_request.description)}</div> |
|
84 | <div style="white-space:pre-wrap">${h.literal(c.pull_request.description)}</div> | |
85 | </div> |
|
85 | </div> | |
86 | </div> |
|
86 | </div> | |
87 | <div class="field"> |
|
87 | <div class="field"> | |
88 | <div class="label-summary"> |
|
88 | <div class="label-summary"> | |
89 | <label>${_('Created on')}:</label> |
|
89 | <label>${_('Created on')}:</label> | |
90 | </div> |
|
90 | </div> | |
91 | <div class="input"> |
|
91 | <div class="input"> | |
92 | <div>${h.fmt_date(c.pull_request.created_on)}</div> |
|
92 | <div>${h.fmt_date(c.pull_request.created_on)}</div> | |
93 | </div> |
|
93 | </div> | |
94 | </div> |
|
94 | </div> | |
95 | </div> |
|
95 | </div> | |
96 | </div> |
|
96 | </div> | |
97 |
|
97 | |||
98 | <div style="overflow: auto;"> |
|
98 | <div style="overflow: auto;"> | |
99 | ##DIFF |
|
99 | ##DIFF | |
100 | <div class="table" style="float:left;clear:none"> |
|
100 | <div class="table" style="float:left;clear:none"> | |
101 | <div id="body" class="diffblock"> |
|
101 | <div id="body" class="diffblock"> | |
102 | <div style="white-space:pre-wrap;padding:5px">${_('Compare view')}</div> |
|
102 | <div style="white-space:pre-wrap;padding:5px">${_('Compare view')}</div> | |
103 | </div> |
|
103 | </div> | |
104 | <div id="changeset_compare_view_content"> |
|
104 | <div id="changeset_compare_view_content"> | |
105 | ##CS |
|
105 | ##CS | |
106 | <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}</div> |
|
106 | <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}</div> | |
107 | <%include file="/compare/compare_cs.html" /> |
|
107 | <%include file="/compare/compare_cs.html" /> | |
108 |
|
108 | |||
109 | ## FILES |
|
109 | ## FILES | |
110 | <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px"> |
|
110 | <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px"> | |
111 |
|
111 | |||
112 | % if c.limited_diff: |
|
112 | % if c.limited_diff: | |
113 | ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)} |
|
113 | ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)} | |
114 | % else: |
|
114 | % else: | |
115 | ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.files)) % (len(c.files),c.lines_added,c.lines_deleted)}: |
|
115 | ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.files)) % (len(c.files),c.lines_added,c.lines_deleted)}: | |
116 | %endif |
|
116 | %endif | |
117 |
|
117 | |||
118 | </div> |
|
118 | </div> | |
119 | <div class="cs_files"> |
|
119 | <div class="cs_files"> | |
120 | %if not c.files: |
|
120 | %if not c.files: | |
121 | <span class="empty_data">${_('No files')}</span> |
|
121 | <span class="empty_data">${_('No files')}</span> | |
122 | %endif |
|
122 | %endif | |
123 | %for fid, change, f, stat in c.files: |
|
123 | %for fid, change, f, stat in c.files: | |
124 | <div class="cs_${change}"> |
|
124 | <div class="cs_${change}"> | |
125 | <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div> |
|
125 | <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div> | |
126 | <div class="changes">${h.fancy_file_stats(stat)}</div> |
|
126 | <div class="changes">${h.fancy_file_stats(stat)}</div> | |
127 | </div> |
|
127 | </div> | |
128 | %endfor |
|
128 | %endfor | |
129 | </div> |
|
129 | </div> | |
130 | % if c.limited_diff: |
|
130 | % if c.limited_diff: | |
131 | <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h5> |
|
131 | <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h5> | |
132 | % endif |
|
132 | % endif | |
133 | </div> |
|
133 | </div> | |
134 | </div> |
|
134 | </div> | |
135 | ## REVIEWERS |
|
135 | ## REVIEWERS | |
136 | <div style="float:left; border-left:1px dashed #eee"> |
|
136 | <div style="float:left; border-left:1px dashed #eee"> | |
137 | <h4>${_('Pull request reviewers')}</h4> |
|
137 | <h4>${_('Pull request reviewers')}</h4> | |
138 | <div id="reviewers" style="padding:0px 0px 5px 10px"> |
|
138 | <div id="reviewers" style="padding:0px 0px 5px 10px"> | |
139 | ## members goes here ! |
|
139 | ## members goes here ! | |
140 | <div class="group_members_wrap" style="min-height:45px"> |
|
140 | <div class="group_members_wrap" style="min-height:45px"> | |
141 | <ul id="review_members" class="group_members"> |
|
141 | <ul id="review_members" class="group_members"> | |
142 | %for member,status in c.pull_request_reviewers: |
|
142 | %for member,status in c.pull_request_reviewers: | |
143 | <li id="reviewer_${member.user_id}"> |
|
143 | <li id="reviewer_${member.user_id}"> | |
144 | <div class="reviewers_member"> |
|
144 | <div class="reviewers_member"> | |
145 | <div style="float:left;padding:0px 3px 0px 0px" class="tooltip" title="${h.tooltip(h.changeset_status_lbl(status[0][1].status if status else 'not_reviewed'))}"> |
|
145 | <div style="float:left;padding:0px 3px 0px 0px" class="tooltip" title="${h.tooltip(h.changeset_status_lbl(status[0][1].status if status else 'not_reviewed'))}"> | |
146 | <img src="${h.url(str('/images/icons/flag_status_%s.png' % (status[0][1].status if status else 'not_reviewed')))}"/> |
|
146 | <img src="${h.url(str('/images/icons/flag_status_%s.png' % (status[0][1].status if status else 'not_reviewed')))}"/> | |
147 | </div> |
|
147 | </div> | |
148 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div> |
|
148 | <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div> | |
149 | <div style="float:left">${member.full_name} (${_('owner') if c.pull_request.user_id == member.user_id else _('reviewer')})</div> |
|
149 | <div style="float:left">${member.full_name} (${_('owner') if c.pull_request.user_id == member.user_id else _('reviewer')})</div> | |
150 | <input type="hidden" value="${member.user_id}" name="review_members" /> |
|
150 | <input type="hidden" value="${member.user_id}" name="review_members" /> | |
151 | %if not c.pull_request.is_closed() and (h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.user_id == c.rhodecode_user.user_id): |
|
151 | %if not c.pull_request.is_closed() and (h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.user_id == c.rhodecode_user.user_id): | |
152 | <span class="delete_icon action_button" onclick="removeReviewMember(${member.user_id})"></span> |
|
152 | <span class="delete_icon action_button" onclick="removeReviewMember(${member.user_id})"></span> | |
153 | %endif |
|
153 | %endif | |
154 | </div> |
|
154 | </div> | |
155 | </li> |
|
155 | </li> | |
156 | %endfor |
|
156 | %endfor | |
157 | </ul> |
|
157 | </ul> | |
158 | </div> |
|
158 | </div> | |
159 | %if not c.pull_request.is_closed(): |
|
159 | %if not c.pull_request.is_closed(): | |
160 | <div class='ac'> |
|
160 | <div class='ac'> | |
161 | %if h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id: |
|
161 | %if h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id: | |
162 | <div class="reviewer_ac"> |
|
162 | <div class="reviewer_ac"> | |
163 | ${h.text('user', class_='yui-ac-input')} |
|
163 | ${h.text('user', class_='yui-ac-input')} | |
164 | <span class="help-block">${_('Add or remove reviewer to this pull request.')}</span> |
|
164 | <span class="help-block">${_('Add or remove reviewer to this pull request.')}</span> | |
165 | <div id="reviewers_container"></div> |
|
165 | <div id="reviewers_container"></div> | |
166 | </div> |
|
166 | </div> | |
167 | <div style="padding:0px 10px"> |
|
167 | <div style="padding:0px 10px"> | |
168 | <span id="update_pull_request" class="ui-btn xsmall">${_('Save changes')}</span> |
|
168 | <span id="update_pull_request" class="ui-btn xsmall">${_('Save changes')}</span> | |
169 | </div> |
|
169 | </div> | |
170 | %endif |
|
170 | %endif | |
171 | </div> |
|
171 | </div> | |
172 | %endif |
|
172 | %endif | |
173 | </div> |
|
173 | </div> | |
174 | </div> |
|
174 | </div> | |
175 | </div> |
|
175 | </div> | |
176 | <script> |
|
176 | <script> | |
177 | var _USERS_AC_DATA = ${c.users_array|n}; |
|
177 | var _USERS_AC_DATA = ${c.users_array|n}; | |
178 | var _GROUPS_AC_DATA = ${c.users_groups_array|n}; |
|
178 | var _GROUPS_AC_DATA = ${c.users_groups_array|n}; | |
179 | // TODO: switch this to pyroutes |
|
179 | // TODO: switch this to pyroutes | |
180 | AJAX_COMMENT_URL = "${url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id)}"; |
|
180 | AJAX_COMMENT_URL = "${url('pullrequest_comment',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id)}"; | |
181 | AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}"; |
|
181 | AJAX_COMMENT_DELETE_URL = "${url('pullrequest_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}"; | |
182 |
|
182 | |||
183 | pyroutes.register('pullrequest_comment', "${url('pullrequest_comment',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']); |
|
183 | pyroutes.register('pullrequest_comment', "${url('pullrequest_comment',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']); | |
184 | pyroutes.register('pullrequest_comment_delete', "${url('pullrequest_comment_delete',repo_name='%(repo_name)s',comment_id='%(comment_id)s')}", ['repo_name', 'comment_id']); |
|
184 | pyroutes.register('pullrequest_comment_delete', "${url('pullrequest_comment_delete',repo_name='%(repo_name)s',comment_id='%(comment_id)s')}", ['repo_name', 'comment_id']); | |
185 | pyroutes.register('pullrequest_update', "${url('pullrequest_update',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']); |
|
185 | pyroutes.register('pullrequest_update', "${url('pullrequest_update',repo_name='%(repo_name)s',pull_request_id='%(pull_request_id)s')}", ['repo_name', 'pull_request_id']); | |
186 |
|
186 | |||
187 | </script> |
|
187 | </script> | |
188 |
|
188 | |||
189 | ## diff block |
|
189 | ## diff block | |
190 | <%namespace name="diff_block" file="/changeset/diff_block.html"/> |
|
190 | <%namespace name="diff_block" file="/changeset/diff_block.html"/> | |
191 | %for fid, change, f, stat in c.files: |
|
191 | %for fid, change, f, stat in c.files: | |
192 | ${diff_block.diff_block_simple([c.changes[fid]])} |
|
192 | ${diff_block.diff_block_simple([c.changes[fid]])} | |
193 | %endfor |
|
193 | %endfor | |
194 | % if c.limited_diff: |
|
194 | % if c.limited_diff: | |
195 | <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h4> |
|
195 | <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a huge diff might take some time and resources")}')">${_('Show full diff')}</a></h4> | |
196 | % endif |
|
196 | % endif | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | ## template for inline comment form |
|
199 | ## template for inline comment form | |
200 | <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> |
|
200 | <%namespace name="comment" file="/changeset/changeset_file_comment.html"/> | |
201 | ${comment.comment_inline_form()} |
|
201 | ${comment.comment_inline_form()} | |
202 |
|
202 | |||
203 | ## render comments and inlines |
|
203 | ## render comments and inlines | |
204 | ${comment.generate_comments(include_pr=True)} |
|
204 | ${comment.generate_comments(include_pr=True)} | |
205 |
|
205 | |||
206 | % if not c.pull_request.is_closed(): |
|
206 | % if not c.pull_request.is_closed(): | |
207 | ## main comment form and it status |
|
207 | ## main comment form and it status | |
208 | ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name, |
|
208 | ${comment.comments(h.url('pullrequest_comment', repo_name=c.repo_name, | |
209 | pull_request_id=c.pull_request.pull_request_id), |
|
209 | pull_request_id=c.pull_request.pull_request_id), | |
210 | c.current_changeset_status, |
|
210 | c.current_changeset_status, | |
211 | close_btn=True, change_status=c.allowed_to_change_status)} |
|
211 | close_btn=True, change_status=c.allowed_to_change_status)} | |
212 | %endif |
|
212 | %endif | |
213 |
|
213 | |||
214 | <script type="text/javascript"> |
|
214 | <script type="text/javascript"> | |
215 | YUE.onDOMReady(function(){ |
|
215 | YUE.onDOMReady(function(){ | |
216 | PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA); |
|
216 | PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA); | |
217 |
|
217 | |||
218 | YUE.on(YUQ('.show-inline-comments'),'change',function(e){ |
|
218 | YUE.on(YUQ('.show-inline-comments'),'change',function(e){ | |
219 | var show = 'none'; |
|
219 | var show = 'none'; | |
220 | var target = e.currentTarget; |
|
220 | var target = e.currentTarget; | |
221 | if(target.checked){ |
|
221 | if(target.checked){ | |
222 | var show = '' |
|
222 | var show = '' | |
223 | } |
|
223 | } | |
224 | var boxid = YUD.getAttribute(target,'id_for'); |
|
224 | var boxid = YUD.getAttribute(target,'id_for'); | |
225 | var comments = YUQ('#{0} .inline-comments'.format(boxid)); |
|
225 | var comments = YUQ('#{0} .inline-comments'.format(boxid)); | |
226 | for(c in comments){ |
|
226 | for(c in comments){ | |
227 | YUD.setStyle(comments[c],'display',show); |
|
227 | YUD.setStyle(comments[c],'display',show); | |
228 | } |
|
228 | } | |
229 | var btns = YUQ('#{0} .inline-comments-button'.format(boxid)); |
|
229 | var btns = YUQ('#{0} .inline-comments-button'.format(boxid)); | |
230 | for(c in btns){ |
|
230 | for(c in btns){ | |
231 | YUD.setStyle(btns[c],'display',show); |
|
231 | YUD.setStyle(btns[c],'display',show); | |
232 | } |
|
232 | } | |
233 | }) |
|
233 | }) | |
234 |
|
234 | |||
235 | YUE.on(YUQ('.line'),'click',function(e){ |
|
235 | YUE.on(YUQ('.line'),'click',function(e){ | |
236 | var tr = e.currentTarget; |
|
236 | var tr = e.currentTarget; | |
237 | injectInlineForm(tr); |
|
237 | injectInlineForm(tr); | |
238 | }); |
|
238 | }); | |
239 |
|
239 | |||
240 | // inject comments into they proper positions |
|
240 | // inject comments into they proper positions | |
241 | var file_comments = YUQ('.inline-comment-placeholder'); |
|
241 | var file_comments = YUQ('.inline-comment-placeholder'); | |
242 | renderInlineComments(file_comments); |
|
242 | renderInlineComments(file_comments); | |
243 |
|
243 | |||
244 | YUE.on(YUD.get('update_pull_request'),'click',function(e){ |
|
244 | YUE.on(YUD.get('update_pull_request'),'click',function(e){ | |
245 | updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}"); |
|
245 | updateReviewers(undefined, "${c.repo_name}", "${c.pull_request.pull_request_id}"); | |
246 | }) |
|
246 | }) | |
247 | }) |
|
247 | }) | |
248 | </script> |
|
248 | </script> | |
249 |
|
249 | |||
250 | </div> |
|
250 | </div> | |
251 |
|
251 | |||
252 | </%def> |
|
252 | </%def> |
@@ -1,749 +1,749 b'' | |||||
1 | <%inherit file="/base/base.html"/> |
|
1 | <%inherit file="/base/base.html"/> | |
2 |
|
2 | |||
3 | <%def name="title()"> |
|
3 | <%def name="title()"> | |
4 | ${_('%s Summary') % c.repo_name} · ${c.rhodecode_name} |
|
4 | ${_('%s Summary') % c.repo_name} · ${c.rhodecode_name} | |
5 | </%def> |
|
5 | </%def> | |
6 |
|
6 | |||
7 | <%def name="breadcrumbs_links()"> |
|
7 | <%def name="breadcrumbs_links()"> | |
8 | ${_('Summary')} |
|
8 | ${_('Summary')} | |
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="head_extra()"> |
|
15 | <%def name="head_extra()"> | |
16 | <link href="${h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" /> |
|
16 | <link href="${h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" /> | |
17 | <link href="${h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" /> |
|
17 | <link href="${h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" /> | |
18 |
|
18 | |||
19 | <script> |
|
19 | <script> | |
20 | redirect_hash_branch = function(){ |
|
20 | redirect_hash_branch = function(){ | |
21 | var branch = window.location.hash.replace(/^#(.*)/, '$1'); |
|
21 | var branch = window.location.hash.replace(/^#(.*)/, '$1'); | |
22 |
|
|
22 | if (branch){ | |
23 |
|
|
23 | window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}" | |
24 |
|
|
24 | .replace('__BRANCH__',branch); | |
25 | } |
|
25 | } | |
26 | } |
|
26 | } | |
27 | redirect_hash_branch(); |
|
27 | redirect_hash_branch(); | |
28 | window.onhashchange = function() { |
|
28 | window.onhashchange = function() { | |
29 |
|
|
29 | redirect_hash_branch(); | |
30 | }; |
|
30 | }; | |
31 | </script> |
|
31 | </script> | |
32 |
|
32 | |||
33 | </%def> |
|
33 | </%def> | |
34 |
|
34 | |||
35 | <%def name="main()"> |
|
35 | <%def name="main()"> | |
36 | ${self.context_bar('summary')} |
|
36 | ${self.context_bar('summary')} | |
37 | <% |
|
37 | <% | |
38 | summary = lambda n:{False:'summary-short'}.get(n) |
|
38 | summary = lambda n:{False:'summary-short'}.get(n) | |
39 | %> |
|
39 | %> | |
40 | %if c.show_stats: |
|
40 | %if c.show_stats: | |
41 | <div class="box box-left"> |
|
41 | <div class="box box-left"> | |
42 | %else: |
|
42 | %else: | |
43 | <div class="box"> |
|
43 | <div class="box"> | |
44 | %endif |
|
44 | %endif | |
45 | <!-- box / title --> |
|
45 | <!-- box / title --> | |
46 | <div class="title"> |
|
46 | <div class="title"> | |
47 | ${self.breadcrumbs()} |
|
47 | ${self.breadcrumbs()} | |
48 | </div> |
|
48 | </div> | |
49 | <!-- end box / title --> |
|
49 | <!-- end box / title --> | |
50 | <div class="form"> |
|
50 | <div class="form"> | |
51 | <div id="summary" class="fields"> |
|
51 | <div id="summary" class="fields"> | |
52 |
|
52 | |||
53 | <div class="field"> |
|
53 | <div class="field"> | |
54 | <div class="label-summary"> |
|
54 | <div class="label-summary"> | |
55 | <label>${_('Name')}:</label> |
|
55 | <label>${_('Name')}:</label> | |
56 | </div> |
|
56 | </div> | |
57 | <div class="input ${summary(c.show_stats)}"> |
|
57 | <div class="input ${summary(c.show_stats)}"> | |
58 |
|
58 | |||
59 | ## locking icon |
|
59 | ## locking icon | |
60 | %if c.rhodecode_db_repo.enable_locking: |
|
60 | %if c.rhodecode_db_repo.enable_locking: | |
61 | %if c.rhodecode_db_repo.locked[0]: |
|
61 | %if c.rhodecode_db_repo.locked[0]: | |
62 | <span class="locking_locked tooltip" title="${_('Repository locked by %s') % h.person_by_id(c.rhodecode_db_repo.locked[0])}"></span> |
|
62 | <span class="locking_locked tooltip" title="${_('Repository locked by %s') % h.person_by_id(c.rhodecode_db_repo.locked[0])}"></span> | |
63 | %else: |
|
63 | %else: | |
64 | <span class="locking_unlocked tooltip" title="${_('Repository unlocked')}"></span> |
|
64 | <span class="locking_unlocked tooltip" title="${_('Repository unlocked')}"></span> | |
65 | %endif |
|
65 | %endif | |
66 | %endif |
|
66 | %endif | |
67 | ##REPO TYPE |
|
67 | ##REPO TYPE | |
68 | %if h.is_hg(c.dbrepo): |
|
68 | %if h.is_hg(c.dbrepo): | |
69 | <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> |
|
69 | <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/> | |
70 | %endif |
|
70 | %endif | |
71 | %if h.is_git(c.dbrepo): |
|
71 | %if h.is_git(c.dbrepo): | |
72 | <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> |
|
72 | <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/> | |
73 | %endif |
|
73 | %endif | |
74 |
|
74 | |||
75 | ##PUBLIC/PRIVATE |
|
75 | ##PUBLIC/PRIVATE | |
76 | %if c.dbrepo.private: |
|
76 | %if c.dbrepo.private: | |
77 | <img style="margin-bottom:2px" class="icon" title="${_('Private repository')}" alt="${_('Private repository')}" src="${h.url('/images/icons/lock.png')}"/> |
|
77 | <img style="margin-bottom:2px" class="icon" title="${_('Private repository')}" alt="${_('Private repository')}" src="${h.url('/images/icons/lock.png')}"/> | |
78 | %else: |
|
78 | %else: | |
79 | <img style="margin-bottom:2px" class="icon" title="${_('Public repository')}" alt="${_('Public repository')}" src="${h.url('/images/icons/lock_open.png')}"/> |
|
79 | <img style="margin-bottom:2px" class="icon" title="${_('Public repository')}" alt="${_('Public repository')}" src="${h.url('/images/icons/lock_open.png')}"/> | |
80 | %endif |
|
80 | %endif | |
81 |
|
81 | |||
82 | ##REPO NAME |
|
82 | ##REPO NAME | |
83 | <span class="repo_name" title="${_('Non changable ID %s') % c.dbrepo.repo_id}">${h.repo_link(c.dbrepo.groups_and_repo)}</span> |
|
83 | <span class="repo_name" title="${_('Non changable ID %s') % c.dbrepo.repo_id}">${h.repo_link(c.dbrepo.groups_and_repo)}</span> | |
84 |
|
84 | |||
85 | ##FORK |
|
85 | ##FORK | |
86 | %if c.dbrepo.fork: |
|
86 | %if c.dbrepo.fork: | |
87 | <div style="margin-top:5px;clear:both"> |
|
87 | <div style="margin-top:5px;clear:both"> | |
88 | <a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}"><img class="icon" alt="${_('Public')}" title="${_('Fork of')} ${c.dbrepo.fork.repo_name}" src="${h.url('/images/icons/arrow_divide.png')}"/> |
|
88 | <a href="${h.url('summary_home',repo_name=c.dbrepo.fork.repo_name)}"><img class="icon" alt="${_('Public')}" title="${_('Fork of')} ${c.dbrepo.fork.repo_name}" src="${h.url('/images/icons/arrow_divide.png')}"/> | |
89 | ${_('Fork of')} ${c.dbrepo.fork.repo_name} |
|
89 | ${_('Fork of')} ${c.dbrepo.fork.repo_name} | |
90 | </a> |
|
90 | </a> | |
91 | </div> |
|
91 | </div> | |
92 | %endif |
|
92 | %endif | |
93 | ##REMOTE |
|
93 | ##REMOTE | |
94 | %if c.dbrepo.clone_uri: |
|
94 | %if c.dbrepo.clone_uri: | |
95 | <div style="margin-top:5px;clear:both"> |
|
95 | <div style="margin-top:5px;clear:both"> | |
96 | <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}"><img class="icon" alt="${_('Remote clone')}" title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}" src="${h.url('/images/icons/connect.png')}"/> |
|
96 | <a href="${h.url(str(h.hide_credentials(c.dbrepo.clone_uri)))}"><img class="icon" alt="${_('Remote clone')}" title="${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)}" src="${h.url('/images/icons/connect.png')}"/> | |
97 | ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)} |
|
97 | ${_('Clone from')} ${h.hide_credentials(c.dbrepo.clone_uri)} | |
98 | </a> |
|
98 | </a> | |
99 | </div> |
|
99 | </div> | |
100 | %endif |
|
100 | %endif | |
101 | </div> |
|
101 | </div> | |
102 | </div> |
|
102 | </div> | |
103 |
|
103 | |||
104 | <div class="field"> |
|
104 | <div class="field"> | |
105 | <div class="label-summary"> |
|
105 | <div class="label-summary"> | |
106 | <label>${_('Description')}:</label> |
|
106 | <label>${_('Description')}:</label> | |
107 | </div> |
|
107 | </div> | |
108 | %if c.visual.stylify_metatags: |
|
108 | %if c.visual.stylify_metatags: | |
109 | <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(c.dbrepo.description))}</div> |
|
109 | <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(c.dbrepo.description))}</div> | |
110 | %else: |
|
110 | %else: | |
111 | <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.dbrepo.description)}</div> |
|
111 | <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.dbrepo.description)}</div> | |
112 | %endif |
|
112 | %endif | |
113 | </div> |
|
113 | </div> | |
114 |
|
114 | |||
115 | <div class="field"> |
|
115 | <div class="field"> | |
116 | <div class="label-summary"> |
|
116 | <div class="label-summary"> | |
117 | <label>${_('Contact')}:</label> |
|
117 | <label>${_('Contact')}:</label> | |
118 | </div> |
|
118 | </div> | |
119 | <div class="input ${summary(c.show_stats)}"> |
|
119 | <div class="input ${summary(c.show_stats)}"> | |
120 | <div class="gravatar"> |
|
120 | <div class="gravatar"> | |
121 | <img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/> |
|
121 | <img alt="gravatar" src="${h.gravatar_url(c.dbrepo.user.email)}"/> | |
122 | </div> |
|
122 | </div> | |
123 | ${_('Username')}: ${c.dbrepo.user.username}<br/> |
|
123 | ${_('Username')}: ${c.dbrepo.user.username}<br/> | |
124 | ${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/> |
|
124 | ${_('Name')}: ${c.dbrepo.user.name} ${c.dbrepo.user.lastname}<br/> | |
125 | ${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a> |
|
125 | ${_('Email')}: <a href="mailto:${c.dbrepo.user.email}">${c.dbrepo.user.email}</a> | |
126 | </div> |
|
126 | </div> | |
127 | </div> |
|
127 | </div> | |
128 |
|
128 | |||
129 | <div class="field"> |
|
129 | <div class="field"> | |
130 | <div class="label-summary"> |
|
130 | <div class="label-summary"> | |
131 | <label>${_('Clone url')}:</label> |
|
131 | <label>${_('Clone url')}:</label> | |
132 | </div> |
|
132 | </div> | |
133 | <div class="input ${summary(c.show_stats)}"> |
|
133 | <div class="input ${summary(c.show_stats)}"> | |
134 | <input style="width:${'75%' if c.show_stats else '80%'}" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/> |
|
134 | <input style="width:${'75%' if c.show_stats else '80%'}" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/> | |
135 | <input style="display:none;width:${'75%' if c.show_stats else '80%'}" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/> |
|
135 | <input style="display:none;width:${'75%' if c.show_stats else '80%'}" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/> | |
136 | <div style="display:none" id="clone_by_name" class="ui-btn clone">${_('Show by Name')}</div> |
|
136 | <div style="display:none" id="clone_by_name" class="ui-btn clone">${_('Show by Name')}</div> | |
137 | <div id="clone_by_id" class="ui-btn clone">${_('Show by ID')}</div> |
|
137 | <div id="clone_by_id" class="ui-btn clone">${_('Show by ID')}</div> | |
138 | </div> |
|
138 | </div> | |
139 | </div> |
|
139 | </div> | |
140 |
|
140 | |||
141 | <div class="field"> |
|
141 | <div class="field"> | |
142 | <div class="label-summary"> |
|
142 | <div class="label-summary"> | |
143 | <label>${_('Trending files')}:</label> |
|
143 | <label>${_('Trending files')}:</label> | |
144 | </div> |
|
144 | </div> | |
145 | <div class="input ${summary(c.show_stats)}"> |
|
145 | <div class="input ${summary(c.show_stats)}"> | |
146 | %if c.show_stats: |
|
146 | %if c.show_stats: | |
147 | <div id="lang_stats"></div> |
|
147 | <div id="lang_stats"></div> | |
148 | %else: |
|
148 | %else: | |
149 | ${_('Statistics are disabled for this repository')} |
|
149 | ${_('Statistics are disabled for this repository')} | |
150 | %if h.HasPermissionAll('hg.admin')('enable stats on from summary'): |
|
150 | %if h.HasPermissionAll('hg.admin')('enable stats on from summary'): | |
151 | ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")} |
|
151 | ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")} | |
152 | %endif |
|
152 | %endif | |
153 | %endif |
|
153 | %endif | |
154 | </div> |
|
154 | </div> | |
155 | </div> |
|
155 | </div> | |
156 |
|
156 | |||
157 | <div class="field"> |
|
157 | <div class="field"> | |
158 | <div class="label-summary"> |
|
158 | <div class="label-summary"> | |
159 | <label>${_('Download')}:</label> |
|
159 | <label>${_('Download')}:</label> | |
160 | </div> |
|
160 | </div> | |
161 | <div class="input ${summary(c.show_stats)}"> |
|
161 | <div class="input ${summary(c.show_stats)}"> | |
162 | %if len(c.rhodecode_repo.revisions) == 0: |
|
162 | %if len(c.rhodecode_repo.revisions) == 0: | |
163 | ${_('There are no downloads yet')} |
|
163 | ${_('There are no downloads yet')} | |
164 | %elif not c.enable_downloads: |
|
164 | %elif not c.enable_downloads: | |
165 | ${_('Downloads are disabled for this repository')} |
|
165 | ${_('Downloads are disabled for this repository')} | |
166 | %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'): |
|
166 | %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'): | |
167 | ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")} |
|
167 | ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")} | |
168 | %endif |
|
168 | %endif | |
169 | %else: |
|
169 | %else: | |
170 | ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)} |
|
170 | ${h.select('download_options',c.rhodecode_repo.get_changeset().raw_id,c.download_options)} | |
171 | <span id="${'zip_link'}">${h.link_to(_('Download as zip'), h.url('files_archive_home',repo_name=c.dbrepo.repo_name,fname='tip.zip'),class_="archive_icon ui-btn")}</span> |
|
171 | <span id="${'zip_link'}">${h.link_to(_('Download as zip'), h.url('files_archive_home',repo_name=c.dbrepo.repo_name,fname='tip.zip'),class_="archive_icon ui-btn")}</span> | |
172 | <span style="vertical-align: bottom"> |
|
172 | <span style="vertical-align: bottom"> | |
173 | <input id="archive_subrepos" type="checkbox" name="subrepos" /> |
|
173 | <input id="archive_subrepos" type="checkbox" name="subrepos" /> | |
174 | <label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label> |
|
174 | <label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label> | |
175 | </span> |
|
175 | </span> | |
176 | %endif |
|
176 | %endif | |
177 | </div> |
|
177 | </div> | |
178 | </div> |
|
178 | </div> | |
179 | </div> |
|
179 | </div> | |
180 | <div id="summary-menu-stats"> |
|
180 | <div id="summary-menu-stats"> | |
181 | <ul> |
|
181 | <ul> | |
182 | <li> |
|
182 | <li> | |
183 | <a class="followers" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}"> |
|
183 | <a class="followers" title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}"> | |
184 | ${_('Followers')} |
|
184 | ${_('Followers')} | |
185 | <span style="float:right" id="current_followers_count">${c.repository_followers}</span> |
|
185 | <span style="float:right" id="current_followers_count">${c.repository_followers}</span> | |
186 | </a> |
|
186 | </a> | |
187 | </li> |
|
187 | </li> | |
188 | <li> |
|
188 | <li> | |
189 | <a class="forks" title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}"> |
|
189 | <a class="forks" title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}"> | |
190 | ${_('Forks')} |
|
190 | ${_('Forks')} | |
191 | <span style="float:right">${c.repository_forks}</span> |
|
191 | <span style="float:right">${c.repository_forks}</span> | |
192 | </a> |
|
192 | </a> | |
193 | </li> |
|
193 | </li> | |
194 |
|
194 | |||
195 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): |
|
195 | %if h.HasRepoPermissionAll('repository.admin')(c.repo_name): | |
196 | <li> |
|
196 | <li> | |
197 | ${h.link_to(_('Settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')} |
|
197 | ${h.link_to(_('Settings'),h.url('edit_repo',repo_name=c.repo_name),class_='settings')} | |
198 | </li> |
|
198 | </li> | |
199 | %endif |
|
199 | %endif | |
200 |
|
200 | |||
201 | <li> |
|
201 | <li> | |
202 | %if c.rhodecode_user.username != 'default': |
|
202 | %if c.rhodecode_user.username != 'default': | |
203 | ${h.link_to(_('Feed'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='feed')} |
|
203 | ${h.link_to(_('Feed'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key),class_='feed')} | |
204 | %else: |
|
204 | %else: | |
205 | ${h.link_to(_('Feed'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='feed')} |
|
205 | ${h.link_to(_('Feed'),h.url('atom_feed_home',repo_name=c.dbrepo.repo_name),class_='feed')} | |
206 | %endif |
|
206 | %endif | |
207 | </li> |
|
207 | </li> | |
208 |
|
208 | |||
209 | %if c.rhodecode_user.username != 'default': |
|
209 | %if c.rhodecode_user.username != 'default': | |
210 | <li class="repo_size"> |
|
210 | <li class="repo_size"> | |
211 | <a href="#" class="repo-size" onclick="javascript:showRepoSize('repo_size_2','${c.dbrepo.repo_name}','${str(h.get_token())}')">${_('Repository Size')}</a> |
|
211 | <a href="#" class="repo-size" onclick="javascript:showRepoSize('repo_size_2','${c.dbrepo.repo_name}','${str(h.get_token())}')">${_('Repository Size')}</a> | |
212 | <span id="repo_size_2"></span> |
|
212 | <span id="repo_size_2"></span> | |
213 | </li> |
|
213 | </li> | |
214 | %endif |
|
214 | %endif | |
215 | </ul> |
|
215 | </ul> | |
216 | </div> |
|
216 | </div> | |
217 | </div> |
|
217 | </div> | |
218 | </div> |
|
218 | </div> | |
219 |
|
219 | |||
220 | %if c.show_stats: |
|
220 | %if c.show_stats: | |
221 | <div class="box box-right" style="min-height:455px"> |
|
221 | <div class="box box-right" style="min-height:455px"> | |
222 | <!-- box / title --> |
|
222 | <!-- box / title --> | |
223 | <div class="title"> |
|
223 | <div class="title"> | |
224 | <h5>${_('Commit activity by day / author')}</h5> |
|
224 | <h5>${_('Commit activity by day / author')}</h5> | |
225 | </div> |
|
225 | </div> | |
226 |
|
226 | |||
227 | <div class="graph"> |
|
227 | <div class="graph"> | |
228 | <div style="padding:0 10px 10px 17px;"> |
|
228 | <div style="padding:0 10px 10px 17px;"> | |
229 | %if c.no_data: |
|
229 | %if c.no_data: | |
230 | ${c.no_data_msg} |
|
230 | ${c.no_data_msg} | |
231 | %if h.HasPermissionAll('hg.admin')('enable stats on from summary'): |
|
231 | %if h.HasPermissionAll('hg.admin')('enable stats on from summary'): | |
232 | ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")} |
|
232 | ${h.link_to(_('enable'),h.url('edit_repo',repo_name=c.repo_name),class_="ui-btn")} | |
233 | %endif |
|
233 | %endif | |
234 | %else: |
|
234 | %else: | |
235 | ${_('Stats gathered: ')} ${c.stats_percentage}% |
|
235 | ${_('Stats gathered: ')} ${c.stats_percentage}% | |
236 | %endif |
|
236 | %endif | |
237 | </div> |
|
237 | </div> | |
238 | <div id="commit_history" style="width:450px;height:300px;float:left"></div> |
|
238 | <div id="commit_history" style="width:450px;height:300px;float:left"></div> | |
239 | <div style="clear: both;height: 10px"></div> |
|
239 | <div style="clear: both;height: 10px"></div> | |
240 | <div id="overview" style="width:450px;height:100px;float:left"></div> |
|
240 | <div id="overview" style="width:450px;height:100px;float:left"></div> | |
241 |
|
241 | |||
242 | <div id="legend_data" style="clear:both;margin-top:10px;"> |
|
242 | <div id="legend_data" style="clear:both;margin-top:10px;"> | |
243 | <div id="legend_container"></div> |
|
243 | <div id="legend_container"></div> | |
244 | <div id="legend_choices"> |
|
244 | <div id="legend_choices"> | |
245 | <table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table> |
|
245 | <table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table> | |
246 | </div> |
|
246 | </div> | |
247 | </div> |
|
247 | </div> | |
248 | </div> |
|
248 | </div> | |
249 | </div> |
|
249 | </div> | |
250 | %endif |
|
250 | %endif | |
251 |
|
251 | |||
252 | <div class="box"> |
|
252 | <div class="box"> | |
253 | <div class="title"> |
|
253 | <div class="title"> | |
254 | <div class="breadcrumbs"> |
|
254 | <div class="breadcrumbs"> | |
255 | %if c.repo_changesets: |
|
255 | %if c.repo_changesets: | |
256 | ${h.link_to(_('Latest changes'),h.url('changelog_home',repo_name=c.repo_name))} |
|
256 | ${h.link_to(_('Latest changes'),h.url('changelog_home',repo_name=c.repo_name))} | |
257 | %else: |
|
257 | %else: | |
258 | ${_('Quick start')} |
|
258 | ${_('Quick start')} | |
259 | %endif |
|
259 | %endif | |
260 | </div> |
|
260 | </div> | |
261 | </div> |
|
261 | </div> | |
262 | <div class="table"> |
|
262 | <div class="table"> | |
263 | <div id="shortlog_data"> |
|
263 | <div id="shortlog_data"> | |
264 | <%include file='../shortlog/shortlog_data.html'/> |
|
264 | <%include file='../shortlog/shortlog_data.html'/> | |
265 | </div> |
|
265 | </div> | |
266 | </div> |
|
266 | </div> | |
267 | </div> |
|
267 | </div> | |
268 |
|
268 | |||
269 | %if c.readme_data: |
|
269 | %if c.readme_data: | |
270 | <div id="readme" class="anchor"> |
|
270 | <div id="readme" class="anchor"> | |
271 | <div class="box" style="background-color: #FAFAFA"> |
|
271 | <div class="box" style="background-color: #FAFAFA"> | |
272 | <div class="title" title="${_("Readme file at revision '%s'" % c.rhodecode_db_repo.landing_rev)}"> |
|
272 | <div class="title" title="${_("Readme file at revision '%s'" % c.rhodecode_db_repo.landing_rev)}"> | |
273 | <div class="breadcrumbs"> |
|
273 | <div class="breadcrumbs"> | |
274 | <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a> |
|
274 | <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a> | |
275 | <a class="permalink" href="#readme" title="${_('Permalink to this readme')}">¶</a> |
|
275 | <a class="permalink" href="#readme" title="${_('Permalink to this readme')}">¶</a> | |
276 | </div> |
|
276 | </div> | |
277 | </div> |
|
277 | </div> | |
278 | <div class="readme"> |
|
278 | <div class="readme"> | |
279 | <div class="readme_box"> |
|
279 | <div class="readme_box"> | |
280 | ${c.readme_data|n} |
|
280 | ${c.readme_data|n} | |
281 | </div> |
|
281 | </div> | |
282 | </div> |
|
282 | </div> | |
283 | </div> |
|
283 | </div> | |
284 | </div> |
|
284 | </div> | |
285 | %endif |
|
285 | %endif | |
286 |
|
286 | |||
287 | <script type="text/javascript"> |
|
287 | <script type="text/javascript"> | |
288 | var clone_url = 'clone_url'; |
|
288 | var clone_url = 'clone_url'; | |
289 | YUE.on(clone_url,'click',function(e){ |
|
289 | YUE.on(clone_url,'click',function(e){ | |
290 | if(YUD.hasClass(clone_url,'selected')){ |
|
290 | if(YUD.hasClass(clone_url,'selected')){ | |
291 | return |
|
291 | return | |
292 | } |
|
292 | } | |
293 | else{ |
|
293 | else{ | |
294 | YUD.addClass(clone_url,'selected'); |
|
294 | YUD.addClass(clone_url,'selected'); | |
295 | YUD.get(clone_url).select(); |
|
295 | YUD.get(clone_url).select(); | |
296 | } |
|
296 | } | |
297 | }) |
|
297 | }) | |
298 |
|
298 | |||
299 | YUE.on('clone_by_name','click',function(e){ |
|
299 | YUE.on('clone_by_name','click',function(e){ | |
300 | // show url by name and hide name button |
|
300 | // show url by name and hide name button | |
301 | YUD.setStyle('clone_url','display',''); |
|
301 | YUD.setStyle('clone_url','display',''); | |
302 | YUD.setStyle('clone_by_name','display','none'); |
|
302 | YUD.setStyle('clone_by_name','display','none'); | |
303 |
|
303 | |||
304 | // hide url by id and show name button |
|
304 | // hide url by id and show name button | |
305 | YUD.setStyle('clone_by_id','display',''); |
|
305 | YUD.setStyle('clone_by_id','display',''); | |
306 | YUD.setStyle('clone_url_id','display','none'); |
|
306 | YUD.setStyle('clone_url_id','display','none'); | |
307 |
|
307 | |||
308 | }) |
|
308 | }) | |
309 | YUE.on('clone_by_id','click',function(e){ |
|
309 | YUE.on('clone_by_id','click',function(e){ | |
310 |
|
310 | |||
311 | // show url by id and hide id button |
|
311 | // show url by id and hide id button | |
312 | YUD.setStyle('clone_by_id','display','none'); |
|
312 | YUD.setStyle('clone_by_id','display','none'); | |
313 | YUD.setStyle('clone_url_id','display',''); |
|
313 | YUD.setStyle('clone_url_id','display',''); | |
314 |
|
314 | |||
315 | // hide url by name and show id button |
|
315 | // hide url by name and show id button | |
316 | YUD.setStyle('clone_by_name','display',''); |
|
316 | YUD.setStyle('clone_by_name','display',''); | |
317 | YUD.setStyle('clone_url','display','none'); |
|
317 | YUD.setStyle('clone_url','display','none'); | |
318 | }) |
|
318 | }) | |
319 |
|
319 | |||
320 |
|
320 | |||
321 | var tmpl_links = {}; |
|
321 | var tmpl_links = {}; | |
322 | %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()): |
|
322 | %for cnt,archive in enumerate(c.rhodecode_repo._get_archives()): | |
323 | tmpl_links["${archive['type']}"] = '${h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.dbrepo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='archive_icon ui-btn')}'; |
|
323 | tmpl_links["${archive['type']}"] = '${h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.dbrepo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='archive_icon ui-btn')}'; | |
324 | %endfor |
|
324 | %endfor | |
325 |
|
325 | |||
326 | YUE.on(['download_options','archive_subrepos'],'change',function(e){ |
|
326 | YUE.on(['download_options','archive_subrepos'],'change',function(e){ | |
327 | var sm = YUD.get('download_options'); |
|
327 | var sm = YUD.get('download_options'); | |
328 | var new_cs = sm.options[sm.selectedIndex]; |
|
328 | var new_cs = sm.options[sm.selectedIndex]; | |
329 |
|
329 | |||
330 | for(k in tmpl_links){ |
|
330 | for(k in tmpl_links){ | |
331 | var s = YUD.get(k+'_link'); |
|
331 | var s = YUD.get(k+'_link'); | |
332 | if(s){ |
|
332 | if(s){ | |
333 | var title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}"; |
|
333 | var title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}"; | |
334 | title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text); |
|
334 | title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text); | |
335 | title_tmpl = title_tmpl.replace('__CS_EXT__',k); |
|
335 | title_tmpl = title_tmpl.replace('__CS_EXT__',k); | |
336 |
|
336 | |||
337 | var url = tmpl_links[k].replace('__CS__',new_cs.value); |
|
337 | var url = tmpl_links[k].replace('__CS__',new_cs.value); | |
338 | var subrepos = YUD.get('archive_subrepos').checked; |
|
338 | var subrepos = YUD.get('archive_subrepos').checked; | |
339 | url = url.replace('__SUB__',subrepos); |
|
339 | url = url.replace('__SUB__',subrepos); | |
340 | url = url.replace('__NAME__',title_tmpl); |
|
340 | url = url.replace('__NAME__',title_tmpl); | |
341 | s.innerHTML = url |
|
341 | s.innerHTML = url | |
342 | } |
|
342 | } | |
343 | } |
|
343 | } | |
344 | }); |
|
344 | }); | |
345 | </script> |
|
345 | </script> | |
346 | %if c.show_stats: |
|
346 | %if c.show_stats: | |
347 | <script type="text/javascript"> |
|
347 | <script type="text/javascript"> | |
348 | var data = ${c.trending_languages|n}; |
|
348 | var data = ${c.trending_languages|n}; | |
349 | var total = 0; |
|
349 | var total = 0; | |
350 | var no_data = true; |
|
350 | var no_data = true; | |
351 | var tbl = document.createElement('table'); |
|
351 | var tbl = document.createElement('table'); | |
352 | tbl.setAttribute('class','trending_language_tbl'); |
|
352 | tbl.setAttribute('class','trending_language_tbl'); | |
353 | var cnt = 0; |
|
353 | var cnt = 0; | |
354 | for (var i=0;i<data.length;i++){ |
|
354 | for (var i=0;i<data.length;i++){ | |
355 | total+= data[i][1].count; |
|
355 | total+= data[i][1].count; | |
356 | } |
|
356 | } | |
357 | for (var i=0;i<data.length;i++){ |
|
357 | for (var i=0;i<data.length;i++){ | |
358 | cnt += 1; |
|
358 | cnt += 1; | |
359 | no_data = false; |
|
359 | no_data = false; | |
360 |
|
360 | |||
361 | var hide = cnt>2; |
|
361 | var hide = cnt>2; | |
362 | var tr = document.createElement('tr'); |
|
362 | var tr = document.createElement('tr'); | |
363 | if (hide){ |
|
363 | if (hide){ | |
364 | tr.setAttribute('style','display:none'); |
|
364 | tr.setAttribute('style','display:none'); | |
365 | tr.setAttribute('class','stats_hidden'); |
|
365 | tr.setAttribute('class','stats_hidden'); | |
366 | } |
|
366 | } | |
367 | var k = data[i][0]; |
|
367 | var k = data[i][0]; | |
368 | var obj = data[i][1]; |
|
368 | var obj = data[i][1]; | |
369 | var percentage = Math.round((obj.count/total*100),2); |
|
369 | var percentage = Math.round((obj.count/total*100),2); | |
370 |
|
370 | |||
371 | var td1 = document.createElement('td'); |
|
371 | var td1 = document.createElement('td'); | |
372 | td1.width = 150; |
|
372 | td1.width = 150; | |
373 | var trending_language_label = document.createElement('div'); |
|
373 | var trending_language_label = document.createElement('div'); | |
374 | trending_language_label.innerHTML = obj.desc+" ("+k+")"; |
|
374 | trending_language_label.innerHTML = obj.desc+" ("+k+")"; | |
375 | td1.appendChild(trending_language_label); |
|
375 | td1.appendChild(trending_language_label); | |
376 |
|
376 | |||
377 | var td2 = document.createElement('td'); |
|
377 | var td2 = document.createElement('td'); | |
378 | td2.setAttribute('style','padding-right:14px !important'); |
|
378 | td2.setAttribute('style','padding-right:14px !important'); | |
379 | var trending_language = document.createElement('div'); |
|
379 | var trending_language = document.createElement('div'); | |
380 | var nr_files = obj.count+" ${_('files')}"; |
|
380 | var nr_files = obj.count+" ${_('files')}"; | |
381 |
|
381 | |||
382 | trending_language.title = k+" "+nr_files; |
|
382 | trending_language.title = k+" "+nr_files; | |
383 |
|
383 | |||
384 | if (percentage>22){ |
|
384 | if (percentage>22){ | |
385 | trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>"; |
|
385 | trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>"; | |
386 | } |
|
386 | } | |
387 | else{ |
|
387 | else{ | |
388 | trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>"; |
|
388 | trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>"; | |
389 | } |
|
389 | } | |
390 |
|
390 | |||
391 | trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner'); |
|
391 | trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner'); | |
392 | trending_language.style.width=percentage+"%"; |
|
392 | trending_language.style.width=percentage+"%"; | |
393 | td2.appendChild(trending_language); |
|
393 | td2.appendChild(trending_language); | |
394 |
|
394 | |||
395 | tr.appendChild(td1); |
|
395 | tr.appendChild(td1); | |
396 | tr.appendChild(td2); |
|
396 | tr.appendChild(td2); | |
397 | tbl.appendChild(tr); |
|
397 | tbl.appendChild(tr); | |
398 | if(cnt == 3){ |
|
398 | if(cnt == 3){ | |
399 | var show_more = document.createElement('tr'); |
|
399 | var show_more = document.createElement('tr'); | |
400 | var td = document.createElement('td'); |
|
400 | var td = document.createElement('td'); | |
401 | lnk = document.createElement('a'); |
|
401 | lnk = document.createElement('a'); | |
402 |
|
402 | |||
403 | lnk.href='#'; |
|
403 | lnk.href='#'; | |
404 | lnk.innerHTML = "${_('Show more')}"; |
|
404 | lnk.innerHTML = "${_('Show more')}"; | |
405 | lnk.id='code_stats_show_more'; |
|
405 | lnk.id='code_stats_show_more'; | |
406 | td.appendChild(lnk); |
|
406 | td.appendChild(lnk); | |
407 |
|
407 | |||
408 | show_more.appendChild(td); |
|
408 | show_more.appendChild(td); | |
409 | show_more.appendChild(document.createElement('td')); |
|
409 | show_more.appendChild(document.createElement('td')); | |
410 | tbl.appendChild(show_more); |
|
410 | tbl.appendChild(show_more); | |
411 | } |
|
411 | } | |
412 |
|
412 | |||
413 | } |
|
413 | } | |
414 |
|
414 | |||
415 | YUD.get('lang_stats').appendChild(tbl); |
|
415 | YUD.get('lang_stats').appendChild(tbl); | |
416 | YUE.on('code_stats_show_more','click',function(){ |
|
416 | YUE.on('code_stats_show_more','click',function(){ | |
417 | l = YUD.getElementsByClassName('stats_hidden') |
|
417 | l = YUD.getElementsByClassName('stats_hidden') | |
418 | for (e in l){ |
|
418 | for (e in l){ | |
419 | YUD.setStyle(l[e],'display',''); |
|
419 | YUD.setStyle(l[e],'display',''); | |
420 | }; |
|
420 | }; | |
421 | YUD.setStyle(YUD.get('code_stats_show_more'), |
|
421 | YUD.setStyle(YUD.get('code_stats_show_more'), | |
422 | 'display','none'); |
|
422 | 'display','none'); | |
423 | }); |
|
423 | }); | |
424 | </script> |
|
424 | </script> | |
425 | <script type="text/javascript"> |
|
425 | <script type="text/javascript"> | |
426 | /** |
|
426 | /** | |
427 | * Plots summary graph |
|
427 | * Plots summary graph | |
428 | * |
|
428 | * | |
429 | * @class SummaryPlot |
|
429 | * @class SummaryPlot | |
430 | * @param {from} initial from for detailed graph |
|
430 | * @param {from} initial from for detailed graph | |
431 | * @param {to} initial to for detailed graph |
|
431 | * @param {to} initial to for detailed graph | |
432 | * @param {dataset} |
|
432 | * @param {dataset} | |
433 | * @param {overview_dataset} |
|
433 | * @param {overview_dataset} | |
434 | */ |
|
434 | */ | |
435 | function SummaryPlot(from,to,dataset,overview_dataset) { |
|
435 | function SummaryPlot(from,to,dataset,overview_dataset) { | |
436 | var initial_ranges = { |
|
436 | var initial_ranges = { | |
437 | "xaxis":{ |
|
437 | "xaxis":{ | |
438 | "from":from, |
|
438 | "from":from, | |
439 | "to":to, |
|
439 | "to":to, | |
440 | }, |
|
440 | }, | |
441 | }; |
|
441 | }; | |
442 | var dataset = dataset; |
|
442 | var dataset = dataset; | |
443 | var overview_dataset = [overview_dataset]; |
|
443 | var overview_dataset = [overview_dataset]; | |
444 | var choiceContainer = YUD.get("legend_choices"); |
|
444 | var choiceContainer = YUD.get("legend_choices"); | |
445 | var choiceContainerTable = YUD.get("legend_choices_tables"); |
|
445 | var choiceContainerTable = YUD.get("legend_choices_tables"); | |
446 | var plotContainer = YUD.get('commit_history'); |
|
446 | var plotContainer = YUD.get('commit_history'); | |
447 | var overviewContainer = YUD.get('overview'); |
|
447 | var overviewContainer = YUD.get('overview'); | |
448 |
|
448 | |||
449 | var plot_options = { |
|
449 | var plot_options = { | |
450 | bars: {show:true,align:'center',lineWidth:4}, |
|
450 | bars: {show:true,align:'center',lineWidth:4}, | |
451 | legend: {show:true, container:"legend_container"}, |
|
451 | legend: {show:true, container:"legend_container"}, | |
452 | points: {show:true,radius:0,fill:false}, |
|
452 | points: {show:true,radius:0,fill:false}, | |
453 | yaxis: {tickDecimals:0,}, |
|
453 | yaxis: {tickDecimals:0,}, | |
454 | xaxis: { |
|
454 | xaxis: { | |
455 | mode: "time", |
|
455 | mode: "time", | |
456 | timeformat: "%d/%m", |
|
456 | timeformat: "%d/%m", | |
457 | min:from, |
|
457 | min:from, | |
458 | max:to, |
|
458 | max:to, | |
459 | }, |
|
459 | }, | |
460 | grid: { |
|
460 | grid: { | |
461 | hoverable: true, |
|
461 | hoverable: true, | |
462 | clickable: true, |
|
462 | clickable: true, | |
463 | autoHighlight:true, |
|
463 | autoHighlight:true, | |
464 | color: "#999" |
|
464 | color: "#999" | |
465 | }, |
|
465 | }, | |
466 | //selection: {mode: "x"} |
|
466 | //selection: {mode: "x"} | |
467 | }; |
|
467 | }; | |
468 | var overview_options = { |
|
468 | var overview_options = { | |
469 | legend:{show:false}, |
|
469 | legend:{show:false}, | |
470 | bars: {show:true,barWidth: 2,}, |
|
470 | bars: {show:true,barWidth: 2,}, | |
471 | shadowSize: 0, |
|
471 | shadowSize: 0, | |
472 | xaxis: {mode: "time", timeformat: "%d/%m/%y",}, |
|
472 | xaxis: {mode: "time", timeformat: "%d/%m/%y",}, | |
473 | yaxis: {ticks: 3, min: 0,tickDecimals:0,}, |
|
473 | yaxis: {ticks: 3, min: 0,tickDecimals:0,}, | |
474 | grid: {color: "#999",}, |
|
474 | grid: {color: "#999",}, | |
475 | selection: {mode: "x"} |
|
475 | selection: {mode: "x"} | |
476 | }; |
|
476 | }; | |
477 |
|
477 | |||
478 | /** |
|
478 | /** | |
479 | *get dummy data needed in few places |
|
479 | *get dummy data needed in few places | |
480 | */ |
|
480 | */ | |
481 | function getDummyData(label){ |
|
481 | function getDummyData(label){ | |
482 | return {"label":label, |
|
482 | return {"label":label, | |
483 | "data":[{"time":0, |
|
483 | "data":[{"time":0, | |
484 | "commits":0, |
|
484 | "commits":0, | |
485 | "added":0, |
|
485 | "added":0, | |
486 | "changed":0, |
|
486 | "changed":0, | |
487 | "removed":0, |
|
487 | "removed":0, | |
488 | }], |
|
488 | }], | |
489 | "schema":["commits"], |
|
489 | "schema":["commits"], | |
490 | "color":'#ffffff', |
|
490 | "color":'#ffffff', | |
491 | } |
|
491 | } | |
492 | } |
|
492 | } | |
493 |
|
493 | |||
494 | /** |
|
494 | /** | |
495 | * generate checkboxes accordindly to data |
|
495 | * generate checkboxes accordindly to data | |
496 | * @param keys |
|
496 | * @param keys | |
497 | * @returns |
|
497 | * @returns | |
498 | */ |
|
498 | */ | |
499 | function generateCheckboxes(data) { |
|
499 | function generateCheckboxes(data) { | |
500 | //append checkboxes |
|
500 | //append checkboxes | |
501 | var i = 0; |
|
501 | var i = 0; | |
502 | choiceContainerTable.innerHTML = ''; |
|
502 | choiceContainerTable.innerHTML = ''; | |
503 | for(var pos in data) { |
|
503 | for(var pos in data) { | |
504 |
|
504 | |||
505 | data[pos].color = i; |
|
505 | data[pos].color = i; | |
506 | i++; |
|
506 | i++; | |
507 | if(data[pos].label != ''){ |
|
507 | if(data[pos].label != ''){ | |
508 | choiceContainerTable.innerHTML += |
|
508 | choiceContainerTable.innerHTML += | |
509 | '<tr><td><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \ |
|
509 | '<tr><td><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \ | |
510 | <label for="id_user_{0}">{0}</label></td></tr>'.format(data[pos].label); |
|
510 | <label for="id_user_{0}">{0}</label></td></tr>'.format(data[pos].label); | |
511 | } |
|
511 | } | |
512 | } |
|
512 | } | |
513 | } |
|
513 | } | |
514 |
|
514 | |||
515 | /** |
|
515 | /** | |
516 | * ToolTip show |
|
516 | * ToolTip show | |
517 | */ |
|
517 | */ | |
518 | function showTooltip(x, y, contents) { |
|
518 | function showTooltip(x, y, contents) { | |
519 | var div=document.getElementById('tooltip'); |
|
519 | var div=document.getElementById('tooltip'); | |
520 | if(!div) { |
|
520 | if(!div) { | |
521 | div = document.createElement('div'); |
|
521 | div = document.createElement('div'); | |
522 | div.id="tooltip"; |
|
522 | div.id="tooltip"; | |
523 | div.style.position="absolute"; |
|
523 | div.style.position="absolute"; | |
524 | div.style.border='1px solid #fdd'; |
|
524 | div.style.border='1px solid #fdd'; | |
525 | div.style.padding='2px'; |
|
525 | div.style.padding='2px'; | |
526 | div.style.backgroundColor='#fee'; |
|
526 | div.style.backgroundColor='#fee'; | |
527 | document.body.appendChild(div); |
|
527 | document.body.appendChild(div); | |
528 | } |
|
528 | } | |
529 | YUD.setStyle(div, 'opacity', 0); |
|
529 | YUD.setStyle(div, 'opacity', 0); | |
530 | div.innerHTML = contents; |
|
530 | div.innerHTML = contents; | |
531 | div.style.top=(y + 5) + "px"; |
|
531 | div.style.top=(y + 5) + "px"; | |
532 | div.style.left=(x + 5) + "px"; |
|
532 | div.style.left=(x + 5) + "px"; | |
533 |
|
533 | |||
534 | var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2); |
|
534 | var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2); | |
535 | anim.animate(); |
|
535 | anim.animate(); | |
536 | } |
|
536 | } | |
537 |
|
537 | |||
538 | /** |
|
538 | /** | |
539 | * This function will detect if selected period has some changesets |
|
539 | * This function will detect if selected period has some changesets | |
540 | for this user if it does this data is then pushed for displaying |
|
540 | for this user if it does this data is then pushed for displaying | |
541 | Additionally it will only display users that are selected by the checkbox |
|
541 | Additionally it will only display users that are selected by the checkbox | |
542 | */ |
|
542 | */ | |
543 | function getDataAccordingToRanges(ranges) { |
|
543 | function getDataAccordingToRanges(ranges) { | |
544 |
|
544 | |||
545 | var data = []; |
|
545 | var data = []; | |
546 | var new_dataset = {}; |
|
546 | var new_dataset = {}; | |
547 | var keys = []; |
|
547 | var keys = []; | |
548 | var max_commits = 0; |
|
548 | var max_commits = 0; | |
549 | for(var key in dataset){ |
|
549 | for(var key in dataset){ | |
550 |
|
550 | |||
551 | for(var ds in dataset[key].data){ |
|
551 | for(var ds in dataset[key].data){ | |
552 | commit_data = dataset[key].data[ds]; |
|
552 | commit_data = dataset[key].data[ds]; | |
553 | if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){ |
|
553 | if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){ | |
554 |
|
554 | |||
555 | if(new_dataset[key] === undefined){ |
|
555 | if(new_dataset[key] === undefined){ | |
556 | new_dataset[key] = {data:[],schema:["commits"],label:key}; |
|
556 | new_dataset[key] = {data:[],schema:["commits"],label:key}; | |
557 | } |
|
557 | } | |
558 | new_dataset[key].data.push(commit_data); |
|
558 | new_dataset[key].data.push(commit_data); | |
559 | } |
|
559 | } | |
560 | } |
|
560 | } | |
561 | if (new_dataset[key] !== undefined){ |
|
561 | if (new_dataset[key] !== undefined){ | |
562 | data.push(new_dataset[key]); |
|
562 | data.push(new_dataset[key]); | |
563 | } |
|
563 | } | |
564 | } |
|
564 | } | |
565 |
|
565 | |||
566 | if (data.length > 0){ |
|
566 | if (data.length > 0){ | |
567 | return data; |
|
567 | return data; | |
568 | } |
|
568 | } | |
569 | else{ |
|
569 | else{ | |
570 | //just return dummy data for graph to plot itself |
|
570 | //just return dummy data for graph to plot itself | |
571 | return [getDummyData('')]; |
|
571 | return [getDummyData('')]; | |
572 | } |
|
572 | } | |
573 | } |
|
573 | } | |
574 |
|
574 | |||
575 | /** |
|
575 | /** | |
576 | * redraw using new checkbox data |
|
576 | * redraw using new checkbox data | |
577 | */ |
|
577 | */ | |
578 | function plotchoiced(e,args){ |
|
578 | function plotchoiced(e,args){ | |
579 | var cur_data = args[0]; |
|
579 | var cur_data = args[0]; | |
580 | var cur_ranges = args[1]; |
|
580 | var cur_ranges = args[1]; | |
581 |
|
581 | |||
582 | var new_data = []; |
|
582 | var new_data = []; | |
583 | var inputs = choiceContainer.getElementsByTagName("input"); |
|
583 | var inputs = choiceContainer.getElementsByTagName("input"); | |
584 |
|
584 | |||
585 | //show only checked labels |
|
585 | //show only checked labels | |
586 | for(var i=0; i<inputs.length; i++) { |
|
586 | for(var i=0; i<inputs.length; i++) { | |
587 | var checkbox_key = inputs[i].name; |
|
587 | var checkbox_key = inputs[i].name; | |
588 |
|
588 | |||
589 | if(inputs[i].checked){ |
|
589 | if(inputs[i].checked){ | |
590 | for(var d in cur_data){ |
|
590 | for(var d in cur_data){ | |
591 | if(cur_data[d].label == checkbox_key){ |
|
591 | if(cur_data[d].label == checkbox_key){ | |
592 | new_data.push(cur_data[d]); |
|
592 | new_data.push(cur_data[d]); | |
593 | } |
|
593 | } | |
594 | } |
|
594 | } | |
595 | } |
|
595 | } | |
596 | else{ |
|
596 | else{ | |
597 | //push dummy data to not hide the label |
|
597 | //push dummy data to not hide the label | |
598 | new_data.push(getDummyData(checkbox_key)); |
|
598 | new_data.push(getDummyData(checkbox_key)); | |
599 | } |
|
599 | } | |
600 | } |
|
600 | } | |
601 |
|
601 | |||
602 | var new_options = YAHOO.lang.merge(plot_options, { |
|
602 | var new_options = YAHOO.lang.merge(plot_options, { | |
603 | xaxis: { |
|
603 | xaxis: { | |
604 | min: cur_ranges.xaxis.from, |
|
604 | min: cur_ranges.xaxis.from, | |
605 | max: cur_ranges.xaxis.to, |
|
605 | max: cur_ranges.xaxis.to, | |
606 | mode:"time", |
|
606 | mode:"time", | |
607 | timeformat: "%d/%m", |
|
607 | timeformat: "%d/%m", | |
608 | }, |
|
608 | }, | |
609 | }); |
|
609 | }); | |
610 | if (!new_data){ |
|
610 | if (!new_data){ | |
611 | new_data = [[0,1]]; |
|
611 | new_data = [[0,1]]; | |
612 | } |
|
612 | } | |
613 | // do the zooming |
|
613 | // do the zooming | |
614 | plot = YAHOO.widget.Flot(plotContainer, new_data, new_options); |
|
614 | plot = YAHOO.widget.Flot(plotContainer, new_data, new_options); | |
615 |
|
615 | |||
616 | plot.subscribe("plotselected", plotselected); |
|
616 | plot.subscribe("plotselected", plotselected); | |
617 |
|
617 | |||
618 | //resubscribe plothover |
|
618 | //resubscribe plothover | |
619 | plot.subscribe("plothover", plothover); |
|
619 | plot.subscribe("plothover", plothover); | |
620 |
|
620 | |||
621 | // don't fire event on the overview to prevent eternal loop |
|
621 | // don't fire event on the overview to prevent eternal loop | |
622 | overview.setSelection(cur_ranges, true); |
|
622 | overview.setSelection(cur_ranges, true); | |
623 |
|
623 | |||
624 | } |
|
624 | } | |
625 |
|
625 | |||
626 | /** |
|
626 | /** | |
627 | * plot only selected items from overview |
|
627 | * plot only selected items from overview | |
628 | * @param ranges |
|
628 | * @param ranges | |
629 | * @returns |
|
629 | * @returns | |
630 | */ |
|
630 | */ | |
631 | function plotselected(ranges,cur_data) { |
|
631 | function plotselected(ranges,cur_data) { | |
632 | //updates the data for new plot |
|
632 | //updates the data for new plot | |
633 | var data = getDataAccordingToRanges(ranges); |
|
633 | var data = getDataAccordingToRanges(ranges); | |
634 | generateCheckboxes(data); |
|
634 | generateCheckboxes(data); | |
635 |
|
635 | |||
636 | var new_options = YAHOO.lang.merge(plot_options, { |
|
636 | var new_options = YAHOO.lang.merge(plot_options, { | |
637 | xaxis: { |
|
637 | xaxis: { | |
638 | min: ranges.xaxis.from, |
|
638 | min: ranges.xaxis.from, | |
639 | max: ranges.xaxis.to, |
|
639 | max: ranges.xaxis.to, | |
640 | mode:"time", |
|
640 | mode:"time", | |
641 | timeformat: "%d/%m", |
|
641 | timeformat: "%d/%m", | |
642 | }, |
|
642 | }, | |
643 | }); |
|
643 | }); | |
644 | // do the zooming |
|
644 | // do the zooming | |
645 | plot = YAHOO.widget.Flot(plotContainer, data, new_options); |
|
645 | plot = YAHOO.widget.Flot(plotContainer, data, new_options); | |
646 |
|
646 | |||
647 | plot.subscribe("plotselected", plotselected); |
|
647 | plot.subscribe("plotselected", plotselected); | |
648 |
|
648 | |||
649 | //resubscribe plothover |
|
649 | //resubscribe plothover | |
650 | plot.subscribe("plothover", plothover); |
|
650 | plot.subscribe("plothover", plothover); | |
651 |
|
651 | |||
652 | // don't fire event on the overview to prevent eternal loop |
|
652 | // don't fire event on the overview to prevent eternal loop | |
653 | overview.setSelection(ranges, true); |
|
653 | overview.setSelection(ranges, true); | |
654 |
|
654 | |||
655 | //resubscribe choiced |
|
655 | //resubscribe choiced | |
656 | YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]); |
|
656 | YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]); | |
657 | } |
|
657 | } | |
658 |
|
658 | |||
659 | var previousPoint = null; |
|
659 | var previousPoint = null; | |
660 |
|
660 | |||
661 | function plothover(o) { |
|
661 | function plothover(o) { | |
662 | var pos = o.pos; |
|
662 | var pos = o.pos; | |
663 | var item = o.item; |
|
663 | var item = o.item; | |
664 |
|
664 | |||
665 | //YUD.get("x").innerHTML = pos.x.toFixed(2); |
|
665 | //YUD.get("x").innerHTML = pos.x.toFixed(2); | |
666 | //YUD.get("y").innerHTML = pos.y.toFixed(2); |
|
666 | //YUD.get("y").innerHTML = pos.y.toFixed(2); | |
667 | if (item) { |
|
667 | if (item) { | |
668 | if (previousPoint != item.datapoint) { |
|
668 | if (previousPoint != item.datapoint) { | |
669 | previousPoint = item.datapoint; |
|
669 | previousPoint = item.datapoint; | |
670 |
|
670 | |||
671 | var tooltip = YUD.get("tooltip"); |
|
671 | var tooltip = YUD.get("tooltip"); | |
672 | if(tooltip) { |
|
672 | if(tooltip) { | |
673 | tooltip.parentNode.removeChild(tooltip); |
|
673 | tooltip.parentNode.removeChild(tooltip); | |
674 | } |
|
674 | } | |
675 | var x = item.datapoint.x.toFixed(2); |
|
675 | var x = item.datapoint.x.toFixed(2); | |
676 | var y = item.datapoint.y.toFixed(2); |
|
676 | var y = item.datapoint.y.toFixed(2); | |
677 |
|
677 | |||
678 | if (!item.series.label){ |
|
678 | if (!item.series.label){ | |
679 | item.series.label = 'commits'; |
|
679 | item.series.label = 'commits'; | |
680 | } |
|
680 | } | |
681 | var d = new Date(x*1000); |
|
681 | var d = new Date(x*1000); | |
682 | var fd = d.toDateString() |
|
682 | var fd = d.toDateString() | |
683 | var nr_commits = parseInt(y); |
|
683 | var nr_commits = parseInt(y); | |
684 |
|
684 | |||
685 | var cur_data = dataset[item.series.label].data[item.dataIndex]; |
|
685 | var cur_data = dataset[item.series.label].data[item.dataIndex]; | |
686 | var added = cur_data.added; |
|
686 | var added = cur_data.added; | |
687 | var changed = cur_data.changed; |
|
687 | var changed = cur_data.changed; | |
688 | var removed = cur_data.removed; |
|
688 | var removed = cur_data.removed; | |
689 |
|
689 | |||
690 | var nr_commits_suffix = " ${_('commits')} "; |
|
690 | var nr_commits_suffix = " ${_('commits')} "; | |
691 | var added_suffix = " ${_('files added')} "; |
|
691 | var added_suffix = " ${_('files added')} "; | |
692 | var changed_suffix = " ${_('files changed')} "; |
|
692 | var changed_suffix = " ${_('files changed')} "; | |
693 | var removed_suffix = " ${_('files removed')} "; |
|
693 | var removed_suffix = " ${_('files removed')} "; | |
694 |
|
694 | |||
695 | if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";} |
|
695 | if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";} | |
696 | if(added==1){added_suffix=" ${_('file added')} ";} |
|
696 | if(added==1){added_suffix=" ${_('file added')} ";} | |
697 | if(changed==1){changed_suffix=" ${_('file changed')} ";} |
|
697 | if(changed==1){changed_suffix=" ${_('file changed')} ";} | |
698 | if(removed==1){removed_suffix=" ${_('file removed')} ";} |
|
698 | if(removed==1){removed_suffix=" ${_('file removed')} ";} | |
699 |
|
699 | |||
700 | showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd |
|
700 | showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd | |
701 | +'<br/>'+ |
|
701 | +'<br/>'+ | |
702 | nr_commits + nr_commits_suffix+'<br/>'+ |
|
702 | nr_commits + nr_commits_suffix+'<br/>'+ | |
703 | added + added_suffix +'<br/>'+ |
|
703 | added + added_suffix +'<br/>'+ | |
704 | changed + changed_suffix + '<br/>'+ |
|
704 | changed + changed_suffix + '<br/>'+ | |
705 | removed + removed_suffix + '<br/>'); |
|
705 | removed + removed_suffix + '<br/>'); | |
706 | } |
|
706 | } | |
707 | } |
|
707 | } | |
708 | else { |
|
708 | else { | |
709 | var tooltip = YUD.get("tooltip"); |
|
709 | var tooltip = YUD.get("tooltip"); | |
710 |
|
710 | |||
711 | if(tooltip) { |
|
711 | if(tooltip) { | |
712 | tooltip.parentNode.removeChild(tooltip); |
|
712 | tooltip.parentNode.removeChild(tooltip); | |
713 | } |
|
713 | } | |
714 | previousPoint = null; |
|
714 | previousPoint = null; | |
715 | } |
|
715 | } | |
716 | } |
|
716 | } | |
717 |
|
717 | |||
718 | /** |
|
718 | /** | |
719 | * MAIN EXECUTION |
|
719 | * MAIN EXECUTION | |
720 | */ |
|
720 | */ | |
721 |
|
721 | |||
722 | var data = getDataAccordingToRanges(initial_ranges); |
|
722 | var data = getDataAccordingToRanges(initial_ranges); | |
723 | generateCheckboxes(data); |
|
723 | generateCheckboxes(data); | |
724 |
|
724 | |||
725 | //main plot |
|
725 | //main plot | |
726 | var plot = YAHOO.widget.Flot(plotContainer,data,plot_options); |
|
726 | var plot = YAHOO.widget.Flot(plotContainer,data,plot_options); | |
727 |
|
727 | |||
728 | //overview |
|
728 | //overview | |
729 | var overview = YAHOO.widget.Flot(overviewContainer, |
|
729 | var overview = YAHOO.widget.Flot(overviewContainer, | |
730 | overview_dataset, overview_options); |
|
730 | overview_dataset, overview_options); | |
731 |
|
731 | |||
732 | //show initial selection on overview |
|
732 | //show initial selection on overview | |
733 | overview.setSelection(initial_ranges); |
|
733 | overview.setSelection(initial_ranges); | |
734 |
|
734 | |||
735 | plot.subscribe("plotselected", plotselected); |
|
735 | plot.subscribe("plotselected", plotselected); | |
736 | plot.subscribe("plothover", plothover) |
|
736 | plot.subscribe("plothover", plothover) | |
737 |
|
737 | |||
738 | overview.subscribe("plotselected", function (ranges) { |
|
738 | overview.subscribe("plotselected", function (ranges) { | |
739 | plot.setSelection(ranges); |
|
739 | plot.setSelection(ranges); | |
740 | }); |
|
740 | }); | |
741 |
|
741 | |||
742 | // user choices on overview |
|
742 | // user choices on overview | |
743 | YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]); |
|
743 | YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]); | |
744 | } |
|
744 | } | |
745 | SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n}); |
|
745 | SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n}); | |
746 | </script> |
|
746 | </script> | |
747 | %endif |
|
747 | %endif | |
748 |
|
748 | |||
749 | </%def> |
|
749 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now