Skip to content

Commit

Permalink
Merge pull request #204 from mattiaerre/master
Browse files Browse the repository at this point in the history
add "getRepositoryUrl" in order to support repository package.json property as object
  • Loading branch information
matteofigus committed Mar 11, 2016
2 parents 905a666 + 96757ab commit 4febdbe
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ Contributors:
* [@char1e5](https://github.com/char1e5)
* [@federicomaffei](https://github.com/federicomaffei)
* [@jankowiakmaria](https://github.com/jankowiakmaria)
* [@mattiaerre](https://github.com/mattiaerre)
* [@pbazydlo](https://github.com/pbazydlo)
* [@stevejhiggs](https://github.com/stevejhiggs)
* [@todd](https://github.com/todd)
Expand Down
14 changes: 13 additions & 1 deletion registry/routes/component-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ module.exports = function(repository){
return param.example;
});
}


component.getRepositoryUrl = function() {
if (_.isObject(this.repository)) {
if (this.repository.url) {
return this.repository.url;
}
}
if (_.isString(this.repository)) {
return this.repository;
}
return null;
};

return res.render('component-info', {
component: component,
dependencies: _.keys(component.dependencies),
Expand Down
2 changes: 1 addition & 1 deletion registry/views/component-info.jade
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ block content
span(class='component-state-' + component.oc.state.toLowerCase())= component.oc.state

h3 Component Info
+property('Repository', component.repository || 'not available', !!component.repository)
+property('Repository', component.getRepositoryUrl() || 'not available', !!component.getRepositoryUrl())
+property('Author', component.author || 'not available')
+property('Publish date', new Date(component.oc.date) || 'not available')
+property('Publish agent', ('OC CLI ' + component.oc.version) || 'not available')
Expand Down

0 comments on commit 4febdbe

Please sign in to comment.