Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

adds links for profile fields #121

Closed
wants to merge 1 commit into from

2 participants

Morgan 'ARR!' Allen isaacs
Morgan 'ARR!' Allen

Similar to PR 100 but doesn't hardcode link types in the template.

isaacs
Owner

Already did this another way.

isaacs isaacs closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 14, 2012
  1. Morgan 'ARR!' Allen
This page is out of date. Refresh to see the latest.
Showing with 30 additions and 4 deletions.
  1. +16 −4 config.js
  2. +7 −0 templates/profile-edit.ejs
  3. +7 −0 templates/profile.ejs
20 config.js
View
@@ -36,10 +36,22 @@ exports.debug = true
// extra fields we hang on the profile.
exports.profileFields =
{ fullname: "Full Name"
-, email: "Email"
-, github: "Github Username"
-, twitter: "Twitter Username"
-, homepage: "Homepage URL"
+, email: {
+ label: "Email",
+ link: "mailto:"
+ }
+, github: {
+ label: "Github Username",
+ link: "https://github.com/"
+ }
+, twitter: {
+ label: "Twitter Username",
+ link: "https://twitter.com/"
+ }
+, homepage: {
+ label: "Homepage URL",
+ link: ""
+}
, freenode: "IRC Handle"
}
7 templates/profile-edit.ejs
View
@@ -8,12 +8,19 @@
<input type=hidden name=name value="<%= profile.name %>">
<%
Object.keys(fields).forEach(function (f) {
+ if(fields[f].label) {
%>
<fieldset>
+ <label for="<%= f %>"><%= fields[f].label %></label>
+ <input id="<%= f %>" name="<%= f %>" value="<%= profile[f] || '' %>">
+ </fieldset>
+ <% } else {%>
+ <fieldset>
<label for="<%= f %>"><%= fields[f] %></label>
<input id="<%= f %>" name="<%= f %>" value="<%= profile[f] || '' %>">
</fieldset>
<%
+ }
})
%>
7 templates/profile.ejs
View
@@ -27,12 +27,19 @@
<table width="100%">
<%
Object.keys(fields).forEach(function (f) {
+ if(fields[f].label) {
%>
<tr>
+ <th><%= fields[f].label %></th>
+ <td><a href="<%= fields[f].link + showprofile[f] || '' %>"><%= showprofile[f] || '' %></a></td>
+ </tr>
+ <% } else { %>
+ <tr>
<th><%= fields[f] %></th>
<td><%= showprofile[f] || '' %></td>
</tr>
<%
+ }
})
%>
</table>
Something went wrong with that request. Please try again.