Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit c6d57d6

Browse files
committed
Merge pull request #7666 from SAPlayer/all-contributors
Show all contributors in the AboutDialog
2 parents 143aac5 + 6eee20e commit c6d57d6

5 files changed

Lines changed: 82 additions & 43 deletions

File tree

src/brackets.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"twitter_url" : "https://twitter.com/brackets",
1515
"troubleshoot_url" : "https://github.com/adobe/brackets/wiki/Troubleshooting#wiki-livedev",
1616
"twitter_name" : "@brackets",
17-
"contributors_url" : "https://api.github.com/repos/adobe/brackets/contributors?per_page=300",
17+
"contributors_url" : "https://api.github.com/repos/adobe/brackets/contributors?per_page={0}&page={1}",
1818
"extension_listing_url" : "",
1919
"extension_registry" : "https://s3.amazonaws.com/extend.brackets/registry.json",
2020
"extension_url" : "https://s3.amazonaws.com/extend.brackets/{0}/{0}-{1}.zip",

src/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"twitter_url": "https://twitter.com/brackets",
1414
"troubleshoot_url": "https://github.com/adobe/brackets/wiki/Troubleshooting#wiki-livedev",
1515
"twitter_name": "@brackets",
16-
"contributors_url": "https://api.github.com/repos/adobe/brackets/contributors?per_page=300",
16+
"contributors_url": "https://api.github.com/repos/adobe/brackets/contributors?per_page={0}&page={1}",
1717
"extension_listing_url": "",
1818
"extension_registry": "https://s3.amazonaws.com/extend.brackets/registry.json",
1919
"extension_url": "https://s3.amazonaws.com/extend.brackets/{0}/{0}-{1}.zip",

src/help/HelpCommandHandlers.js

Lines changed: 75 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,22 @@ define(function (require, exports, module) {
2929
"use strict";
3030

3131
var AppInit = require("utils/AppInit"),
32-
Global = require("utils/Global"),
3332
BuildInfoUtils = require("utils/BuildInfoUtils"),
34-
Commands = require("command/Commands"),
3533
CommandManager = require("command/CommandManager"),
34+
Commands = require("command/Commands"),
3635
Dialogs = require("widgets/Dialogs"),
37-
Strings = require("strings"),
38-
UpdateNotification = require("utils/UpdateNotification"),
3936
FileUtils = require("file/FileUtils"),
37+
Global = require("utils/Global"),
4038
NativeApp = require("utils/NativeApp"),
39+
Strings = require("strings"),
4140
StringUtils = require("utils/StringUtils"),
41+
UpdateNotification = require("utils/UpdateNotification"),
4242
AboutDialogTemplate = require("text!htmlContent/about-dialog.html"),
4343
ContributorsTemplate = require("text!htmlContent/contributors-list.html");
4444

45+
/** @const This is the thirdparty API's (GitHub) maximum contributors per page limit */
46+
var CONTRIBUTORS_PER_PAGE = 100;
47+
4548
var buildInfo;
4649

4750

@@ -76,39 +79,78 @@ define(function (require, exports, module) {
7679
Dialogs.showModalDialogUsingTemplate(Mustache.render(AboutDialogTemplate, templateVars));
7780

7881
// Get containers
79-
var $dlg = $(".about-dialog.instance"),
80-
$contributors = $dlg.find(".about-contributors"),
81-
$spinner = $dlg.find(".spinner");
82+
var $dlg = $(".about-dialog.instance"),
83+
$contributors = $dlg.find(".about-contributors"),
84+
$spinner = $dlg.find(".spinner"),
85+
contributorsUrl = brackets.config.contributors_url,
86+
page;
87+
88+
if (contributorsUrl.indexOf("{1}") !== -1) { // pagination enabled
89+
page = 1;
90+
}
8291

8392
$spinner.addClass("spin");
8493

85-
// Get all the project contributors and add them to the dialog
86-
$.getJSON(brackets.config.contributors_url).done(function (contributorsInfo) {
87-
88-
// Populate the contributors data
89-
var totalContributors = contributorsInfo.length;
90-
var contributorsCount = 0;
91-
92-
$contributors.html(Mustache.render(ContributorsTemplate, contributorsInfo));
93-
94-
// This is used to create an opacity transition when each image is loaded
95-
$contributors.find("img").one("load", function () {
96-
$(this).css("opacity", 1);
97-
98-
// Count the contributors loaded and hide the spinner once all are loaded
99-
contributorsCount++;
100-
if (contributorsCount >= totalContributors) {
101-
$spinner.removeClass("spin");
102-
}
103-
}).each(function () {
104-
if (this.complete) {
105-
$(this).trigger("load");
106-
}
94+
function loadContributors(rawUrl, page, contributors, deferred) {
95+
deferred = deferred || new $.Deferred();
96+
contributors = contributors || [];
97+
var url = StringUtils.format(rawUrl, CONTRIBUTORS_PER_PAGE, page);
98+
99+
$.ajax({
100+
url: url,
101+
dataType: "json",
102+
cache: false
103+
})
104+
.done(function (response) {
105+
contributors = contributors.concat(response || []);
106+
if (page && response.length === CONTRIBUTORS_PER_PAGE) {
107+
loadContributors(rawUrl, page + 1, contributors, deferred);
108+
} else {
109+
deferred.resolve(contributors);
110+
}
111+
})
112+
.fail(function () {
113+
if (contributors.length) { // we weren't able to fetch this page, but previous fetches were successful
114+
deferred.resolve(contributors);
115+
} else {
116+
deferred.reject();
117+
}
118+
});
119+
return deferred.promise();
120+
}
121+
122+
loadContributors(contributorsUrl, page) // Load the contributors
123+
.done(function (allContributors) {
124+
// Populate the contributors data
125+
var totalContributors = allContributors.length,
126+
contributorsCount = 0;
127+
128+
allContributors.forEach(function (contributor) {
129+
// remove any UrlParams delivered via the GitHub API
130+
contributor.avatar_url = contributor.avatar_url.split("?")[0];
131+
});
132+
133+
$contributors.html(Mustache.render(ContributorsTemplate, allContributors));
134+
135+
// This is used to create an opacity transition when each image is loaded
136+
$contributors.find("img").one("load", function () {
137+
$(this).css("opacity", 1);
138+
139+
// Count the contributors loaded and hide the spinner once all are loaded
140+
contributorsCount++;
141+
if (contributorsCount >= totalContributors) {
142+
$spinner.removeClass("spin");
143+
}
144+
}).each(function () {
145+
if (this.complete) {
146+
$(this).trigger("load");
147+
}
148+
});
149+
})
150+
.fail(function () {
151+
$spinner.removeClass("spin");
152+
$contributors.html(Mustache.render("<p class='dialog-message'>{{ABOUT_TEXT_LINE6}}</p>", Strings));
107153
});
108-
}).fail(function () {
109-
$spinner.removeClass("spin");
110-
$contributors.html(Mustache.render("<p class='dialog-message'>{{ABOUT_TEXT_LINE6}}</p>", Strings));
111-
});
112154
}
113155

114156
// Read "build number" SHAs off disk immediately at APP_READY, instead
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{#.}}<a href="{{html_url}}" title="{{login}} - {{html_url}}"><img src="{{avatar_url}}" alt="{{login}}" width="30" height="30" /></a>{{/.}}
1+
{{#.}}<a href="{{html_url}}" title="{{login}} - {{html_url}}"><img src="{{avatar_url}}?size=30" alt="{{login}}" width="30" height="30" /></a>{{/.}}

src/styles/brackets_patterns_override.less

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -988,13 +988,10 @@ a[href^="http"] {
988988
a {
989989
text-decoration: none;
990990
}
991-
}
992-
.about-contributors img {
993-
opacity: 0;
994-
-webkit-transition: opacity 1s;
995-
-moz-transition: opacity 1s;
996-
-o-transition: opacity 1s;
997-
transition: opacity 1s;
991+
img {
992+
opacity: 0;
993+
transition: opacity 1s;
994+
}
998995
}
999996
}
1000997

0 commit comments

Comments
 (0)