Skip to content

Commit ac5dfdc

Browse files
authored
add slack, github, and orcid (#2)
1 parent e252b09 commit ac5dfdc

File tree

4 files changed

+68
-16
lines changed

4 files changed

+68
-16
lines changed

people_directory/people.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
USER_DETAILS = ['firstName', 'lastName', 'email', 'username']
14-
USER_ATTRS = ['mobile']
14+
USER_ATTRS = ['mobile', 'slack', 'github', 'orcid']
1515

1616

1717
class People:
@@ -38,7 +38,7 @@ async def update(self):
3838
inst = insts[group_path]
3939
inst['group_path'] = group_path
4040

41-
if 'name' not in inst or 'cite' not in inst:
41+
if 'name' not in inst or not inst.get('has_mou', False):
4242
logging.info(f'bad inst: {group_path}')
4343
del insts[group_path]
4444
continue

people_directory/static/index.html

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,30 @@ <h2>Navigation</h2>
4545
<div class="user header">
4646
<div class="name">Name</div>
4747
<div class="user-insts">Institution</div>
48-
<div class="phone">Phone</div>
49-
<div class="email">E-mail Address</div>
48+
<div class="profiles">
49+
<div class="github">GitHub</div>
50+
<div class="orcid">ORCID</div>
51+
</div>
52+
<div class="contacts">
53+
<div class="phone">Phone</div>
54+
<div class="slack">Slack</div>
55+
<div class="email">E-mail</div>
56+
</div>
5057
</div>
5158
<vue-display class="user_list" v-bind:insts="insts" v-bind:users="users" v-bind:filtered_users="filtered_users" v-bind:filtered_insts="filtered_insts">
5259
{% for user in sorted(users.values(), key=lambda x: (x['lastName']+x['firstName']).lower()) %}
5360
<div class="user">
5461
<div class="name">{{ user['lastName'] }}, {{ user['firstName'] }}{% if 'IL' in user %} [IL]{% end %}</div>
5562
<div class="user-insts">{% for inst in user['institutions'] %}<span>{{ insts[inst]['name'] if inst in insts else '' }}</span>{% end %}</div>
56-
<div class="phone">{{ user['mobile'] }}</div>
57-
<div class="email">{{ user['email'] }}</div>
63+
<div class="profiles">
64+
<div class="github">{{ user['github'] }}</div>
65+
<div class="orcid">{{ user['orcid'] }}</div>
66+
</div>
67+
<div class="contacts">
68+
<div class="phone">{{ user['mobile'] }}</div>
69+
<div class="slack">{{ user['slack'] }}</div>
70+
<div class="email">{{ user['email'] }}</div>
71+
</div>
5872
</div>
5973
{% end %}
6074
</vue-display>

people_directory/static/main.css

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ article .header {
171171
}
172172

173173
article .user>div {
174-
overflow-wrap: break-word;
174+
overflow-wrap: anywhere;
175175
margin: 0;
176176
padding: 0;
177177
flex-grow: 0;
@@ -182,8 +182,8 @@ article .user .name {
182182
width: 14em;
183183
}
184184
article .user .user-insts {
185+
margin-left: .5em;
185186
min-width: 14em;
186-
margin: auto;
187187
flex-shrink: 1;
188188
flex-grow: 1;
189189
}
@@ -193,26 +193,36 @@ article .user .user-insts span {
193193
article .user .user-insts span:not(:last-child)::after {
194194
content: ",";
195195
}
196-
article .user .phone {
196+
article .user .profiles {
197+
margin-left: .5em;
197198
width: 10em;
198199
}
199-
article .user .email {
200+
article .user .phone, article .user .github, article .user .slack, article .user .orcid, article .user .email {
201+
display: inline-block;
202+
}
203+
article .user .github::after,
204+
article .user .slack::after,
205+
article .user .phone::after {
206+
content: " | "
207+
}
208+
article .user .contacts {
200209
width: 18em;
210+
margin-left: .5em;
201211
text-align: right;
202212
}
203213
@media all and (min-width: 1100px) {
204-
article .user .phone {
214+
article .user .profiles {
205215
width: 11em;
206216
}
207-
article .user .email {
217+
article .user .contacts {
208218
width: 22em;
209219
}
210220
}
211221
@media all and (min-width: 1200px) {
212-
article .user .phone {
222+
article .user .profiles {
213223
width: 12em;
214224
}
215-
article .user .email {
225+
article .user .contacts {
216226
width: 22em;
217227
}
218228
}

people_directory/static/main.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,42 @@ Vue.component('vue-display', {
6363
return this.insts[group_path].name
6464
}
6565
return ''
66+
},
67+
profile_link: function(prefix, profile) {
68+
if (profile == '') {
69+
return ''
70+
} else {
71+
return '<a href="'+prefix+profile+'">'+profile+'</a>'
72+
}
73+
},
74+
phone_link: function(phone) {
75+
if (phone == '') {
76+
return ''
77+
} else {
78+
return '<a href="tel:'+phone+'">'+phone+'</a>'
79+
}
80+
},
81+
email_link: function(email) {
82+
if (email == '') {
83+
return ''
84+
} else {
85+
return '<a href="mailto:'+email+'">'+email+'</a>'
86+
}
6687
}
6788
},
6889
template: `<div class="user_list">
6990
<div class="user" v-for="user in my_users" :key="user.username">
7091
<div class="name">{{ user.lastName }}, {{ user.firstName }}<span v-if="user.username in leads"> [IL]</span></div>
7192
<div class="user-insts"><span v-for="group_path in user.institutions">{{ inst_name(group_path) }}</span></div>
72-
<div class="phone">{{ user.mobile }}</div>
73-
<div class="email">{{ user.email }}</div>
93+
<div class="profiles">
94+
<div class="github" v-html="profile_link('https://github.com/', user.github)"></div>
95+
<div class="orcid" v-html="profile_link('https://orcid.org/', user.orcid)"></div>
96+
</div>
97+
<div class="contacts">
98+
<div class="phone" v-html="phone_link(user.mobile)"></div>
99+
<div class="slack">{{ user.slack }}</div>
100+
<div class="email" v-html="email_link(user.email)"></div>
101+
</div>
74102
</div></div>`,
75103
})
76104

0 commit comments

Comments
 (0)