2016-02-23 13:17:56 +09:00
|
|
|
import NoSSR from 'react-no-ssr';
|
2016-03-23 11:46:56 +09:00
|
|
|
import Router from '../router.js'
|
2016-03-18 10:50:40 +09:00
|
|
|
import Core from "meteor/nova:core";
|
2016-03-24 10:56:47 +09:00
|
|
|
import { Button } from 'react-bootstrap';
|
|
|
|
|
2016-03-18 10:50:40 +09:00
|
|
|
const Messages = Core.Messages;
|
2016-02-25 21:05:53 +09:00
|
|
|
|
2016-03-17 18:08:03 +09:00
|
|
|
const Header = ({currentUser}) => {
|
2016-02-16 15:08:30 +09:00
|
|
|
|
2016-03-24 10:56:47 +09:00
|
|
|
({Logo, ListContainer, CategoriesList, FlashContainer, FlashMessages, ModalTrigger, NewDocContainer, CanCreatePost, CurrentUserContainer, NewsletterForm, SearchForm} = Telescope.components);
|
2016-02-16 15:08:30 +09:00
|
|
|
|
|
|
|
const logoUrl = Telescope.settings.get("logoUrl");
|
|
|
|
const siteTitle = Telescope.settings.get("title", "Telescope");
|
|
|
|
const tagline = Telescope.settings.get("tagline");
|
|
|
|
|
|
|
|
return (
|
|
|
|
<header className="header">
|
|
|
|
<div className="logo">
|
|
|
|
<Logo logoUrl={logoUrl} siteTitle={siteTitle} />
|
|
|
|
{tagline ? <h2 className="tagline">{tagline}</h2> : "" }
|
|
|
|
</div>
|
2016-03-24 18:17:35 +09:00
|
|
|
|
2016-03-03 18:09:19 -06:00
|
|
|
<LogInButtons />
|
2016-02-23 13:17:56 +09:00
|
|
|
|
2016-03-23 11:46:56 +09:00
|
|
|
{currentUser ? <p><a href={Router.path("account")}>My Account</a></p> : ""}
|
2016-02-25 21:05:53 +09:00
|
|
|
|
2016-03-17 18:08:03 +09:00
|
|
|
<CanCreatePost user={currentUser}>
|
2016-03-24 10:56:47 +09:00
|
|
|
<ModalTrigger component={<Button bsStyle="primary">New Post</Button>}>
|
2016-03-18 10:50:40 +09:00
|
|
|
<NewDocContainer
|
|
|
|
collection={Posts}
|
|
|
|
label="New Post"
|
|
|
|
methodName="posts.new"
|
|
|
|
successCallback={(post)=>{
|
|
|
|
Messages.flash("Post created.", "success");
|
2016-03-23 11:46:56 +09:00
|
|
|
Router.go('posts.single', post);
|
2016-03-18 10:50:40 +09:00
|
|
|
}}
|
|
|
|
/>
|
2016-03-24 10:56:47 +09:00
|
|
|
</ModalTrigger>
|
2016-02-27 17:46:11 +09:00
|
|
|
</CanCreatePost>
|
2016-02-25 21:05:53 +09:00
|
|
|
|
2016-03-18 11:53:46 +09:00
|
|
|
<CurrentUserContainer component={NewsletterForm} />
|
|
|
|
|
2016-03-18 10:50:40 +09:00
|
|
|
<FlashContainer component={FlashMessages}/>
|
2016-02-25 21:05:53 +09:00
|
|
|
|
2016-03-24 18:17:35 +09:00
|
|
|
<div className="nav">
|
|
|
|
<ListContainer collection={Categories} limit={0}><CategoriesList/></ListContainer>
|
|
|
|
</div>
|
|
|
|
|
2016-02-16 15:08:30 +09:00
|
|
|
</header>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2016-03-03 18:09:19 -06:00
|
|
|
module.exports = Header;
|