Example #1
0
    return Tasks.find({}, {sort: {createdAt: -1} });
  },
   incompleteCount() {
    return Tasks.find({ checked: { $ne: true } }).count();
  },
});

Template.body.events({
  'submit .new-task'(event) {
    // prevent default browser form submit
    event.preventDefault();

    // get value from form element
    const target = event.target;
    const text = target.text.value;

    // insert tasks into the collection
    Tasks.insert({
      text,
      createdAt: new Date(),
      owner: Meteor.userId(),
      username: Meteor.user().username,
    });
    // clear form
    target.text.value = '';
  },
  'change .hide-completed input'(event, instance) {
    instance.state.set('hideCompleted', event.target.checked);
  },
});
Example #2
0
import {Template} from 'meteor/templating';
import {Tasks} from '../api/tasks.js';

import './task.js';
import './body.html';


Template.body.helpers({
	tasks(){
		return Tasks.find({});
	},
});
Template.body.events({
	'submit .new_task'(event){
		event.preventDefault();

		const target = event.target;
		const text = target.text.value;


		Tasks.insert({
			text,
			createdAt: new Date(),
		});
		target.text.value='';
	}
});
Example #3
0
  	}
  	// Show newest tasks at the top
  	return Tasks.find({}, { sort: { createdAt: -1} } );
  },
  incompleteCount() {
  	return Tasks.find({ checked: { $ne: true } } ).count();
  },
});

Template.body.events({
  'submit .new-task'(event) {
    // Prevent default browser form submit
    event.preventDefault();
 
    // Get value from form element
    const target = event.target;
    const text = target.text.value;
 
    // Insert a task into the collection
    Meteor.call('tasks.insert', text);
 
    // Clear form
    target.text.value = '';

    //console.log(event)
  },
  'change .hide-completed input' (event, instance) {
  	instance.state.set('hideCompleted', event.target.checked);
  },

});
Example #4
0
import { Template } from 'meteor/templating';

Template.body.helpers({

});

Template.body.events({

	'submit #madLib-form': function(event, template) {
		event.preventDefault();

		let exclamation = template.find('#exclamation').value;
		let adverb = template.find('#adverb').value;
		let noun = template.find('#noun').value;
		let verb = template.find('#verb').value;
		let madLib = "'" + exclamation + "!' you say, as you " + adverb + " jump onto your " + noun + " and " + verb + " into the sunset.";
		$("#madLib").hide();
		$("#madLib").text(madLib);
		$("#madLib").css("color","#0000ff");
		$("#madLib").fadeIn("slow");
	}
});
Example #5
0
// Add event handler for form submit 4.2
Template.body.events({
    'submit .new-task'(event) {
        // Prevent default browser form submit
        event.preventDefault();

        // Get value from form element
        const target = event.target;
        const text = target.text.value;

        // Insert a task into the collection
        // commented out after adding it to import/api/tasks.js for username checks 9.3
        // Tasks.insert({
        //     text,
        //     createdAt: new Date(), //current time
        //     // Update insert to include use date 8.5
        //     owner: Meteor.userId(), //current userId
        //     username: Meteor.user().username // current username
        // });

        // Replace insert with addText method 9.3
        Meteor.call('tasks.insert', text);

        // Clear Form
        target.text.value = '';
    },
    // Add event handler for checkbox 7.4
    'change .hide-completed input'(event, instance) {
        instance.state.set('hideCompleted', event.target.checked);
    }
});
Example #6
0
import './body.html';

Template.body.onCreated(function bodyOnCreated() {
    this.state = new ReactiveDict();
    //Meteor.subscribe('tasks');
    //Meteor.subscribe('groupMarkers', "");
    //Meteor.subscribe('destinations');
    Meteor.subscribe('groups');
    //Meteor.subscribe('userGroups');

    //this.subscribe('groups');
});

Template.body.onRendered( function () {

    // $('#map').addClass("hide-on-small-only");
    
    $(".dropdown-button").dropdown();
    $(".button-collapse").sideNav();
});

Template.body.helpers({


});

Template.body.events({

});

Example #7
0
};

bodyOnCreated = function() {
  this.state = new ReactiveDict();
  Meteor.subscribe("tasks");
  return true;
};

Template.body.onCreated(bodyOnCreated);

Template.body.helpers({
  tasks: tasks,
  incompleteCount: incompleteCount
});

