Sha256: 7b689c46d26fbc431328932079fabf10dbf3fd096bf0c2dddb1c5e1e3c4d9db7

Contents?: true

Size: 1006 Bytes

Versions: 22

Compression:

Stored size: 1006 Bytes

Contents

module Raos
  module Controller
    # Handles automatic form submits.
    #
    # Prerequisites:
    #
    # Include the javascript:
    #
    #     # app/assets/javascripts/application.js
    #     //= require rails/add_ons/application/autosubmit
    #
    # Example:
    #
    #     # app/controllers/posts_controller.rb
    #     class PostsController < ApplicationController
    #       include AutosubmitConcern
    #
    #       # ...
    #
    #       private
    #
    #       def autosubmit?
    #         true
    #       end
    #     end
    #
    #     # app/views/posts/new.html.haml
    #     = form_for(...) do |f|
    #       = autosubmit
    #
    module AutosubmitConcern
      extend ActiveSupport::Concern

      included do
        helper Rao::AutosubmitHelper
        helper_method :autosubmit?, :autosubmit_now?
      end

      private

      def autosubmit?
        false
      end

      def autosubmit_now?
        autosubmit? && action_name == 'new'
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rao-service_controller-0.0.23.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.22.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.21.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.20.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.19.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.18.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.17.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.16.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.15.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.14.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.13.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.12.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.11.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.10.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.9.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.8.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.7.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.6.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.5.pre app/concerns/rao/controller/autosubmit_concern.rb
rao-service_controller-0.0.4.pre app/concerns/rao/controller/autosubmit_concern.rb