From 56e74239d6b34df8f30ef046f0b0ff4ff0866a71 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 14 Jun 2015 23:53:32 -0800 Subject: first commit --- web/react/components/edit_channel_modal.jsx | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 web/react/components/edit_channel_modal.jsx (limited to 'web/react/components/edit_channel_modal.jsx') diff --git a/web/react/components/edit_channel_modal.jsx b/web/react/components/edit_channel_modal.jsx new file mode 100644 index 000000000..f1f4eca40 --- /dev/null +++ b/web/react/components/edit_channel_modal.jsx @@ -0,0 +1,57 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +var Client = require('../utils/client.jsx'); +var AsyncClient = require('../utils/async_client.jsx'); + +module.exports = React.createClass({ + handleEdit: function(e) { + var data = {} + data["channel_id"] = this.state.channel_id; + if (data["channel_id"].length !== 26) return; + data["channel_description"] = this.state.description.trim(); + + Client.updateChannelDesc(data, + function(data) { + AsyncClient.getChannels(true); + }.bind(this), + function(err) { + AsyncClient.dispatchError(err, "updateChannelDesc"); + }.bind(this) + ); + }, + handleUserInput: function(e) { + this.setState({ description: e.target.value }); + }, + componentDidMount: function() { + var self = this; + $(this.refs.modal.getDOMNode()).on('show.bs.modal', function(e) { + var button = e.relatedTarget; + self.setState({ description: $(button).attr('data-desc'), title: $(button).attr('data-title'), channel_id: $(button).attr('data-channelid') }); + }); + }, + getInitialState: function() { + return { description: "", title: "", channel_id: "" }; + }, + render: function() { + return ( + + ); + } +}); -- cgit v1.2.3-1-g7c22