Sha256: 530f260b0bc038cc489442bb5e90a038228cbbc1899a241c02a66263b5e03b35

Contents?: true

Size: 1006 Bytes

Versions: 3

Compression:

Stored size: 1006 Bytes

Contents

window.App =
  Models: {}
  Controllers: {}
  Views: {}


class App.Models.Base extends Backbone.Model
  constructor: ->
    super
  initialize: ->
    this.bind 'invalid',(model,error)->
      #console.log error
      if $('.alert-error').length>0
        $('.alert-error').html error
        $('.alert-error').show('slow')
      else
        alert(error)
    super

class App.Views.Base extends Backbone.View
  constructor: (options = {}) ->
    super
    @render = _.wrap @render, (render) =>
      @beforeRender()
      render()
      @afterRender()
      @
  initialize: ->
    @csrf_token = $('meta[name=csrf-token]').attr('content')
    @csrf_param = $('meta[name=csrf-param]').attr('content')
    if typeof @csrf_param isnt 'undefined' and typeof @csrf_token isnt 'undefined'
      @csrf_web_params=@csrf_param + "=" + encodeURIComponent(@csrf_token)
    super
  beforeRender: () =>
    #console.log 'beforeRender'
  render: () =>
    @
  afterRender: () =>
    #console.log 'afterRender'
    #
  

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_mongo_backbone_bootstrap_tmpl-0.0.3.1 template/app/assets/javascripts/app/app.js.coffee
rails_mongo_backbone_bootstrap_tmpl-0.0.3 template/app/assets/javascripts/app/app.js.coffee
rails_mongo_backbone_bootstrap_tmpl-0.0.2 template/app/assets/javascripts/app/app.js.coffee