Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "getRepositoryUrl" in order to support repository package.json property as object #204

Merged
merged 11 commits into from
Mar 11, 2016
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 (typeof this.repository === 'object') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just use underscore's _.isObject for consistency?

if (this.repository.url) {
return this.repository.url;
}
}
if (typeof this.repository === 'string') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and _.isString(...) here

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