Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Allow third party repository locations #177

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app/elements/element-action-menu/element-action-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<catalog-element name="[[element]]" data="{{_element}}"></catalog-element>
<a tabindex="0" role="button" on-tap="cartAdd"><cart-item-icon id="cartItemIcon" element="[[element]]" present-label="Remove" absent-label="Add" no-label="[[iconsOnly]]"></cart-item-icon></a>
<a tabindex="0" role="button" on-click="navToDocs" aria-label="View Docs"><iron-icon icon="description" title="View Docs"></iron-icon><span hidden$="[[iconsOnly]]">Docs</span></a>
<a tabindex="0" role="button" href="[[githubLink(_element.source)]]" target="_blank" title="View Source on GitHub" aria-label="View Source on GitHub"><iron-icon icon="code"></iron-icon><span hidden$="[[iconsOnly]]">Source</span></a>
<a tabindex="0" role="button" href="[[repositoryLink(_element.source)]]" target="_blank" title="View Source on GitHub" aria-label="View Source on GitHub"><iron-icon icon="code"></iron-icon><span hidden$="[[iconsOnly]]">Source</span></a>
<a tabindex="0" role="button" on-click="navToDemo" disabled$="[[!_element.demo]]" aria-label="View Demo"><iron-icon icon="visibility" title="View Demo"></iron-icon><span hidden$="[[iconsOnly]]">Demo</span></a>
</template>
</dom-module>
Expand All @@ -47,7 +47,10 @@
_element: Object,
iconsOnly: {type: Boolean, value: false, reflectToAttribute: true}
},
githubLink: function(source) {
repositoryLink: function(source) {
return (source.indexOf('http') === 0) ? source : this._githubLink(source);
},
_githubLink: function(source) {
return "https://github.com/" + source;
},
cartAdd: function(e) {
Expand All @@ -67,4 +70,4 @@
this.fire('nav', {url: '/elements/' + this.element + '?active=' + this._element.active + "&view=demo:" + this._element.demo.path});
}
});
</script>
</script>
5 changes: 4 additions & 1 deletion app/elements/pages/page-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h2 id="element-title">[[element]]</h2>
<template is="dom-repeat" items="[[docDemos]]">
<a is="app-link" class="item" href="[[_demoLink(active,item.path)]]" active$="[[_demoActive(item.path,view)]]"><iron-icon icon="visibility"></iron-icon> <span>[[_demoName(item.desc)]]</span></a>
</template>
<a class="item" href="[[_githubLink(metadata.source)]]" target="_blank"><iron-icon icon="code"></iron-icon> <span>Source</span></a>
<a class="item" href="[[repositoryLink(metadata.source)]]" target="_blank"><iron-icon icon="code"></iron-icon> <span>Source</span></a>
</nav>

<div class="nav" id="cart-add">
Expand Down Expand Up @@ -138,6 +138,9 @@ <h4>All <span>[[package.title]]</span></h4>
_demoActive: function(path) {
return this.view === 'demo:' + path;
},
repositoryLink: function(source) {
return (source.indexOf('http') === 0) ? source : this._githubLink(source);
},
_githubLink: function(source) {
return 'https://github.com/' + source;
},
Expand Down