-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
335 changed files
with
53,862 additions
and
2,232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Ember from 'ember'; | ||
import layout from './template'; | ||
|
||
/** | ||
* @module ember-osf | ||
* @submodule components | ||
*/ | ||
|
||
/** | ||
* Adapted from Ember Preprints. | ||
* Creates a link to a contributor name if link exists, otherwise just displays contributor name. | ||
* | ||
* Sample usage: | ||
* ```handlebars | ||
* {{author-link | ||
* contributor=contributor | ||
*}} | ||
* ``` | ||
* @class author-link | ||
*/ | ||
export default Ember.Component.extend({ | ||
layout, | ||
tagName: 'li', | ||
/** | ||
* @property contributor | ||
* type Object - SHARE contributor | ||
*/ | ||
contributor: null, | ||
profileLink: Ember.computed('contributor', function() { | ||
// Builds profile link for contributor - handles nesting under contributor or users | ||
const contributor = this.get('contributor'); | ||
let ids = contributor.users ? contributor.users.identifiers || [] : contributor.identifiers || []; | ||
|
||
for (let i = 0; i < ids.length; i++) | ||
if (ids[i].match(/^https?:\/\/(?:.*\.)osf\.io/)) | ||
return ids[i]; | ||
|
||
return false; | ||
}), | ||
contributorName: Ember.computed('contributor', function() { | ||
// Extracts contributor name - handles nesting under contributor or users | ||
const contributor = this.get('contributor'); | ||
return contributor.users ? contributor.users.name : contributor.name; | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{~#if profileLink~}} | ||
<a href={{profileLink}}> | ||
{{~contributorName~}} | ||
</a> | ||
{{~else~}} | ||
{{~contributorName~}} | ||
{{~/if}} |
Oops, something went wrong.