assets/scripts/coffee/hoarder/submitter/submitters/simple_submitter.coffee in hoarder-js-0.0.1 vs assets/scripts/coffee/hoarder/submitter/submitters/simple_submitter.coffee in hoarder-js-0.0.2

- old
+ new

@@ -1,30 +1,20 @@ -require "lib/jquery" +require 'lib/reqwest' -Signal = require "cronus/signal" +BaseSubmitter = require 'hoarder/submitter/submitters/base_submitter' -# -# @author - Tim Shelburne <tim@musiconelive.com> -# -# handles submitting a form and waiting for a response -# -class SimpleSubmitter +class SimpleSubmitter extends BaseSubmitter + constructor: -> - @submittedWithSuccess = new Signal() - @submittedWithError = new Signal() + super() + @type = 'simple' - canSubmit: (form)-> form.type is "simple" - - submitForm: (form)-> - $.ajax + submit: (form)-> + reqwest( url: form.action type: form.method data: form.serialize() - success: (data)=> - @submitSuccess(form, data) - error: (xhr, text)=> @submitError(form, xhr, text) - - submitSuccess: (form, data)-> @submittedWithSuccess.dispatch(form, data) - - submitError: (form, xhr, text)-> @submittedWithError.dispatch(form, text) + success: (data)=> @submittedWithSuccess.dispatch(form, data) + error: (xhr, text)=> @submittedWithError.dispatch(form, text) + ) return SimpleSubmitter \ No newline at end of file