This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var couchDoc = Backbone.Model.extend( | |
| { | |
| idAttribute: "_id", | |
| save:function(attrs,options){ | |
| function updateRev(model,resp,status){ | |
| model.set({_rev:status.rev},{silent: true}); | |
| }; | |
| options || (options = {}); | |
| var model = this; | |
| var success = options.success; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var countryList = Locations.extend( | |
| {model:country, | |
| initialize:function(){ | |
| var stores_db = db('stores_rt7'); | |
| var reigion_v = appView('country_prov_city_postal_code'); | |
| groupQuery(reigion_v,stores_db,1) | |
| (function(data){ | |
| this.add(_(data.rows).chain() | |
| .pluck('key') | |
| .flatten() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var countryList = Locations.extend( | |
| {model:country, | |
| initialize:function(){ | |
| var that = this; | |
| var stores_db = db('stores_rt7'); | |
| var reigion_v = appView('country_prov_city_postal_code'); | |
| groupQuery(reigion_v,stores_db,1) | |
| (function(data){ | |
| var colData = _.map(extractKeysArr(data),function(item){return {name:item};}); | |
| console.log("done setting up collection"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defmulti statsTransform | |
| (fn [fromDB toDB] | |
| (let [dbs (db/all-databases) | |
| fromDB? (some #(= % fromDB) dbs) | |
| toDB? (some #(= % toDB) dbs)] | |
| (swank.core/break) | |
| [fromDB? toDB?]))) | |
| (defmethod statsTransform [true true] [from to] :rect-shape) | |
| (defmethod statsTransform [true false] [from to] | |
| (create-transformation-db to)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var couchCollection = function(couch,options){ | |
| couch || (couch = {}); | |
| couch.db || (couch.db = 'db'); | |
| options || (options = {}); | |
| var urlBase = window.location.protocol + "//" + window.location.hostname + ":" +window.location.port + "/"; | |
| return Backbone.Collection.extend( | |
| _.extend(options, | |
| {url:urlBase + couch.db, | |
| parse: function(response) { | |
| return _(response.rows) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var install_db = db('install'); | |
| var Selection = new (Backbone.Model.extend()); | |
| var Company = couchDoc.extend( | |
| {defaults: function() { | |
| return { | |
| name:"unknown", | |
| hierarchy:{groups:["none"]} | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Workspace = Backbone.Router.extend( | |
| { | |
| routes: { | |
| "help": "help", // #help | |
| "search/:query": "search", // #search/kiwis | |
| "search/:query/p:page": "search" // #search/kiwis/p7 | |
| }, | |
| help: function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function quickViewDialog (html,options) { | |
| $(html).dialog({ | |
| autoOpen: false, | |
| height: 400, | |
| width: 500, | |
| modal: true, | |
| buttons: { | |
| Cancel: function() { | |
| $(html).dialog('destroy'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var couchDoc = Backbone.Model.extend( | |
| { | |
| idAttribute: "_id", | |
| save:function(attrs,options){ | |
| function updateRev(model,resp,status){ | |
| model.set({_rev:status.rev,_id:status.id},{silent: true}); | |
| }; | |
| options || (options = {}); | |
| var model = this; | |
| var success = options.success; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function BindValidator(validator){ | |
| return function(validationObj){ | |
| var str = validationObj.str; | |
| var isValid = validator(str); | |
| if(!validationObj.valid){ | |
| return{str:str,valid:false}; | |
| } | |
| return {str:str,valid:isValid}; | |
| }; | |
| }; |