Skip to content

Commit

Permalink
sort the list and add bootstrap styles
Browse files Browse the repository at this point in the history
  • Loading branch information
eballo committed Nov 22, 2016
1 parent 745fde1 commit c3883fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h1 class="page-header">Interactive Map of Catalunya SVG/VML and RaphaëlJs - De
</div>

<div class="llistaComarques col-md-12">
<ul class="list"></ul>
<ul class="list list-group"></ul>
</div>

</div>
Expand Down
16 changes: 12 additions & 4 deletions js/catalunya-map-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,19 @@ $(function () {
console.log('create llista comarques ...');
}

// clear the existing list
$('#llistaComarques li').remove();
var i = 0;
var llistaComarques =[];
for (var comarca in mappaths) {
$("<li>"+mappaths[comarca].name+"</li>").appendTo("ul.list");
llistaComarques.push({ name: mappaths[comarca].name, url:mappaths[comarca].url });
}

// Order the list by name
llistaComarques = llistaComarques.sort(function (a, b) {
return a.name.localeCompare( b.name );
});

// Create list with bootstrap styles
for(i=0;i<llistaComarques.length;i++){
$("<li class='list-group-item'><a href='"+llistaComarques[i].url+"' class='list-group-item'>"+llistaComarques[i].name+"</a></li>").appendTo("ul.list");
}
}

Expand Down

0 comments on commit c3883fe

Please sign in to comment.