Template.body.events({
  "submit .new-task": function(event, template) {
    var target, text;
    event.preventDefault();
    target = event.target;
    text = target.text.value;
    Meteor.call('tasks.insert', text);
    return target.text.value = '';
  },
  'change .hide-completed input': function(event, instance) {
    return instance.state.set('hideCompleted', event.target.checked);
  }
});

text = "重要通知:\n由于最近新系统仍然存在很多问题,经过董事会和信息中心的讨论,我们决定下周一启用老系统。本周(7月9日-7月17日)所有在新系统中添加的订单,今晚会导入回老系统,届时,新系统依旧开放可供数据对比。\n下周一开始请在旧系统中操作。\n由于时间关系,无法将所有数据恢复,本周所有审批流程请重新提交,重新审核,其他如意向客户、导游排班、物品认领等数据,下周逐步导回老系统。";
import '../../client/main.html';

var number = localStorage.getItem("number") || 0;
Template.body.onCreated(function bodyOnCreated() {
	Meteor.subscribe('queue');
})
Template.body.helpers({
	queue() {
		return Queue.find({});
	}, 
	serving() {
		return Serving.find({});
	}
});

Template.body.events({

  'click #submit'(event, instance) {
  	number++;
    localStorage.setItem("number", number);
    Meteor.call('queue.insert', number);
  },
 'click #serve' (event, instance) {
 	if (Queue.find().count() != 0) {
 		Meteor.call('serving.insert', Queue.findOne().number);
 	}
  },
  'click .remove' (event, instance) {
  	Meteor.call('serving.delete', this.number);
  }
});
Example #9
0
import {db} from "./imports/localdb";
import {Persistence} from "./imports/persistence";
import {Template} from "meteor/templating";
import {Timers} from "/client/imports/timers";

import {_3D} from "/client/imports/3D";
import {Planet} from "/imports/planet";

var time = 1;
var id = "SXxn64cvuCZdAzAJy" + time;
Template.body.rendered = function () {
  var planet = _3D.create.planet(Planet.generate(id));
  _3D.show.planet(planet);
};

Template.body.events({
  "click"(){
      //3D.showPlanet({_id : Math.random()});
  }
})
Example #10
0

Template.body.events({
    "change #category-select": function (event, template) {
        var user_id = $(event.currentTarget).val();
        Template.body.state.set('selectedid', user_id);
        drawChart();
    },
    'click #exportToCSV': function (event, instance) {
      var data = Template.body.state.get('tableData');
      var csvRows = ['\"User\" \, \"Type\" \, \"Room\" \, \"Object\" \, \"Timestamp [s]\" \, \"duration [s]\" \, \"Mission\" \, \"Feedback - act\" \, \"Feedback - actor\" \, \"Feedback - epoch\" \, \"Feedback - errors\" \, \"Feedback - message\" \, \"Feedback - noErrors\"'];
      for(var i = 0; i<data.length; i++)
      {

          var row = data[i];
          for(var j = 0; j<row.length; j++)
          {
            row[j] = '\"' + row[j] + '\"';
          }
          csvRows.push(row.join('\,'));
      }
      var csvString = csvRows.join("\n");
      var a         = document.createElement('a');
      a.href        = 'data:attachment/csv,' +  encodeURIComponent(csvString);
      a.target      = '_blank';
      a.download    = 'data.csv';
      document.body.appendChild(a);
      a.click();
    }
});

function getUserMissionLine(userid)
Example #11
0
});

Template.body.helpers({
  tasks() {
    const instance = Template.instance();
    const sort = { sort: { createdAt: -1 } };
    if(instance.state.get('hideCompleted')) {
      return Tasks.find({ checked: { $ne: true }}, sort);
    }
    return Tasks.find({}, sort);
  },
  incompleteCount() {
    return Tasks.find({ checked: { $ne: true }}).count();
  }
});

Template.body.events({
  "submit .new-task": function(event){
     event.preventDefault();

     const target = event.target;
     const text = target.text.value;

     Meteor.call('tasks.insert', text);
     target.text.value = '';
  },
  "change .hide-completed input"(event, instance){
    instance.state.set('hideCompleted', event.target.checked);
  }
});
Example #12
0
Template.body.events({
    'submit .new-task'(event) {
        // Prevent default browser form submit
        event.preventDefault();

        //Get value from the form element
        const target = event.target;
        const text = target.text.value;

        // Insert a task into the collection
        if (text == '' | text.length < 5) {
            return false
        } else {
            Tasks.insert({
                text,
                createdAt: new Date(),
                owner: Meteor.userId(),
                username: Meteor.user().username,
            });
        }

        Meteor.call('tasks.insert', text);

        // Clear form
        target.text.value = '';
    },
    'click .clear'(event) {
        event.preventDefault();
        Tasks.delete({});
    }
})
Example #13
0
import './clockpicker.js'
import './progress.js'
import './body.html'


