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 buildSubmitHandler(ajaxOptions) { | |
| function submitViaAJAX(event) { | |
| var data = $.extend( {}, ajaxOptions.data, $form.serialize() ), | |
| options = $.extend({}, { | |
| url: $form.attr('action'), | |
| type: $form.attr('method'), | |
| }, ajaxOptions, { data: data }); | |
| $.ajax(options) |
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
| // This is the proposed API for a jQuery plugin that will let you build | |
| // forms that look something like this example from iTunes: | |
| // https://img.skitch.com/20120609-nk4hfrjm7ybnfmw7drhm64eq8a.png | |
| // Each row consists of a "field," an "operator," and possibly a "target value." | |
| $('form') .conditioner({ | |
| name: Conditioner.STRING, | |
| age: Conditioner.NUMBER, | |
| price: Conditioner.NUMBER, |
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
| defineApp({ | |
| defaultSheet: 'loading', | |
| requests: { | |
| loadFoos: function(id) { | |
| return { url: fmt('/tickets/%@/foos', id) }; | |
| } | |
| }, |
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
| # When a proxy request comes in, send it to Rails for authorization: | |
| location /api/proxy { | |
| proxy_pass http://rails; | |
| } | |
| # Rails will send an X-Accel-Redirect if the proxy request is valid, | |
| # attaching any domain information the proxy needs so it doesn't have | |
| # to do database lookups: | |
| location /proxy { | |
| internal; |
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
| Tasks.FooDetailsView = Em.View.extend({ | |
| templateName: 'tasks/details/foo' | |
| }) |
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
| {{#view "Zendesk.RootView" id="wrapper" classBinding="Zendesk.section Zendesk.idle"}} | |
| <div id="loading" {{bindAttr class="Zendesk.stillLoading"}}></div> | |
| (a huge number of other views...) | |
| {{/view}} |
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
| // A mixin for `Em.ContainerView` that allows an initial render from | |
| // a template, followed by further additions by mutating childViews. | |
| // Note that the template should *only* contain calls to | |
| // `{{childView}}` | |
| App.Mixins.TemplateContainerView = Em.Mixin.create({ | |
| render: function() { | |
| if (!this.get('_renderedFromTemplate')) { | |
| Em.View.prototype.render.apply(this, arguments); | |
| this.set('_renderedFromTemplate', true); |
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
| # This version works in Rails 3.2 | |
| require 'redcarpet' | |
| class ActionView::Template | |
| class Redcarpet | |
| class <<self | |
| def renderer | |
| @renderer ||= ::Redcarpet::Markdown.new( | |
| ::Redcarpet::Render::HTML, | |
| :autolink => true, |
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(globals) { | |
| // CLDR Pluralization Data | |
| // see http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html | |
| // The six plural forms. Not all languages use all six forms. | |
| var Z = 'zero', | |
| O = 'one', | |
| T = 'two', | |
| F = 'few', |