forked from publiclab/community-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dropdown autocomplete for navigation around repositories (publicl…
…ab#219) * add dropdown for navigation around repositories. * make autocomplete a dropdown.
- Loading branch information
1 parent
bf490b3
commit e13747e
Showing
6 changed files
with
128 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function generateAutocomplete(repos) { | ||
let repoAlreadySelected = urlHash().getUrlHashParameters('r'); | ||
if(jQuery.isEmptyObject(repoAlreadySelected)) { | ||
repoAlreadySelected = "plots2"; | ||
}else { | ||
repoAlreadySelected = repoAlreadySelected.r; | ||
} | ||
$('#dropdownMenuButton').html(repoAlreadySelected); | ||
|
||
repos.map((repo,i) => { | ||
$('<p>', { | ||
class: 'dropdown-items', | ||
text: repo | ||
}).appendTo('#dropdown-container'); | ||
}); | ||
|
||
$('.dropdown-items').click((e) => { | ||
let repo = e.target.textContent; | ||
urlHash().setUrlHashParameter("r", repo); | ||
$('#dropdownMenuButton').html(repo); | ||
location.reload(); | ||
}) | ||
} | ||
|
||
|
||
|
||
module.exports.generateAutocomplete = generateAutocomplete; |