Template.main_menu.events({
    'click #start'(event){
        //event.preventDefault();
        Session.set('showButtons', true);
        Session.set('newWindow', false);
    }
});

Template.main_menu.helpers({
    showButtons : true,
    newWindow: false
});

Session.setDefault('page', 'main_menu');

Template.body.helpers({
    currentPage: function(page){
        return Session.get('page')
    }
});

Template.body.events({
    'click .btn': function(event, template){
        Session.set('page', event.currentTarget.getAttribute('data-page'))
    }
});
Template.body.events({
  'submit .nieuw-cijfer'(event) {
    // Prevent default browser form submit
    event.preventDefault();
 
    // Get value from form element
    const target = event.target;
    const leerling = target.leerling.value;
    const vak = target.vak.value;
    const cijfer = target.cijfer.value;
 
    // Insert a task into the collection
    if (isNaN(cijfer) || cijfer < 0.0 || cijfer > 10.0) {
      alert('Het cijfer moet een getal zal dat tussen de 0.0 en 10.0 ligt. Probeer het opnieuw.') 
    } else if (leerling === "" || cijfer === "" || vak === "" || isNaN(leerling) === false) {
      alert('Vul alstublieft alle gegevens correct in!')
    }
    else {
      Cijfers.insert({
      leerling,
      vak,
      cijfer,
      createdAt: new Date(), // current time
      owner: Meteor.userId(),
      username: Meteor.user().username,
    });
    }
 
    // Clear form
    target.leerling.value = '';
    target.vak.value = '';
    target.cijfer.value = '';
  },
});
import './task.js';
import './body.html';

Template.body.helpers({
  tasks() {
      // Show newest tasks at the top
      return Tasks.find({}, { sort: { createdAt: -1 } });
  },
});

Template.body.events({
  'submit .new-task'(event) {
    // Prevent default browser form submit
    event.preventDefault();

    // Get value from form element
    const target = event.target;
    const text = target.text.value;

    // Insert a task into the collection
    Tasks.insert({
      text,
      createdAt: new Date(), // current time
    });

    // Clear form
    target.text.value = '';
  },
});
Example #16
0
Template.body.onCreated(function bodyOnCreated(){
	Meteor.call('results.clear');
	this.queryContent = "";
	Meteor.subscribe('results');
});

Template.body.helpers({
	results() {
		console.log(ResultsArray);
		return ResultsArray.find();
	}
});

Template.body.events({
  'submit .searchQuery'(event) {
  	Meteor.call('results.clear');
  	event.preventDefault();
    var q = document.getElementById("userQuery");
    var baseURL = "https://en.wikipedia.org/w/api.php?action=query&list=allpages&apfrom=REPLACE&aplimit=10&format=json";
    var finalQuery = baseURL.replace("REPLACE", q.value);

    $.getJSON(finalQuery, function(json){
    	var jsonArray = json.query.allpages;
    	for(var ii = 0; ii < jsonArray.length; ii++) {
    		Meteor.call('results.insert', jsonArray[ii].title);	
    	}
    });
  },
});
Example #17
0
  Meteor.subscribe('projects');
  
});

Template.body.helpers({

            
});

Template.body.events({
   
    'click .menu-opt' (event) {
            
        let opt = event.target.closest('.menu-opt'),
            button = opt.closest('.dropdown').getElementsByClassName('dropdown-toggle').item(0);
        
        console.log(opt);
        console.log(opt.getAttribute("value"));
        
        button.innerHTML = opt.innerHTML;
        button.setAttribute("value", opt.getAttribute("value"));
    }, 

});





Example #18
0
Meteor.startup(function(){
  if (!Meteor.userId()){
    Meteor.loginWithPassword("p","a",function(e){
    });
  }
});


function sync(){
  Meteor.call("getState",function(err,result){
    if (err){
      console.log(err);
      return;
    }
    delete result._id;
    localdb.update({},result,{upsert : true});
  })
}

Template.body.events({
  "click #hardReset" : function(){
    Meteor.call("hardReset");
  }
});


