Sha256: 430b44f67af0d1367391975d0eb7290e01dd76e45ed9f2354d32531ab85368e8

Contents?: true

Size: 939 Bytes

Versions: 18

Compression:

Stored size: 939 Bytes

Contents

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

    included do
      helper_method :autosubmit?, :autosubmit_now?
    end

    private

    def autosubmit?
      false
    end

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rao-service_controller-0.0.52.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.51.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.50.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.49.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.48.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.47.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.46.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.45.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.44.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.43.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.42.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.41.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.40.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.39.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.38.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.37.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.36.pre app/concerns/rao/service_controller/autosubmit_concern.rb
rao-service_controller-0.0.35.pre app/concerns/rao/service_controller/autosubmit_concern.rb