Skip to content

Commit

Permalink
Flux - 31 - Actions With Multiple Methods
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Jul 5, 2015
1 parent 95af337 commit 43e3865
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions imgur-client/sass/image-detail.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.image-detail {
.panel-body {
text-align: center;
}

img, video {
max-width: 100%;
}
}
2 changes: 1 addition & 1 deletion imgur-client/src/components/image-detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = React.createClass({
Actions.getImage(this.props.params.id);
},
render: function() {
return <div>
return <div className="image-detail">
{this.state.image ? this.renderContent() : null}
</div>
},
Expand Down
17 changes: 17 additions & 0 deletions imgur-client/src/stores/comment-store.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var Reflux = require('reflux');
var Actions = require('../actions');
var Api = require('../utils/api');

module.exports = Reflux.createStore({
listenables: [Actions],
getImage: function(id){
Api.get('gallery/' + id + '/comments')
.then(function(json){
this.comment = json.data;
this.triggerChange();
}.bind(this));
},
triggerChange: function() {
this.trigger('change', this.comment);
}
});

0 comments on commit 43e3865

Please sign in to comment.