⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% block enquiry %} | |
<form id="enquiry_form" action="{{ contents.enquiries.api.create }}" method="post"> | |
{% editable_long_text 'welcome' %} | |
<h3>Got an enquiry?</h3> | |
<p>Please fill in the form below and we will get in touch as soon as possible.</p> | |
{% endeditable_long_text %} | |
<fieldset> | |
<div id="error_message">No Errors</div> | |
<ol> | |
<li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activeRequests = [] | |
Backbone._sync = Backbone.sync | |
Backbone.sync = (method, model, options) -> | |
asyncToken = Backbone._sync.apply(this,arguments) | |
asyncToken.then () -> | |
activeRequests = _.without activeRequests, asyncToken | |
if activeRequests.length == 0 then console.log "LOADING COMPLETE" | |
if activeRequests.length == 0 | |
console.log "START LOADING" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activeRequests = [] | |
Backbone._sync = Backbone.sync | |
Backbone.sync = (method, model, options) -> | |
asyncToken = Backbone._sync.apply(this,arguments) | |
asyncToken.then () -> | |
activeRequests = _.without activeRequests, asyncToken | |
if activeRequests.length == 0 then console.log "LOADING COMPLETE" | |
if activeRequests.length == 0 | |
console.log "START LOADING" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.Model::nestCollection = (attributeName, nestedCollection) -> | |
#setup nested references | |
for item, i in nestedCollection | |
@attributes[attributeName][i] = nestedCollection.at(i).attributes | |
#create empty arrays if none | |
nestedCollection.bind 'add', (initiative) => | |
if !@get(attributeName) | |
@attributes[attributeName] = [] | |
@get(attributeName).push(initiative.attributes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activeRequests = [] | |
Backbone._sync = Backbone.sync | |
Backbone.sync = (method, model, options) -> | |
asyncToken = Backbone._sync.apply(this,arguments) | |
asyncToken.then () -> | |
activeRequests = _.without activeRequests, asyncToken | |
if activeRequests.length == 0 then console.log "LOADING COMPLETE" | |
if activeRequests.length == 0 | |
console.log "START LOADING" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before this file is loaded, a locale should be set: | |
# | |
# In a browser environment, you can use: | |
# ```<script>__locale='en';</script>``` | |
# | |
# In a server environment (specifically node.js): | |
# ```global.__locale = 'en';``` | |
# normalize in-app locale string to "en" or "de-AT" | |
parts = @__locale.split('-') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
Helps creating and submitting forms | |
- easy labeling | |
- automatically inserts values of the model to the form | |
- is able to serialize forms to JSON | |
- can submit the form to the server | |
- automatically displays errors if there are any | |
### | |
class FormHelper | |