Skip to content

Commit

Permalink
display online and max users counters, fix #56
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Bardanov committed Jul 30, 2014
1 parent d9f48f5 commit 5d0ffd9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions extension/locale/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ define(function (require, exports, module){
badgeForksTitle: 'Most forked extension on GitHub', //0.4.0
/*END of BADGES*/

onlineTitle: 'Number of users that is using this extension right now. Click to find out how this number was calculated.', //0.5.0
maxUsersTitle: 'Overall count of extension\'s users', //0.5.0

//Detailed info about ##
'click-more': 'Detailed info about', //0.3.0

Expand Down
10 changes: 9 additions & 1 deletion extension/services/mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ define(function (require, exports, module){
registryEntry = registry.get(id),
stars = registryEntry ? registryEntry.stars : 'NA',
forks = registryEntry ? registryEntry.forks : 'NA',
online = registryEntry && registryEntry.online ? registryEntry.online : 0,
maxUsers = registryEntry && registryEntry.maxUsers ? registryEntry.maxUsers : 0,
totalDownloads = extension && extension.totalDownloads? extension.totalDownloads : 0,
dailyDownloads = registryEntry ? registryEntry.dailyDownloads : 0,
badgeHolder;
Expand All @@ -108,12 +110,16 @@ define(function (require, exports, module){
str_downloads: locale.get('downloads'),
str_more: locale.get('more'),
str_daily: locale.get('daily'),
str_online: locale.get('onlineTitle'),
str_max_users: locale.get('maxUsersTitle'),
str_click_more: locale.get('click-more') + ' ' + registryEntry? registryEntry.title : '',
id: id,
daily: dailyDownloads ? dailyDownloads : '',
path: config.root,
stars: stars,
forks: forks
forks: forks,
online: online,
max_users: maxUsers
}));

if (registryEntry.authorAvatar){
Expand All @@ -129,6 +135,8 @@ define(function (require, exports, module){
//hide forks counter for extensions without forks on GitHub
if (!forks) { $t.find('.ext-forks').hide(); }

if (!online) { $t.find('.ext-users').hide(); }

if (registryEntry.badge && registryEntry.badge.length > 0){
badgeHolder = $('<div class="ext-badges"></div>');
$t.find('.ext-info').append(badgeHolder);
Expand Down
8 changes: 8 additions & 0 deletions extension/templates/downloads.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@
<span class="ext-forks">
<i class="fa fa-code-fork"></i> ${forks}
</span>
<div class="ext-users">
<i class="fa fa-users"></i>
<a href="https://github.com/dnbard/brackets-extension-rating/wiki/Online-and-max-users-counters-in-this-extension">
<span title="${str_online}">${online}</span>
</a>
<span>/</span>
<span title="${str_max_users}">${max_users}</span>
</div>
</div>

0 comments on commit 5d0ffd9

Please sign in to comment.