Commit 94b5d7d7eb82f9dc4ba29afbc22997a9107f3483
show names when mouseover avatar links
Dominic Tarr committed on 8/5/2016, 3:10:10 AMParent: f620b921a2133b93e775316a92ac76a61ba55798
Files changed
modules/avatar-profile.js | changed |
modules/avatar.js | changed |
modules/avatar-link.js | added |
modules/avatar-profile.js | ||
---|---|---|
@@ -1,10 +1,9 @@ | ||
1 | 1 | var h = require('hyperscript') |
2 | 2 | var plugs = require('../plugs') |
3 | 3 | var pull = require('pull-stream') |
4 | 4 | |
5 | -var avatar_image = plugs.first(exports.avatar_image = []) | |
6 | -var avatar_name = plugs.first(exports.avatar_name = []) | |
5 | +var avatar_image_link = plugs.first(exports.avatar_image_link = []) | |
7 | 6 | var avatar_action = plugs.map(exports.avatar_action = []) |
8 | 7 | var avatar_edit = plugs.first(exports.avatar_edit = []) |
9 | 8 | |
10 | 9 | var follows = plugs.first(exports.follows = []) |
@@ -20,9 +19,9 @@ | ||
20 | 19 | return el |
21 | 20 | } |
22 | 21 | |
23 | 22 | function image_link (id) { |
24 | - return h('a', {href:'#'+id}, avatar_image(id, 'thumbnail')) | |
23 | + return avatar_image_link(id, 'thumbnail') | |
25 | 24 | } |
26 | 25 | |
27 | 26 | exports.avatar_profile = function (id) { |
28 | 27 | return h('div.column.profile', |
@@ -47,4 +46,8 @@ | ||
47 | 46 | ) |
48 | 47 | ) |
49 | 48 | } |
50 | 49 | |
50 | + | |
51 | + | |
52 | + | |
53 | + |
modules/avatar.js | ||
---|---|---|
@@ -1,16 +1,23 @@ | ||
1 | 1 | var h = require('hyperscript') |
2 | 2 | var u = require('../util') |
3 | +var plugs = require('../plugs') | |
3 | 4 | |
4 | - | |
5 | -var plugs = require('../plugs') | |
6 | 5 | var avatar_name = plugs.first(exports.avatar_name = []) |
7 | 6 | var avatar_image = plugs.first(exports.avatar_image = []) |
7 | +var avatar_link = plugs.first(exports.avatar_link = []) | |
8 | 8 | |
9 | 9 | exports.avatar = function (author, classes) { |
10 | - return h('a.avatar', | |
11 | - {href:'#'+author}, | |
10 | + return exports.avatar_image_name_link(author, classes) | |
11 | +} | |
12 | + | |
13 | +exports.avatar_image_name_link = function (author, classes) { | |
14 | + return avatar_link(author, [ | |
12 | 15 | avatar_image(author, classes), |
13 | 16 | avatar_name(author) |
14 | - ) | |
17 | + ]) | |
15 | 18 | } |
16 | 19 | |
20 | +exports.avatar_image_link = function (author, classes) { | |
21 | + return avatar_link(author, avatar_image(author, classes)) | |
22 | +} | |
23 | + |
modules/avatar-link.js | ||
---|---|---|
@@ -1,0 +1,18 @@ | ||
1 | +var h = require('hyperscript') | |
2 | +var plugs = require('../plugs') | |
3 | +var avatar_name = plugs.first(exports.avatar_name = []) | |
4 | + | |
5 | +var signifier = require('../plugs').first(exports.signifier = []) | |
6 | + | |
7 | +exports.avatar_link = function (id, element) { | |
8 | + | |
9 | + var link = h('a.avatar', {href: "#"+id, title: id}, element) | |
10 | + | |
11 | + signifier(id, function (_, names) { | |
12 | + if(names.length) | |
13 | + link.title = names[0].name + '\n '+id | |
14 | + }) | |
15 | + | |
16 | + return link | |
17 | +} | |
18 | + |
Built with git-ssb-web