Skip to content

Instantly share code, notes, and snippets.

View copleykj's full-sized avatar
😎
Totally Committed

Kelly Copley copleykj

😎
Totally Committed
View GitHub Profile
Template.gem_view.context = function() {
return {
contentTemplate: "gems"
};
};
Template.page.render_content = function() {
var context = this;
var html = Template.no_template_found;
if (context && context.contentTemplate) {
@copleykj
copleykj / gist:7922639
Created December 12, 2013 03:09
Basic example of publishing one server side collection to 2 different client side collections.
//Available on Client and Server and is a managed collection
Vehicles = new Meteor.Collection('vehicles');
if(Meteor.isServer){
Meteor.publish('cars', function () {
var cursor = Vehicles.find({type:"car"});
var subscription = this;
var handle = cursor.observe({
added: function (document) {
@copleykj
copleykj / gist:7896726
Created December 10, 2013 19:35
Trigger meteor template events programmatically.
_(Template.templateName._tmpl_data.events["event selector"]).each(function(eventName){
eventName.call(self, event);
});
@copleykj
copleykj / exact_checked_rule
Created July 24, 2013 21:23
A Mesosphere rule to make sure a check box array has at least one field checked.
Mesosphere.registerRule("exactChecked", function(fieldValue, ruleValue, fieldName, formFieldsObject, fieldRequirements){
if(_(formFieldsObject[fieldName]).isArray() && formFieldsObject[fieldName].length == ruleValue){
return true;
}
return false;
});