Git Product home page Git Product logo

microscope's Introduction

Microscope

Microscope is a simple social news app that lets you share links, comment, and vote on them.

It was built with Meteor as a companion app to The Meteor Book, and is the "little brother" of Telescope, the (much more complex) open-source social news app that was the inspiration for the book.

Microscope itself is free and open-source, and is a good example of common Meteor app patterns such as:

  • Routing
  • User Accounts
  • Notifications
  • Errors
  • Publications/Subscriptions
  • Permissions

This Repository

The commits to this repository are organized in a very linear fashion, corresponding to progress throughout the book. Commits are tagged in the format chapterX-Y, indicating the Yth commit of chapter X.

Also, note that as the book focuses on development, all CSS is committed in a single commit early on.

Branches

There are 2 branches in this repository which correspond to advanced code that is covered in sidebars of the book, and outside of the main code progression. They are tagged sidebarX-Y, corresponding to the sidebar number in the book.

Developing on Nitrous.IO

Start hacking on this app on Nitrous.IO in seconds:

Hack DiscoverMeteor/Microscope on Nitrous.IO

microscope's People

Contributors

tmeasday avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microscope's Issues

User Management totally unclear

I'm having a problem with "Adding Users".

  • The HTML markup being used is totally black magick
  • Whatever is being rendered doesn't match what is shown on your site (tried with multiple browsers). I don't see "sign in / up", only three dashes (see below)

capture decran 2013-08-14 a 18 20 08

  • If I login, then logout, I cannot login again (firefox 22).

Unwanted animations on /best pagination

After finishing the animation chapter, I found that there are unwanted animations also happening on paging through the "Best" posts. This is not intentional, right? Anyone have hints on how to stop this?

Warning in Browser Console

Hi,

Just upgraded to the premium version of the "Discover Meteor" Book. Im working through the collections section. When I open my "Chrome" browsers console I'm seeing this warning.

event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 

Carl

Latency Compensation, partial code provided

I'm closely following the book and with the Latency Compensation sidebar the collections/posts.js source is the first time that the entire file's contents aren't provided, with just the change highlighted. Thus simply copying & pasting the code as I've done up to this point is not adequate. Doing so removes the critical Posts = new Meteor.Collection('posts'); declaration.

I've since found that the excise is even greater with the // .. existing validation code referring to more than the aforementioned code. This is also the first time a comment referred to code in the original file that must be retained. While the comment reflects '...validation code' it's also referring to the needed assignment code var user = Meteor.user(), postWithSameLink = Posts.findOne({url: postAttributes.url});.

