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 signForm = $.ajax({ | |
| type: "POST", | |
| url: "/some/form", | |
| dataType: "JSON", | |
| data: myData | |
| }); | |
| signForm.done(function(response){ | |
| // handle success here | |
| }); |
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 user = { | |
| validateCredentials: function (username, password) { | |
| return ( | |
| (!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
| : (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
| : (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
| : (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
| : (!/^([a-z0-9-_]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
| : false | |
| ); |
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
| Backbone.View.extend({ | |
| template: 'my-view-template', | |
| render: function () { | |
| var deferred = new $.Deferred(), | |
| promise = deferred.promise(), | |
| that = this; | |
| require('/templates/' + this.template + '.html', function (tmpl) { | |
| deferred.resolve(that.$el.html(tmpl)); |
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
| define([ | |
| // notice the text! prefix | |
| // this tells require.js to | |
| // use the text plugin to | |
| // retrieve the template | |
| 'text!./myTemplate.htm' | |
| ], function(myTemplate){ | |
| // use your template here | |
| }); |
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
| geocoder.geocode( { 'address': unitOfWork}, function(results, status) { | |
| if (status == google.maps.GeocoderStatus.OK) { | |
| var result = {}; | |
| result.address = unitOfWork.replace(/\+/g,' '); | |
| result.location = results[0].geometry.location.b + ',' + results[0].geometry.location.c; | |
| displayMarkerStack.push(results[0].geometry.location); | |
| finishedStack.push(result); | |
| $("body").trigger('addressComplete'); |
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
| search.View = Backbone.View.extend({ | |
| events: { | |
| "keydown input": "search" | |
| }, | |
| search: function(event) { | |
| this.trigger('search',"myq"); | |
| } | |
| }); |
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
| search.View = Backbone.View.extend({ | |
| events: { | |
| "keydown input": "search" | |
| }, | |
| search: function(event) { | |
| var o = {}; | |
| _.extend(o,Backbone.Events); | |
| o.trigger('route:search'); |
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
| // Modeling | |
| { | |
| "Operator": "", | |
| "ColumnName": "", | |
| "Value": "", | |
| "RelationshipToPreviousSibling": "", | |
| "Attributes": { | |
| "ModelId": "3e267d46-343b-4f76-9774-3537d425f3e5" | |
| }, |
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 (models) { | |
| models.Contract = Backbone.Model.extend({ | |
| Value: "", | |
| Text: "" | |
| }); | |
| }(widgets.models = widgets.models || {})); |
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
| // events simply proxy through. | |
| _onModelEvent : function(ev, model) { | |
| if (ev === 'change:id') { | |
| delete this._byId[model.previous('id')]; | |
| this._byId[model.id] = model; | |
| } | |
| this.trigger.apply(this, arguments); | |
| } | |
| }); |