1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- Websites = new Mongo.Collection("websites");
- if (Meteor.isClient) {
-
-
-
-
- Template.website_list.helpers({
- websites:function(){
- return Websites.find({});
- }
- });
-
-
-
- Template.website_item.events({
- "click .js-upvote":function(event){
-
-
- var website_id = this._id;
- console.log("Up voting website with id "+website_id);
-
- return false;
- },
- "click .js-downvote":function(event){
-
-
- var website_id = this._id;
- console.log("Down voting website with id "+website_id);
-
- return false;
- }
- })
- Template.website_form.events({
- "click .js-toggle-website-form":function(event){
- $("#website_form").toggle('slow');
- },
- "submit .js-save-website-form":function(event){
-
- var url = event.target.url.value;
- console.log("The url they entered is: "+url);
-
-
- return false;
- }
- });
- }
- if (Meteor.isServer) {
-
- Meteor.startup(function () {
-
- if (!Websites.findOne()){
- console.log("No websites yet. Creating starter data.");
- Websites.insert({
- title:"Goldsmiths Computing Department",
- url:"http://www.gold.ac.uk/computing/",
- description:"This is where this course was developed.",
- createdOn:new Date()
- });
- Websites.insert({
- title:"University of London",
- url:"http://www.londoninternational.ac.uk/courses/undergraduate/goldsmiths/bsc-creative-computing-bsc-diploma-work-entry-route",
- description:"University of London International Programme.",
- createdOn:new Date()
- });
- Websites.insert({
- title:"Coursera",
- url:"http://www.coursera.org",
- description:"Universal access to the world’s best education.",
- createdOn:new Date()
- });
- Websites.insert({
- title:"Google",
- url:"http://www.google.com",
- description:"Popular search engine.",
- createdOn:new Date()
- });
- }
- });
- }
|