Accounts.onLogin(function(){
  id = {_id : Meteor.userId()}
  sync();
});
Example #19
0
    if(instance.state.get('hideCompleted')){
      return Tasks.find({ checked: { $ne: true }}, { sort: { createAt: -1 } });
    }
    return Tasks.find({}, { sort: { createAt: -1 } });
  },
  incompleteCount(){
    return Tasks.find({ checked: { $ne: true } }).count();
  },
});

Template.body.events({
  'submit .new-task'(event){
    event.preventDefault();

    const target = event.target;
    const text = target.text.value;
/*    Tasks.insert({
      text,
      createAt : new Date(),
      owner: Meteor.userId(),
      username: Meteor.user().username,
    });*/
    Meteor.call('tasks.insert', text);

    target.text.value = '';
  },
  'change .hide-completed input'(event, instance){
    instance.state.set('hideCompleted', event.target.checked);
  },
});
Example #20
0
  tasks() {
    return Tasks.find({});
  },
});
 
Template.body.events({
  'submit .new-task'(event) {
    // Prevent default browser form submit
    event.preventDefault();
 
    // Get value from form element
    const target = event.target;
    const text = target.text.value;
 
    // Insert a task into the collection
    Tasks.insert({
      text,
      createdAt: new Date(), // current time
    });
 
    // Clear form
    target.text.value = '';
  },
   'change .hide-completed input'(event, instance) {
    instance.state.set('hideCompleted', event.target.checked);
  },
});

Template.body.helpers({
  tasks() {
    const instance = Template.instance();
    if (instance.state.get('hideCompleted')) {
Example #21
0
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';

import './main.html';
col = new Mongo.Collection('iterthru');
Template.body.helpers({
    iterthru:function(){return col.find();}

});
Template.body.events({
    'submit .email':function(event){
        var x =event.target.emailid.value;
        y=Meteor.user().emails[0].address;
        col.insert({a1:x,a2:y});
        event.target.emailid.value="";
        return false;
    }
})
 

/*Template.hello.events({
    'click .del':function(){
        col.remove(this._id);
    }
})*/
Example #22
0
		return Tasks.find({ checked: { $ne: true } }).count();
	},
});

Template.body.events({
	'submit .new-task'(event) {
		event.preventDefault();

		const target = event.target;
		const text = target.text.value;

		Tasks.insert({
			text,
			createdAt: new Date(),
		});

		target.text.value =''
	},
	'click .toggle-checked'() {

		Tasks.update(this._id, {
			$set: { checked: ! this.checked }
		});
	},
	'click .delete'() {
		Tasks.remove(this._id);
	},
	'change .hide-completed input' (event, instance) {
		instance.state.set('hideCompleted', event.target.checked);
	},
});
Example #23
0
   incompleteCount() {
    return Raps.find({ checked: { $ne: true } }).count();
  },

});
 
Template.body.events({
  'submit .new-rap'(event) {
    // Prevent default browser form submit
    event.preventDefault();
 
    // Get value from form element
    const target = event.target;
    const text = target.text.value;
 
    // Insert a rap into the collection
    Raps.insert({
      text,
      createdAt: new Date(), // current time
      voteCount: 0,
      owner: Meteor.userId(),
      username: Meteor.user().username,
    });
 
    // Clear form
    target.text.value = '';
  },
  'change .hide-completed input'(event, instance) {
    instance.state.set('hideCompleted', event.target.checked);
  },
});
Example #24
0
import './body.html';

Template.body.events({
  'click button'(event) {
    console.log('aaa');
    Tasks.insert({
      'recurrence' : [{
        'nameZHCN' : 'qqqq1',
        'gallery' : [
          {
            'fileType' : 'image2',
            'fileStorage' : 'aliyun3',
          },
          {
            'fileType' : 'image4',
            'fileStorage' : 'aliyun5',
          }
        ],
        'contact' : [
          {
            'representative' : 'qqqqq6',
          }
        ],
        _id: 'F9Fqh3EtTFy4Pi9di'
      }
    ]});
    Tasks.update({'_id': 'g55W3s7iZ88koy8W5'},
                 {$pull: {'recurrence.0.gallery': {fileType: 'image2'}}});
  }
});

