Skip to content

Commit

Permalink
Turn friends into profile viewer links.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenVerborgh committed Sep 26, 2018
1 parent e4b19b0 commit ba69445
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 6 additions & 3 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ solid.auth.trackSession(session => {
}
});

$('#view').click(async () => {
$('#view').click(async function loadProfile() {
// Set up a local data store and associated data fetcher
const store = $rdf.graph();
const fetcher = new $rdf.Fetcher(store);
Expand All @@ -37,7 +37,10 @@ $('#view').click(async () => {
friends.forEach(async (friend) => {
await fetcher.load(friend);
const fullName = store.any(friend, FOAF('name'));
$('#friends').append($('<li>')
.text(fullName && fullName.value || friend.value));
$('#friends').append(
$('<li>').append(
$('<a>').text(fullName && fullName.value || friend.value)
.click(() => $('#profile').val(friend.value))
.click(loadProfile)));
});
});
9 changes: 9 additions & 0 deletions styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ dt {
dt:after {
content: ': ';
}

a {
color: #7c4dff;
border-bottom: 1px solid;
cursor: pointer;
}
a:hover {
color: #9b79fc;
}

0 comments on commit ba69445

Please sign in to comment.