Last active
December 16, 2015 03:59
-
-
Save mrmurphy/5374429 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Artifacts, exports, getDataFromForm; | |
exports = this; | |
Artifacts = new Meteor.Collection("artifacts"); | |
exports.Artifacts = Artifacts; | |
/* Global convenience functions | |
*/ | |
getDataFromForm = function(formID) { | |
var retobj; | |
retobj = {}; | |
$("" + formID + " > *").each(function() { | |
var field; | |
field = $(this); | |
if (!!field.val() && field.val() !== "Filter by Type") { | |
return retobj[field.attr('id')] = field.val(); | |
} | |
}); | |
return retobj; | |
}; | |
/* Set up page forwarding | |
*/ | |
if (Meteor.isClient) { | |
Meteor.pages({ | |
"/": { | |
to: "home", | |
nav: "Home" | |
}, | |
"/home": { | |
to: "home", | |
nav: "Home" | |
}, | |
"/add_artifact": { | |
to: "add_artifact", | |
nav: "Add Artifact" | |
}, | |
"/artifact_search": { | |
to: "artifact_search", | |
nav: "Artifact Search" | |
}, | |
"/view_action": { | |
to: "view_action", | |
nav: "Action Log" | |
}, | |
"/view_teams": { | |
to: "view_teams", | |
nav: "View Teams" | |
} | |
}, { | |
defaults: { | |
layout: "layout" | |
} | |
}); | |
/* Set up some defauilts | |
*/ | |
Meteor.startup(function() { | |
Session.set("current_page", 'home'); | |
return Session.set("filter_criteria", ""); | |
}); | |
/* These functions are needed to render the templates correctly. | |
*/ | |
Template.home.rendermap = function() { | |
return Meteor.defer(function() { | |
return loadmap(); | |
}); | |
}; | |
Template.layout.runlayoutscripts = function() { | |
$(document).foundation(); | |
}; | |
/* These are global helpers for all of the pages. | |
*/ | |
Handlebars.registerHelper("iscurrentpage", function(page) { | |
return page === Session.get("current_page"); | |
}); | |
Handlebars.registerHelper("getcurrentpage", function(page) { | |
return Session.get("current_page"); | |
}); | |
/* Code for the add artifacts page. | |
*/ | |
Template.add_artifact.events({ | |
"click button#add": function() { | |
Artifacts.insert({ | |
Northing: $("#Northing").val(), | |
Easting: $("#Easting").val(), | |
Datum: $("#Datum").val(), | |
Notes: $("#Notes").val(), | |
Username: $("#Username").val(), | |
ArtifactNumber: $("#ArtifactNumber").val(), | |
ArtifactType: $("#ArtifactType").val(), | |
Depth: $("#Depth").val() | |
}); | |
return $('<p>Data added!</p>').insertAfter('#add'); | |
} | |
/* Searching artifacts. | |
*/ | |
}); | |
Template.artifact_search.artifacts = function() { | |
var criteria; | |
criteria = Session.get('filter_criteria'); | |
return Artifacts.find({ | |
Depth: criteria | |
}); | |
}; | |
Template.artifact_search.events({ | |
"click button#search": function() { | |
Session.set('filter_criteria', "3"); | |
} | |
}); | |
Template.artifact_search.has_search_preset = function() { | |
if (Session.get('search_preset')) { | |
return true; | |
} | |
}; | |
Template.artifact_search.get_search_preset = function(NorE) { | |
var preset; | |
preset = Session.get('search_preset'); | |
if (NorE === 'northing') { | |
return preset['northing']; | |
} else { | |
return preset['easting']; | |
} | |
}; | |
/* Code for view teams page | |
*/ | |
Template.view_teams.makeflickable = function() { | |
return Meteor.defer(function() { | |
Flickable('.flickable', { | |
enableMouseEvents: true | |
}); | |
}); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the code I have, but this is the error I get back after clicking the 'search' button: | |
Exception from Deps recompute: Error: Error copying attribute '"': Error: InvalidCharacterError: DOM Exception 5 | |
at Function.Spark._Patcher._copyAttributes (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:494:19) | |
at Spark._Patcher.match (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:249:26) | |
at http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:61:23 | |
at visitNodes (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:17:11) | |
at visitNodes (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:18:9) | |
at visitNodes (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:18:9) | |
at visitNodes (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:18:9) | |
at visitNodes (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:18:9) | |
at Object.Spark._patch (http://localhost:3000/packages/spark/patch.js?299cb25985c501315fbd758353d7f498697a39c3:31:3) | |
at http://localhost:3000/packages/spark/spark.js?45c746f38023ceb80745f4b4280457e15f058bbc:638:13 logging.js:40 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up a database that can be accessed from the client, | |
# or from the server and put it in the global namespace ### | |
exports = this | |
Artifacts = new Meteor.Collection("artifacts") | |
exports.Artifacts = Artifacts | |
### Global convenience functions ### | |
getDataFromForm = (formID)-> | |
retobj = {} | |
$("#{formID} > *").each -> | |
field = $(@) | |
if !!field.val() and field.val() isnt "Filter by Type" | |
retobj[field.attr('id')] = field.val() | |
return retobj | |
###### | |
### Set up page forwarding ### | |
if Meteor.isClient | |
Meteor.pages | |
# Page values can be an object of options, a function or a template name string | |
"/": | |
to: "home" | |
nav: "Home" | |
"/home": | |
to: "home" | |
nav: "Home" | |
"/add_artifact": | |
to: "add_artifact" | |
nav: "Add Artifact" | |
"/artifact_search": | |
to: "artifact_search" | |
nav: "Artifact Search" | |
"/view_action": | |
to: "view_action" | |
nav: "Action Log" | |
"/view_teams": | |
to: "view_teams" | |
nav: "View Teams" | |
, | |
# optional options to pass to the PageRouter | |
defaults: | |
layout: "layout" | |
### Set up some defauilts ### | |
Meteor.startup -> | |
Session.set "current_page", 'home' | |
Session.set "filter_criteria", "" | |
###### | |
### These functions are needed to render the templates correctly. ### | |
Template.home.rendermap = -> | |
Meteor.defer -> #This line is VERY important! | |
loadmap() | |
Template.layout.runlayoutscripts = -> | |
$(document).foundation() | |
return | |
###### | |
### These are global helpers for all of the pages. ### | |
Handlebars.registerHelper "iscurrentpage", (page) -> | |
return page is Session.get "current_page" | |
Handlebars.registerHelper "getcurrentpage", (page) -> | |
return Session.get "current_page" | |
###### | |
### Code for the add artifacts page. ### | |
Template.add_artifact.events "click button#add": -> | |
Artifacts.insert ( | |
Northing: $("#Northing").val() | |
Easting: $("#Easting").val() | |
Datum : $("#Datum").val() | |
Notes: $("#Notes").val() | |
Username: $("#Username").val() | |
ArtifactNumber: $("#ArtifactNumber").val() | |
ArtifactType: $("#ArtifactType").val() | |
Depth: $("#Depth").val() | |
) | |
$('<p>Data added!</p>').insertAfter('#add') | |
###### | |
### Searching artifacts. ### | |
Template.artifact_search.artifacts = -> | |
criteria = Session.get 'filter_criteria' | |
Artifacts.find({Depth: criteria}) | |
Template.artifact_search.events "click button#search" : -> | |
#formdata=getDataFromForm("#searchform") | |
Session.set 'filter_criteria', "3" | |
return | |
Template.artifact_search.has_search_preset = -> | |
if Session.get('search_preset') | |
return true | |
Template.artifact_search.get_search_preset = (NorE) -> | |
preset = Session.get('search_preset') | |
if NorE is 'northing' | |
return preset['northing'] | |
else | |
return preset['easting'] | |
###### | |
### Code for view teams page ### | |
Template.view_teams.makeflickable = -> | |
Meteor.defer -> | |
Flickable('.flickable', enableMouseEvents: true) | |
return | |
### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ var Artifacts, exports, getDataFromForm; | |
exports = this; | |
Artifacts = new Meteor.Collection("artifacts"); | |
exports.Artifacts = Artifacts; | |
/* Global convenience functions | |
*/ | |
getDataFromForm = function(formID) { | |
var retobj; | |
retobj = {}; | |
$("" + formID + " > *").each(function() { | |
var field; | |
field = $(this); | |
if (!!field.val() && field.val() !== "Filter by Type") { | |
return retobj[field.attr('id')] = field.val(); | |
} | |
}); | |
return retobj; | |
}; | |
/* Set up page forwarding | |
*/ | |
if (Meteor.isClient) { | |
Meteor.pages({ | |
"/": { | |
to: "home", | |
nav: "Home" | |
}, | |
"/home": { | |
to: "home", | |
nav: "Home" | |
}, | |
"/add_artifact": { | |
to: "add_artifact", | |
nav: "Add Artifact" | |
}, | |
"/artifact_search": { | |
to: "artifact_search", | |
nav: "Artifact Search" | |
}, | |
"/view_action": { | |
to: "view_action", | |
nav: "Action Log" | |
}, | |
"/view_teams": { | |
to: "view_teams", | |
nav: "View Teams" | |
} | |
}, { | |
defaults: { | |
layout: "layout" | |
} | |
}); | |
/* Set up some defauilts | |
*/ | |
Meteor.startup(function() { | |
Session.set("current_page", 'home'); | |
return Session.set("filter_criteria", ""); | |
}); | |
/* These functions are needed to render the templates correctly. | |
*/ | |
Template.home.rendermap = function() { | |
return Meteor.defer(function() { | |
return loadmap(); | |
}); | |
}; | |
Template.layout.runlayoutscripts = function() { | |
$(document).foundation(); | |
}; | |
/* These are global helpers for all of the pages. | |
*/ | |
Handlebars.registerHelper("iscurrentpage", function(page) { | |
return page === Session.get("current_page"); | |
}); | |
Handlebars.registerHelper("getcurrentpage", function(page) { | |
return Session.get("current_page"); | |
}); | |
/* Code for the add artifacts page. | |
*/ | |
Template.add_artifact.events({ | |
"click button#add": function() { | |
Artifacts.insert({ | |
Northing: $("#Northing").val(), | |
Easting: $("#Easting").val(), | |
Datum: $("#Datum").val(), | |
Notes: $("#Notes").val(), | |
Username: $("#Username").val(), | |
ArtifactNumber: $("#ArtifactNumber").val(), | |
ArtifactType: $("#ArtifactType").val(), | |
Depth: $("#Depth").val() | |
}); | |
return $('<p>Data added!</p>').insertAfter('#add'); | |
} | |
/* Searching artifacts. | |
*/ | |
}); | |
Template.artifact_search.artifacts = function() { | |
var criteria; | |
criteria = Session.get('filter_criteria'); | |
return Artifacts.find({ | |
Depth: criteria | |
}); | |
}; | |
Template.artifact_search.events({ | |
"click button#search": function() { | |
Session.set('filter_criteria', "3"); | |
} | |
}); | |
Template.artifact_search.has_search_preset = function() { | |
if (Session.get('search_preset')) { | |
return true; | |
} | |
}; | |
Template.artifact_search.get_search_preset = function(NorE) { | |
var preset; | |
preset = Session.get('search_preset'); | |
if (NorE === 'northing') { | |
return preset['northing']; | |
} else { | |
return preset['easting']; | |
} | |
}; | |
/* Code for view teams page | |
*/ | |
Template.view_teams.makeflickable = function() { | |
return Meteor.defer(function() { | |
Flickable('.flickable', { | |
enableMouseEvents: true | |
}); | |
}); | |
}; | |
} | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template name="artifact_search"> | |
{{> breadcrumb}} | |
<div class="row"> | |
<div id="left"> | |
<div class="large-6 columns"> | |
<form id="searchform"> | |
<select id="ArtifactType" class="medium"> | |
<option>Filter by Type</option> | |
<option>Pottery</option> | |
<option>Bones</option> | |
<option>Seeds</option> | |
<option>Arrow Heads</option> | |
</select> | |
<br><br> | |
<span>Search by Keyword</span> | |
<input id="Keyword" type="text" placeholder="Search by Keyword"> | |
<span>Search by Northing</span> | |
<input id="Northing" {{#if has_search_preset}}value="{{get_search_preset 'northing'}}{{/if}}" type="text" placeholder="Search by Northing"> | |
<span>Search by Easting</span> | |
<input id="Easting" {{#if has_search_preset}}value="{{get_search_preset 'easting'}}{{/if}}" type="text" placeholder="Search by Easting"> | |
<span>Search by Depth</span> | |
<input id="Depth" type="text" placeholder="Filter by Depth"> | |
<span>Search by Researcher</span> | |
<input id="Researcher" type="text" placeholder="Filter by Researcher"> | |
</form> | |
<button class="small button" onClick="parent.location=('home')">Home</button> | |
<button class="small button" id="search">Search</button> | |
</div> | |
</div> | |
<div id="right"> | |
<div class="large-6 columns"> | |
<DL id="artifactslist"> | |
{{#each artifacts}} | |
{{> artifact}} | |
{{/each}} | |
</DL> | |
</div> | |
</div> | |
</div> | |
</template> | |
<template name="artifact"> | |
<DT><STRONG>{{Notes}}</STRONG></DT> | |
<DD>FS# {{ArtifactNumber}} Found by {{Username}} at a depth of {{Depth}}</DD> | |
</template> |
@mkarliner Sorry! I guess I don't have notifications turned on, I just found this comment.
If I remember correctly, it ended up being just badly formatted HTML.
I had a quotation mark in the wrong spot, which rendered one of the tags ineffective. So, a general cleanup of the HTML solved the issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Did you ever find out why this was? I'm getting the same error and have no clue.