FEATURE: display github profile links on user card and profile
Can be disabled by unchecking "public_github_screen_name"
This commit is contained in:
parent
e14e2b8158
commit
95c518329a
|
@ -437,7 +437,15 @@ Discourse.User = Discourse.Model.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, function () {});
|
}, function () {});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
githubProfileUrl: function(){
|
||||||
|
|
||||||
|
var screenName = this.get('github_screen_name');
|
||||||
|
if(screenName) {
|
||||||
|
return "https://github.com/" + screenName;
|
||||||
|
}
|
||||||
|
}.property()
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@
|
||||||
<div class="metadata">
|
<div class="metadata">
|
||||||
<h3><i class="fa fa-comment"></i> {{i18n last_post}} {{format-date path="user.last_posted_at" leaveAgo="true"}} </h3>
|
<h3><i class="fa fa-comment"></i> {{i18n last_post}} {{format-date path="user.last_posted_at" leaveAgo="true"}} </h3>
|
||||||
<h3><i class="fa fa-user"></i> {{i18n joined}} {{format-date path="user.created_at" leaveAgo="true"}}</h3>
|
<h3><i class="fa fa-user"></i> {{i18n joined}} {{format-date path="user.created_at" leaveAgo="true"}}</h3>
|
||||||
|
{{#if user.githubProfileUrl}}
|
||||||
|
<a href="{{unbound user.githubProfileUrl}}"><h3><i class="fa fa-github"></i> GitHub</h3></a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</dd>
|
</dd>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if github_screen_name}}
|
||||||
|
<dt>GitHub</dt>
|
||||||
|
<dd><a href="{{unbound githubProfileUrl}}">{{github_screen_name}}</a></dd>
|
||||||
|
{{/if}}
|
||||||
</dl>
|
</dl>
|
||||||
{{plugin-outlet "user-profile-secondary"}}
|
{{plugin-outlet "user-profile-secondary"}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -215,6 +215,9 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
color: $primary;
|
color: $primary;
|
||||||
|
a {
|
||||||
|
color: $primary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dt {
|
dt {
|
||||||
|
|
|
@ -257,6 +257,9 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
color: $primary;
|
color: $primary;
|
||||||
|
a {
|
||||||
|
color: $primary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dt {
|
dt {
|
||||||
|
|
|
@ -48,7 +48,8 @@ class UserSerializer < BasicUserSerializer
|
||||||
:has_title_badges,
|
:has_title_badges,
|
||||||
:edit_history_public,
|
:edit_history_public,
|
||||||
:custom_fields,
|
:custom_fields,
|
||||||
:user_fields
|
:user_fields,
|
||||||
|
:github_screen_name
|
||||||
|
|
||||||
has_one :invited_by, embed: :object, serializer: BasicUserSerializer
|
has_one :invited_by, embed: :object, serializer: BasicUserSerializer
|
||||||
has_many :custom_groups, embed: :object, serializer: BasicGroupSerializer
|
has_many :custom_groups, embed: :object, serializer: BasicGroupSerializer
|
||||||
|
@ -88,6 +89,11 @@ class UserSerializer < BasicUserSerializer
|
||||||
###
|
###
|
||||||
### ATTRIBUTES
|
### ATTRIBUTES
|
||||||
###
|
###
|
||||||
|
def github_screen_name
|
||||||
|
if SiteSetting.public_github_screen_name
|
||||||
|
object.github_user_info && object.github_user_info.screen_name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def include_email?
|
def include_email?
|
||||||
object.id && object.id == scope.user.try(:id)
|
object.id && object.id == scope.user.try(:id)
|
||||||
|
|
|
@ -808,6 +808,7 @@ en:
|
||||||
facebook_app_secret: "App secret for Facebook authentication, registered at https://developers.facebook.com/apps"
|
facebook_app_secret: "App secret for Facebook authentication, registered at https://developers.facebook.com/apps"
|
||||||
|
|
||||||
enable_github_logins: "Enable Github authentication, requires github_client_id and github_client_secret"
|
enable_github_logins: "Enable Github authentication, requires github_client_id and github_client_secret"
|
||||||
|
public_github_screen_name: "Display Github screen names publicly in the forum (on user page and profile)"
|
||||||
github_client_id: "Client id for Github authentication, registered at https://github.com/settings/applications"
|
github_client_id: "Client id for Github authentication, registered at https://github.com/settings/applications"
|
||||||
github_client_secret: "Client secret for Github authentication, registered at https://github.com/settings/applications"
|
github_client_secret: "Client secret for Github authentication, registered at https://github.com/settings/applications"
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,7 @@ login:
|
||||||
enable_github_logins:
|
enable_github_logins:
|
||||||
client: true
|
client: true
|
||||||
default: false
|
default: false
|
||||||
|
public_github_screen_name: true
|
||||||
github_client_id:
|
github_client_id:
|
||||||
default: ''
|
default: ''
|
||||||
regex: "^[a-f0-9]*$"
|
regex: "^[a-f0-9]*$"
|
||||||
|
|
Loading…
Reference in New Issue