var React = require('react'); var Glyphicon = require('react-bootstrap/lib/Glyphicon'); var Nav = require('react-bootstrap/lib/Nav'); var NavItem = require('react-bootstrap/lib/NavItem'); var Navbar = require('react-bootstrap/lib/Navbar'); var NavDropdown = require('react-bootstrap/lib/NavDropdown'); var MenuItem = require('react-bootstrap/lib/MenuItem'); var Modal = require('react-bootstrap/lib/Modal'); var Button = require('react-bootstrap/lib/Button'); var Input = require('react-bootstrap/lib/Input'); var MenuStore = require('../stores/MenuStore'); JarrNavBar = React.createClass({ getInitialState: function() { return {is_admin: MenuStore._datas.is_admin, crawling_method: MenuStore._datas.crawling_method, showModal: false, modalType: null}; }, buttonFetch: function() { if(this.state.is_admin && this.state.crawling_method != 'http') { return ( Fetch ); } }, sectionAdmin: function() { if(this.state.is_admin) { return ( Dashboard ); } }, getModal: function() { var heading = null; var action = null; var body = null; if(this.state.modalType == 'addFeed') { heading = 'Add a new feed'; action = '/feed/bookmarklet'; placeholder = "Site or feed url"; body = ; } else { heading = 'Add a new category'; action = '/category/create'; body = ; } return (
{heading} {body}
); }, close: function() { this.setState({showModal: false, modalType: null}); }, openAddFeed: function() { this.setState({showModal: true, modalType: 'addFeed'}); }, openAddCategory: function() { this.setState({showModal: true, modalType: 'addCategory'}); }, render: function() { return ( {this.getModal()} JARR ); }, componentDidMount: function() { MenuStore.addChangeListener(this._onChange); }, componentWillUnmount: function() { MenuStore.removeChangeListener(this._onChange); }, _onChange: function() { var datas = MenuStore.getAll(); this.setState({is_admin: datas.is_admin, crawling_method: datas.crawling_method}); }, }); module.exports = JarrNavBar;