mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
added "new" page
This commit is contained in:
parent
248fa129b3
commit
dfd6ac149e
11 changed files with 68 additions and 32 deletions
|
@ -33,6 +33,8 @@ if (Meteor.is_client) {
|
|||
},
|
||||
routes: {
|
||||
'': 'top',
|
||||
'top':'top',
|
||||
'new':'new',
|
||||
'test':'test',
|
||||
'signin':'signin',
|
||||
'signup':'signup',
|
||||
|
@ -45,14 +47,14 @@ if (Meteor.is_client) {
|
|||
'comments/:id/edit':'comment_edit',
|
||||
'settings':'settings'
|
||||
},
|
||||
top: function() { console.log("top"); this.goto('top'); },
|
||||
test: function() {console.log("test"); this.goto('test'); },
|
||||
signup: function() {console.log("signup"); this.goto('signup'); },
|
||||
signin: function() {console.log("signin"); this.goto('signin'); },
|
||||
submit: function() {console.log("submit"); this.goto('post_submit'); },
|
||||
settings: function() {console.log("settings"); this.goto('settings'); },
|
||||
post_deleted: function() {console.log("post_deleted"); this.goto('post_deleted'); },
|
||||
comment_deleted: function() {console.log("comment_deleted"); this.goto('comment_deleted'); },
|
||||
top: function() { this.goto('posts_top'); },
|
||||
new: function() { this.goto('posts_new'); },
|
||||
signup: function() { this.goto('signup'); },
|
||||
signin: function() { this.goto('signin'); },
|
||||
submit: function() { this.goto('post_submit'); },
|
||||
settings: function() { this.goto('settings'); },
|
||||
post_deleted: function() { this.goto('post_deleted'); },
|
||||
comment_deleted: function() { this.goto('comment_deleted'); },
|
||||
post: function(id) {
|
||||
console.log("post, id="+id);
|
||||
Session.set('selected_post_id', id);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<template name="nav">
|
||||
<div id="pageslide" class="hidden">
|
||||
<ul>
|
||||
<li><a href="/top">Top</a></li>
|
||||
<li><a href="/new">New</a></li>
|
||||
<li><a href="/ask">Ask</a></li>
|
||||
<li><a class="top" href="/top">Top</a></li>
|
||||
<li><a class="new" href="/new">New</a></li>
|
||||
<!-- <li><a href="/ask">Ask</a></li>
|
||||
<li><a href="/show">Show</a></li>
|
||||
<li><a href="/jobs">Jobs </a></li>
|
||||
<li><a href="/signup">Sign Up </a></li>
|
||||
<li><a href="/signin">Log In</a></li>
|
||||
<li><a href="/signin">Log In</a></li> -->
|
||||
</ul>
|
||||
</div>
|
||||
<header class="header grid">
|
||||
|
@ -15,11 +15,11 @@
|
|||
<a id="mobile-menu" href="#menu" class="mobile mobile-button menu"><i class="icon-menu"></i><span>Menu</span></a>
|
||||
<!-- <a href="/submit" class="mobile mobile-button submit"><i class="icon-plus"></i><span>Submit</span></a> -->
|
||||
<ul class="nav site-nav desktop">
|
||||
<li><a href="top">Top</a></li>
|
||||
<li><a href="new">New</a></li>
|
||||
<li><a href="ask">Ask</a></li>
|
||||
<li><a class="top" href="top">Top</a></li>
|
||||
<li><a class="new" href="new">New</a></li>
|
||||
<!-- <li><a href="ask">Ask</a></li>
|
||||
<li><a href="show">Show</a></li>
|
||||
<li><a href="jobs">Jobs</a></li>
|
||||
<li><a href="jobs">Jobs</a></li> -->
|
||||
</ul>
|
||||
<ul class="nav user-nav desktop">
|
||||
<!-- {{#if logged_in}}
|
||||
|
|
|
@ -37,6 +37,16 @@ Template.nav.events = {
|
|||
iframe: false
|
||||
});
|
||||
}
|
||||
|
||||
, 'click .top': function(event){
|
||||
event.preventDefault();
|
||||
Router.navigate('top', {trigger: true});
|
||||
}
|
||||
|
||||
, 'click .new': function(event){
|
||||
event.preventDefault();
|
||||
Router.navigate('new', {trigger: true});
|
||||
}
|
||||
};
|
||||
|
||||
Template.nav.logged_in = function(){
|
||||
|
|
|
@ -89,10 +89,19 @@ Template.post_item.voted = function(){
|
|||
};
|
||||
|
||||
var getRank = function(post){
|
||||
var filter = {$or: [
|
||||
{score: {$gt: post.score}},
|
||||
{$and: [{score: post.score}, {submitted: {$lt: post.submitted}}]}
|
||||
]};
|
||||
console.log(window.sortBy);
|
||||
if(window.sortBy=="score"){
|
||||
var filter = {$or: [
|
||||
{score: {$gt: post.score}},
|
||||
{$and: [{score: post.score}, {submitted: {$lt: post.submitted}}]}
|
||||
]};
|
||||
}else{
|
||||
var filter = {$or: [
|
||||
{submitted: {$gt: post.submitted}},
|
||||
{$and: [{submitted: post.submitted}, {score: {$lt: post.score}}]}
|
||||
]};
|
||||
}
|
||||
|
||||
return Posts.find(filter).count()+1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<template name="top">
|
||||
<template name="posts_new">
|
||||
<div class="posts grid list">
|
||||
{{#each posts}}
|
||||
{{> post_item}}
|
8
client/templates/posts_new.js
Normal file
8
client/templates/posts_new.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
Template.posts_new.posts = function(){
|
||||
var posts = Posts.find({}, {sort: {submitted: -1}});
|
||||
return posts;
|
||||
};
|
||||
|
||||
Template.posts_new.created = function(){
|
||||
window.sortBy="time";
|
||||
}
|
7
client/templates/posts_top.html
Normal file
7
client/templates/posts_top.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<template name="posts_top">
|
||||
<div class="posts grid list">
|
||||
{{#each posts}}
|
||||
{{> post_item}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</template>
|
8
client/templates/posts_top.js
Normal file
8
client/templates/posts_top.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
Template.posts_top.posts = function(){
|
||||
var posts = Posts.find({}, {sort: {score: -1}});
|
||||
return posts;
|
||||
};
|
||||
|
||||
Template.posts_top.created = function(){
|
||||
window.sortBy="score";
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
Template.top.show = function(){
|
||||
return Session.equals('state', 'list');
|
||||
};
|
||||
|
||||
Template.top.posts = function(){
|
||||
var posts = Posts.find({}, {sort: {score: -1}});
|
||||
return posts;
|
||||
};
|
||||
|
||||
Template.top.rendered = function(){
|
||||
};
|
3
client/templates/users.html
Normal file
3
client/templates/users.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<template name="users">
|
||||
|
||||
</template>
|
0
client/templates/users.js
Normal file
0
client/templates/users.js
Normal file
Loading…
Add table
Reference in a new issue