Skip to content

Commit

Permalink
Loading message on CSV download page
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmo0 committed Dec 2, 2018
1 parent 81ab9bc commit 131bc84
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/csv/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h2>Download a pre-built games list</h2>
li.on('click', () => {
$('#csvs').find('a').removeClass('active');
li.addClass('active');
listFiles(csv.repository, csv.folder, csv.details);
listFiles(csv.repository, csv.folder, csv.details, li.find('.name').text());
});

$('#csvs').append(li);
Expand All @@ -44,16 +44,18 @@ <h2>Download a pre-built games list</h2>
* @param {string} repository The repository: username/repository
* @param {string} folder The path to the folder: csv/mame2003
* @param {string} details The path to the files details: csv/files.json
* @param {string} name The name of the repository to load
*/
function listFiles(repository, folder, details) {
$('#files').empty();
function listFiles(repository, folder, details, name) {
$('#files').empty().html('Loading ' + name + ', please wait...');
let template = $('#fileItemTemplate').html();

// get files details
downloader.downloadFile(repository, details, (filesdetailsContent) => {
// list CSV files in folder
downloader.listFiles(repository, folder, (folderContents) => {
let filesdetails = JSON.parse(filesdetailsContent);
$('#files').empty();
for (let filedetail of filesdetails.files) {
// get matching file in the folder
let fileinfos = folderContents.find((item) => item.path === filedetail.filename);
Expand Down

0 comments on commit 131bc84

Please sign in to comment.