Example #25
0
Template.body.events({

    'click #bookingCategory1'(event) {
        // Prevent default browser form submit
        event.preventDefault();
        // Insert a task into the collection
        Meteor.call('booking.add', "Kategorie 1");
    },

    'click #bookingCategory2'(event) {
        // Prevent default browser form submit
        event.preventDefault();
        // Insert a task into the collection
        Meteor.call('booking.add', "Kategorie 2");
    },

    'click #bookingCategory3'(event) {
        // Prevent default browser form submit
        event.preventDefault();
        // Insert a task into the collection
        Meteor.call('booking.add', "Kategorie 3");
    },


    'submit .new-task'(event) {
        // Prevent default browser form submit
        event.preventDefault();

        // Get value from form element
        const target = event.target;
        const text = target.text.value;

        // Insert a task into the collection
        Meteor.call('bookingLog.insert', text);

        // Clear form
        target.text.value = '';
    },
});
Example #26
0
Template.body.events({
    'submit .new-task' (event) {
        // Prevent default browser form submit
        event.preventDefault();

        // Get value from form element
        const target = event.target;
        const text = target.text.value;

        // Insert a task into the collection
        Meteor.call('tasks.insert', text);

        // Clear form
        target.text.value = '';
    },
    'change .hide-completed input' (event, instance) {
        instance.state.set('hideCompleted', event.target.checked);
    },
    'keyup .search-task' (event) {
        //console.log(event.target, event.target.text, $('.search-task').val());
        Session.set('Search', $('.search-task').val());
    },
    'click .js-tag-check' (event) {
        checked = event.target.checked;
        tag = event.target.id;
        console.log(checked, tag);

        tagsArray = Session.get('tagsArray');
        console.log(typeof tagsArray, tagsArray);
        if (checked) {
            tagsArray.push(tag)
            Session.set('tagsArray', tagsArray);
        } else {
            i = tagsArray.indexOf(tag);
            if (i > -1) {
                tagsArray.splice(i, 1);
                Session.set('tagsArray', tagsArray);
            }

        }

        // do array with checked keys
        /* Plan B
        checkedTags = [];
        $('.js-tag-check').each(function(index, value) {
            console.log(index, value);
        }); */
        // Session.set('tagsArray', tags);
    }
});
Example #27
0
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';

import './main.html';


Template.body.events({
    'click .loginBtn'(event, instance){
        console.log("loginBtn Clikced");
    }
})

Template.feedbackForm.onCreated(function helloOnCreated() {
    // counter starts at 0
    this.finished = new ReactiveVar(false);
    this.responseMsg = new ReactiveVar("");

    Meteor.setTimeout(function () {
        $('body').css('opacity', '1');
    }, 10);
});

Template.feedbackForm.helpers({
    counter() {
        return "";
    },

    finished() {
        return Template.instance().finished.get();
    },
    responseMsg(){
Example #28
0
    return Items.find({}, { sort: { createdAt: -1 } });
  },
  calcScore() {
    var count = 0;
    var allItems = Items.find().fetch();
    for (var i=0; i < allItems.length; i++){
      count += parseInt(allItems[i].points);
    }
    return count;
  },
});

Template.body.events({
  'submit .new-item'(event) {
    event.preventDefault();

    const target = event.target;
    const text = target.text.value;
    const points = target.number.value;

    //console.log(target)
    Items.insert({
      text,
      points,
      createdAt: new Date(),
    });

    target.text.value = '';
  },
});
Example #29
0
    return !condition;
});

Template.body.helpers({
    showLoginForm() {
        return !loggedIn.get();
    },
    targetTemplate() {
        return target.get();
    }
});

Template.body.events({
    'click [id=btn-cpanel]'(event, template) {
        if (Meteor.user().profile.isRoot) {
            target.set('controlPanel');
        }
    },
    'click [id=btn-logout]'(event, template) {
        Meteor.logout(function (error) {
            loggedIn.set(false);
        });
    },
    'click [id=btn-list-projects]'(event, template) {
        target.set('projects');
    },
    'click [id=btn-usr-page]'(event, template) {
        target.set('home');
    },
});
Example #30
0
        randAirfare = numeral(randNum).format('$0,0');

    return randAirfare;
  }
});

Template.body.events({

  'change select[name="filter-regions"]': function(e, templ) {

    var filterValue = e.currentTarget.value;

    Session.set('filter_region', filterValue);

    console.log("Session variable changed to: ", Session.get('filter_region'));
  },

  'keyup input[name="search-q"]': function(evt, templ) {

    console.log(evt.currentTarget.value, " pressed!");

    Session.set("search-q", evt.currentTarget.value);

  }

});


Template.body.onRendered(function () {

  // activate dropdowns
  $('#js-filter-regions').dropdown()