/*jshint nomen:true */ /*globals React, App */ (function () { 'use strict'; /** * Modal for managing channels * * @prop {channels: Array} List of channels * @prop {open: func} Called to open the window * @prop {close: func} Called to close the window */ App.components.modal('Channel', { displayName: 'Modal', mixins: [React.addons.PureRenderMixin], propTypes: { channels: React.PropTypes.array, open: React.PropTypes.func, close: React.PropTypes.func }, getDefaultProps: function () { return { channels: [], open: function () {}, close: function () {} }; }, /** * Render modal */ render: function () { var title = 'Gestion des canaux', channels; channels = this.props.channels.map(function (channel) { channel.key = 'channel-' + channel.id; return App.components.Channel.Channel(channel); }); return React.DOM.form({ className: 'vex-dialog-form channels' }, [ React.DOM.h4({ key: 'title', className: 'main-title' }, title), React.DOM.ul({ key: 'channels' }, channels) ]); } }); }());