Show More
@@ -1,131 +1,131 | |||
|
1 | 1 | ${h.form(url('update_repo', repo_name=c.repo_info.repo_name))} |
|
2 | 2 | <div class="form"> |
|
3 | 3 | <div class="form-horizontal"> |
|
4 | 4 | <div class="form-group"> |
|
5 | 5 | <label class="control-label" for="repo_name">${_('Name')}:</label> |
|
6 | 6 | <div> |
|
7 | 7 | ${h.text('repo_name',class_='form-control')} |
|
8 | 8 | <span class="help-block">${_('Permanent Repository ID')}: `_${c.repo_info.repo_id}` <span><a id="show_more_clone_id" href="#">${_('What is that?')}</a></span></span> |
|
9 | 9 | <span id="clone_id" class="help-block" style="display: none"> |
|
10 | 10 | ${_('URL by id')}: `${c.repo_info.clone_url(with_id=True)}`<br/> |
|
11 | 11 | ${_('''In case this repository is renamed or moved into another group the repository URL changes. |
|
12 | 12 | Using the above permanent URL guarantees that this repository always will be accessible on that URL. |
|
13 | 13 | This is useful for CI systems, or any other cases that you need to hardcode the URL into a 3rd party service.''')}</span> |
|
14 | 14 | </div> |
|
15 | 15 | </div> |
|
16 | 16 | <div class="form-group"> |
|
17 | 17 | <label class="control-label" for="clone_uri">${_('Remote repository')}:</label> |
|
18 | 18 | <div> |
|
19 | 19 | <div id="alter_clone_uri"> |
|
20 | 20 | ${h.text('clone_uri',class_='form-control', placeholder=_('Repository URL'))} |
|
21 | 21 | ${h.hidden('clone_uri_hidden', c.repo_info.clone_uri_hidden)} |
|
22 | 22 | </div> |
|
23 | 23 | <span id="alter_clone_uri_help_block" class="help-block"> |
|
24 | 24 | ${_('Optional: URL of a remote repository. If set, the repository can be pulled from this URL.')} |
|
25 | 25 | </span> |
|
26 | 26 | </div> |
|
27 | 27 | </div> |
|
28 | 28 | <div class="form-group"> |
|
29 | 29 | <label class="control-label" for="repo_group">${_('Repository group')}:</label> |
|
30 | 30 | <div> |
|
31 | 31 | ${h.select('repo_group','',c.repo_groups,class_='form-control')} |
|
32 | 32 | <span class="help-block">${_('Optionally select a group to put this repository into.')}</span> |
|
33 | 33 | </div> |
|
34 | 34 | </div> |
|
35 | 35 | <div class="form-group"> |
|
36 | 36 | <label class="control-label" for="repo_landing_rev">${_('Landing revision')}:</label> |
|
37 | 37 | <div> |
|
38 | 38 | ${h.select('repo_landing_rev','',c.landing_revs,class_='form-control')} |
|
39 | 39 | <span class="help-block">${_('Default revision for files page, downloads, whoosh and readme')}</span> |
|
40 | 40 | </div> |
|
41 | 41 | </div> |
|
42 | 42 | <div class="form-group"> |
|
43 | 43 | <label class="control-label" for="owner">${_('Owner')}:</label> |
|
44 | 44 | <div class="ac"> |
|
45 | 45 | <div class="perm_ac"> |
|
46 | 46 | ${h.text('owner',class_='yui-ac-input form-control')} |
|
47 | 47 | <span class="help-block">${_('Change owner of this repository.')}</span> |
|
48 | 48 | <div id="owner_container"></div> |
|
49 | 49 | </div> |
|
50 | 50 | </div> |
|
51 | 51 | </div> |
|
52 | 52 | <div class="form-group"> |
|
53 | 53 | <label class="control-label" for="repo_description">${_('Description')}:</label> |
|
54 | 54 | <div> |
|
55 |
${h.textarea('repo_description',class_='form-control' |
|
|
55 | ${h.textarea('repo_description',class_='form-control')} | |
|
56 | 56 | <span class="help-block">${_('Keep it short and to the point. Use a README file for longer descriptions.')}</span> |
|
57 | 57 | </div> |
|
58 | 58 | </div> |
|
59 | 59 | |
|
60 | 60 | <div class="form-group"> |
|
61 | 61 | <label class="control-label" for="repo_private">${_('Private repository')}:</label> |
|
62 | 62 | <div> |
|
63 | 63 | ${h.checkbox('repo_private',value="True")} |
|
64 | 64 | <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span> |
|
65 | 65 | </div> |
|
66 | 66 | </div> |
|
67 | 67 | <div class="form-group"> |
|
68 | 68 | <label class="control-label" for="repo_enable_statistics">${_('Enable statistics')}:</label> |
|
69 | 69 | <div> |
|
70 | 70 | ${h.checkbox('repo_enable_statistics',value="True")} |
|
71 | 71 | <span class="help-block">${_('Enable statistics window on summary page.')}</span> |
|
72 | 72 | </div> |
|
73 | 73 | </div> |
|
74 | 74 | <div class="form-group"> |
|
75 | 75 | <label class="control-label" for="repo_enable_downloads">${_('Enable downloads')}:</label> |
|
76 | 76 | <div> |
|
77 | 77 | ${h.checkbox('repo_enable_downloads',value="True")} |
|
78 | 78 | <span class="help-block">${_('Enable download menu on summary page.')}</span> |
|
79 | 79 | </div> |
|
80 | 80 | </div> |
|
81 | 81 | <div class="form-group"> |
|
82 | 82 | <label class="control-label" for="repo_enable_locking">${_('Enable locking')}:</label> |
|
83 | 83 | <div> |
|
84 | 84 | ${h.checkbox('repo_enable_locking',value="True")} |
|
85 | 85 | <span class="help-block">${_('Enable lock-by-pulling on repository.')}</span> |
|
86 | 86 | </div> |
|
87 | 87 | </div> |
|
88 | 88 | |
|
89 | 89 | %if c.visual.repository_fields: |
|
90 | 90 | ## EXTRA FIELDS |
|
91 | 91 | %for field in c.repo_fields: |
|
92 | 92 | <div class="form-group"> |
|
93 | 93 | <label class="control-label" for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label> |
|
94 | 94 | <div> |
|
95 | 95 | ${h.text(field.field_key_prefixed, field.field_value, class_='form-control')} |
|
96 | 96 | %if field.field_desc: |
|
97 | 97 | <span class="help-block">${field.field_desc}</span> |
|
98 | 98 | %endif |
|
99 | 99 | </div> |
|
100 | 100 | </div> |
|
101 | 101 | %endfor |
|
102 | 102 | %endif |
|
103 | 103 | <div class="form-group"> |
|
104 | 104 | <div class="buttons"> |
|
105 | 105 | ${h.submit('save',_('Save'),class_="btn btn-default")} |
|
106 | 106 | ${h.reset('reset',_('Reset'),class_="btn btn-default")} |
|
107 | 107 | </div> |
|
108 | 108 | </div> |
|
109 | 109 | </div> |
|
110 | 110 | </div> |
|
111 | 111 | ${h.end_form()} |
|
112 | 112 | |
|
113 | 113 | <script> |
|
114 | 114 | $(document).ready(function(){ |
|
115 | 115 | $('#show_more_clone_id').on('click', function(e){ |
|
116 | 116 | $('#clone_id').show(); |
|
117 | 117 | e.preventDefault(); |
|
118 | 118 | }); |
|
119 | 119 | |
|
120 | 120 | $('#repo_landing_rev').select2({ |
|
121 | 121 | 'dropdownAutoWidth': true |
|
122 | 122 | }); |
|
123 | 123 | $('#repo_group').select2({ |
|
124 | 124 | 'dropdownAutoWidth': true |
|
125 | 125 | }); |
|
126 | 126 | |
|
127 | 127 | // autocomplete |
|
128 | 128 | var _USERS_AC_DATA = ${h.js(c.users_array)}; |
|
129 | 129 | SimpleUserAutoComplete($('#owner'), $('#owner_container'), _USERS_AC_DATA); |
|
130 | 130 | }); |
|
131 | 131 | </script> |
@@ -1,387 +1,387 | |||
|
1 | 1 | <%inherit file="/base/base.html"/> |
|
2 | 2 | |
|
3 | 3 | <%block name="title"> |
|
4 | 4 | ${_('%s Summary') % c.repo_name} |
|
5 | 5 | </%block> |
|
6 | 6 | |
|
7 | 7 | <%def name="breadcrumbs_links()"> |
|
8 | 8 | ${_('Summary')} |
|
9 | 9 | |
|
10 | 10 | ## locking icon |
|
11 | 11 | %if c.db_repo.enable_locking: |
|
12 | 12 | %if c.db_repo.locked[0]: |
|
13 | 13 | <span class="locking_locked icon-block" data-toggle="tooltip" title="${_('Repository locked by %s') % h.person_by_id(c.db_repo.locked[0])}"></span> |
|
14 | 14 | %else: |
|
15 | 15 | <span class="locking_unlocked icon-ok" data-toggle="tooltip" title="${_('Repository unlocked')}"></span> |
|
16 | 16 | %endif |
|
17 | 17 | %endif |
|
18 | 18 | |
|
19 | 19 | ##FORK |
|
20 | 20 | %if c.db_repo.fork: |
|
21 | 21 | <span> |
|
22 | 22 | - <i class="icon-fork"></i> ${_('Fork of')} "<a href="${h.url('summary_home',repo_name=c.db_repo.fork.repo_name)}">${c.db_repo.fork.repo_name}</a>" |
|
23 | 23 | </span> |
|
24 | 24 | %endif |
|
25 | 25 | |
|
26 | 26 | ##REMOTE |
|
27 | 27 | %if c.db_repo.clone_uri: |
|
28 | 28 | <span> |
|
29 | 29 | - <i class="icon-fork"></i> ${_('Clone from')} "<a href="${h.url(str(h.hide_credentials(c.db_repo.clone_uri)))}">${h.hide_credentials(c.db_repo.clone_uri)}</a>" |
|
30 | 30 | <span> |
|
31 | 31 | %endif |
|
32 | 32 | </%def> |
|
33 | 33 | |
|
34 | 34 | <%block name="header_menu"> |
|
35 | 35 | ${self.menu('repositories')} |
|
36 | 36 | </%block> |
|
37 | 37 | |
|
38 | 38 | <%block name="head_extra"> |
|
39 | 39 | <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" /> |
|
40 | 40 | <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" /> |
|
41 | 41 | |
|
42 | 42 | <script> |
|
43 | 43 | redirect_hash_branch = function(){ |
|
44 | 44 | var branch = window.location.hash.replace(/^#(.*)/, '$1'); |
|
45 | 45 | if (branch){ |
|
46 | 46 | window.location = ${h.js(h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__'))} |
|
47 | 47 | .replace('__BRANCH__',branch); |
|
48 | 48 | } |
|
49 | 49 | } |
|
50 | 50 | redirect_hash_branch(); |
|
51 | 51 | window.onhashchange = function() { |
|
52 | 52 | redirect_hash_branch(); |
|
53 | 53 | }; |
|
54 | 54 | </script> |
|
55 | 55 | </%block> |
|
56 | 56 | |
|
57 | 57 | <%def name="main()"> |
|
58 | 58 | ${self.repo_context_bar('summary')} |
|
59 | 59 | <div class="panel panel-primary"> |
|
60 | 60 | <div class="panel-heading clearfix"> |
|
61 | 61 | ${self.breadcrumbs()} |
|
62 | 62 | </div> |
|
63 | 63 | <div id="summary-panel-body" class="form panel-body"> |
|
64 | 64 | <div id="summary" class="form-horizontal"> |
|
65 | 65 | <div class="form-group form-inline clearfix"> |
|
66 | 66 | <label>${_('Clone URL')}:</label> |
|
67 | 67 | <div id="clone-url"> |
|
68 | 68 | <div id="clone_by_name" class="input-group"> |
|
69 | 69 | <span class="input-group-addon">${self.repotag(c.db_repo)}</span> |
|
70 | 70 | <input class="form-control" size="80" readonly="readonly" value="${c.clone_repo_url}"/> |
|
71 | 71 | <span class="input-group-addon btn">${_('Show by ID')}</span> |
|
72 | 72 | </div> |
|
73 | 73 | <div id="clone_by_id" class="input-group" style="display:none"> |
|
74 | 74 | <span class="input-group-addon">${self.repotag(c.db_repo)}</span> |
|
75 | 75 | <input class="form-control" size="80" readonly="readonly" value="${c.clone_repo_url_id}"/> |
|
76 | 76 | <span class="input-group-addon btn">${_('Show by Name')}</span> |
|
77 | 77 | </div> |
|
78 | 78 | </div> |
|
79 | 79 | </div> |
|
80 | 80 | |
|
81 | 81 | <div class="form-group clearfix"> |
|
82 | 82 | <label>${_('Description')}:</label> |
|
83 | 83 | <div class="desc">${h.urlify_text(c.db_repo.description, stylize=c.visual.stylify_metatags)}</div> |
|
84 | 84 | </div> |
|
85 | 85 | |
|
86 | 86 | <div class="form-group clearfix"> |
|
87 | 87 | <label>${_('Trending files')}:</label> |
|
88 | 88 | <div> |
|
89 | 89 | %if c.show_stats: |
|
90 | 90 | <div id="lang_stats"></div> |
|
91 | 91 | %else: |
|
92 | 92 | ${_('Statistics are disabled for this repository')} |
|
93 | 93 | %if h.HasPermissionAny('hg.admin')('enable stats on from summary'): |
|
94 | 94 | ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_statistics'),class_="btn btn-default btn-xs")} |
|
95 | 95 | %endif |
|
96 | 96 | %endif |
|
97 | 97 | </div> |
|
98 | 98 | </div> |
|
99 | 99 | |
|
100 | 100 | <div class="form-group clearfix"> |
|
101 | 101 | <label>${_('Download')}:</label> |
|
102 | 102 | <div> |
|
103 | 103 | %if len(c.db_repo_scm_instance.revisions) == 0: |
|
104 | 104 | ${_('There are no downloads yet')} |
|
105 | 105 | %elif not c.enable_downloads: |
|
106 | 106 | ${_('Downloads are disabled for this repository')} |
|
107 | 107 | %if h.HasPermissionAny('hg.admin')('enable downloads on from summary'): |
|
108 | 108 | ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_downloads'),class_="btn btn-default btn-xs")} |
|
109 | 109 | %endif |
|
110 | 110 | %else: |
|
111 | 111 | <span id="${'zip_link'}"> |
|
112 | 112 | <a class="btn btn-default btn-sm" href="${h.url('files_archive_home',repo_name=c.db_repo.repo_name,fname='tip.zip')}"><i class="icon-file-zip"></i> ${_('Download as zip')}</a> |
|
113 | 113 | </span> |
|
114 | 114 | ${h.hidden('download_options')} |
|
115 | 115 | <span> |
|
116 | 116 | <label data-toggle="tooltip" title="${_('Check this to download archive with subrepos')}"> |
|
117 | 117 | <input id="archive_subrepos" type="checkbox" name="subrepos" /> |
|
118 | 118 | ${_('With subrepos')} |
|
119 | 119 | </label> |
|
120 | 120 | </span> |
|
121 | 121 | %endif |
|
122 | 122 | </div> |
|
123 | 123 | </div> |
|
124 | 124 | </div> |
|
125 | 125 | <ul id="summary-menu-stats" class="list-group"> |
|
126 | 126 | <li class="list-group-item"> |
|
127 | 127 | <a title="${_('Owner')} ${c.db_repo.owner.email}"> |
|
128 | 128 | <i class="icon-user"></i> ${c.db_repo.owner.username} |
|
129 |
${h.gravatar_div(c.db_repo.owner.email, size=18, div_class="pull-right", div_ |
|
|
129 | ${h.gravatar_div(c.db_repo.owner.email, size=18, div_class="pull-right", div_title=c.db_repo.owner.full_name)} | |
|
130 | 130 | </a> |
|
131 | 131 | </li> |
|
132 | 132 | <li class="list-group-item"> |
|
133 | 133 | <a title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}"> |
|
134 | 134 | <i class="icon-heart"></i> ${_('Followers')} |
|
135 | 135 | <span class="badge pull-right" id="current_followers_count">${c.repository_followers}</span> |
|
136 | 136 | </a> |
|
137 | 137 | </li> |
|
138 | 138 | <li class="list-group-item"> |
|
139 | 139 | <a title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}"> |
|
140 | 140 | <i class="icon-fork"></i> ${_('Forks')} |
|
141 | 141 | <span class="badge pull-right">${c.repository_forks}</span> |
|
142 | 142 | </a> |
|
143 | 143 | </li> |
|
144 | 144 | |
|
145 | 145 | %if request.authuser.username != 'default': |
|
146 | 146 | <li class="list-group-item clearfix"> |
|
147 | 147 | <a href="#" onclick="javascript:showRepoSize('repo_size_2','${c.db_repo.repo_name}')"> |
|
148 | 148 | <i class="icon-ruler"></i> ${_('Size')} |
|
149 | 149 | <span class="badge pull-right" id="repo_size_2"></span> |
|
150 | 150 | </a> |
|
151 | 151 | </li> |
|
152 | 152 | %endif |
|
153 | 153 | |
|
154 | 154 | <li class="list-group-item"> |
|
155 | 155 | %if request.authuser.username != 'default': |
|
156 | 156 | <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=request.authuser.api_key)}"><i class="icon-rss-squared"></i> ${_('Feed')}</a> |
|
157 | 157 | %else: |
|
158 | 158 | <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name)}"><i class="icon-rss-squared"></i> ${_('Feed')}</a> |
|
159 | 159 | %endif |
|
160 | 160 | </li> |
|
161 | 161 | |
|
162 | 162 | %if c.show_stats: |
|
163 | 163 | <li class="list-group-item"> |
|
164 | 164 | <a title="${_('Statistics')}" href="${h.url('repo_stats_home',repo_name=c.repo_name)}"> |
|
165 | 165 | <i class="icon-graph"></i> ${_('Statistics')} |
|
166 | 166 | </a> |
|
167 | 167 | </li> |
|
168 | 168 | %endif |
|
169 | 169 | </ul> |
|
170 | 170 | </div> |
|
171 | 171 | </div> |
|
172 | 172 | |
|
173 | 173 | |
|
174 | 174 | <div class="panel panel-primary"> |
|
175 | 175 | <div class="panel-heading"> |
|
176 | 176 | <div class="breadcrumbs panel-title"> |
|
177 | 177 | %if c.repo_changesets: |
|
178 | 178 | ${h.link_to(_('Latest Changes'),h.url('changelog_home',repo_name=c.repo_name))} |
|
179 | 179 | %else: |
|
180 | 180 | ${_('Quick Start')} |
|
181 | 181 | %endif |
|
182 | 182 | </div> |
|
183 | 183 | </div> |
|
184 | 184 | <div class="panel-body"> |
|
185 | 185 | <div id="shortlog_data"> |
|
186 | 186 | <%include file='../changelog/changelog_summary_data.html'/> |
|
187 | 187 | </div> |
|
188 | 188 | </div> |
|
189 | 189 | </div> |
|
190 | 190 | |
|
191 | 191 | %if c.readme_data: |
|
192 | 192 | <div id="readme" class="anchor"> |
|
193 | 193 | </div> |
|
194 | 194 | <div class="panel panel-primary"> |
|
195 | 195 | <div class="panel-heading" title="${_('Readme file from revision %s:%s') % (c.db_repo.landing_rev[0], c.db_repo.landing_rev[1])}"> |
|
196 | 196 | <div class="breadcrumbs panel-title"> |
|
197 | 197 | <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a> |
|
198 | 198 | </div> |
|
199 | 199 | </div> |
|
200 | 200 | <div class="readme panel-body"> |
|
201 | 201 | ${c.readme_data|n} |
|
202 | 202 | </div> |
|
203 | 203 | </div> |
|
204 | 204 | %endif |
|
205 | 205 | |
|
206 | 206 | <script type="text/javascript"> |
|
207 | 207 | $(document).ready(function(){ |
|
208 | 208 | $('#clone-url input').click(function(e){ |
|
209 | 209 | if($(this).hasClass('selected')){ |
|
210 | 210 | $(this).removeClass('selected'); |
|
211 | 211 | return ; |
|
212 | 212 | }else{ |
|
213 | 213 | $(this).addClass('selected'); |
|
214 | 214 | $(this).select(); |
|
215 | 215 | } |
|
216 | 216 | }); |
|
217 | 217 | |
|
218 | 218 | var $clone_by_name = $('#clone_by_name'); |
|
219 | 219 | var $clone_by_id = $('#clone_by_id'); |
|
220 | 220 | $clone_by_name.find('.btn').click(function(e){ |
|
221 | 221 | $clone_by_name.hide(); |
|
222 | 222 | $clone_by_id.show(); |
|
223 | 223 | }); |
|
224 | 224 | $clone_by_id.find('.btn').click(function(e){ |
|
225 | 225 | $clone_by_id.hide(); |
|
226 | 226 | $clone_by_name.show(); |
|
227 | 227 | }); |
|
228 | 228 | |
|
229 | 229 | var cache = {} |
|
230 | 230 | $("#download_options").select2({ |
|
231 | 231 | placeholder: _TM['Select changeset'], |
|
232 | 232 | dropdownAutoWidth: true, |
|
233 | 233 | query: function(query){ |
|
234 | 234 | var key = 'cache'; |
|
235 | 235 | var cached = cache[key] ; |
|
236 | 236 | if(cached) { |
|
237 | 237 | var data = {results: []}; |
|
238 | 238 | //filter results |
|
239 | 239 | $.each(cached.results, function(){ |
|
240 | 240 | var section = this.text; |
|
241 | 241 | var children = []; |
|
242 | 242 | $.each(this.children, function(){ |
|
243 | 243 | if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){ |
|
244 | 244 | children.push({'id': this.id, 'text': this.text}); |
|
245 | 245 | } |
|
246 | 246 | }); |
|
247 | 247 | data.results.push({'text': section, 'children': children}); |
|
248 | 248 | }); |
|
249 | 249 | query.callback(data); |
|
250 | 250 | }else{ |
|
251 | 251 | $.ajax({ |
|
252 | 252 | url: pyroutes.url('repo_refs_data', {'repo_name': ${h.js(c.repo_name)}}), |
|
253 | 253 | data: {}, |
|
254 | 254 | dataType: 'json', |
|
255 | 255 | type: 'GET', |
|
256 | 256 | success: function(data) { |
|
257 | 257 | cache[key] = data; |
|
258 | 258 | query.callback({results: data.results}); |
|
259 | 259 | } |
|
260 | 260 | }); |
|
261 | 261 | } |
|
262 | 262 | } |
|
263 | 263 | }); |
|
264 | 264 | // on change of download options |
|
265 | 265 | $('#download_options').change(function(e){ |
|
266 | 266 | var new_cs = e.added |
|
267 | 267 | |
|
268 | 268 | for(k in tmpl_links){ |
|
269 | 269 | var s = $('#'+k+'_link'); |
|
270 | 270 | if(s){ |
|
271 | 271 | var title_tmpl = ${h.jshtml(_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__'))}; |
|
272 | 272 | title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text); |
|
273 | 273 | title_tmpl = title_tmpl.replace('__CS_EXT__',k); |
|
274 | 274 | title_tmpl = '<i class="icon-file-zip"></i> '+ title_tmpl; |
|
275 | 275 | var url = tmpl_links[k].replace('__CS__',new_cs.id); |
|
276 | 276 | var subrepos = $('#archive_subrepos').is(':checked'); |
|
277 | 277 | url = url.replace('__SUB__',subrepos); |
|
278 | 278 | url = url.replace('__NAME__',title_tmpl); |
|
279 | 279 | |
|
280 | 280 | s.html(url); |
|
281 | 281 | } |
|
282 | 282 | } |
|
283 | 283 | }); |
|
284 | 284 | |
|
285 | 285 | var tmpl_links = {}; |
|
286 | 286 | %for cnt,archive in enumerate(c.db_repo_scm_instance._get_archives()): |
|
287 | 287 | tmpl_links[${h.jshtml(archive['type'])}] = ${h.js(h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.db_repo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='btn btn-default btn-sm'))}; |
|
288 | 288 | %endfor |
|
289 | 289 | }); |
|
290 | 290 | </script> |
|
291 | 291 | |
|
292 | 292 | %if c.show_stats: |
|
293 | 293 | <script type="text/javascript"> |
|
294 | 294 | $(document).ready(function(){ |
|
295 | 295 | var data = ${h.js(c.trending_languages)}; |
|
296 | 296 | var total = 0; |
|
297 | 297 | var no_data = true; |
|
298 | 298 | var tbl = document.createElement('table'); |
|
299 | 299 | tbl.setAttribute('class','table'); |
|
300 | 300 | var cnt = 0; |
|
301 | 301 | for (var i=0;i<data.length;i++){ |
|
302 | 302 | total+= data[i][1].count; |
|
303 | 303 | } |
|
304 | 304 | for (var i=0;i<data.length;i++){ |
|
305 | 305 | cnt += 1; |
|
306 | 306 | no_data = false; |
|
307 | 307 | |
|
308 | 308 | var hide = cnt>2; |
|
309 | 309 | var tr = document.createElement('tr'); |
|
310 | 310 | if (hide){ |
|
311 | 311 | tr.setAttribute('style','display:none'); |
|
312 | 312 | tr.setAttribute('class','stats_hidden'); |
|
313 | 313 | } |
|
314 | 314 | var k = data[i][0]; |
|
315 | 315 | var obj = data[i][1]; |
|
316 | 316 | var percentage = Math.round((obj.count/total*100),2); |
|
317 | 317 | |
|
318 | 318 | var td1 = document.createElement('td'); |
|
319 | 319 | td1.width = 250; |
|
320 | 320 | var trending_language_label = document.createElement('div'); |
|
321 | 321 | trending_language_label.innerHTML = obj.desc+" ("+k+")"; |
|
322 | 322 | td1.appendChild(trending_language_label); |
|
323 | 323 | |
|
324 | 324 | var td2 = document.createElement('td'); |
|
325 | 325 | td2.setAttribute('style','padding-right:14px !important'); |
|
326 | 326 | var trending_language = document.createElement('div'); |
|
327 | 327 | var nr_files = obj.count + ' ' + ${h.jshtml(_('files'))}; |
|
328 | 328 | |
|
329 | 329 | trending_language.title = k+" "+nr_files; |
|
330 | 330 | |
|
331 | 331 | if (percentage>22){ |
|
332 | 332 | trending_language.innerHTML = "<b class='progress-bar' role='progressbar'" |
|
333 | 333 | + "aria-valuemin='0' aria-valuemax='100' aria-valuenow='" + percentage |
|
334 | 334 | + "' style='width: " + percentage + "%;'>" + percentage + "%, " + nr_files + "</b>"; |
|
335 | 335 | } |
|
336 | 336 | else{ |
|
337 | 337 | trending_language.innerHTML = "<b class='progress-bar' role='progressbar'" |
|
338 | 338 | + "aria-valuemin='0' aria-valuemax='100' aria-valuenow='" + percentage |
|
339 | 339 | + "' style='width: " + percentage + "%;'>" + percentage + "%</b>"; |
|
340 | 340 | } |
|
341 | 341 | |
|
342 | 342 | td2.appendChild(trending_language); |
|
343 | 343 | |
|
344 | 344 | tr.appendChild(td1); |
|
345 | 345 | tr.appendChild(td2); |
|
346 | 346 | tbl.appendChild(tr); |
|
347 | 347 | if(cnt == 3){ |
|
348 | 348 | var show_more = document.createElement('tr'); |
|
349 | 349 | var td = document.createElement('td'); |
|
350 | 350 | lnk = document.createElement('a'); |
|
351 | 351 | |
|
352 | 352 | lnk.href='#'; |
|
353 | 353 | lnk.innerHTML = ${h.jshtml(_('Show more'))}; |
|
354 | 354 | lnk.id='code_stats_show_more'; |
|
355 | 355 | td.appendChild(lnk); |
|
356 | 356 | |
|
357 | 357 | show_more.appendChild(td); |
|
358 | 358 | show_more.appendChild(document.createElement('td')); |
|
359 | 359 | tbl.appendChild(show_more); |
|
360 | 360 | } |
|
361 | 361 | |
|
362 | 362 | } |
|
363 | 363 | if (data.length == 0) { |
|
364 | 364 | tbl.innerHTML = '<tr><td>' + ${h.jshtml(_('No data ready yet'))} + '</td></tr>'; |
|
365 | 365 | } |
|
366 | 366 | |
|
367 | 367 | $('#lang_stats').append(tbl); |
|
368 | 368 | $('#code_stats_show_more').click(function(){ |
|
369 | 369 | $('.stats_hidden').show(); |
|
370 | 370 | $('#code_stats_show_more').hide(); |
|
371 | 371 | }); |
|
372 | 372 | }); |
|
373 | 373 | </script> |
|
374 | 374 | %endif |
|
375 | 375 | |
|
376 | 376 | ## Shortlog paging |
|
377 | 377 | <script type="text/javascript"> |
|
378 | 378 | $(document).ready(function(){ |
|
379 | 379 | var $shortlog_data = $('#shortlog_data'); |
|
380 | 380 | $shortlog_data.on('click','.pager_link',function(e){ |
|
381 | 381 | asynchtml(e.target.href, $shortlog_data, function(){tooltip_activate();}); |
|
382 | 382 | e.preventDefault(); |
|
383 | 383 | }); |
|
384 | 384 | }); |
|
385 | 385 | </script> |
|
386 | 386 | |
|
387 | 387 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now