diff --git a/Gemfile b/Gemfile
index 21bcd48..8ebfa18 100644
--- a/Gemfile
+++ b/Gemfile
@@ -56,6 +56,7 @@ gem 'spring', :group => :development
gem 'delayed_job_active_record'
gem 'puma'
gem 'brakeman'
+ gem 'rails-lineman'
group :development do
#gem 'bullet'
diff --git a/Gemfile.lock b/Gemfile.lock
index e6c97cb..98334b4 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -131,6 +131,8 @@ GEM
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
+ rails-lineman (0.3.0)
+ rake
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
@@ -207,6 +209,7 @@ DEPENDENCIES
passenger
puma
rails (= 4.2.5)
+ rails-lineman
rails_12factor
rb-readline
round_robin_tournament
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 8f3a604..6e74089 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -1,4 +1,9 @@
class ApiController < ApplicationController
+ protect_from_forgery with: :null_session
+
+ def index
+
+ end
def tournaments
@tournaments = Tournament.all
diff --git a/app/views/api/index.html.erb b/app/views/api/index.html.erb
new file mode 100644
index 0000000..7eefeea
--- /dev/null
+++ b/app/views/api/index.html.erb
@@ -0,0 +1,2 @@
+<%= stylesheet_link_tag "lineman/app" %>
+<%= javascript_include_tag "lineman/app" %>
\ No newline at end of file
diff --git a/config/application.rb b/config/application.rb
index 80a1c83..d8037e7 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -29,7 +29,7 @@ module Wrestling
config.active_job.queue_adapter = :delayed_job
-
+ config.rails_lineman.lineman_project_location = "frontend"
end
diff --git a/config/routes.rb b/config/routes.rb
index 799b3de..a4008fb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -55,6 +55,7 @@ Wrestling::Application.routes.draw do
#API
get "/api/tournaments" => "api#tournaments"
get "/api/tournaments/:tournament" => "api#tournament"
+ get "/api/index" => "api#index"
# Example of regular route:
# get 'products/:id' => 'catalog#view'
diff --git a/frontend/.gitignore b/frontend/.gitignore
new file mode 100644
index 0000000..275ec00
--- /dev/null
+++ b/frontend/.gitignore
@@ -0,0 +1,9 @@
+.DS_Store
+
+#ignore node_modules, as the node project is not "deployed" per se: http://www.mikealrogers.com/posts/nodemodules-in-git.html
+/node_modules
+
+/dist
+/generated
+
+.sass-cache
diff --git a/frontend/.npmignore b/frontend/.npmignore
new file mode 100644
index 0000000..275ec00
--- /dev/null
+++ b/frontend/.npmignore
@@ -0,0 +1,9 @@
+.DS_Store
+
+#ignore node_modules, as the node project is not "deployed" per se: http://www.mikealrogers.com/posts/nodemodules-in-git.html
+/node_modules
+
+/dist
+/generated
+
+.sass-cache
diff --git a/frontend/.travis.yml b/frontend/.travis.yml
new file mode 100644
index 0000000..53ce7b2
--- /dev/null
+++ b/frontend/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+- 0.10
+script: "lineman spec-ci"
diff --git a/frontend/Gruntfile.js b/frontend/Gruntfile.js
new file mode 100644
index 0000000..ed05645
--- /dev/null
+++ b/frontend/Gruntfile.js
@@ -0,0 +1,4 @@
+/*global module:false*/
+module.exports = function(grunt) {
+ require('./config/lineman').config.grunt.run(grunt);
+};
diff --git a/frontend/Procfile b/frontend/Procfile
new file mode 100644
index 0000000..8513c01
--- /dev/null
+++ b/frontend/Procfile
@@ -0,0 +1 @@
+web: npm run production
diff --git a/frontend/README.md b/frontend/README.md
new file mode 100644
index 0000000..debad91
--- /dev/null
+++ b/frontend/README.md
@@ -0,0 +1 @@
+# My Lineman Application
\ No newline at end of file
diff --git a/frontend/app/css/style.css b/frontend/app/css/style.css
new file mode 100644
index 0000000..2c361ec
--- /dev/null
+++ b/frontend/app/css/style.css
@@ -0,0 +1,4 @@
+.hello {
+ background-color: #efefef;
+ border: 1px solid #dedede;
+}
diff --git a/frontend/app/img/.keep b/frontend/app/img/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/app/js/.keep b/frontend/app/js/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/app/js/hello.js b/frontend/app/js/hello.js
new file mode 100644
index 0000000..4a9d1e5
--- /dev/null
+++ b/frontend/app/js/hello.js
@@ -0,0 +1,14 @@
+window.helloText = function() {
+ return 'Hello, World!';
+};
+
+window.hello = function() {
+ html = JST['app/templates/hello.us']({text: helloText()});
+ document.body.innerHTML += html;
+};
+
+if(window.addEventListener) {
+ window.addEventListener('DOMContentLoaded', hello, false);
+} else {
+ window.attachEvent('onload', hello);
+}
diff --git a/frontend/app/pages/index.us b/frontend/app/pages/index.us
new file mode 100644
index 0000000..365a292
--- /dev/null
+++ b/frontend/app/pages/index.us
@@ -0,0 +1,12 @@
+
+
+
+ <%= pkg.name %>
+
+
+
+
+
+ Test
+
+
diff --git a/frontend/app/static/favicon.ico b/frontend/app/static/favicon.ico
new file mode 100644
index 0000000..70de606
Binary files /dev/null and b/frontend/app/static/favicon.ico differ
diff --git a/frontend/app/templates/hello.us b/frontend/app/templates/hello.us
new file mode 100644
index 0000000..b17f363
--- /dev/null
+++ b/frontend/app/templates/hello.us
@@ -0,0 +1,3 @@
+
+ <%= text %>
+
\ No newline at end of file
diff --git a/frontend/config/application.js b/frontend/config/application.js
new file mode 100644
index 0000000..43bbe4e
--- /dev/null
+++ b/frontend/config/application.js
@@ -0,0 +1,59 @@
+/* Exports a function which returns an object that overrides the default &
+ * plugin grunt configuration object.
+ *
+ * You can familiarize yourself with Lineman's defaults by looking at:
+ *
+ * - https://github.com/linemanjs/lineman/blob/master/config/application.coffee
+ * - https://github.com/linemanjs/lineman/blob/master/config/plugins
+ *
+ * You can also ask about Lineman's config from the command line:
+ *
+ * $ lineman config #=> to print the entire config
+ * $ lineman config concat_sourcemap.js #=> to see the JS config for the concat task.
+ */
+module.exports = function(lineman) {
+ //Override application configuration here. Common examples follow in the comments.
+ return {
+
+ // API Proxying
+ //
+ // During development, you'll likely want to make XHR (AJAX) requests to an API on the same
+ // port as your lineman development server. By enabling the API proxy and setting the port, all
+ // requests for paths that don't match a static asset in ./generated will be forwarded to
+ // whatever service might be running on the specified port.
+ //
+ // server: {
+ // apiProxy: {
+ // enabled: true,
+ // host: 'localhost',
+ // port: 3000
+ // }
+ // },
+
+ // Sass
+ //
+ // Lineman supports Sass via grunt-contrib-sass, which requires you first
+ // have Ruby installed as well as the `sass` gem. To enable it, uncomment the
+ // following line:
+ //
+ // enableSass: true,
+
+ // Asset Fingerprints
+ //
+ // Lineman can fingerprint your static assets by appending a hash to the filename
+ // and logging a manifest of logical-to-hashed filenames in dist/assets.json
+ // via grunt-asset-fingerprint
+ //
+ // enableAssetFingerprint: true,
+
+ // LiveReload
+ //
+ // Lineman can LiveReload browsers whenever a file is changed that results in
+ // assets to be processed, preventing the need to hit F5/Cmd-R every time you
+ // make a change in each browser you're working against. To enable LiveReload,
+ // comment out the following line:
+ //
+ // livereload: true
+
+ };
+};
diff --git a/frontend/config/files.js b/frontend/config/files.js
new file mode 100644
index 0000000..a64ab32
--- /dev/null
+++ b/frontend/config/files.js
@@ -0,0 +1,23 @@
+/* Exports a function which returns an object that overrides the default &
+ * plugin file patterns (used widely through the app configuration)
+ *
+ * To see the default definitions for Lineman's file paths and globs, see:
+ *
+ * - https://github.com/linemanjs/lineman/blob/master/config/files.coffee
+ */
+module.exports = function(lineman) {
+ //Override file patterns here
+ return {
+
+ // As an example, to override the file patterns for
+ // the order in which to load third party JS libs:
+ //
+ // js: {
+ // vendor: [
+ // "vendor/js/underscore.js",
+ // "vendor/js/**/*.js"
+ // ]
+ // }
+
+ };
+};
diff --git a/frontend/config/lineman.js b/frontend/config/lineman.js
new file mode 100644
index 0000000..0ce0689
--- /dev/null
+++ b/frontend/config/lineman.js
@@ -0,0 +1 @@
+module.exports = require(process.env['LINEMAN_MAIN']);
diff --git a/frontend/config/server.js b/frontend/config/server.js
new file mode 100644
index 0000000..1654dc1
--- /dev/null
+++ b/frontend/config/server.js
@@ -0,0 +1,21 @@
+/* Define custom server-side HTTP routes for lineman's development server
+ * These might be as simple as stubbing a little JSON to
+ * facilitate development of code that interacts with an HTTP service
+ * (presumably, mirroring one that will be reachable in a live environment).
+ *
+ * It's important to remember that any custom endpoints defined here
+ * will only be available in development, as lineman only builds
+ * static assets, it can't run server-side code.
+ *
+ * This file can be very useful for rapid prototyping or even organically
+ * defining a spec based on the needs of the client code that emerge.
+ *
+ */
+
+module.exports = {
+ drawRoutes: function(app) {
+ // app.get('/api/greeting/:message', function(req, res){
+ // res.json({ message: "OK, "+req.params.message });
+ // });
+ }
+};
\ No newline at end of file
diff --git a/frontend/config/spec.json b/frontend/config/spec.json
new file mode 100644
index 0000000..b6258d5
--- /dev/null
+++ b/frontend/config/spec.json
@@ -0,0 +1,9 @@
+{
+ "framework" : "jasmine",
+ "launch_in_dev" : ["Chrome"],
+ "launch_in_ci" : ["PhantomJS"],
+ "src_files" : [
+ "generated/js/app.js",
+ "generated/js/spec.js"
+ ]
+}
\ No newline at end of file
diff --git a/frontend/package.json b/frontend/package.json
new file mode 100644
index 0000000..b58aa98
--- /dev/null
+++ b/frontend/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "frontend",
+ "description": "An HTML/JS/CSS app",
+ "version": "0.0.1",
+ "private": true,
+ "author": "John Doe",
+ "devDependencies": {
+ "lineman": "~0.36.6",
+ "lineman-rails": "^0.1.0"
+ },
+ "scripts": {
+ "start": "lineman run",
+ "test": "lineman spec-ci",
+ "production": "lineman clean build && npm i express@3 && node -e \"var e = require('express'), a = e(); a.use(e.static('dist/')); a.listen(process.env.PORT)\""
+ }
+}
diff --git a/frontend/spec/hello-spec.js b/frontend/spec/hello-spec.js
new file mode 100644
index 0000000..208eca2
--- /dev/null
+++ b/frontend/spec/hello-spec.js
@@ -0,0 +1,4 @@
+describe(".helloText", function(){
+ When(function(){ this.result = helloText(); });
+ Then(function(){ expect(this.result).toEqual("Hello, World!"); });
+});
diff --git a/frontend/spec/helpers/helper.js b/frontend/spec/helpers/helper.js
new file mode 100644
index 0000000..3c9ebf8
--- /dev/null
+++ b/frontend/spec/helpers/helper.js
@@ -0,0 +1,2 @@
+window.context = window.describe;
+window.xcontext = window.xdescribe;
diff --git a/frontend/spec/helpers/jasmine-fixture.js b/frontend/spec/helpers/jasmine-fixture.js
new file mode 100644
index 0000000..1d28910
--- /dev/null
+++ b/frontend/spec/helpers/jasmine-fixture.js
@@ -0,0 +1,433 @@
+/* jasmine-fixture - 1.3.2
+ * Makes injecting HTML snippets into the DOM easy & clean!
+ * https://github.com/searls/jasmine-fixture
+ */
+(function() {
+ var createHTMLBlock,
+ __slice = [].slice;
+
+ (function($) {
+ var ewwSideEffects, jasmineFixture, originalAffix, originalJasmineDotFixture, originalJasmineFixture, root, _, _ref;
+ root = (1, eval)('this');
+ originalJasmineFixture = root.jasmineFixture;
+ originalJasmineDotFixture = (_ref = root.jasmine) != null ? _ref.fixture : void 0;
+ originalAffix = root.affix;
+ _ = function(list) {
+ return {
+ inject: function(iterator, memo) {
+ var item, _i, _len, _results;
+ _results = [];
+ for (_i = 0, _len = list.length; _i < _len; _i++) {
+ item = list[_i];
+ _results.push(memo = iterator(memo, item));
+ }
+ return _results;
+ }
+ };
+ };
+ root.jasmineFixture = function($) {
+ var $whatsTheRootOf, affix, create, jasmineFixture, noConflict;
+ affix = function(selectorOptions) {
+ return create.call(this, selectorOptions, true);
+ };
+ create = function(selectorOptions, attach) {
+ var $top;
+ $top = null;
+ _(selectorOptions.split(/[ ](?![^\{]*\})(?=[^\]]*?(?:\[|$))/)).inject(function($parent, elementSelector) {
+ var $el;
+ if (elementSelector === ">") {
+ return $parent;
+ }
+ $el = createHTMLBlock($, elementSelector);
+ if (attach || $top) {
+ $el.appendTo($parent);
+ }
+ $top || ($top = $el);
+ return $el;
+ }, $whatsTheRootOf(this));
+ return $top;
+ };
+ noConflict = function() {
+ var currentJasmineFixture, _ref1;
+ currentJasmineFixture = jasmine.fixture;
+ root.jasmineFixture = originalJasmineFixture;
+ if ((_ref1 = root.jasmine) != null) {
+ _ref1.fixture = originalJasmineDotFixture;
+ }
+ root.affix = originalAffix;
+ return currentJasmineFixture;
+ };
+ $whatsTheRootOf = function(that) {
+ if ((that != null ? that.jquery : void 0) != null) {
+ return that;
+ } else if ($('#jasmine_content').length > 0) {
+ return $('#jasmine_content');
+ } else {
+ return $('').appendTo('body');
+ }
+ };
+ jasmineFixture = {
+ affix: affix,
+ create: create,
+ noConflict: noConflict
+ };
+ ewwSideEffects(jasmineFixture);
+ return jasmineFixture;
+ };
+ ewwSideEffects = function(jasmineFixture) {
+ var _ref1;
+ if ((_ref1 = root.jasmine) != null) {
+ _ref1.fixture = jasmineFixture;
+ }
+ $.fn.affix = root.affix = jasmineFixture.affix;
+ return afterEach(function() {
+ return $('#jasmine_content').remove();
+ });
+ };
+ if ($) {
+ return jasmineFixture = root.jasmineFixture($);
+ } else {
+ return root.affix = function() {
+ var nowJQueryExists;
+ nowJQueryExists = window.jQuery || window.$;
+ if (nowJQueryExists != null) {
+ jasmineFixture = root.jasmineFixture(nowJQueryExists);
+ return affix.call.apply(affix, [this].concat(__slice.call(arguments)));
+ } else {
+ throw new Error("jasmine-fixture requires jQuery to be defined at window.jQuery or window.$");
+ }
+ };
+ }
+ })(window.jQuery || window.$);
+
+ createHTMLBlock = (function() {
+ var bindData, bindEvents, parseAttributes, parseClasses, parseContents, parseEnclosure, parseReferences, parseVariableScope, regAttr, regAttrDfn, regAttrs, regCBrace, regClass, regClasses, regData, regDatas, regEvent, regEvents, regExclamation, regId, regReference, regTag, regTagNotContent, regZenTagDfn;
+ createHTMLBlock = function($, ZenObject, data, functions, indexes) {
+ var ZenCode, arr, block, blockAttrs, blockClasses, blockHTML, blockId, blockTag, blocks, el, el2, els, forScope, indexName, inner, len, obj, origZenCode, paren, result, ret, zc, zo;
+ if ($.isPlainObject(ZenObject)) {
+ ZenCode = ZenObject.main;
+ } else {
+ ZenCode = ZenObject;
+ ZenObject = {
+ main: ZenCode
+ };
+ }
+ origZenCode = ZenCode;
+ if (indexes === undefined) {
+ indexes = {};
+ }
+ if (ZenCode.charAt(0) === "!" || $.isArray(data)) {
+ if ($.isArray(data)) {
+ forScope = ZenCode;
+ } else {
+ obj = parseEnclosure(ZenCode, "!");
+ obj = obj.substring(obj.indexOf(":") + 1, obj.length - 1);
+ forScope = parseVariableScope(ZenCode);
+ }
+ while (forScope.charAt(0) === "@") {
+ forScope = parseVariableScope("!for:!" + parseReferences(forScope, ZenObject));
+ }
+ zo = ZenObject;
+ zo.main = forScope;
+ el = $();
+ if (ZenCode.substring(0, 5) === "!for:" || $.isArray(data)) {
+ if (!$.isArray(data) && obj.indexOf(":") > 0) {
+ indexName = obj.substring(0, obj.indexOf(":"));
+ obj = obj.substr(obj.indexOf(":") + 1);
+ }
+ arr = ($.isArray(data) ? data : data[obj]);
+ zc = zo.main;
+ if ($.isArray(arr) || $.isPlainObject(arr)) {
+ $.map(arr, function(value, index) {
+ var next;
+ zo.main = zc;
+ if (indexName !== undefined) {
+ indexes[indexName] = index;
+ }
+ if (!$.isPlainObject(value)) {
+ value = {
+ value: value
+ };
+ }
+ next = createHTMLBlock($, zo, value, functions, indexes);
+ if (el.length !== 0) {
+ return $.each(next, function(index, value) {
+ return el.push(value);
+ });
+ }
+ });
+ }
+ if (!$.isArray(data)) {
+ ZenCode = ZenCode.substr(obj.length + 6 + forScope.length);
+ } else {
+ ZenCode = "";
+ }
+ } else if (ZenCode.substring(0, 4) === "!if:") {
+ result = parseContents("!" + obj + "!", data, indexes);
+ if (result !== "undefined" || result !== "false" || result !== "") {
+ el = createHTMLBlock($, zo, data, functions, indexes);
+ }
+ ZenCode = ZenCode.substr(obj.length + 5 + forScope.length);
+ }
+ ZenObject.main = ZenCode;
+ } else if (ZenCode.charAt(0) === "(") {
+ paren = parseEnclosure(ZenCode, "(", ")");
+ inner = paren.substring(1, paren.length - 1);
+ ZenCode = ZenCode.substr(paren.length);
+ zo = ZenObject;
+ zo.main = inner;
+ el = createHTMLBlock($, zo, data, functions, indexes);
+ } else {
+ blocks = ZenCode.match(regZenTagDfn);
+ block = blocks[0];
+ if (block.length === 0) {
+ return "";
+ }
+ if (block.indexOf("@") >= 0) {
+ ZenCode = parseReferences(ZenCode, ZenObject);
+ zo = ZenObject;
+ zo.main = ZenCode;
+ return createHTMLBlock($, zo, data, functions, indexes);
+ }
+ block = parseContents(block, data, indexes);
+ blockClasses = parseClasses($, block);
+ if (regId.test(block)) {
+ blockId = regId.exec(block)[1];
+ }
+ blockAttrs = parseAttributes(block, data);
+ blockTag = (block.charAt(0) === "{" ? "span" : "div");
+ if (ZenCode.charAt(0) !== "#" && ZenCode.charAt(0) !== "." && ZenCode.charAt(0) !== "{") {
+ blockTag = regTag.exec(block)[1];
+ }
+ if (block.search(regCBrace) !== -1) {
+ blockHTML = block.match(regCBrace)[1];
+ }
+ blockAttrs = $.extend(blockAttrs, {
+ id: blockId,
+ "class": blockClasses,
+ html: blockHTML
+ });
+ el = $("<" + blockTag + ">", blockAttrs);
+ el.attr(blockAttrs);
+ el = bindEvents(block, el, functions);
+ el = bindData(block, el, data);
+ ZenCode = ZenCode.substr(blocks[0].length);
+ ZenObject.main = ZenCode;
+ }
+ if (ZenCode.length > 0) {
+ if (ZenCode.charAt(0) === ">") {
+ if (ZenCode.charAt(1) === "(") {
+ zc = parseEnclosure(ZenCode.substr(1), "(", ")");
+ ZenCode = ZenCode.substr(zc.length + 1);
+ } else if (ZenCode.charAt(1) === "!") {
+ obj = parseEnclosure(ZenCode.substr(1), "!");
+ forScope = parseVariableScope(ZenCode.substr(1));
+ zc = obj + forScope;
+ ZenCode = ZenCode.substr(zc.length + 1);
+ } else {
+ len = Math.max(ZenCode.indexOf("+"), ZenCode.length);
+ zc = ZenCode.substring(1, len);
+ ZenCode = ZenCode.substr(len);
+ }
+ zo = ZenObject;
+ zo.main = zc;
+ els = $(createHTMLBlock($, zo, data, functions, indexes));
+ els.appendTo(el);
+ }
+ if (ZenCode.charAt(0) === "+") {
+ zo = ZenObject;
+ zo.main = ZenCode.substr(1);
+ el2 = createHTMLBlock($, zo, data, functions, indexes);
+ $.each(el2, function(index, value) {
+ return el.push(value);
+ });
+ }
+ }
+ ret = el;
+ return ret;
+ };
+ bindData = function(ZenCode, el, data) {
+ var datas, i, split;
+ if (ZenCode.search(regDatas) === 0) {
+ return el;
+ }
+ datas = ZenCode.match(regDatas);
+ if (datas === null) {
+ return el;
+ }
+ i = 0;
+ while (i < datas.length) {
+ split = regData.exec(datas[i]);
+ if (split[3] === undefined) {
+ $(el).data(split[1], data[split[1]]);
+ } else {
+ $(el).data(split[1], data[split[3]]);
+ }
+ i++;
+ }
+ return el;
+ };
+ bindEvents = function(ZenCode, el, functions) {
+ var bindings, fn, i, split;
+ if (ZenCode.search(regEvents) === 0) {
+ return el;
+ }
+ bindings = ZenCode.match(regEvents);
+ if (bindings === null) {
+ return el;
+ }
+ i = 0;
+ while (i < bindings.length) {
+ split = regEvent.exec(bindings[i]);
+ if (split[2] === undefined) {
+ fn = functions[split[1]];
+ } else {
+ fn = functions[split[2]];
+ }
+ $(el).bind(split[1], fn);
+ i++;
+ }
+ return el;
+ };
+ parseAttributes = function(ZenBlock, data) {
+ var attrStrs, attrs, i, parts;
+ if (ZenBlock.search(regAttrDfn) === -1) {
+ return undefined;
+ }
+ attrStrs = ZenBlock.match(regAttrDfn);
+ attrs = {};
+ i = 0;
+ while (i < attrStrs.length) {
+ parts = regAttr.exec(attrStrs[i]);
+ attrs[parts[1]] = "";
+ if (parts[3] !== undefined) {
+ attrs[parts[1]] = parseContents(parts[3], data);
+ }
+ i++;
+ }
+ return attrs;
+ };
+ parseClasses = function($, ZenBlock) {
+ var classes, clsString, i;
+ ZenBlock = ZenBlock.match(regTagNotContent)[0];
+ if (ZenBlock.search(regClasses) === -1) {
+ return undefined;
+ }
+ classes = ZenBlock.match(regClasses);
+ clsString = "";
+ i = 0;
+ while (i < classes.length) {
+ clsString += " " + regClass.exec(classes[i])[1];
+ i++;
+ }
+ return $.trim(clsString);
+ };
+ parseContents = function(ZenBlock, data, indexes) {
+ var html;
+ if (indexes === undefined) {
+ indexes = {};
+ }
+ html = ZenBlock;
+ if (data === undefined) {
+ return html;
+ }
+ while (regExclamation.test(html)) {
+ html = html.replace(regExclamation, function(str, str2) {
+ var begChar, fn, val;
+ begChar = "";
+ if (str.indexOf("!for:") > 0 || str.indexOf("!if:") > 0) {
+ return str;
+ }
+ if (str.charAt(0) !== "!") {
+ begChar = str.charAt(0);
+ str = str.substring(2, str.length - 1);
+ }
+ fn = new Function("data", "indexes", "var r=undefined;" + "with(data){try{r=" + str + ";}catch(e){}}" + "with(indexes){try{if(r===undefined)r=" + str + ";}catch(e){}}" + "return r;");
+ val = unescape(fn(data, indexes));
+ return begChar + val;
+ });
+ }
+ html = html.replace(/\\./g, function(str) {
+ return str.charAt(1);
+ });
+ return unescape(html);
+ };
+ parseEnclosure = function(ZenCode, open, close, count) {
+ var index, ret;
+ if (close === undefined) {
+ close = open;
+ }
+ index = 1;
+ if (count === undefined) {
+ count = (ZenCode.charAt(0) === open ? 1 : 0);
+ }
+ if (count === 0) {
+ return;
+ }
+ while (count > 0 && index < ZenCode.length) {
+ if (ZenCode.charAt(index) === close && ZenCode.charAt(index - 1) !== "\\") {
+ count--;
+ } else {
+ if (ZenCode.charAt(index) === open && ZenCode.charAt(index - 1) !== "\\") {
+ count++;
+ }
+ }
+ index++;
+ }
+ ret = ZenCode.substring(0, index);
+ return ret;
+ };
+ parseReferences = function(ZenCode, ZenObject) {
+ ZenCode = ZenCode.replace(regReference, function(str) {
+ var fn;
+ str = str.substr(1);
+ fn = new Function("objs", "var r=\"\";" + "with(objs){try{" + "r=" + str + ";" + "}catch(e){}}" + "return r;");
+ return fn(ZenObject, parseReferences);
+ });
+ return ZenCode;
+ };
+ parseVariableScope = function(ZenCode) {
+ var forCode, rest, tag;
+ if (ZenCode.substring(0, 5) !== "!for:" && ZenCode.substring(0, 4) !== "!if:") {
+ return undefined;
+ }
+ forCode = parseEnclosure(ZenCode, "!");
+ ZenCode = ZenCode.substr(forCode.length);
+ if (ZenCode.charAt(0) === "(") {
+ return parseEnclosure(ZenCode, "(", ")");
+ }
+ tag = ZenCode.match(regZenTagDfn)[0];
+ ZenCode = ZenCode.substr(tag.length);
+ if (ZenCode.length === 0 || ZenCode.charAt(0) === "+") {
+ return tag;
+ } else if (ZenCode.charAt(0) === ">") {
+ rest = "";
+ rest = parseEnclosure(ZenCode.substr(1), "(", ")", 1);
+ return tag + ">" + rest;
+ }
+ return undefined;
+ };
+ regZenTagDfn = /([#\.\@]?[\w-]+|\[([\w-!?=:"']+(="([^"]|\\")+")? {0,})+\]|\~[\w$]+=[\w$]+|&[\w$]+(=[\w$]+)?|[#\.\@]?!([^!]|\\!)+!){0,}(\{([^\}]|\\\})+\})?/i;
+ regTag = /(\w+)/i;
+ regId = /(?:^|\b)#([\w-!]+)/i;
+ regTagNotContent = /((([#\.]?[\w-]+)?(\[([\w!]+(="([^"]|\\")+")? {0,})+\])?)+)/i;
+ /*
+ See lookahead syntax (?!) at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
+ */
+
+ regClasses = /(\.[\w-]+)(?!["\w])/g;
+ regClass = /\.([\w-]+)/i;
+ regReference = /(@[\w$_][\w$_\d]+)/i;
+ regAttrDfn = /(\[([\w-!]+(="?([^"]|\\")+"?)? {0,})+\])/ig;
+ regAttrs = /([\w-!]+(="([^"]|\\")+")?)/g;
+ regAttr = /([\w-!]+)(="?((([\w]+(\[.*?\])+)|[^"\]]|\\")+)"?)?/i;
+ regCBrace = /\{(([^\}]|\\\})+)\}/i;
+ regExclamation = /(?:([^\\]|^))!([^!]|\\!)+!/g;
+ regEvents = /\~[\w$]+(=[\w$]+)?/g;
+ regEvent = /\~([\w$]+)=([\w$]+)/i;
+ regDatas = /&[\w$]+(=[\w$]+)?/g;
+ regData = /&([\w$]+)(=([\w$]+))?/i;
+ return createHTMLBlock;
+ })();
+
+}).call(this);
diff --git a/frontend/spec/helpers/jasmine-given.js b/frontend/spec/helpers/jasmine-given.js
new file mode 100644
index 0000000..a1c911e
--- /dev/null
+++ b/frontend/spec/helpers/jasmine-given.js
@@ -0,0 +1,373 @@
+/* jasmine-given - 2.6.3
+ * Adds a Given-When-Then DSL to jasmine as an alternative style for specs
+ * https://github.com/searls/jasmine-given
+ */
+/* jasmine-matcher-wrapper - 0.0.3
+ * Wraps Jasmine 1.x matchers for use with Jasmine 2
+ * https://github.com/testdouble/jasmine-matcher-wrapper
+ */
+(function() {
+ var __hasProp = {}.hasOwnProperty,
+ __slice = [].slice;
+
+ (function(jasmine) {
+ var comparatorFor, createMatcher;
+ if (jasmine == null) {
+ return typeof console !== "undefined" && console !== null ? console.warn("jasmine was not found. Skipping jasmine-matcher-wrapper. Verify your script load order.") : void 0;
+ }
+ if (jasmine.matcherWrapper != null) {
+ return;
+ }
+ jasmine.matcherWrapper = {
+ wrap: function(matchers) {
+ var matcher, name, wrappedMatchers;
+ if (jasmine.addMatchers == null) {
+ return matchers;
+ }
+ wrappedMatchers = {};
+ for (name in matchers) {
+ if (!__hasProp.call(matchers, name)) continue;
+ matcher = matchers[name];
+ wrappedMatchers[name] = createMatcher(name, matcher);
+ }
+ return wrappedMatchers;
+ }
+ };
+ createMatcher = function(name, matcher) {
+ return function() {
+ return {
+ compare: comparatorFor(matcher, false),
+ negativeCompare: comparatorFor(matcher, true)
+ };
+ };
+ };
+ return comparatorFor = function(matcher, isNot) {
+ return function() {
+ var actual, context, message, params, pass, _ref;
+ actual = arguments[0], params = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ context = {
+ actual: actual,
+ isNot: isNot
+ };
+ pass = matcher.apply(context, params);
+ if (isNot) {
+ pass = !pass;
+ }
+ if (!pass) {
+ message = (_ref = context.message) != null ? _ref.apply(context, params) : void 0;
+ }
+ return {
+ pass: pass,
+ message: message
+ };
+ };
+ };
+ })(jasmine || getJasmineRequireObj());
+
+}).call(this);
+
+(function() {
+ var __slice = [].slice;
+
+ (function(jasmine) {
+ var Waterfall, additionalInsightsForErrorMessage, apparentReferenceError, attemptedEquality, cloneArray, comparisonInsight, currentSpec, declareJasmineSpec, deepEqualsNotice, doneWrapperFor, errorWithRemovedLines, evalInContextOfSpec, finalStatementFrom, getBlock, invariantList, mostRecentExpectations, mostRecentStacks, mostRecentlyUsed, o, root, stringifyExpectation, wasComparison, whenList, wrapAsExpectations;
+ mostRecentlyUsed = null;
+ root = (1, eval)('this');
+ currentSpec = null;
+ beforeEach(function() {
+ return currentSpec = this;
+ });
+ root.Given = function() {
+ mostRecentlyUsed = root.Given;
+ return beforeEach(getBlock(arguments));
+ };
+ whenList = [];
+ root.When = function() {
+ var b;
+ mostRecentlyUsed = root.When;
+ b = getBlock(arguments);
+ beforeEach(function() {
+ return whenList.push(b);
+ });
+ return afterEach(function() {
+ return whenList.pop();
+ });
+ };
+ invariantList = [];
+ root.Invariant = function() {
+ var invariantBehavior;
+ mostRecentlyUsed = root.Invariant;
+ invariantBehavior = getBlock(arguments);
+ beforeEach(function() {
+ return invariantList.push(invariantBehavior);
+ });
+ return afterEach(function() {
+ return invariantList.pop();
+ });
+ };
+ getBlock = function(thing) {
+ var assignResultTo, setupFunction;
+ setupFunction = o(thing).firstThat(function(arg) {
+ return o(arg).isFunction();
+ });
+ assignResultTo = o(thing).firstThat(function(arg) {
+ return o(arg).isString();
+ });
+ return doneWrapperFor(setupFunction, function(done) {
+ var context, result;
+ context = currentSpec;
+ result = setupFunction.call(context, done);
+ if (assignResultTo) {
+ if (!context[assignResultTo]) {
+ return context[assignResultTo] = result;
+ } else {
+ throw new Error("Unfortunately, the variable '" + assignResultTo + "' is already assigned to: " + context[assignResultTo]);
+ }
+ }
+ });
+ };
+ mostRecentExpectations = null;
+ mostRecentStacks = null;
+ declareJasmineSpec = function(specArgs, itFunction) {
+ var expectationFunction, expectations, label, stacks;
+ if (itFunction == null) {
+ itFunction = it;
+ }
+ label = o(specArgs).firstThat(function(arg) {
+ return o(arg).isString();
+ });
+ expectationFunction = o(specArgs).firstThat(function(arg) {
+ return o(arg).isFunction();
+ });
+ mostRecentlyUsed = root.subsequentThen;
+ mostRecentExpectations = expectations = [expectationFunction];
+ mostRecentStacks = stacks = [errorWithRemovedLines("failed expectation", 3)];
+ itFunction("then " + (label != null ? label : stringifyExpectation(expectations)), doneWrapperFor(expectationFunction, function(jasmineDone) {
+ var userCommands;
+ userCommands = [].concat(whenList, invariantList, wrapAsExpectations(expectations, stacks));
+ return new Waterfall(userCommands, jasmineDone).flow();
+ }));
+ return {
+ Then: subsequentThen,
+ And: subsequentThen
+ };
+ };
+ wrapAsExpectations = function(expectations, stacks) {
+ var expectation, i, _i, _len, _results;
+ _results = [];
+ for (i = _i = 0, _len = expectations.length; _i < _len; i = ++_i) {
+ expectation = expectations[i];
+ _results.push((function(expectation, i) {
+ return doneWrapperFor(expectation, function(maybeDone) {
+ return expect(expectation).not.toHaveReturnedFalseFromThen(currentSpec, i + 1, stacks[i], maybeDone);
+ });
+ })(expectation, i));
+ }
+ return _results;
+ };
+ doneWrapperFor = function(func, toWrap) {
+ if (func.length === 0) {
+ return function() {
+ return toWrap();
+ };
+ } else {
+ return function(done) {
+ return toWrap(done);
+ };
+ }
+ };
+ root.Then = function() {
+ return declareJasmineSpec(arguments);
+ };
+ root.Then.only = function() {
+ return declareJasmineSpec(arguments, it.only);
+ };
+ root.subsequentThen = function(additionalExpectation) {
+ mostRecentExpectations.push(additionalExpectation);
+ mostRecentStacks.push(errorWithRemovedLines("failed expectation", 3));
+ return this;
+ };
+ errorWithRemovedLines = function(msg, n) {
+ var error, lines, stack, _ref;
+ if (stack = new Error(msg).stack) {
+ _ref = stack.split("\n"), error = _ref[0], lines = 2 <= _ref.length ? __slice.call(_ref, 1) : [];
+ return "" + error + "\n" + (lines.slice(n).join("\n"));
+ }
+ };
+ mostRecentlyUsed = root.Given;
+ root.And = function() {
+ return mostRecentlyUsed.apply(this, jasmine.util.argsToArray(arguments));
+ };
+ o = function(thing) {
+ return {
+ isFunction: function() {
+ return Object.prototype.toString.call(thing) === "[object Function]";
+ },
+ isString: function() {
+ return Object.prototype.toString.call(thing) === "[object String]";
+ },
+ firstThat: function(test) {
+ var i;
+ i = 0;
+ while (i < thing.length) {
+ if (test(thing[i]) === true) {
+ return thing[i];
+ }
+ i++;
+ }
+ return void 0;
+ }
+ };
+ };
+ Waterfall = (function() {
+ function Waterfall(functions, finalCallback) {
+ if (functions == null) {
+ functions = [];
+ }
+ this.finalCallback = finalCallback != null ? finalCallback : function() {};
+ this.functions = cloneArray(functions);
+ }
+
+ Waterfall.prototype.flow = function() {
+ var func,
+ _this = this;
+ if (this.functions.length === 0) {
+ return this.finalCallback();
+ }
+ func = this.functions.shift();
+ if (func.length > 0) {
+ return func(function() {
+ return _this.flow();
+ });
+ } else {
+ func();
+ return this.flow();
+ }
+ };
+
+ return Waterfall;
+
+ })();
+ cloneArray = function(a) {
+ return a.slice(0);
+ };
+ jasmine._given = {
+ matchers: {
+ toHaveReturnedFalseFromThen: function(context, n, stackTrace, done) {
+ var e, exception, result;
+ result = false;
+ exception = void 0;
+ try {
+ result = this.actual.call(context, done);
+ } catch (_error) {
+ e = _error;
+ exception = e;
+ }
+ this.message = function() {
+ var msg, stringyExpectation;
+ stringyExpectation = stringifyExpectation(this.actual);
+ msg = "Then clause" + (n > 1 ? " #" + n : "") + " `" + stringyExpectation + "` failed by ";
+ if (exception) {
+ msg += "throwing: " + exception.toString();
+ } else {
+ msg += "returning false";
+ }
+ msg += additionalInsightsForErrorMessage(stringyExpectation);
+ if (stackTrace != null) {
+ msg += "\n\n" + stackTrace;
+ }
+ return msg;
+ };
+ return result === false;
+ }
+ },
+ __Waterfall__: Waterfall
+ };
+ stringifyExpectation = function(expectation) {
+ var matches;
+ matches = expectation.toString().replace(/\n/g, '').match(/function\s?\(.*\)\s?{\s*(return\s+)?(.*?)(;)?\s*}/i);
+ if (matches && matches.length >= 3) {
+ return matches[2].replace(/\s+/g, ' ');
+ } else {
+ return "";
+ }
+ };
+ additionalInsightsForErrorMessage = function(expectationString) {
+ var comparison, expectation;
+ expectation = finalStatementFrom(expectationString);
+ if (comparison = wasComparison(expectation)) {
+ return comparisonInsight(expectation, comparison);
+ } else {
+ return "";
+ }
+ };
+ finalStatementFrom = function(expectationString) {
+ var multiStatement;
+ if (multiStatement = expectationString.match(/.*return (.*)/)) {
+ return multiStatement[multiStatement.length - 1];
+ } else {
+ return expectationString;
+ }
+ };
+ wasComparison = function(expectation) {
+ var comparator, comparison, left, right, s;
+ if (comparison = expectation.match(/(.*) (===|!==|==|!=|>|>=|<|<=) (.*)/)) {
+ s = comparison[0], left = comparison[1], comparator = comparison[2], right = comparison[3];
+ return {
+ left: left,
+ comparator: comparator,
+ right: right
+ };
+ }
+ };
+ comparisonInsight = function(expectation, comparison) {
+ var left, msg, right;
+ left = evalInContextOfSpec(comparison.left);
+ right = evalInContextOfSpec(comparison.right);
+ if (apparentReferenceError(left) && apparentReferenceError(right)) {
+ return "";
+ }
+ msg = "\n\nThis comparison was detected:\n " + expectation + "\n " + left + " " + comparison.comparator + " " + right;
+ if (attemptedEquality(left, right, comparison.comparator)) {
+ msg += "\n\n" + (deepEqualsNotice(comparison.left, comparison.right));
+ }
+ return msg;
+ };
+ apparentReferenceError = function(result) {
+ return /^";
+ }
+ };
+ attemptedEquality = function(left, right, comparator) {
+ var _ref;
+ if (!(comparator === "==" || comparator === "===")) {
+ return false;
+ }
+ if (((_ref = jasmine.matchersUtil) != null ? _ref.equals : void 0) != null) {
+ return jasmine.matchersUtil.equals(left, right);
+ } else {
+ return jasmine.getEnv().equals_(left, right);
+ }
+ };
+ deepEqualsNotice = function(left, right) {
+ return "However, these items are deeply equal! Try an expectation like this instead:\n expect(" + left + ").toEqual(" + right + ")";
+ };
+ return beforeEach(function() {
+ if (jasmine.addMatchers != null) {
+ return jasmine.addMatchers(jasmine.matcherWrapper.wrap(jasmine._given.matchers));
+ } else {
+ return this.addMatchers(jasmine._given.matchers);
+ }
+ });
+ })(jasmine);
+
+}).call(this);
diff --git a/frontend/spec/helpers/jasmine-only.js b/frontend/spec/helpers/jasmine-only.js
new file mode 100644
index 0000000..c60fb0b
--- /dev/null
+++ b/frontend/spec/helpers/jasmine-only.js
@@ -0,0 +1,98 @@
+/* jasmine-only - 0.1.1
+ * Exclusivity spec helpers for jasmine: `describe.only` and `it.only`
+ * https://github.com/davemo/jasmine-only
+ */
+(function() {
+ var __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ (function(jasmine) {
+ var describeOnly, env, itOnly, root;
+ root = (1, eval)('this');
+ env = jasmine.getEnv();
+ describeOnly = function(description, specDefinitions) {
+ var suite;
+ suite = new jasmine.Suite(this, description, null, this.currentSuite);
+ suite.exclusive_ = 1;
+ this.exclusive_ = Math.max(this.exclusive_, 1);
+ return this.describe_(suite, specDefinitions);
+ };
+ itOnly = function(description, func) {
+ var spec;
+ spec = this.it(description, func);
+ spec.exclusive_ = 2;
+ this.exclusive_ = 2;
+ return spec;
+ };
+ env.exclusive_ = 0;
+ env.describe = function(description, specDefinitions) {
+ var suite;
+ suite = new jasmine.Suite(this, description, null, this.currentSuite);
+ return this.describe_(suite, specDefinitions);
+ };
+ env.describe_ = function(suite, specDefinitions) {
+ var declarationError, e, parentSuite;
+ parentSuite = this.currentSuite;
+ if (parentSuite) {
+ parentSuite.add(suite);
+ } else {
+ this.currentRunner_.add(suite);
+ }
+ this.currentSuite = suite;
+ declarationError = null;
+ try {
+ specDefinitions.call(suite);
+ } catch (_error) {
+ e = _error;
+ declarationError = e;
+ }
+ if (declarationError) {
+ this.it("encountered a declaration exception", function() {
+ throw declarationError;
+ });
+ }
+ this.currentSuite = parentSuite;
+ return suite;
+ };
+ env.specFilter = function(spec) {
+ return this.exclusive_ <= spec.exclusive_;
+ };
+ env.describe.only = function() {
+ return describeOnly.apply(env, arguments);
+ };
+ env.it.only = function() {
+ return itOnly.apply(env, arguments);
+ };
+ root.describe.only = function(description, specDefinitions) {
+ return env.describe.only(description, specDefinitions);
+ };
+ root.it.only = function(description, func) {
+ return env.it.only(description, func);
+ };
+ root.iit = root.it.only;
+ root.ddescribe = root.describe.only;
+ jasmine.Spec = (function(_super) {
+ __extends(Spec, _super);
+
+ function Spec(env, suite, description) {
+ this.exclusive_ = suite.exclusive_;
+ Spec.__super__.constructor.call(this, env, suite, description);
+ }
+
+ return Spec;
+
+ })(jasmine.Spec);
+ return jasmine.Suite = (function(_super) {
+ __extends(Suite, _super);
+
+ function Suite(env, suite, specDefinitions, parentSuite) {
+ this.exclusive_ = parentSuite && parentSuite.exclusive_ || 0;
+ Suite.__super__.constructor.call(this, env, suite, specDefinitions, parentSuite);
+ }
+
+ return Suite;
+
+ })(jasmine.Suite);
+ })(jasmine);
+
+}).call(this);
diff --git a/frontend/spec/helpers/jasmine-stealth.js b/frontend/spec/helpers/jasmine-stealth.js
new file mode 100644
index 0000000..774afc6
--- /dev/null
+++ b/frontend/spec/helpers/jasmine-stealth.js
@@ -0,0 +1,214 @@
+/* jasmine-stealth - 0.0.17
+ * Makes Jasmine spies a bit more robust
+ * https://github.com/searls/jasmine-stealth
+ */
+(function() {
+ var __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ (function() {
+ var Captor, fake, root, stubChainer, unfakes, whatToDoWhenTheSpyGetsCalled, _;
+ root = (1, eval)('this');
+ _ = function(obj) {
+ return {
+ each: function(iterator) {
+ var item, _i, _len, _results;
+ _results = [];
+ for (_i = 0, _len = obj.length; _i < _len; _i++) {
+ item = obj[_i];
+ _results.push(iterator(item));
+ }
+ return _results;
+ },
+ isFunction: function() {
+ return Object.prototype.toString.call(obj) === "[object Function]";
+ },
+ isString: function() {
+ return Object.prototype.toString.call(obj) === "[object String]";
+ }
+ };
+ };
+ root.spyOnConstructor = function(owner, classToFake, methodsToSpy) {
+ var fakeClass, spies;
+ if (methodsToSpy == null) {
+ methodsToSpy = [];
+ }
+ if (_(methodsToSpy).isString()) {
+ methodsToSpy = [methodsToSpy];
+ }
+ spies = {
+ constructor: jasmine.createSpy("" + classToFake + "'s constructor")
+ };
+ fakeClass = (function() {
+ function _Class() {
+ spies.constructor.apply(this, arguments);
+ }
+
+ return _Class;
+
+ })();
+ _(methodsToSpy).each(function(methodName) {
+ spies[methodName] = jasmine.createSpy("" + classToFake + "#" + methodName);
+ return fakeClass.prototype[methodName] = function() {
+ return spies[methodName].apply(this, arguments);
+ };
+ });
+ fake(owner, classToFake, fakeClass);
+ return spies;
+ };
+ unfakes = [];
+ afterEach(function() {
+ _(unfakes).each(function(u) {
+ return u();
+ });
+ return unfakes = [];
+ });
+ fake = function(owner, thingToFake, newThing) {
+ var originalThing;
+ originalThing = owner[thingToFake];
+ owner[thingToFake] = newThing;
+ return unfakes.push(function() {
+ return owner[thingToFake] = originalThing;
+ });
+ };
+ root.stubFor = root.spyOn;
+ jasmine.createStub = jasmine.createSpy;
+ jasmine.createStubObj = function(baseName, stubbings) {
+ var name, obj, stubbing;
+ if (stubbings.constructor === Array) {
+ return jasmine.createSpyObj(baseName, stubbings);
+ } else {
+ obj = {};
+ for (name in stubbings) {
+ stubbing = stubbings[name];
+ obj[name] = jasmine.createSpy(baseName + "." + name);
+ if (_(stubbing).isFunction()) {
+ obj[name].andCallFake(stubbing);
+ } else {
+ obj[name].andReturn(stubbing);
+ }
+ }
+ return obj;
+ }
+ };
+ whatToDoWhenTheSpyGetsCalled = function(spy) {
+ var matchesStub, priorPlan;
+ matchesStub = function(stubbing, args, context) {
+ switch (stubbing.type) {
+ case "args":
+ return jasmine.getEnv().equals_(stubbing.ifThis, jasmine.util.argsToArray(args));
+ case "context":
+ return jasmine.getEnv().equals_(stubbing.ifThis, context);
+ }
+ };
+ priorPlan = spy.plan;
+ return spy.andCallFake(function() {
+ var i, stubbing;
+ i = 0;
+ while (i < spy._stealth_stubbings.length) {
+ stubbing = spy._stealth_stubbings[i];
+ if (matchesStub(stubbing, arguments, this)) {
+ if (stubbing.satisfaction === "callFake") {
+ return stubbing.thenThat.apply(stubbing, arguments);
+ } else {
+ return stubbing.thenThat;
+ }
+ }
+ i++;
+ }
+ return priorPlan.apply(spy, arguments);
+ });
+ };
+ jasmine.Spy.prototype.whenContext = function(context) {
+ var spy;
+ spy = this;
+ spy._stealth_stubbings || (spy._stealth_stubbings = []);
+ whatToDoWhenTheSpyGetsCalled(spy);
+ return stubChainer(spy, "context", context);
+ };
+ jasmine.Spy.prototype.when = function() {
+ var ifThis, spy;
+ spy = this;
+ ifThis = jasmine.util.argsToArray(arguments);
+ spy._stealth_stubbings || (spy._stealth_stubbings = []);
+ whatToDoWhenTheSpyGetsCalled(spy);
+ return stubChainer(spy, "args", ifThis);
+ };
+ stubChainer = function(spy, type, ifThis) {
+ var addStubbing;
+ addStubbing = function(satisfaction) {
+ return function(thenThat) {
+ spy._stealth_stubbings.unshift({
+ type: type,
+ ifThis: ifThis,
+ satisfaction: satisfaction,
+ thenThat: thenThat
+ });
+ return spy;
+ };
+ };
+ return {
+ thenReturn: addStubbing("return"),
+ thenCallFake: addStubbing("callFake")
+ };
+ };
+ jasmine.Spy.prototype.mostRecentCallThat = function(callThat, context) {
+ var i;
+ i = this.calls.length - 1;
+ while (i >= 0) {
+ if (callThat.call(context || this, this.calls[i]) === true) {
+ return this.calls[i];
+ }
+ i--;
+ }
+ };
+ jasmine.Matchers.ArgThat = (function(_super) {
+ __extends(ArgThat, _super);
+
+ function ArgThat(matcher) {
+ this.matcher = matcher;
+ }
+
+ ArgThat.prototype.jasmineMatches = function(actual) {
+ return this.matcher(actual);
+ };
+
+ return ArgThat;
+
+ })(jasmine.Matchers.Any);
+ jasmine.Matchers.ArgThat.prototype.matches = jasmine.Matchers.ArgThat.prototype.jasmineMatches;
+ jasmine.argThat = function(expected) {
+ return new jasmine.Matchers.ArgThat(expected);
+ };
+ jasmine.Matchers.Capture = (function(_super) {
+ __extends(Capture, _super);
+
+ function Capture(captor) {
+ this.captor = captor;
+ }
+
+ Capture.prototype.jasmineMatches = function(actual) {
+ this.captor.value = actual;
+ return true;
+ };
+
+ return Capture;
+
+ })(jasmine.Matchers.Any);
+ jasmine.Matchers.Capture.prototype.matches = jasmine.Matchers.Capture.prototype.jasmineMatches;
+ Captor = (function() {
+ function Captor() {}
+
+ Captor.prototype.capture = function() {
+ return new jasmine.Matchers.Capture(this);
+ };
+
+ return Captor;
+
+ })();
+ return jasmine.captor = function() {
+ return new Captor();
+ };
+ })();
+
+}).call(this);
diff --git a/frontend/tasks/.keep b/frontend/tasks/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/vendor/css/.keep b/frontend/vendor/css/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/vendor/img/.keep b/frontend/vendor/img/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/frontend/vendor/js/underscore.js b/frontend/vendor/js/underscore.js
new file mode 100644
index 0000000..9a4cabe
--- /dev/null
+++ b/frontend/vendor/js/underscore.js
@@ -0,0 +1,1343 @@
+// Underscore.js 1.6.0
+// http://underscorejs.org
+// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+// Underscore may be freely distributed under the MIT license.
+
+(function() {
+
+ // Baseline setup
+ // --------------
+
+ // Establish the root object, `window` in the browser, or `exports` on the server.
+ var root = this;
+
+ // Save the previous value of the `_` variable.
+ var previousUnderscore = root._;
+
+ // Establish the object that gets returned to break out of a loop iteration.
+ var breaker = {};
+
+ // Save bytes in the minified (but not gzipped) version:
+ var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
+
+ // Create quick reference variables for speed access to core prototypes.
+ var
+ push = ArrayProto.push,
+ slice = ArrayProto.slice,
+ concat = ArrayProto.concat,
+ toString = ObjProto.toString,
+ hasOwnProperty = ObjProto.hasOwnProperty;
+
+ // All **ECMAScript 5** native function implementations that we hope to use
+ // are declared here.
+ var
+ nativeForEach = ArrayProto.forEach,
+ nativeMap = ArrayProto.map,
+ nativeReduce = ArrayProto.reduce,
+ nativeReduceRight = ArrayProto.reduceRight,
+ nativeFilter = ArrayProto.filter,
+ nativeEvery = ArrayProto.every,
+ nativeSome = ArrayProto.some,
+ nativeIndexOf = ArrayProto.indexOf,
+ nativeLastIndexOf = ArrayProto.lastIndexOf,
+ nativeIsArray = Array.isArray,
+ nativeKeys = Object.keys,
+ nativeBind = FuncProto.bind;
+
+ // Create a safe reference to the Underscore object for use below.
+ var _ = function(obj) {
+ if (obj instanceof _) return obj;
+ if (!(this instanceof _)) return new _(obj);
+ this._wrapped = obj;
+ };
+
+ // Export the Underscore object for **Node.js**, with
+ // backwards-compatibility for the old `require()` API. If we're in
+ // the browser, add `_` as a global object via a string identifier,
+ // for Closure Compiler "advanced" mode.
+ if (typeof exports !== 'undefined') {
+ if (typeof module !== 'undefined' && module.exports) {
+ exports = module.exports = _;
+ }
+ exports._ = _;
+ } else {
+ root._ = _;
+ }
+
+ // Current version.
+ _.VERSION = '1.6.0';
+
+ // Collection Functions
+ // --------------------
+
+ // The cornerstone, an `each` implementation, aka `forEach`.
+ // Handles objects with the built-in `forEach`, arrays, and raw objects.
+ // Delegates to **ECMAScript 5**'s native `forEach` if available.
+ var each = _.each = _.forEach = function(obj, iterator, context) {
+ if (obj == null) return obj;
+ if (nativeForEach && obj.forEach === nativeForEach) {
+ obj.forEach(iterator, context);
+ } else if (obj.length === +obj.length) {
+ for (var i = 0, length = obj.length; i < length; i++) {
+ if (iterator.call(context, obj[i], i, obj) === breaker) return;
+ }
+ } else {
+ var keys = _.keys(obj);
+ for (var i = 0, length = keys.length; i < length; i++) {
+ if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
+ }
+ }
+ return obj;
+ };
+
+ // Return the results of applying the iterator to each element.
+ // Delegates to **ECMAScript 5**'s native `map` if available.
+ _.map = _.collect = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
+ each(obj, function(value, index, list) {
+ results.push(iterator.call(context, value, index, list));
+ });
+ return results;
+ };
+
+ var reduceError = 'Reduce of empty array with no initial value';
+
+ // **Reduce** builds up a single result from a list of values, aka `inject`,
+ // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
+ _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
+ var initial = arguments.length > 2;
+ if (obj == null) obj = [];
+ if (nativeReduce && obj.reduce === nativeReduce) {
+ if (context) iterator = _.bind(iterator, context);
+ return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
+ }
+ each(obj, function(value, index, list) {
+ if (!initial) {
+ memo = value;
+ initial = true;
+ } else {
+ memo = iterator.call(context, memo, value, index, list);
+ }
+ });
+ if (!initial) throw new TypeError(reduceError);
+ return memo;
+ };
+
+ // The right-associative version of reduce, also known as `foldr`.
+ // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
+ _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
+ var initial = arguments.length > 2;
+ if (obj == null) obj = [];
+ if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
+ if (context) iterator = _.bind(iterator, context);
+ return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
+ }
+ var length = obj.length;
+ if (length !== +length) {
+ var keys = _.keys(obj);
+ length = keys.length;
+ }
+ each(obj, function(value, index, list) {
+ index = keys ? keys[--length] : --length;
+ if (!initial) {
+ memo = obj[index];
+ initial = true;
+ } else {
+ memo = iterator.call(context, memo, obj[index], index, list);
+ }
+ });
+ if (!initial) throw new TypeError(reduceError);
+ return memo;
+ };
+
+ // Return the first value which passes a truth test. Aliased as `detect`.
+ _.find = _.detect = function(obj, predicate, context) {
+ var result;
+ any(obj, function(value, index, list) {
+ if (predicate.call(context, value, index, list)) {
+ result = value;
+ return true;
+ }
+ });
+ return result;
+ };
+
+ // Return all the elements that pass a truth test.
+ // Delegates to **ECMAScript 5**'s native `filter` if available.
+ // Aliased as `select`.
+ _.filter = _.select = function(obj, predicate, context) {
+ var results = [];
+ if (obj == null) return results;
+ if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context);
+ each(obj, function(value, index, list) {
+ if (predicate.call(context, value, index, list)) results.push(value);
+ });
+ return results;
+ };
+
+ // Return all the elements for which a truth test fails.
+ _.reject = function(obj, predicate, context) {
+ return _.filter(obj, function(value, index, list) {
+ return !predicate.call(context, value, index, list);
+ }, context);
+ };
+
+ // Determine whether all of the elements match a truth test.
+ // Delegates to **ECMAScript 5**'s native `every` if available.
+ // Aliased as `all`.
+ _.every = _.all = function(obj, predicate, context) {
+ predicate || (predicate = _.identity);
+ var result = true;
+ if (obj == null) return result;
+ if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context);
+ each(obj, function(value, index, list) {
+ if (!(result = result && predicate.call(context, value, index, list))) return breaker;
+ });
+ return !!result;
+ };
+
+ // Determine if at least one element in the object matches a truth test.
+ // Delegates to **ECMAScript 5**'s native `some` if available.
+ // Aliased as `any`.
+ var any = _.some = _.any = function(obj, predicate, context) {
+ predicate || (predicate = _.identity);
+ var result = false;
+ if (obj == null) return result;
+ if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context);
+ each(obj, function(value, index, list) {
+ if (result || (result = predicate.call(context, value, index, list))) return breaker;
+ });
+ return !!result;
+ };
+
+ // Determine if the array or object contains a given value (using `===`).
+ // Aliased as `include`.
+ _.contains = _.include = function(obj, target) {
+ if (obj == null) return false;
+ if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
+ return any(obj, function(value) {
+ return value === target;
+ });
+ };
+
+ // Invoke a method (with arguments) on every item in a collection.
+ _.invoke = function(obj, method) {
+ var args = slice.call(arguments, 2);
+ var isFunc = _.isFunction(method);
+ return _.map(obj, function(value) {
+ return (isFunc ? method : value[method]).apply(value, args);
+ });
+ };
+
+ // Convenience version of a common use case of `map`: fetching a property.
+ _.pluck = function(obj, key) {
+ return _.map(obj, _.property(key));
+ };
+
+ // Convenience version of a common use case of `filter`: selecting only objects
+ // containing specific `key:value` pairs.
+ _.where = function(obj, attrs) {
+ return _.filter(obj, _.matches(attrs));
+ };
+
+ // Convenience version of a common use case of `find`: getting the first object
+ // containing specific `key:value` pairs.
+ _.findWhere = function(obj, attrs) {
+ return _.find(obj, _.matches(attrs));
+ };
+
+ // Return the maximum element or (element-based computation).
+ // Can't optimize arrays of integers longer than 65,535 elements.
+ // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
+ _.max = function(obj, iterator, context) {
+ if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
+ return Math.max.apply(Math, obj);
+ }
+ var result = -Infinity, lastComputed = -Infinity;
+ each(obj, function(value, index, list) {
+ var computed = iterator ? iterator.call(context, value, index, list) : value;
+ if (computed > lastComputed) {
+ result = value;
+ lastComputed = computed;
+ }
+ });
+ return result;
+ };
+
+ // Return the minimum element (or element-based computation).
+ _.min = function(obj, iterator, context) {
+ if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
+ return Math.min.apply(Math, obj);
+ }
+ var result = Infinity, lastComputed = Infinity;
+ each(obj, function(value, index, list) {
+ var computed = iterator ? iterator.call(context, value, index, list) : value;
+ if (computed < lastComputed) {
+ result = value;
+ lastComputed = computed;
+ }
+ });
+ return result;
+ };
+
+ // Shuffle an array, using the modern version of the
+ // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
+ _.shuffle = function(obj) {
+ var rand;
+ var index = 0;
+ var shuffled = [];
+ each(obj, function(value) {
+ rand = _.random(index++);
+ shuffled[index - 1] = shuffled[rand];
+ shuffled[rand] = value;
+ });
+ return shuffled;
+ };
+
+ // Sample **n** random values from a collection.
+ // If **n** is not specified, returns a single random element.
+ // The internal `guard` argument allows it to work with `map`.
+ _.sample = function(obj, n, guard) {
+ if (n == null || guard) {
+ if (obj.length !== +obj.length) obj = _.values(obj);
+ return obj[_.random(obj.length - 1)];
+ }
+ return _.shuffle(obj).slice(0, Math.max(0, n));
+ };
+
+ // An internal function to generate lookup iterators.
+ var lookupIterator = function(value) {
+ if (value == null) return _.identity;
+ if (_.isFunction(value)) return value;
+ return _.property(value);
+ };
+
+ // Sort the object's values by a criterion produced by an iterator.
+ _.sortBy = function(obj, iterator, context) {
+ iterator = lookupIterator(iterator);
+ return _.pluck(_.map(obj, function(value, index, list) {
+ return {
+ value: value,
+ index: index,
+ criteria: iterator.call(context, value, index, list)
+ };
+ }).sort(function(left, right) {
+ var a = left.criteria;
+ var b = right.criteria;
+ if (a !== b) {
+ if (a > b || a === void 0) return 1;
+ if (a < b || b === void 0) return -1;
+ }
+ return left.index - right.index;
+ }), 'value');
+ };
+
+ // An internal function used for aggregate "group by" operations.
+ var group = function(behavior) {
+ return function(obj, iterator, context) {
+ var result = {};
+ iterator = lookupIterator(iterator);
+ each(obj, function(value, index) {
+ var key = iterator.call(context, value, index, obj);
+ behavior(result, key, value);
+ });
+ return result;
+ };
+ };
+
+ // Groups the object's values by a criterion. Pass either a string attribute
+ // to group by, or a function that returns the criterion.
+ _.groupBy = group(function(result, key, value) {
+ _.has(result, key) ? result[key].push(value) : result[key] = [value];
+ });
+
+ // Indexes the object's values by a criterion, similar to `groupBy`, but for
+ // when you know that your index values will be unique.
+ _.indexBy = group(function(result, key, value) {
+ result[key] = value;
+ });
+
+ // Counts instances of an object that group by a certain criterion. Pass
+ // either a string attribute to count by, or a function that returns the
+ // criterion.
+ _.countBy = group(function(result, key) {
+ _.has(result, key) ? result[key]++ : result[key] = 1;
+ });
+
+ // Use a comparator function to figure out the smallest index at which
+ // an object should be inserted so as to maintain order. Uses binary search.
+ _.sortedIndex = function(array, obj, iterator, context) {
+ iterator = lookupIterator(iterator);
+ var value = iterator.call(context, obj);
+ var low = 0, high = array.length;
+ while (low < high) {
+ var mid = (low + high) >>> 1;
+ iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
+ }
+ return low;
+ };
+
+ // Safely create a real, live array from anything iterable.
+ _.toArray = function(obj) {
+ if (!obj) return [];
+ if (_.isArray(obj)) return slice.call(obj);
+ if (obj.length === +obj.length) return _.map(obj, _.identity);
+ return _.values(obj);
+ };
+
+ // Return the number of elements in an object.
+ _.size = function(obj) {
+ if (obj == null) return 0;
+ return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
+ };
+
+ // Array Functions
+ // ---------------
+
+ // Get the first element of an array. Passing **n** will return the first N
+ // values in the array. Aliased as `head` and `take`. The **guard** check
+ // allows it to work with `_.map`.
+ _.first = _.head = _.take = function(array, n, guard) {
+ if (array == null) return void 0;
+ if ((n == null) || guard) return array[0];
+ if (n < 0) return [];
+ return slice.call(array, 0, n);
+ };
+
+ // Returns everything but the last entry of the array. Especially useful on
+ // the arguments object. Passing **n** will return all the values in
+ // the array, excluding the last N. The **guard** check allows it to work with
+ // `_.map`.
+ _.initial = function(array, n, guard) {
+ return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
+ };
+
+ // Get the last element of an array. Passing **n** will return the last N
+ // values in the array. The **guard** check allows it to work with `_.map`.
+ _.last = function(array, n, guard) {
+ if (array == null) return void 0;
+ if ((n == null) || guard) return array[array.length - 1];
+ return slice.call(array, Math.max(array.length - n, 0));
+ };
+
+ // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
+ // Especially useful on the arguments object. Passing an **n** will return
+ // the rest N values in the array. The **guard**
+ // check allows it to work with `_.map`.
+ _.rest = _.tail = _.drop = function(array, n, guard) {
+ return slice.call(array, (n == null) || guard ? 1 : n);
+ };
+
+ // Trim out all falsy values from an array.
+ _.compact = function(array) {
+ return _.filter(array, _.identity);
+ };
+
+ // Internal implementation of a recursive `flatten` function.
+ var flatten = function(input, shallow, output) {
+ if (shallow && _.every(input, _.isArray)) {
+ return concat.apply(output, input);
+ }
+ each(input, function(value) {
+ if (_.isArray(value) || _.isArguments(value)) {
+ shallow ? push.apply(output, value) : flatten(value, shallow, output);
+ } else {
+ output.push(value);
+ }
+ });
+ return output;
+ };
+
+ // Flatten out an array, either recursively (by default), or just one level.
+ _.flatten = function(array, shallow) {
+ return flatten(array, shallow, []);
+ };
+
+ // Return a version of the array that does not contain the specified value(s).
+ _.without = function(array) {
+ return _.difference(array, slice.call(arguments, 1));
+ };
+
+ // Split an array into two arrays: one whose elements all satisfy the given
+ // predicate, and one whose elements all do not satisfy the predicate.
+ _.partition = function(array, predicate) {
+ var pass = [], fail = [];
+ each(array, function(elem) {
+ (predicate(elem) ? pass : fail).push(elem);
+ });
+ return [pass, fail];
+ };
+
+ // Produce a duplicate-free version of the array. If the array has already
+ // been sorted, you have the option of using a faster algorithm.
+ // Aliased as `unique`.
+ _.uniq = _.unique = function(array, isSorted, iterator, context) {
+ if (_.isFunction(isSorted)) {
+ context = iterator;
+ iterator = isSorted;
+ isSorted = false;
+ }
+ var initial = iterator ? _.map(array, iterator, context) : array;
+ var results = [];
+ var seen = [];
+ each(initial, function(value, index) {
+ if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
+ seen.push(value);
+ results.push(array[index]);
+ }
+ });
+ return results;
+ };
+
+ // Produce an array that contains the union: each distinct element from all of
+ // the passed-in arrays.
+ _.union = function() {
+ return _.uniq(_.flatten(arguments, true));
+ };
+
+ // Produce an array that contains every item shared between all the
+ // passed-in arrays.
+ _.intersection = function(array) {
+ var rest = slice.call(arguments, 1);
+ return _.filter(_.uniq(array), function(item) {
+ return _.every(rest, function(other) {
+ return _.contains(other, item);
+ });
+ });
+ };
+
+ // Take the difference between one array and a number of other arrays.
+ // Only the elements present in just the first array will remain.
+ _.difference = function(array) {
+ var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
+ return _.filter(array, function(value){ return !_.contains(rest, value); });
+ };
+
+ // Zip together multiple lists into a single array -- elements that share
+ // an index go together.
+ _.zip = function() {
+ var length = _.max(_.pluck(arguments, 'length').concat(0));
+ var results = new Array(length);
+ for (var i = 0; i < length; i++) {
+ results[i] = _.pluck(arguments, '' + i);
+ }
+ return results;
+ };
+
+ // Converts lists into objects. Pass either a single array of `[key, value]`
+ // pairs, or two parallel arrays of the same length -- one of keys, and one of
+ // the corresponding values.
+ _.object = function(list, values) {
+ if (list == null) return {};
+ var result = {};
+ for (var i = 0, length = list.length; i < length; i++) {
+ if (values) {
+ result[list[i]] = values[i];
+ } else {
+ result[list[i][0]] = list[i][1];
+ }
+ }
+ return result;
+ };
+
+ // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
+ // we need this function. Return the position of the first occurrence of an
+ // item in an array, or -1 if the item is not included in the array.
+ // Delegates to **ECMAScript 5**'s native `indexOf` if available.
+ // If the array is large and already in sort order, pass `true`
+ // for **isSorted** to use binary search.
+ _.indexOf = function(array, item, isSorted) {
+ if (array == null) return -1;
+ var i = 0, length = array.length;
+ if (isSorted) {
+ if (typeof isSorted == 'number') {
+ i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
+ } else {
+ i = _.sortedIndex(array, item);
+ return array[i] === item ? i : -1;
+ }
+ }
+ if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
+ for (; i < length; i++) if (array[i] === item) return i;
+ return -1;
+ };
+
+ // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
+ _.lastIndexOf = function(array, item, from) {
+ if (array == null) return -1;
+ var hasIndex = from != null;
+ if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
+ return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
+ }
+ var i = (hasIndex ? from : array.length);
+ while (i--) if (array[i] === item) return i;
+ return -1;
+ };
+
+ // Generate an integer Array containing an arithmetic progression. A port of
+ // the native Python `range()` function. See
+ // [the Python documentation](http://docs.python.org/library/functions.html#range).
+ _.range = function(start, stop, step) {
+ if (arguments.length <= 1) {
+ stop = start || 0;
+ start = 0;
+ }
+ step = arguments[2] || 1;
+
+ var length = Math.max(Math.ceil((stop - start) / step), 0);
+ var idx = 0;
+ var range = new Array(length);
+
+ while(idx < length) {
+ range[idx++] = start;
+ start += step;
+ }
+
+ return range;
+ };
+
+ // Function (ahem) Functions
+ // ------------------
+
+ // Reusable constructor function for prototype setting.
+ var ctor = function(){};
+
+ // Create a function bound to a given object (assigning `this`, and arguments,
+ // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
+ // available.
+ _.bind = function(func, context) {
+ var args, bound;
+ if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
+ if (!_.isFunction(func)) throw new TypeError;
+ args = slice.call(arguments, 2);
+ return bound = function() {
+ if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
+ ctor.prototype = func.prototype;
+ var self = new ctor;
+ ctor.prototype = null;
+ var result = func.apply(self, args.concat(slice.call(arguments)));
+ if (Object(result) === result) return result;
+ return self;
+ };
+ };
+
+ // Partially apply a function by creating a version that has had some of its
+ // arguments pre-filled, without changing its dynamic `this` context. _ acts
+ // as a placeholder, allowing any combination of arguments to be pre-filled.
+ _.partial = function(func) {
+ var boundArgs = slice.call(arguments, 1);
+ return function() {
+ var position = 0;
+ var args = boundArgs.slice();
+ for (var i = 0, length = args.length; i < length; i++) {
+ if (args[i] === _) args[i] = arguments[position++];
+ }
+ while (position < arguments.length) args.push(arguments[position++]);
+ return func.apply(this, args);
+ };
+ };
+
+ // Bind a number of an object's methods to that object. Remaining arguments
+ // are the method names to be bound. Useful for ensuring that all callbacks
+ // defined on an object belong to it.
+ _.bindAll = function(obj) {
+ var funcs = slice.call(arguments, 1);
+ if (funcs.length === 0) throw new Error('bindAll must be passed function names');
+ each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
+ return obj;
+ };
+
+ // Memoize an expensive function by storing its results.
+ _.memoize = function(func, hasher) {
+ var memo = {};
+ hasher || (hasher = _.identity);
+ return function() {
+ var key = hasher.apply(this, arguments);
+ return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
+ };
+ };
+
+ // Delays a function for the given number of milliseconds, and then calls
+ // it with the arguments supplied.
+ _.delay = function(func, wait) {
+ var args = slice.call(arguments, 2);
+ return setTimeout(function(){ return func.apply(null, args); }, wait);
+ };
+
+ // Defers a function, scheduling it to run after the current call stack has
+ // cleared.
+ _.defer = function(func) {
+ return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
+ };
+
+ // Returns a function, that, when invoked, will only be triggered at most once
+ // during a given window of time. Normally, the throttled function will run
+ // as much as it can, without ever going more than once per `wait` duration;
+ // but if you'd like to disable the execution on the leading edge, pass
+ // `{leading: false}`. To disable execution on the trailing edge, ditto.
+ _.throttle = function(func, wait, options) {
+ var context, args, result;
+ var timeout = null;
+ var previous = 0;
+ options || (options = {});
+ var later = function() {
+ previous = options.leading === false ? 0 : _.now();
+ timeout = null;
+ result = func.apply(context, args);
+ context = args = null;
+ };
+ return function() {
+ var now = _.now();
+ if (!previous && options.leading === false) previous = now;
+ var remaining = wait - (now - previous);
+ context = this;
+ args = arguments;
+ if (remaining <= 0) {
+ clearTimeout(timeout);
+ timeout = null;
+ previous = now;
+ result = func.apply(context, args);
+ context = args = null;
+ } else if (!timeout && options.trailing !== false) {
+ timeout = setTimeout(later, remaining);
+ }
+ return result;
+ };
+ };
+
+ // Returns a function, that, as long as it continues to be invoked, will not
+ // be triggered. The function will be called after it stops being called for
+ // N milliseconds. If `immediate` is passed, trigger the function on the
+ // leading edge, instead of the trailing.
+ _.debounce = function(func, wait, immediate) {
+ var timeout, args, context, timestamp, result;
+
+ var later = function() {
+ var last = _.now() - timestamp;
+ if (last < wait) {
+ timeout = setTimeout(later, wait - last);
+ } else {
+ timeout = null;
+ if (!immediate) {
+ result = func.apply(context, args);
+ context = args = null;
+ }
+ }
+ };
+
+ return function() {
+ context = this;
+ args = arguments;
+ timestamp = _.now();
+ var callNow = immediate && !timeout;
+ if (!timeout) {
+ timeout = setTimeout(later, wait);
+ }
+ if (callNow) {
+ result = func.apply(context, args);
+ context = args = null;
+ }
+
+ return result;
+ };
+ };
+
+ // Returns a function that will be executed at most one time, no matter how
+ // often you call it. Useful for lazy initialization.
+ _.once = function(func) {
+ var ran = false, memo;
+ return function() {
+ if (ran) return memo;
+ ran = true;
+ memo = func.apply(this, arguments);
+ func = null;
+ return memo;
+ };
+ };
+
+ // Returns the first function passed as an argument to the second,
+ // allowing you to adjust arguments, run code before and after, and
+ // conditionally execute the original function.
+ _.wrap = function(func, wrapper) {
+ return _.partial(wrapper, func);
+ };
+
+ // Returns a function that is the composition of a list of functions, each
+ // consuming the return value of the function that follows.
+ _.compose = function() {
+ var funcs = arguments;
+ return function() {
+ var args = arguments;
+ for (var i = funcs.length - 1; i >= 0; i--) {
+ args = [funcs[i].apply(this, args)];
+ }
+ return args[0];
+ };
+ };
+
+ // Returns a function that will only be executed after being called N times.
+ _.after = function(times, func) {
+ return function() {
+ if (--times < 1) {
+ return func.apply(this, arguments);
+ }
+ };
+ };
+
+ // Object Functions
+ // ----------------
+
+ // Retrieve the names of an object's properties.
+ // Delegates to **ECMAScript 5**'s native `Object.keys`
+ _.keys = function(obj) {
+ if (!_.isObject(obj)) return [];
+ if (nativeKeys) return nativeKeys(obj);
+ var keys = [];
+ for (var key in obj) if (_.has(obj, key)) keys.push(key);
+ return keys;
+ };
+
+ // Retrieve the values of an object's properties.
+ _.values = function(obj) {
+ var keys = _.keys(obj);
+ var length = keys.length;
+ var values = new Array(length);
+ for (var i = 0; i < length; i++) {
+ values[i] = obj[keys[i]];
+ }
+ return values;
+ };
+
+ // Convert an object into a list of `[key, value]` pairs.
+ _.pairs = function(obj) {
+ var keys = _.keys(obj);
+ var length = keys.length;
+ var pairs = new Array(length);
+ for (var i = 0; i < length; i++) {
+ pairs[i] = [keys[i], obj[keys[i]]];
+ }
+ return pairs;
+ };
+
+ // Invert the keys and values of an object. The values must be serializable.
+ _.invert = function(obj) {
+ var result = {};
+ var keys = _.keys(obj);
+ for (var i = 0, length = keys.length; i < length; i++) {
+ result[obj[keys[i]]] = keys[i];
+ }
+ return result;
+ };
+
+ // Return a sorted list of the function names available on the object.
+ // Aliased as `methods`
+ _.functions = _.methods = function(obj) {
+ var names = [];
+ for (var key in obj) {
+ if (_.isFunction(obj[key])) names.push(key);
+ }
+ return names.sort();
+ };
+
+ // Extend a given object with all the properties in passed-in object(s).
+ _.extend = function(obj) {
+ each(slice.call(arguments, 1), function(source) {
+ if (source) {
+ for (var prop in source) {
+ obj[prop] = source[prop];
+ }
+ }
+ });
+ return obj;
+ };
+
+ // Return a copy of the object only containing the whitelisted properties.
+ _.pick = function(obj) {
+ var copy = {};
+ var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
+ each(keys, function(key) {
+ if (key in obj) copy[key] = obj[key];
+ });
+ return copy;
+ };
+
+ // Return a copy of the object without the blacklisted properties.
+ _.omit = function(obj) {
+ var copy = {};
+ var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
+ for (var key in obj) {
+ if (!_.contains(keys, key)) copy[key] = obj[key];
+ }
+ return copy;
+ };
+
+ // Fill in a given object with default properties.
+ _.defaults = function(obj) {
+ each(slice.call(arguments, 1), function(source) {
+ if (source) {
+ for (var prop in source) {
+ if (obj[prop] === void 0) obj[prop] = source[prop];
+ }
+ }
+ });
+ return obj;
+ };
+
+ // Create a (shallow-cloned) duplicate of an object.
+ _.clone = function(obj) {
+ if (!_.isObject(obj)) return obj;
+ return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
+ };
+
+ // Invokes interceptor with the obj, and then returns obj.
+ // The primary purpose of this method is to "tap into" a method chain, in
+ // order to perform operations on intermediate results within the chain.
+ _.tap = function(obj, interceptor) {
+ interceptor(obj);
+ return obj;
+ };
+
+ // Internal recursive comparison function for `isEqual`.
+ var eq = function(a, b, aStack, bStack) {
+ // Identical objects are equal. `0 === -0`, but they aren't identical.
+ // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
+ if (a === b) return a !== 0 || 1 / a == 1 / b;
+ // A strict comparison is necessary because `null == undefined`.
+ if (a == null || b == null) return a === b;
+ // Unwrap any wrapped objects.
+ if (a instanceof _) a = a._wrapped;
+ if (b instanceof _) b = b._wrapped;
+ // Compare `[[Class]]` names.
+ var className = toString.call(a);
+ if (className != toString.call(b)) return false;
+ switch (className) {
+ // Strings, numbers, dates, and booleans are compared by value.
+ case '[object String]':
+ // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+ // equivalent to `new String("5")`.
+ return a == String(b);
+ case '[object Number]':
+ // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
+ // other numeric values.
+ return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
+ case '[object Date]':
+ case '[object Boolean]':
+ // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+ // millisecond representations. Note that invalid dates with millisecond representations
+ // of `NaN` are not equivalent.
+ return +a == +b;
+ // RegExps are compared by their source patterns and flags.
+ case '[object RegExp]':
+ return a.source == b.source &&
+ a.global == b.global &&
+ a.multiline == b.multiline &&
+ a.ignoreCase == b.ignoreCase;
+ }
+ if (typeof a != 'object' || typeof b != 'object') return false;
+ // Assume equality for cyclic structures. The algorithm for detecting cyclic
+ // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+ var length = aStack.length;
+ while (length--) {
+ // Linear search. Performance is inversely proportional to the number of
+ // unique nested structures.
+ if (aStack[length] == a) return bStack[length] == b;
+ }
+ // Objects with different constructors are not equivalent, but `Object`s
+ // from different frames are.
+ var aCtor = a.constructor, bCtor = b.constructor;
+ if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
+ _.isFunction(bCtor) && (bCtor instanceof bCtor))
+ && ('constructor' in a && 'constructor' in b)) {
+ return false;
+ }
+ // Add the first object to the stack of traversed objects.
+ aStack.push(a);
+ bStack.push(b);
+ var size = 0, result = true;
+ // Recursively compare objects and arrays.
+ if (className == '[object Array]') {
+ // Compare array lengths to determine if a deep comparison is necessary.
+ size = a.length;
+ result = size == b.length;
+ if (result) {
+ // Deep compare the contents, ignoring non-numeric properties.
+ while (size--) {
+ if (!(result = eq(a[size], b[size], aStack, bStack))) break;
+ }
+ }
+ } else {
+ // Deep compare objects.
+ for (var key in a) {
+ if (_.has(a, key)) {
+ // Count the expected number of properties.
+ size++;
+ // Deep compare each member.
+ if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
+ }
+ }
+ // Ensure that both objects contain the same number of properties.
+ if (result) {
+ for (key in b) {
+ if (_.has(b, key) && !(size--)) break;
+ }
+ result = !size;
+ }
+ }
+ // Remove the first object from the stack of traversed objects.
+ aStack.pop();
+ bStack.pop();
+ return result;
+ };
+
+ // Perform a deep comparison to check if two objects are equal.
+ _.isEqual = function(a, b) {
+ return eq(a, b, [], []);
+ };
+
+ // Is a given array, string, or object empty?
+ // An "empty" object has no enumerable own-properties.
+ _.isEmpty = function(obj) {
+ if (obj == null) return true;
+ if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
+ for (var key in obj) if (_.has(obj, key)) return false;
+ return true;
+ };
+
+ // Is a given value a DOM element?
+ _.isElement = function(obj) {
+ return !!(obj && obj.nodeType === 1);
+ };
+
+ // Is a given value an array?
+ // Delegates to ECMA5's native Array.isArray
+ _.isArray = nativeIsArray || function(obj) {
+ return toString.call(obj) == '[object Array]';
+ };
+
+ // Is a given variable an object?
+ _.isObject = function(obj) {
+ return obj === Object(obj);
+ };
+
+ // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
+ each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
+ _['is' + name] = function(obj) {
+ return toString.call(obj) == '[object ' + name + ']';
+ };
+ });
+
+ // Define a fallback version of the method in browsers (ahem, IE), where
+ // there isn't any inspectable "Arguments" type.
+ if (!_.isArguments(arguments)) {
+ _.isArguments = function(obj) {
+ return !!(obj && _.has(obj, 'callee'));
+ };
+ }
+
+ // Optimize `isFunction` if appropriate.
+ if (typeof (/./) !== 'function') {
+ _.isFunction = function(obj) {
+ return typeof obj === 'function';
+ };
+ }
+
+ // Is a given object a finite number?
+ _.isFinite = function(obj) {
+ return isFinite(obj) && !isNaN(parseFloat(obj));
+ };
+
+ // Is the given value `NaN`? (NaN is the only number which does not equal itself).
+ _.isNaN = function(obj) {
+ return _.isNumber(obj) && obj != +obj;
+ };
+
+ // Is a given value a boolean?
+ _.isBoolean = function(obj) {
+ return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
+ };
+
+ // Is a given value equal to null?
+ _.isNull = function(obj) {
+ return obj === null;
+ };
+
+ // Is a given variable undefined?
+ _.isUndefined = function(obj) {
+ return obj === void 0;
+ };
+
+ // Shortcut function for checking if an object has a given property directly
+ // on itself (in other words, not on a prototype).
+ _.has = function(obj, key) {
+ return hasOwnProperty.call(obj, key);
+ };
+
+ // Utility Functions
+ // -----------------
+
+ // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
+ // previous owner. Returns a reference to the Underscore object.
+ _.noConflict = function() {
+ root._ = previousUnderscore;
+ return this;
+ };
+
+ // Keep the identity function around for default iterators.
+ _.identity = function(value) {
+ return value;
+ };
+
+ _.constant = function(value) {
+ return function () {
+ return value;
+ };
+ };
+
+ _.property = function(key) {
+ return function(obj) {
+ return obj[key];
+ };
+ };
+
+ // Returns a predicate for checking whether an object has a given set of `key:value` pairs.
+ _.matches = function(attrs) {
+ return function(obj) {
+ if (obj === attrs) return true; //avoid comparing an object to itself.
+ for (var key in attrs) {
+ if (attrs[key] !== obj[key])
+ return false;
+ }
+ return true;
+ }
+ };
+
+ // Run a function **n** times.
+ _.times = function(n, iterator, context) {
+ var accum = Array(Math.max(0, n));
+ for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
+ return accum;
+ };
+
+ // Return a random integer between min and max (inclusive).
+ _.random = function(min, max) {
+ if (max == null) {
+ max = min;
+ min = 0;
+ }
+ return min + Math.floor(Math.random() * (max - min + 1));
+ };
+
+ // A (possibly faster) way to get the current timestamp as an integer.
+ _.now = Date.now || function() { return new Date().getTime(); };
+
+ // List of HTML entities for escaping.
+ var entityMap = {
+ escape: {
+ '&': '&',
+ '<': '<',
+ '>': '>',
+ '"': '"',
+ "'": '''
+ }
+ };
+ entityMap.unescape = _.invert(entityMap.escape);
+
+ // Regexes containing the keys and values listed immediately above.
+ var entityRegexes = {
+ escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
+ unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
+ };
+
+ // Functions for escaping and unescaping strings to/from HTML interpolation.
+ _.each(['escape', 'unescape'], function(method) {
+ _[method] = function(string) {
+ if (string == null) return '';
+ return ('' + string).replace(entityRegexes[method], function(match) {
+ return entityMap[method][match];
+ });
+ };
+ });
+
+ // If the value of the named `property` is a function then invoke it with the
+ // `object` as context; otherwise, return it.
+ _.result = function(object, property) {
+ if (object == null) return void 0;
+ var value = object[property];
+ return _.isFunction(value) ? value.call(object) : value;
+ };
+
+ // Add your own custom functions to the Underscore object.
+ _.mixin = function(obj) {
+ each(_.functions(obj), function(name) {
+ var func = _[name] = obj[name];
+ _.prototype[name] = function() {
+ var args = [this._wrapped];
+ push.apply(args, arguments);
+ return result.call(this, func.apply(_, args));
+ };
+ });
+ };
+
+ // Generate a unique integer id (unique within the entire client session).
+ // Useful for temporary DOM ids.
+ var idCounter = 0;
+ _.uniqueId = function(prefix) {
+ var id = ++idCounter + '';
+ return prefix ? prefix + id : id;
+ };
+
+ // By default, Underscore uses ERB-style template delimiters, change the
+ // following template settings to use alternative delimiters.
+ _.templateSettings = {
+ evaluate : /<%([\s\S]+?)%>/g,
+ interpolate : /<%=([\s\S]+?)%>/g,
+ escape : /<%-([\s\S]+?)%>/g
+ };
+
+ // When customizing `templateSettings`, if you don't want to define an
+ // interpolation, evaluation or escaping regex, we need one that is
+ // guaranteed not to match.
+ var noMatch = /(.)^/;
+
+ // Certain characters need to be escaped so that they can be put into a
+ // string literal.
+ var escapes = {
+ "'": "'",
+ '\\': '\\',
+ '\r': 'r',
+ '\n': 'n',
+ '\t': 't',
+ '\u2028': 'u2028',
+ '\u2029': 'u2029'
+ };
+
+ var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
+
+ // JavaScript micro-templating, similar to John Resig's implementation.
+ // Underscore templating handles arbitrary delimiters, preserves whitespace,
+ // and correctly escapes quotes within interpolated code.
+ _.template = function(text, data, settings) {
+ var render;
+ settings = _.defaults({}, settings, _.templateSettings);
+
+ // Combine delimiters into one regular expression via alternation.
+ var matcher = new RegExp([
+ (settings.escape || noMatch).source,
+ (settings.interpolate || noMatch).source,
+ (settings.evaluate || noMatch).source
+ ].join('|') + '|$', 'g');
+
+ // Compile the template source, escaping string literals appropriately.
+ var index = 0;
+ var source = "__p+='";
+ text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
+ source += text.slice(index, offset)
+ .replace(escaper, function(match) { return '\\' + escapes[match]; });
+
+ if (escape) {
+ source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
+ }
+ if (interpolate) {
+ source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
+ }
+ if (evaluate) {
+ source += "';\n" + evaluate + "\n__p+='";
+ }
+ index = offset + match.length;
+ return match;
+ });
+ source += "';\n";
+
+ // If a variable is not specified, place data values in local scope.
+ if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
+
+ source = "var __t,__p='',__j=Array.prototype.join," +
+ "print=function(){__p+=__j.call(arguments,'');};\n" +
+ source + "return __p;\n";
+
+ try {
+ render = new Function(settings.variable || 'obj', '_', source);
+ } catch (e) {
+ e.source = source;
+ throw e;
+ }
+
+ if (data) return render(data, _);
+ var template = function(data) {
+ return render.call(this, data, _);
+ };
+
+ // Provide the compiled function source as a convenience for precompilation.
+ template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
+
+ return template;
+ };
+
+ // Add a "chain" function, which will delegate to the wrapper.
+ _.chain = function(obj) {
+ return _(obj).chain();
+ };
+
+ // OOP
+ // ---------------
+ // If Underscore is called as a function, it returns a wrapped object that
+ // can be used OO-style. This wrapper holds altered versions of all the
+ // underscore functions. Wrapped objects may be chained.
+
+ // Helper function to continue chaining intermediate results.
+ var result = function(obj) {
+ return this._chain ? _(obj).chain() : obj;
+ };
+
+ // Add all of the Underscore functions to the wrapper object.
+ _.mixin(_);
+
+ // Add all mutator Array functions to the wrapper.
+ each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
+ var method = ArrayProto[name];
+ _.prototype[name] = function() {
+ var obj = this._wrapped;
+ method.apply(obj, arguments);
+ if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
+ return result.call(this, obj);
+ };
+ });
+
+ // Add all accessor Array functions to the wrapper.
+ each(['concat', 'join', 'slice'], function(name) {
+ var method = ArrayProto[name];
+ _.prototype[name] = function() {
+ return result.call(this, method.apply(this._wrapped, arguments));
+ };
+ });
+
+ _.extend(_.prototype, {
+
+ // Start chaining a wrapped Underscore object.
+ chain: function() {
+ this._chain = true;
+ return this;
+ },
+
+ // Extracts the result from a wrapped and chained object.
+ value: function() {
+ return this._wrapped;
+ }
+
+ });
+
+ // AMD registration happens at the end for compatibility with AMD loaders
+ // that may not enforce next-turn semantics on modules. Even though general
+ // practice for AMD registration is to be anonymous, underscore registers
+ // as a named module because, like jQuery, it is a base library that is
+ // popular enough to be bundled in a third party lib, but not be part of
+ // an AMD load request. Those cases could generate an error when an
+ // anonymous define() is called outside of a loader request.
+ if (typeof define === 'function' && define.amd) {
+ define('underscore', [], function() {
+ return _;
+ });
+ }
+}).call(this);
diff --git a/frontend/vendor/static/.keep b/frontend/vendor/static/.keep
new file mode 100644
index 0000000..e69de29