Skip to content
Browse files

Added a submit post page and linked to it in the header.

  • Loading branch information
tmeasday committed Oct 19, 2015
1 parent 22c0d6d commit f76d91a2db2be19371a4c80158752d908dd1f05a
@@ -10,6 +10,9 @@
<a class="navbar-brand" href="{{pathFor 'postsList'}}">Microscope</a>
<div class="collapse navbar-collapse" id="navigation">
<ul class="nav navbar-nav">
<li><a href="{{pathFor 'postSubmit'}}">Submit Post</a></li>
<ul class="nav navbar-nav navbar-right">
{{> loginButtons}}
@@ -0,0 +1,17 @@
<template name="postSubmit">
<form class="main form page">
<div class="form-group">
<label class="control-label" for="url">URL</label>
<div class="controls">
<input name="url" id="url" type="text" value="" placeholder="Your URL" class="form-control"/>
<div class="form-group">
<label class="control-label" for="title">Title</label>
<div class="controls">
<input name="title" id="title" type="text" value="" placeholder="Name your post" class="form-control"/>
<input type="submit" value="Submit" class="btn btn-primary"/>
@@ -0,0 +1,13 @@{
'submit form': function(e) {

var post = {
url: $('[name=url]').val(),
title: $('[name=title]').val()

post._id = Posts.insert(post);
Router.go('postPage', post);
@@ -12,4 +12,6 @@ Router.route('/posts/:_id', {
data: function() { return Posts.findOne(this.params._id); }

Router.route('/submit', {name: 'postSubmit'});

Router.onBeforeAction('dataNotFound', {only: 'postPage'});

0 comments on commit f76d91a

Please sign in to comment.
You can’t perform that action at this time.