Improve the look of the title list, and replace all _ by spaces in the title names (as suggested by peter-x)

The titles are now more easily clickable
Fixes #46
This commit is contained in:
mossroy 2013-08-17 14:28:22 +02:00
parent 8ff38e9a54
commit 3367336d22
3 changed files with 8 additions and 9 deletions

View File

@ -130,8 +130,8 @@
<!-- List of articles matching the typed prefix -->
<div class="container">
<ul id="titleList" class="list-unstyled">
</ul>
<div id="titleList" class="list-group">
</div>
</div>
<div id="readingArticle" style="display: none;">
Reading article <span id="articleName"></span> from archive... Please wait <img src="img/spinner.gif" />

View File

@ -250,19 +250,18 @@ define(function(require) {
* @param {type} titleArray
*/
function populateListOfTitles(titleArray) {
var titleListUl = $('#titleList');
var titleListDiv = $('#titleList');
// Remove previous results
titleListUl.empty();
titleListDiv.empty();
for (var i = 0; i < titleArray.length; i++) {
var title = titleArray[i];
var titleLi = document.createElement('li');
var titleA = document.createElement('a');
titleA.setAttribute("class","list-group-item");
titleA.setAttribute("titleId", title.toStringId());
titleA.setAttribute("href", "#");
$(titleA).append(title.name);
$(titleA).append(title.getReadableName());
$(titleA).on("click",handleTitleClick);
$(titleLi).append(titleA);
titleListUl.append(titleLi);
titleListDiv.append(titleA);
}
$('#searchingForTitles').hide();
}

View File

@ -23,7 +23,7 @@ define(function(require) {
;
Title.prototype.getReadableName = function() {
return this.name.replace("_", " ");
return this.name.replace(/_/g, " ");
};