User groups let you give your users permission to perform specific actions.
Users.createGroup("mods"); // let's create a new "mods" group
import {mount} from 'react-mounter'; | |
////////////////////////////////////////////////////// | |
// Collection & Schema // | |
////////////////////////////////////////////////////// | |
Movies = new Mongo.Collection("movies"); | |
const isLoggedIn = user => !!user; | |
const isOwner = (user, document) => user._id === document.userId; |
import NoSSR from 'react-no-ssr'; | |
import Core from 'meteor/nova:core'; | |
import SmartContainers from "meteor/utilities:react-list-container"; | |
import FormContainers from "meteor/utilities:react-form-containers"; | |
FlashContainer = Core.FlashContainer; | |
ModalButton = Core.ModalButton; | |
NewDocContainer = FormContainers.NewDocContainer; | |
EditDocContainer = FormContainers.EditDocContainer; |
/* | |
This component fetches a .md file and renders it as an HTML page. | |
Dependencies: react, react-markdown | |
Note: a package file can only access assets in the same package. This means | |
this component needs to be live in the same package as your assets, | |
which means it can't be distributed as a separate package. |
if (Meteor.isClient) { | |
NovaCounts = new Mongo.Collection("novacounts"); | |
} | |
if (Meteor.isServer) { | |
NovaCounts = { | |
subscription: {}, | |
counts: [], | |
push(listId, count, sessionId) { | |
this.subscription.added("novacounts", listId, {count: count}); |
Telescope Nova is the new, React-based version of Telescope, a Meteor open-source app.
Now that Telescope's front-end layer has been ported to React, the next step is porting the data layer to Apollo.
You can find Telescope's code on GitHub. I recommend you use this branch to get the latest version of the codebase:
// Explanation: | |
// This is a migration script for your users to be compatible with the Apollo version of Nova | |
// We do not support anymore users properties on the `telescope` namespace. They will be duplicated onto __setting: | |
// Example: `user.telescope.karma` becomes `user.__karma` | |
// Note: we do not remove the `user.telescope` object, you'll still be able to go back to your previous full Meteor build if you feel that Apollo doesn't fit your needs | |
// How to use: | |
// Create a new /server directory at the root of your project then paste the script below in /server/migration.js | |
import Users from 'meteor/nova:users'; |
// define component1, component2, etc. here | |
// will pass mutation as this.props.myMutation | |
export default withMutation({ | |
name: 'myMutation', | |
args: {foo: 'String', bar: 'String'}, | |
})(component1); | |
// will pass mutation as this.props.myOtherMutation | |
// this time, we don't have any arguments |
import {withList} from 'meteor/nova:core'; | |
import gql from 'graphql-tag'; | |
import Movies from 'movies.js'; | |
const MyComponent = ({loading, results}) => <div> | |
{ loading ? <p>Loading…</p> : results.map(movie => <p>{movie.title} ({movie.year})</p>) } | |
</div> | |
const options = { | |
collection: Movies, |