I suggest either amending the example to include the complete code or describe that only the Meteor.methods({ should be replaced - removing the erroneous comment regarding 'validation code'.

The inconsistencies run rampant in the code samples in the next couple of chapters: Sometimes providing ellipsis where existing code is to be retained, sometimes shading in green, sometimes none of these. Would prefer a consistent presentation be retained.

  • Edited to add more detail

notifications on own post are not necesssary

If I leave a comment on my own post, say as a reply to another user's comment, I don't need a notification because I already know I made the comment.

I fixed this in collections/notifications.js like so:

createCommentNotification = function(comment) {
    var post = Posts.findOne(comment.postId);
    if (comment.userId !== post.userId) {
        Notifications.insert({
            userId: post.userId,
            postId: post._id,
            commentId: comment._id,
            commenterName: comment.author,
            read: false
        });
    }
};

Maybe there's a better way though??

comment textarea not cleared after posting a comment

The last comment remains in the textarea after submitting. I used some jQuery in comment_submit.js to clear it.:

Meteor.call('comment', comment, function(error, commentId) {
    if (error){
        Meteor.Errors.throw(error.reason);
    } else {
        $(event.target).find('[name=body]').val('');
    }
});

add spin broke project

was following along but after adding the spinner I no longer get data. in console:

event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Exception from Deps recompute: Error: No such template 'spinner'

click edit throw Exception

collections code

method calls have "console.log" output in the browser AND the server terminal ?
Meteor.users.find() running in the browser fails.
why are the method calls running in 2 places ?
move the method calls to the "server" directory ?

Sign In / Up disappears

The Sign In / Up box disappears when the browser window is smaller than about 980 pixels. It happens on both Chrome and Safari. Any idea why?

latency compensation collections/posts.js

commit/sidebar7-5-1

collections/posts.js

line 24: both 'title' and 'message' are removed from _.pick but only title is defined on the next line. Therefore, the message is no longer saved when adding a post. This seems unintended.

Router package no longer works with Meteor 0.6.5

Had to do mrt install iron-router which got everything working again, but the routing syntax is different, and I couldn't figure out how to get the specific post pages to render with the new iron-router.

sort of BestPostsList

It doesn't seem to work in the snapshot.
screen shot 2013-12-16 at 8 53 48 pm

BestPostsListController = PostsListController.extend({
sort: {votes: -1, submitted: -1, _id: -1},
nextPath: function() {
return Router.routes.bestPosts.path({postsLimit: this.limit() + this.increment})
}
});

Todays book update 0.6.5

Hi all there,

thanks for todays book update. My question is, is also the PDF Document always updated with latest version of the books online content?

Maybe you could add somewhere on the first pages an update and/or release date for the book.

Thanks for the book, it is a great introduction
Tom

Commit 13-1 User doesn't see error messages

An anonymous user can click on the upload button, but doesn't get an error message. Similarly a signed in user can click twice, and the second click is ignored without an error message being displayed.

You have gone to the trouble of generating these error messages on the Meteor Server side method.
It would be nice for the user to see the error messages.

border-radius got taken out of bootstrap-3

From reading Stack Overflow answers, it looks like doing border-radius for each side individually is still valid. But it means I can't just copy/paste the css from the book. Maybe fix to work with bootstrap 3? ^_^

Username-only Login Not Working

The last change before commit chapter6-1 doesn't seem to be working.

Adding:
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY'
});

to a new config.js file in client/helpers/config.js does not remove the password form field from the login dropdown. I tested on my own version and an instance based on this commit http://meteor-book-chapter6-1.meteor.com/.

mrt run error

I'm getting this error when I do 'mrt run' after cloning the main repository into my computer.

Rodrigos-MacBook-Pro:Microscope rodcisal$ mrt run

fs.js:524
return binding.stat(pathModule.makeLong(path));
^
Error: ENOENT, no such file or directory '/Users/rodcisal/.meteorite/packages/spin/SachaG/meteor-spin/fd3a2871a69442848b4b4e74f5e1ae28fa4a95a4/.meteor/meteorite/packages/spin'
at Object.fs.statSync (fs.js:524:18)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:85:25)
at Array.forEach (native)
at Function.
.each..forEach (/usr/local/lib/node_modules/meteorite/node_modules/underscore/underscore.js:76:11)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:83:7)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:87:9)
at Array.forEach (native)
at Function.
.each._.forEach (/usr/local/lib/node_modules/meteorite/node_modules/underscore/underscore.js:76:11)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:83:7)
at Package.libPath.findPackage (/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:87:9)

Any idea???

Thanks!!!
@rodcisal

edit page is blank

First, I'm about halfway through the book and I've found it to be a good intro to Meteor. Good work.

Second, I would suggest a chapter or sidebar on debugging. It's great to follow along with the book but when things don't work it would be good to get pointers on how to debug/troubleshoot.

I'm on the chapter "Editing Posts". When I click the link to edit a post I just see a page with the header but the rest is blank. I know the page_edit.html template is being run because if I comment out the lines {{#with post}} and {{/with}}, i.e. make it a static template, it renders the form as expected.

So then I'm looking at the post_edit.js and thinking it must be something in

Template.postEdit.helpers({
post: function() {
return Posts.findOne(Session.get('currentPostId'));
}
});

I tried hard-coding the postID instead of using Session.get() but that didn't help. I copied the source from github so I'm pretty sure it's not a typo. I'm not seeing anything in the javascript console.

Can you recommend how to debug this?

Thanks.

Deployment on custom server running into problems.

I've ran into some problems with the third method and node-fibers package.

