mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
working on daily view
This commit is contained in:
parent
247a589d39
commit
184ff290ac
7 changed files with 39 additions and 75 deletions
|
@ -1,4 +1,5 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import { Button } from 'react-bootstrap';
|
||||
|
||||
// for a number of days "n" return dates object for the past n days
|
||||
const getLastNDates = n => {
|
||||
|
@ -23,11 +24,12 @@ class PostDaily extends Component{
|
|||
}
|
||||
|
||||
render() {
|
||||
({PostDay} = Telescope.components);
|
||||
({PostDay, PostListHeader} = Telescope.components);
|
||||
return (
|
||||
<div className="post-daily">
|
||||
<PostListHeader />
|
||||
{getLastNDates(this.state.days).map((date, index) => <PostDay key={index} date={date} number={index}/>)}
|
||||
<a className="button button--primary" onClick={this.loadMoreDays}>Load More Days</a>
|
||||
<button className="post-load-more" onClick={this.loadMoreDays}>Load More Days</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ const PostDay = ({date, number}) => {
|
|||
|
||||
return (
|
||||
<div className="post-day">
|
||||
<h2>{moment(date).format("dddd, MMMM Do YYYY")}</h2>
|
||||
<h4>{moment(date).format("dddd, MMMM Do YYYY")}</h4>
|
||||
<ListContainer
|
||||
collection={Posts}
|
||||
publication="posts.list"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const LoadMore = ({loadMore, count, totalCount}) => {
|
||||
const label = totalCount ? `Load More (${count}/${totalCount})` : "Load More";
|
||||
return <a className="post-load-more" onClick={loadMore}>{label}</a>
|
||||
return <button className="post-load-more" onClick={loadMore}>{label}</button>
|
||||
}
|
||||
|
||||
module.exports = LoadMore;
|
|
@ -4,7 +4,7 @@ import { Button, ButtonGroup } from 'react-bootstrap';
|
|||
|
||||
const PostViews = (props, context) => {
|
||||
|
||||
let views = ["top", "new", "best", "daily"];
|
||||
let views = ["top", "new", "best"];
|
||||
const adminViews = ["pending", "rejected", "scheduled"];
|
||||
|
||||
if (Users.is.admin(Meteor.user())) {
|
||||
|
@ -18,8 +18,9 @@ const PostViews = (props, context) => {
|
|||
return (
|
||||
<div className="post-views">
|
||||
<ButtonGroup>
|
||||
{views.map(view => <Button className={currentView === view ? "post-view-active" : "post-view-inactive"} bsStyle="default" key={view} href={Router.extendPathWithQueryParams("posts.list", {}, {view: view})}>{view}</Button>)}
|
||||
{views.map(view => <Button className={currentRoute.route.name === "posts.list" && currentView === view ? "post-view-active" : "post-view-inactive"} bsStyle="default" key={view} href={Router.extendPathWithQueryParams("posts.list", {}, {view: view})}>{view}</Button>)}
|
||||
</ButtonGroup>
|
||||
<Button bsStyle="default" href={Router.path("posts.daily")} className={currentRoute.route.name === "posts.daily" ? "post-view-active" : "post-view-inactive"} >daily</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import React from 'react';
|
|||
import Router from './router.js'
|
||||
import {mount} from 'react-mounter';
|
||||
|
||||
|
||||
// ------------------------------------- Posts -------------------------------- //
|
||||
|
||||
Router.route('/', {
|
||||
|
@ -52,19 +51,7 @@ Router.route('/posts/:_id/:slug?', {
|
|||
}
|
||||
});
|
||||
|
||||
// Router.route('/posts/:_id/edit', {
|
||||
// name: 'posts.edit',
|
||||
// action(params, queryParams) {
|
||||
// ({App, DocumentContainer} = Telescope.components);
|
||||
// mount(App, {content: <DocumentContainer
|
||||
// collection={Posts}
|
||||
// publication="posts.single"
|
||||
// selector={{_id: params._id}}
|
||||
// terms={params}
|
||||
// component={PostEdit}
|
||||
// ><PostEdit/></DocumentContainer>});
|
||||
// }
|
||||
// });
|
||||
// ------------------------------------- Users -------------------------------- //
|
||||
|
||||
Router.route('/users/:slug', {
|
||||
name: 'users.single',
|
||||
|
@ -111,6 +98,8 @@ Router.route('/users/:slug/edit', {
|
|||
}
|
||||
});
|
||||
|
||||
// ------------------------------------- Other -------------------------------- //
|
||||
|
||||
Router.route('/cheatsheet', {
|
||||
name: 'cheatsheet',
|
||||
action() {
|
||||
|
@ -119,56 +108,9 @@ Router.route('/cheatsheet', {
|
|||
}
|
||||
});
|
||||
|
||||
// ------------------------------------- Comments -------------------------------- //
|
||||
|
||||
// Router.route('/comments/:_id', {
|
||||
// name: "commentPage",
|
||||
// action: function(params, queryParams) {
|
||||
// BlazeLayout.render("layout", {main: "comment_controller", commentTemplate: "comment_reply"});
|
||||
// }
|
||||
// });
|
||||
|
||||
// Router.route('/comments/:_id/edit', {
|
||||
// name: "commentEdit",
|
||||
// action: function(params, queryParams) {
|
||||
// BlazeLayout.render("layout", {main: "comment_controller", commentTemplate: "comment_edit"});
|
||||
// }
|
||||
// });
|
||||
|
||||
// ------------------------------------- Users -------------------------------- //
|
||||
|
||||
// Telescope.adminRoutes.route('/users', {
|
||||
// name: "adminUsers",
|
||||
// action: function(params, queryParams) {
|
||||
// BlazeLayout.render("layout", {main: "admin_wrapper", admin: "users_dashboard"});
|
||||
// }
|
||||
// });
|
||||
|
||||
// Router.route('/users/:_idOrSlug', {
|
||||
// name: "userProfile",
|
||||
// action: function(params, queryParams) {
|
||||
// BlazeLayout.render("layout", {main: "user_controller", userTemplate: "user_profile"});
|
||||
// }
|
||||
// });
|
||||
|
||||
// Router.route('/users/:_idOrSlug/edit', {
|
||||
// name: "userEdit",
|
||||
// action: function(params, queryParams) {
|
||||
// BlazeLayout.render("layout", {main: "user_controller", userTemplate: "user_edit"});
|
||||
// }
|
||||
// });
|
||||
|
||||
// Router.route('/account', {
|
||||
// name: "userAccountShortcut",
|
||||
// triggersEnter: [function(context, redirect) {
|
||||
// redirect("userEdit", {_idOrSlug: Meteor.userId()});
|
||||
// }]
|
||||
// });
|
||||
|
||||
// Router.route('/sign-out', {
|
||||
// name: "signOut",
|
||||
// triggersEnter: [function(context, redirect) {
|
||||
// AccountsTemplates.logout();
|
||||
// Messages.flash(i18n.t("you_have_been_logged_out"));
|
||||
// }]
|
||||
// });
|
||||
FlowRouter.notFound = {
|
||||
action() {
|
||||
({Error404} = Telescope.components);
|
||||
mount(App, {content: <Error404/>});
|
||||
}
|
||||
};
|
|
@ -18,6 +18,9 @@
|
|||
background: $light-blue;
|
||||
}
|
||||
}
|
||||
.btn-group{
|
||||
margin-right: $hmargin;
|
||||
}
|
||||
}
|
||||
.post-list-content{
|
||||
border-top: $border;
|
||||
|
@ -146,6 +149,9 @@
|
|||
font-size: $large-font;
|
||||
padding: 10px 20px;
|
||||
@include activeHover;
|
||||
width: 100%;
|
||||
background: $white;
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
.post-page{
|
||||
|
@ -170,4 +176,17 @@
|
|||
height: 50px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.post-day{
|
||||
margin-bottom: $vmargin;
|
||||
.post-load-more{
|
||||
border: none;
|
||||
padding: 0;
|
||||
&:hover{
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
border: inherit;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -64,7 +64,7 @@ Meteor.publish('posts.list', function (terms) {
|
|||
|
||||
// this.unblock(); // causes bug where publication returns 0 results
|
||||
|
||||
// this.autorun(function () { // sadly, reactive joins break SSR for now :(
|
||||
this.autorun(function () {
|
||||
const currentUser = Meteor.users.findOne(this.userId);
|
||||
|
||||
terms.currentUserId = this.userId; // add currentUserId to terms
|
||||
|
@ -80,7 +80,7 @@ Meteor.publish('posts.list', function (terms) {
|
|||
|
||||
return Users.can.view(currentUser) ? [posts, users] : [];
|
||||
|
||||
// });
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue