Skip to content

Commit

Permalink
Make homepage URL hyperlink and browse it with default browser
Browse files Browse the repository at this point in the history
  • Loading branch information
linquize committed Feb 2, 2015
1 parent 232cdb4 commit d116f61
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ in rec {
name = "nixui";
src = [ tarball ];
buildInputs = nodePackages.nativeDeps."nixui" or [];
deps = [ nodePackages.underscore nodePackages.nedb ];
deps = [ nodePackages.underscore nodePackages.nedb nodePackages.open ];
peerDependencies = [];
passthru.names = [ "nixui" ];
};
Expand Down
15 changes: 15 additions & 0 deletions node.nix
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,21 @@
passthru.names = [ "nedb" ];
};
"nedb" = self.by-version."nedb"."1.0.2";
by-spec."open"."0.0.5" =
self.by-version."open"."0.0.5";
by-version."open"."0.0.5" = self.buildNodePackage {
name = "open-0.0.5";
bin = false;
src = fetchurl {
url = "http://registry.npmjs.org/open/-/open-0.0.5.tgz";
name = "open-0.0.5.tgz";
sha1 = "42c3e18ec95466b6bf0dc42f3a2945c3f0cad8fc";
};
deps = {
};
peerDependencies = [];
};
"open" = self.by-version."open"."0.0.5";
by-spec."samsam"."~1.1" =
self.by-version."samsam"."1.1.2";
by-version."samsam"."1.1.2" = lib.makeOverridable self.buildNodePackage {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
},
"dependencies": {
"underscore": "^1.6.0",
"nedb": "~1.0.0"
"nedb": "~1.0.0",
"open": "~0.0.3"
},
"devDependencies": {
"mocha": "~1.21.0",
Expand Down
5 changes: 5 additions & 0 deletions src/helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var open = require('open');

exports.openFileWithDefault = function (file) {
open(file);
};
15 changes: 12 additions & 3 deletions src/package-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<labeled-panel label="native Build Inputs" content="{{pkginfo.nativeBuildInputs}}"></labeled-panel>
<labeled-panel label="propagated Native Build Inputs" content="{{pkginfo.propagatedNativeBuildInputs}}"></labeled-panel>

<labeled-panel label="Home Page" content="{{pkginfo.meta.homepage}}"></labeled-panel>
<labeled-panel label="Home Page" content="{{pkginfo.meta.homepage}}" hyperlink="true"></labeled-panel>
<labeled-panel label="Description" content="{{pkginfo.meta.description}}"></labeled-panel>
<labeled-panel label="Long Description" content="{{pkginfo.meta.longDescription}}"></labeled-panel>
<labeled-panel label="License" content="{{pkginfo.meta.license}}"></labeled-panel>
Expand Down Expand Up @@ -156,7 +156,7 @@
</polymer-element>


<polymer-element name="labeled-panel" attributes="label content">
<polymer-element name="labeled-panel" attributes="label content hyperlink">
<template>
<style>
#panellabel {
Expand All @@ -179,7 +179,12 @@
</style>
<div class="{{emptyEntryClass}}">
<div id="panellabel">{{label}}</div>
<div id="panelcontent">{{content | contentToString}}</div>
<template if="{{hyperlink}}">
<div id="panelcontent"><a on-click="{{openUrl}}" href="#">{{content | contentToString}}</a></div>
</template>
<template if="{{!hyperlink}}">
<div id="panelcontent">{{content | contentToString}}</div>
</template>
</div>
</template>
<script>
Expand Down Expand Up @@ -214,6 +219,10 @@
}

},
openUrl: function(event, detail, sender) {
require("./helper.js").openFileWithDefault(this.content);
event.preventDefault();
},
ready: function() {
this.emptyEntryClass = "";
}
Expand Down

0 comments on commit d116f61

Please sign in to comment.