On ubuntu 13.04 from Digital Ocean I get /home/meteor/bundle/programs/server/node_modules/fibers/bin/linux-x64-v8-3.14/fibers.node is missing. Try reinstalling node-fibers?` when I try to run the app.

In that location linux-x64-v8-3.11/fibers.node exists, however linux-x64-v8-3.14/fibers.node does not.

Which means, I think, that it is only compiled for an older V8 version (and older node?) and not for the latest one.

Is there any way to resolve this? Can I manually compile this for 0.10? Do I need to use node 0.8 instead of 0.10 instead? Current node version is 0.10.17.

mrt add router error

when I do mrt add router I get

Kodachi:microscope phil$ mrt add router
smart.json changed.. installing from smart.json
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.1
smart.json changed.. installing from smart.json
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.1
smart.json changed.. installing from smart.json
✓ router
tag: https://github.com/tmeasday/meteor-router.git#v0.5.1

/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:106
throw('Could not locate package.js within path ' + self.source.packagePa
^
Could not locate package.js within path /Users/phil/.meteorite/packages/router/tmeasday/meteor-router/32e377c7703bb119acccc859fc7296882903cbe7

Any ideas?

App crashing with new meteor release 0.6.5

Hi Guys,

I foolishly upgraded meteor to the latest version (0.6.5) and now, naturally, its not compiling. I did an meteor update and mrt update, then meteor, and got

[[[[[ ~/microscope ]]]]]

router: updating npm dependencies -- connect...
=> Errors prevented startup:

While building package accounts-ui-bootstrap-dropdown:
error: no such package: 'accounts-urls'

=> Your application has errors. Waiting for file change.

I did wonder if upgrading was a good idea :) Guess it wasn't. Any ideas?

Ta Peter.

Page not Displaying

Hello,

I've followed all steps in the book into Chapter 3 and I am only getting a blank page on my localhost:3000. I am not sure where to go from here. Can you help troubleshoot?

When i review code in browser this is what shows in the body:

body kpm-analyzer="1.2.1"
body

Thanks,

Rob

routing not working.

Hi Guys,

love the book so far, but, am having issues with the basic routing stuff.

I've checked and re-checked my code and it all looks the same as the git repo, however, as soon as I replace postsList with renderPage I loose all of my books.

I've added some tests to client/helpers/router.js as follows

'/': 'postsList',
'/posts': 'postsList',
'/test': 'test

and added test.html to client/views/posts/ as

This is a test

but, calling localhost:3000/test returns the same thing as / or /posts does which is an empty list.

Any ideas why the routing isn't working, and any other ways to trouble shoot it?

URL Issue - Commit 7-3

The URL when submitting a post is defaulting to the localhost whether it be on my own local host or under joshtest.meteor.com instead of the url I typed in

Suggestion for Editing Posts page in book

I'm not sure this is the best place to put this comment, but here it goes:

Sometimes being really specific helps people that might have gotten lost somewhere along the way.

In the Editing Posts chapter, this sentence is nice and casual, but wouldn't hurt from the addition of some specifics.


A while back, we got rid of the allow() Methods because we were only inserting new posts via a server Method (which bypasses allow() anyway).

Where and how did we get rid of allow()? Was it when we took out autopublish? I'm not sure at the moment and I want to plow ahead with the book without more head-scratching than necessary.

Charlie Magee

Uncaught TypeError: Cannot call method 'clear' of undefined

I'm unable to package the error display functionality as a Meteor Package, I get the following error in my browser console:

router.js?6c9f56d1887306c31d2b2bcdf9a15617c5d42c21:23
Meteor.Router.filters.clearErrors router.js?6c9f56d1887306c31d2b2bcdf9a15617c5d42c21:23
Router._applyFilter router_client.js:169
(anonymous function) router_client.js:155
_.reduce._.foldl._.inject underscore.js:114
Router._applyFilters router_client.js:154
(anonymous function) router_client.js:35
_.extend._compute deps.js:129
Deps.Computation deps.js:64
_.extend.autorun deps.js:255
Router._setPageFn router_client.js:24
(anonymous function) index.js:278
next index.js:166
page.dispatch index.js:169
page.replace index.js:148
page.start index.js:103
page index.js:60
Meteor.Router.Route.options router_client.js:180
ready

Funny enough, I can't see the scripts of the error package loaded under packages. What could be the problem, I'm using meteor 0.6.5.

Chapter 7.5 page 84 : Latency Compensation problem

Hi,
In Discover Meteor there is an example about Latency compensation. I'm running Meteor 0.6.4 (but also reproduced on 0.6.3.1) and the example fail. In fact the callback passed to Meteor.call('post'...) is not called by client until the server send the response. The post is well created on client side, the methods is called both on client and on server, but the callback is just waiting for the server response.
I had to add the following code in collections/posts.js to do the client redirection instead of returning the postId :
var postId = Posts.insert(post);
/* START my hack /
if (this.isSimulation) {
Meteor.Router.to('postsList');
}
/ END my hack */
return postId;

ReferenceError: RSS is not defined

ReferenceError: RSS is not defined
at Object.Meteor.Router.add./feed.xml (app/server/router.js:3:20)
at Router.match (packages/router/lib/router_server.js:61)
at Router._start (packages/router/lib/router_server.js:95)

Chapter 16 - 2

Adding Users (the pkg named accounts-ui-bootstrap-dropdown does not exist)

Edit - I fixed this issue by editing smart.lock and adding the code from this commit. chapter6-1

I've been successfully following the book up until the section Adding Users. I ran mrt add accounts-ui-bootstrap-dropdown and got a confirmation saying that the package was successfully installed. I also installed accounts-password. I updated the code in main.html and header.html, but when I ran meteor it gave me the error listed above (pkg accounts-ui...etc does not exist).

I installed the package, so how does it not exist? This is really confusing to me and I don't know how to proceed.

screen shot 2013-06-24 at 4 03 34 pm

Able to post duplicate link

@SachaG @tmeasday @DiscoverMeteor

Wanted to let you all know that with your current edit post method in your microscope app, users are able to submit a duplicate link to an already posted item by editing one of their post. The edit post method does not check to see if there are already posts with a duplicate link in the collection. The solution for this is a little more complicated. I'll work some things around and post my solution to it so you can update the code and the book.

Also, this bug can be duplicated in your telescope app demo.

Thanks for all your work on the book. It's a great read!

Intercom.io chapter doesn't cover Notifications

Maybe I missed it, but I've got all the Intercom stuff working except when I send the user a message or notification via the intercom.io site, it'll never show for the user.

I'm thinking there's a step needed for window.Intercom('update');?

I created a timer to run update every minute, but I still don't see popups until I refresh:

Template.loggedIn.created = function () {
    Meteor.setInterval(function () {
        window.Intercom('update');
    }, 60000);
};

Thanks for any advice, enjoying the book and premium content.

Commit 14-2 Animation Target above scroll range

If you have a long list of Posts, and add a new one, then vote on it, it animates, but the target location is outside the visible scrollable area. This may not be an issue, but I had to hunt for the voted post, by scrolling and then finding it.

The suplemtary chapter on Intercom appears to have a problem.

Hi Guys,

I've just tried adding the intecom code to microscope and don't seem to have any connection to the intercom website when I restart my app up to the initial part where its saying its waiting for a connection. I've checked the code against github at commit 15-1 and it all seems to be the same as your code, but no joy at all. Any ideas? I assume the package needs to be in the microscope/package/ directory, that's the only bit I'm not sure about.

postItem template uses attributes don't match the ones defined in the manager

Edit: Never mind, should've read on... Seems that the missing attribute is defined later on. :)

In the Templates chapter under the Meteor Templates heading, the postsData manager defines three attributes for a post: title, author and URL:

var postsData = [
  {
    title: 'Introducing Telescope',
    author: 'Sacha Greif',
    url: 'http://sachagreif.com/introducing-telescope/'
  },
  ...
];
Template.postsList.helpers({
  posts: postsData
});

But the template that was created earlier references a domain attribute, when it should be referencing the author attribute, I think:

<template name="postItem">
  <div class="post">
    <div class="post-content">
      <h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3>
    </div>
  </div>
</template>

Notifications are hard to clear

Reported by Tim:

If a user placed two comments under one post, the owner of the post has two notifications. But he needs to click both notifications to remove the badge, even though clicking just once let him sees both comments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.