mirror of
https://github.com/twisterarmy/twister-react.git
synced 2025-09-01 00:31:59 +00:00
retwist button
This commit is contained in:
parent
be7899b849
commit
0615207135
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ var SetIntervalMixin = require("../common/SetIntervalMixin.js");
|
|||||||
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
|
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
|
||||||
var PostContent = require('../common/PostContent.js');
|
var PostContent = require('../common/PostContent.js');
|
||||||
var ReplyModalButton = require('../common/ReplyModalButton.js');
|
var ReplyModalButton = require('../common/ReplyModalButton.js');
|
||||||
|
var RetwistModalButton = require('../common/RetwistModalButton.js');
|
||||||
|
|
||||||
module.exports = Post = React.createClass({
|
module.exports = Post = React.createClass({
|
||||||
mixins: [SetIntervalMixin,SafeStateChangeMixin],
|
mixins: [SetIntervalMixin,SafeStateChangeMixin],
|
||||||
|
74
jsx/common/RetwistModalButton.js
Normal file
74
jsx/common/RetwistModalButton.js
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
var ReactBootstrap = require('react-bootstrap')
|
||||||
|
, OverlayMixin = ReactBootstrap.OverlayMixin
|
||||||
|
, Button = ReactBootstrap.Button
|
||||||
|
, ButtonGroup = ReactBootstrap.ButtonGroup
|
||||||
|
, Glyphicon = ReactBootstrap.Glyphicon
|
||||||
|
, Modal = ReactBootstrap.Modal
|
||||||
|
, Input = ReactBootstrap.Input
|
||||||
|
|
||||||
|
var React = require('react');
|
||||||
|
|
||||||
|
var SafeStateChangeMixin = require('../common/SafeStateChangeMixin.js');
|
||||||
|
var SetIntervalMixin = require("../common/SetIntervalMixin.js");
|
||||||
|
var PostContent = require("../common/PostContent.js");
|
||||||
|
|
||||||
|
module.exports = RetwistModalButton = React.createClass({
|
||||||
|
mixins: [OverlayMixin],
|
||||||
|
getInitialState: function () {
|
||||||
|
return {
|
||||||
|
isModalOpen: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
handleToggle: function () {
|
||||||
|
this.setState({
|
||||||
|
isModalOpen: !this.state.isModalOpen
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleRetwist: function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
Twister.getAccount(this.props.activeAccount).retwist(
|
||||||
|
this.props.retwistUsername,
|
||||||
|
this.props.retwistPostId,
|
||||||
|
function(post){
|
||||||
|
|
||||||
|
var event = new CustomEvent('newpostbyuser',{detail: post});
|
||||||
|
//alert("scrolled to bottom")
|
||||||
|
window.dispatchEvent(event);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
this.handleToggle();
|
||||||
|
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
render: function() {
|
||||||
|
return (
|
||||||
|
<a onClick={this.handleToggle} className="link-button-gray"><Glyphicon glyph='retweet' /></a>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
renderOverlay: function() {
|
||||||
|
|
||||||
|
if (!this.state.isModalOpen) {
|
||||||
|
return <span/>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal bsStyle='primary' title={
|
||||||
|
<Glyphicon glyph='retweet'/>
|
||||||
|
} onRequestHide={this.handleToggle}>
|
||||||
|
<div className='modal-body'>
|
||||||
|
<form onSubmit={this.handleRetwist}>
|
||||||
|
<strong>{this.props.retwistUserFullname}</strong>
|
||||||
|
<PostContent content={this.props.originalMsg}/>
|
||||||
|
<Input type='submit' value='Retwist' data-dismiss="modal" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user