Show More
@@ -154,10 +154,8 b' class SummaryController(BaseRepoControll' | |||||
154 | "desc": LANGUAGES_EXTENSIONS_MAP.get(x)}) |
|
154 | "desc": LANGUAGES_EXTENSIONS_MAP.get(x)}) | |
155 | for x, y in lang_stats_d.items()) |
|
155 | for x, y in lang_stats_d.items()) | |
156 |
|
156 | |||
157 |
c.trending_languages = json.dumps( |
|
157 | c.trending_languages = json.dumps( | |
158 |
|
|
158 | sorted(lang_stats, reverse=True, key=lambda k: k[1])[:10] | |
159 | key=lambda k: k[1])[:10] |
|
|||
160 | ) |
|
|||
161 | ) |
|
159 | ) | |
162 | last_rev = stats.stat_on_revision + 1 |
|
160 | last_rev = stats.stat_on_revision + 1 | |
163 | c.repo_last_rev = c.rhodecode_repo.count()\ |
|
161 | c.repo_last_rev = c.rhodecode_repo.count()\ |
@@ -87,6 +87,7 b' class _Nil(object):' | |||||
87 |
|
87 | |||
88 | _nil = _Nil() |
|
88 | _nil = _Nil() | |
89 |
|
89 | |||
|
90 | ||||
90 | class _odict(object): |
|
91 | class _odict(object): | |
91 | """Ordered dict data structure, with O(1) complexity for dict operations |
|
92 | """Ordered dict data structure, with O(1) complexity for dict operations | |
92 | that modify one element. |
|
93 | that modify one element. | |
@@ -146,7 +147,7 b' class _odict(object):' | |||||
146 | dict_impl = self._dict_impl() |
|
147 | dict_impl = self._dict_impl() | |
147 | try: |
|
148 | try: | |
148 | dict_impl.__getitem__(self, key)[1] = val |
|
149 | dict_impl.__getitem__(self, key)[1] = val | |
149 |
except KeyError |
|
150 | except KeyError: | |
150 | new = [dict_impl.__getattribute__(self, 'lt'), val, _nil] |
|
151 | new = [dict_impl.__getattribute__(self, 'lt'), val, _nil] | |
151 | dict_impl.__setitem__(self, key, new) |
|
152 | dict_impl.__setitem__(self, key, new) | |
152 | if dict_impl.__getattribute__(self, 'lt') == _nil: |
|
153 | if dict_impl.__getattribute__(self, 'lt') == _nil: | |
@@ -351,6 +352,7 b' class _odict(object):' | |||||
351 | dict_impl.__getattribute__(self, 'lt'), |
|
352 | dict_impl.__getattribute__(self, 'lt'), | |
352 | dict_impl.__repr__(self)) |
|
353 | dict_impl.__repr__(self)) | |
353 |
|
354 | |||
|
355 | ||||
354 | class OrderedDict(_odict, dict): |
|
356 | class OrderedDict(_odict, dict): | |
355 |
|
357 | |||
356 | def _dict_impl(self): |
|
358 | def _dict_impl(self): |
@@ -295,33 +295,35 b" YUE.on(['download_options','archive_subr" | |||||
295 | var data = ${c.trending_languages|n}; |
|
295 | var data = ${c.trending_languages|n}; | |
296 | var total = 0; |
|
296 | var total = 0; | |
297 | var no_data = true; |
|
297 | var no_data = true; | |
298 | for (k in data){ |
|
|||
299 | total += data[k].count; |
|
|||
300 | no_data = false; |
|
|||
301 | } |
|
|||
302 | var tbl = document.createElement('table'); |
|
298 | var tbl = document.createElement('table'); | |
303 | tbl.setAttribute('class','trending_language_tbl'); |
|
299 | tbl.setAttribute('class','trending_language_tbl'); | |
304 | var cnt = 0; |
|
300 | var cnt = 0; | |
305 | for (k in data){ |
|
301 | ||
|
302 | for (var i=0;i<data.length;i++){ | |||
|
303 | total += data[i][1].count; | |||
306 | cnt += 1; |
|
304 | cnt += 1; | |
|
305 | no_data = false; | |||
|
306 | ||||
307 | var hide = cnt>2; |
|
307 | var hide = cnt>2; | |
308 | var tr = document.createElement('tr'); |
|
308 | var tr = document.createElement('tr'); | |
309 | if (hide){ |
|
309 | if (hide){ | |
310 | tr.setAttribute('style','display:none'); |
|
310 | tr.setAttribute('style','display:none'); | |
311 | tr.setAttribute('class','stats_hidden'); |
|
311 | tr.setAttribute('class','stats_hidden'); | |
312 | } |
|
312 | } | |
313 | var percentage = Math.round((data[k].count/total*100),2); |
|
313 | var k = data[i][0]; | |
314 |
var |
|
314 | var obj = data[i][1]; | |
|
315 | var percentage = Math.round((obj.count/total*100),2); | |||
|
316 | ||||
315 | var td1 = document.createElement('td'); |
|
317 | var td1 = document.createElement('td'); | |
316 | td1.width = 150; |
|
318 | td1.width = 150; | |
317 | var trending_language_label = document.createElement('div'); |
|
319 | var trending_language_label = document.createElement('div'); | |
318 |
trending_language_label.innerHTML = |
|
320 | trending_language_label.innerHTML = obj.desc+" ("+k+")"; | |
319 | td1.appendChild(trending_language_label); |
|
321 | td1.appendChild(trending_language_label); | |
320 |
|
322 | |||
321 | var td2 = document.createElement('td'); |
|
323 | var td2 = document.createElement('td'); | |
322 | td2.setAttribute('style','padding-right:14px !important'); |
|
324 | td2.setAttribute('style','padding-right:14px !important'); | |
323 | var trending_language = document.createElement('div'); |
|
325 | var trending_language = document.createElement('div'); | |
324 |
var nr_files = |
|
326 | var nr_files = obj.count+" ${_('files')}"; | |
325 |
|
327 | |||
326 | trending_language.title = k+" "+nr_files; |
|
328 | trending_language.title = k+" "+nr_files; | |
327 |
|
329 |
General Comments 0
You need to be logged in to leave comments.
Login now