Skip to content

Commit 43e3865

Browse files
committed
Flux - 31 - Actions With Multiple Methods
1 parent 95af337 commit 43e3865

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

imgur-client/sass/image-detail.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.image-detail {
2+
.panel-body {
3+
text-align: center;
4+
}
5+
6+
img, video {
7+
max-width: 100%;
8+
}
9+
}

imgur-client/src/components/image-detail.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = React.createClass({
1616
Actions.getImage(this.props.params.id);
1717
},
1818
render: function() {
19-
return <div>
19+
return <div className="image-detail">
2020
{this.state.image ? this.renderContent() : null}
2121
</div>
2222
},
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var Reflux = require('reflux');
2+
var Actions = require('../actions');
3+
var Api = require('../utils/api');
4+
5+
module.exports = Reflux.createStore({
6+
listenables: [Actions],
7+
getImage: function(id){
8+
Api.get('gallery/' + id + '/comments')
9+
.then(function(json){
10+
this.comment = json.data;
11+
this.triggerChange();
12+
}.bind(this));
13+
},
14+
triggerChange: function() {
15+
this.trigger('change', this.comment);
16+
}
17+
});

0 commit comments

Comments
 (0)