Sha256: 779760b28d161e25ecfb386c4ac24c13698517c56f630d38452f110528f86a58

Contents?: true

Size: 844 Bytes

Versions: 9

Compression:

Stored size: 844 Bytes

Contents

Locomotive.Views.Pages ||= {}

class Locomotive.Views.Pages.EditView extends Locomotive.Views.Pages.FormView

  save: (event) ->
    event.stopPropagation() & event.preventDefault()

    form = $(event.target).trigger('ajax:beforeSend')

    @clear_errors()

    @model.save {},
      success: (model, response) =>
        form.trigger('ajax:complete')

        model._normalize()

        if model.get('template_changed') == true
          @reset_editable_elements()
        else
          @refresh_editable_elements()

        # refresh the show link
        fullpath = @model.get('localized_fullpaths')[window.content_locale]
        @$('#local-actions-bar > a.show').attr('href', "/#{fullpath}")

      error: (model, xhr) =>
        form.trigger('ajax:complete')

        errors = JSON.parse(xhr.responseText)

        @show_errors errors

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
locomotive_cms-2.2.3 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.2.2 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.2.1 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.2.0 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.1.4 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.1.3 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.1.2 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.1.1 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee
locomotive_cms-2.1.0 app/assets/javascripts/locomotive/views/pages/edit_view.js.coffee