-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e216cb
commit 8405709
Showing
319 changed files
with
135,743 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ examples/* | |
docs/* | ||
tmp/* | ||
coverage/* | ||
test/mocha/html-snapshots/server |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
define([ | ||
"backbone.layoutmanager" | ||
], function() { | ||
|
||
// Provide a global location to place configuration settings and module | ||
// creation. | ||
var app = { | ||
// The root path to run the application. | ||
root: "/" | ||
}; | ||
|
||
// Localize or create a new JavaScript Template object. | ||
var JST = window.JST = window.JST || {}; | ||
|
||
// Configure LayoutManager with Backbone Boilerplate defaults. | ||
Backbone.Layout.configure({ | ||
// Allow LayoutManager to augment Backbone.View.prototype. | ||
manage: true, | ||
|
||
prefix: "app/templates/", | ||
|
||
fetch: function(path) { | ||
// Concatenate the file extension. | ||
path = path + ".html"; | ||
|
||
// If cached, use the compiled template. | ||
if (JST[path]) { | ||
return JST[path]; | ||
} | ||
|
||
// Put fetch into `async-mode`. | ||
var done = this.async(); | ||
|
||
// Seek out the template asynchronously. | ||
$.get(app.root + path, function(contents) { | ||
done(JST[path] = _.template(contents)); | ||
}); | ||
} | ||
}); | ||
|
||
// Mix Backbone.Events, modules, and layout management into the app object. | ||
return _.extend(app, { | ||
// Create a custom object with a nested Views object. | ||
module: function(additionalProps) { | ||
return _.extend({ Views: {} }, additionalProps); | ||
}, | ||
|
||
// Helper for using layouts. | ||
useLayout: function(name, options) { | ||
// Enable variable arity by allowing the first argument to be the options | ||
// object and omitting the name argument. | ||
if (_.isObject(name)) { | ||
options = name; | ||
} | ||
|
||
// Ensure options is an object. | ||
options = options || {}; | ||
|
||
// If a name property was specified use that as the template. | ||
if (_.isString(name)) { | ||
options.template = name; | ||
} | ||
|
||
// Create a new Layout with options. | ||
var layout = new Backbone.Layout(_.extend({ | ||
el: "#main" | ||
}, options)); | ||
|
||
// Cache the refererence. | ||
return this.layout = layout; | ||
} | ||
}, Backbone.Events); | ||
|
||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Set the require.js configuration for your application. | ||
require.config({ | ||
|
||
// Initialize the application with the main application file and the JamJS | ||
// generated configuration file. | ||
deps: ["../vendor/jam/require.config", "main"], | ||
|
||
paths: { | ||
|
||
// Use the underscore build of Lo-Dash to minimize incompatibilities. | ||
"lodash": "../vendor/jam/lodash/dist/lodash.underscore", | ||
|
||
// JavaScript folders. | ||
plugins: "../vendor/js/plugins", | ||
vendor: "../vendor", | ||
|
||
// shortcut to foundation | ||
foundation: "../vendor/foundation", | ||
|
||
polyfiller: "../vendor/js/libs/webshim/minified/polyfiller" | ||
|
||
}, | ||
|
||
config: { | ||
"modules/contact": { | ||
// these have to match the api | ||
endpoint: "/api", | ||
resource: "contact", | ||
slug: "NORTHSTAR86i23a03pZ" | ||
}, | ||
"modules/render": { | ||
polyfillerBasePath: "/vendor/js/libs/webshim/minified/shims/" | ||
} | ||
}, | ||
|
||
map: { | ||
// Ensure Lo-Dash is used instead of underscore. | ||
"*": { "underscore": "lodash" } | ||
|
||
// Put additional maps here. | ||
}, | ||
|
||
shim: { | ||
|
||
"foundation/jquery.event.move": { | ||
deps: ["jquery"] | ||
}, | ||
"foundation/jquery.event.swipe": { | ||
deps: ["jquery"] | ||
}, | ||
|
||
"foundation/jquery.foundation.orbit.ln": { | ||
deps: ["jquery"] | ||
}, | ||
"foundation/init": { | ||
deps: ["jquery"] | ||
}, | ||
/* | ||
"foundation/jquery.foundation.mediaQueryToggle": { | ||
deps: ["jquery"] | ||
}, | ||
*/ | ||
"foundation/jquery.foundation.navigation.ln" : { | ||
deps: ["jquery"] | ||
}, | ||
"foundation/jquery.placeholder": { | ||
deps: ["jquery"] | ||
}, | ||
"foundation/jquery.foundation.reveal": { | ||
deps: ["jquery"] | ||
} | ||
} | ||
|
||
}); |
193 changes: 193 additions & 0 deletions
193
test/mocha/html-snapshots/server/app/data/pageData.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
{ | ||
"home": { | ||
"name": "home", | ||
"type": "target", | ||
"url": "/", | ||
"displayName": "Home", | ||
"slides": [ | ||
{ | ||
"cssclass": "slider-1", | ||
"content": "<h1>Welcome to North Star Cleaning</h1>" | ||
}, | ||
{ | ||
"cssclass": "slider-1", | ||
"content": "<h2>The next slide</h2>" | ||
} | ||
], | ||
"mainArt": "/images/art1.jpg", | ||
"mainArtAlt": "Test Art", | ||
"pageTitle": "North Star Cleaning Service", | ||
"pageDescription": "this is the home page", | ||
"pageKeywords": "home page", | ||
"vectorArt": true, | ||
"images": [] | ||
}, | ||
"contact": { | ||
"name": "contact", | ||
"type": "target", | ||
"slides": [ | ||
{ | ||
"cssclass": "slider-1", | ||
"content": "<h1>Contact us today!</h1>" | ||
} | ||
], | ||
"mainArt": "", | ||
"mainArtAlt": "", | ||
"pageTitle": "Contact - North Star Cleaning Service", | ||
"pageDescription": "this is the contact page", | ||
"pageKeywords": "contact page", | ||
"displayName": "Contact", | ||
"url": "/contact", | ||
"mailTo": "info@northstarcleaningme.com", | ||
"responseTime": "24 hours", | ||
"vectorArt": false | ||
}, | ||
"footer": { | ||
"name": "footer", | ||
"type": "component", | ||
"mainArt": "/images/art1.jpg", | ||
"mainArtAlt": "Footer Art" | ||
}, | ||
"carpets": { | ||
"name": "carpets", | ||
"type": "service", | ||
"slides": [ | ||
{ | ||
"cssclass": "", | ||
"content": "<h1>We Clean Carpets</h1><p>Oh yes we do. We really really do - believe it!</p>" | ||
} | ||
], | ||
"mainArt": "/images/art1.jpg", | ||
"mainArtAlt": "Test Art", | ||
"pageTitle": "Carpet Cleaning - North Star Cleaning Service", | ||
"pageDescription": "this is the carpets page", | ||
"pageKeywords": "carpets page", | ||
"displayName": "Carpets", | ||
"url": "/services/carpets", | ||
"vectorArt": true, | ||
"images": [ | ||
{ | ||
"pair": 0, | ||
"revealId": "carpet1", | ||
"th_src": "/images/carpets/carpet1_th.jpg", | ||
"th_alt": "small carpet", | ||
"th_width": "300px", | ||
"th_height": "300px", | ||
"m_src": "/images/carpets/carpet1.jpg", | ||
"m_alt": "big carpet", | ||
"m_width": "600px", | ||
"m_height": "600px", | ||
"title": "carpet one" | ||
}, | ||
{ | ||
"pair": 0, | ||
"revealId": "carpet2", | ||
"th_src": "/images/carpets/carpet2_th.jpg", | ||
"th_alt": "small carpet", | ||
"th_width": "300px", | ||
"th_height": "300px", | ||
"m_src": "/images/carpets/carpet2.jpg", | ||
"m_alt": "big carpet", | ||
"m_width": "600px", | ||
"m_height": "600px", | ||
"title": "carpet two" | ||
}, | ||
{ | ||
"pair": 1, | ||
"revealId": "carpet3", | ||
"th_src": "/images/carpets/carpet3_th.jpg", | ||
"th_alt": "small carpet", | ||
"th_width": "300px", | ||
"th_height": "300px", | ||
"m_src": "/images/carpets/carpet3.jpg", | ||
"m_alt": "big carpet", | ||
"m_width": "600px", | ||
"m_height": "600px", | ||
"title": "carpet three" | ||
}, | ||
{ | ||
"pair": 1, | ||
"revealId": "carpet4", | ||
"th_src": "/images/carpets/carpet4_th.jpg", | ||
"th_alt": "small carpet", | ||
"th_width": "300px", | ||
"th_height": "300px", | ||
"m_src": "/images/carpets/carpet4.jpg", | ||
"m_alt": "big carpet", | ||
"m_width": "600px", | ||
"m_height": "600px", | ||
"title": "carpet four" | ||
} | ||
] | ||
}, | ||
"floors": { | ||
"name": "floors", | ||
"type": "service", | ||
"slides": [], | ||
"mainArt": "", | ||
"mainArtAlt": "", | ||
"pageTitle": "Floor Cleaning - North Star Cleaning Service", | ||
"pageDescription": "this is the floors page", | ||
"pageKeywords": "floors page", | ||
"displayName": "Floors", | ||
"url": "/services/floors", | ||
"vectorArt": false, | ||
"images": [] | ||
}, | ||
"upholstery": { | ||
"name": "upholstery", | ||
"type": "service", | ||
"slides": [], | ||
"mainArt": "", | ||
"mainArtAlt": "", | ||
"pageTitle": "Upholstery Cleaning - North Star Cleaning Service", | ||
"pageDescription": "this is the upholstery page", | ||
"pageKeywords": "upholstery page", | ||
"displayName": "Upholstery", | ||
"url": "/services/upholstery", | ||
"vectorArt": false, | ||
"images": [] | ||
}, | ||
"tile-grout": { | ||
"name": "tile-grout", | ||
"type": "service", | ||
"slides": [], | ||
"mainArt": "", | ||
"mainArtAlt": "", | ||
"pageTitle": "Tile & Grout - North Star Cleaning Service", | ||
"pageDescription": "this is the tile & grout page", | ||
"pageKeywords": "tile & grout page", | ||
"displayName": "Tile & Grout", | ||
"url": "/services/tile-grout", | ||
"vectorArt": false, | ||
"images": [] | ||
}, | ||
"water-damage": { | ||
"name": "water-damage", | ||
"type": "service", | ||
"slides": [], | ||
"mainArt": "", | ||
"mainArtAlt": "", | ||
"pageTitle": "Water Damage - North Star Cleaning Service", | ||
"pageDescription": "this is the water damage page", | ||
"pageKeywords": "water damage page", | ||
"displayName": "Water Damage", | ||
"url": "/services/water-damage", | ||
"vectorArt": false, | ||
"images": [] | ||
}, | ||
"faq": { | ||
"name": "faq", | ||
"type": "service", | ||
"slides": [], | ||
"mainArt": "", | ||
"mainArtAlt": "", | ||
"pageTitle": "FAQ - North Star Cleaning Service", | ||
"pageDescription": "this is the FAQ page", | ||
"pageKeywords": "FAQ page", | ||
"displayName": "FAQ", | ||
"url": "/services/faq", | ||
"vectorArt": false, | ||
"images": [] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require([ | ||
"app", | ||
"router" | ||
], | ||
function(app, Router) { | ||
|
||
// Define your master router on the application namespace and trigger all | ||
// navigation from this instance. | ||
app.router = new Router(); | ||
|
||
// Trigger the initial route and enable HTML5 History API support, set the | ||
// root folder to '/' by default. Change in app.js. | ||
Backbone.history.start({ pushState: true, root: app.root }); | ||
|
||
// All navigation that is relative should be passed through the navigate | ||
// method, to be processed by the router. If the link has a `data-bypass` | ||
// attribute, bypass the delegation completely. | ||
$(document).on("click", "a[href]:not([data-bypass])", function(evt) { | ||
// Get the absolute anchor href. | ||
var href = { prop: $(this).prop("href"), attr: $(this).attr("href") }; | ||
|
||
// Get the absolute root. | ||
var root = location.protocol + "//" + location.host + app.root; | ||
|
||
// If the browser is normalizing, remove the absolute root from the href attr | ||
// Switch to normalizr instead when if/when it becomes available | ||
if (!$.support.hrefNormalized) | ||
href.attr = href.attr.replace(root, ""); | ||
|
||
// Ensure the root is part of the anchor href, meaning it's relative. | ||
if (href.prop.slice(0, root.length) === root) { | ||
// Stop the default event to ensure the link will not cause a page | ||
// refresh. | ||
evt.preventDefault(); | ||
|
||
// `Backbone.history.navigate` is sufficient for all Routers and will | ||
// trigger the correct events. The Router's internal `navigate` method | ||
// calls this anyways. The fragment is sliced from the root. | ||
Backbone.history.navigate(href.attr, true); | ||
} | ||
}); | ||
|
||
}); |
Oops, something went wrong.