Skip to content

Commit f0a488f

Browse files
author
Emmanouil Konstantinidis
committed
Open repo url in browser
1 parent 0549cde commit f0a488f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/js/components/notifications.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
var React = require('react');
22
var Reflux = require('reflux');
3-
var _ = require('underscore');
43
var Loading = require('reloading');
4+
var _ = require('underscore');
5+
var remote = window.require('remote');
6+
var shell = remote.require('shell');
57

68
var Actions = require('../actions/actions');
79
var NotificationsStore = require('../stores/notifications');
@@ -29,15 +31,21 @@ var Notifications = React.createClass({
2931
this.setState( {loading: false } );
3032
},
3133

34+
openRepoBrowser: function (e) {
35+
var url = this.state.notifications[e][0].repository.html_url;
36+
shell.openExternal(url);
37+
},
38+
3239
render: function () {
3340
var notifications;
41+
var self = this;
3442

3543
if (!_.isEmpty(this.state.notifications)) {
3644
notifications = (
3745
_.map(this.state.notifications, function(repo, i) {
3846
return (
3947
<div key={i}>
40-
<h4>{i}</h4>
48+
<h4 onClick={self.openRepoBrowser.bind(self, i)}>{i}</h4>
4149
{repo.map(function(as, df) {
4250
return (
4351
<SingleNotification notification={as} key={as.id} />

0 commit comments

Comments
 (0)