Updated drive file list items to have IDs and close dialog

This commit is contained in:
Lewis Hemens 2014-03-25 23:46:37 +00:00
parent f54c2ccc51
commit b42b71e0b6
3 changed files with 17 additions and 3 deletions

View File

@ -563,7 +563,9 @@ textarea {
<div id="drive-filename">Untitled ASCII Diagram</div>
<div style="margin: 5px;">Edit file permissions in <a href="http://drive.google.com/" target="_blank">Google Drive</a>.</div>
<br>
<div id="drive-file-list"></div>
<div id="drive-file-list">
<!-- filled with li#drive-file-list-item -->
</div>
<button id="drive-new-file-button">New Drawing</button>
<div class="dialog-button-bar">
<button class="close-dialog-button">Close</button>

View File

@ -619,7 +619,14 @@ function pa(a) {
a = a.items;
for (var c in a) {
var d = document.createElement("li");
d.innerHTML = '<a href="#' + a[c].id + '">' + a[c].title + "</a>";
d.id = "drive-file-list-item";
var e = document.createElement("a");
d.appendChild(e);
e.href = "#" + a[c].id;
$(e).click(function() {
$("#drive-dialog").removeClass("visible");
});
e.innerHTML = a[c].title;
$("#drive-file-list").append(d);
}
}.bind(a));

View File

@ -127,7 +127,12 @@ ascii.DriveController.prototype.loadFileList = function() {
var items = result['items'];
for (var i in items) {
var entry = document.createElement('li');
entry.innerHTML = '<a href="#' + items[i]['id'] + '">' + items[i]['title'] + '</a>';
entry.id = "drive-file-list-item";
var title = document.createElement('a');
entry.appendChild(title);
title.href = '#' + items[i]['id'];
$(title).click(function() { $('#drive-dialog').removeClass('visible'); });
title.innerHTML = items[i]['title'];
$('#drive-file-list').append(entry);
}
}.bind(this));