From 5949bd6787f2a7fa910dea6036df0315e119b457 Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Sun, 31 Jan 2016 18:02:52 +0100 Subject: modal from nav --- src/web/js/components/Navbar.react.js | 69 ++++++++++++++++++++++------- src/web/lib/feed_utils.py | 13 ++++-- src/web/static/css/customized-bootstrap.css | 38 +++++----------- src/web/templates/layout.html | 2 +- src/web/views/feed.py | 5 ++- 5 files changed, 79 insertions(+), 48 deletions(-) (limited to 'src/web') diff --git a/src/web/js/components/Navbar.react.js b/src/web/js/components/Navbar.react.js index 56de178e..295b4bb6 100644 --- a/src/web/js/components/Navbar.react.js +++ b/src/web/js/components/Navbar.react.js @@ -5,6 +5,7 @@ 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'); @@ -13,11 +14,14 @@ var MenuStore = require('../stores/MenuStore'); JarrNavBar = React.createClass({ getInitialState: function() { return {is_admin: MenuStore._datas.is_admin, - crawling_method: MenuStore._datas.crawling_method}; + crawling_method: MenuStore._datas.crawling_method, + showModal: false, modalType: null}; }, buttonFetch: function() { if(this.state.is_admin && this.state.crawling_method != 'http') { - return Fetch; + return ( + Fetch + ); } }, buttonAdmin: function() { @@ -30,11 +34,50 @@ JarrNavBar = React.createClass({ ); } }, + getModel: 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, we'll sort it out later ;)"; + 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() { var gl_title = ( Add a new feed ); - return ( + return ( + {this.getModel()} JARR @@ -42,19 +85,15 @@ JarrNavBar = React.createClass({