Sha256: 96925ce7f01548f6915cb8e8d29e814cb755ea305419fef6b53b1e50f1df6b07

Contents?: true

Size: 720 Bytes

Versions: 9

Compression:

Stored size: 720 Bytes

Contents

# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

module RailsBootstrapForm
  module Inputs
    module StaticField
      extend ActiveSupport::Concern

      included do
        def static_field(*args)
          options = args.extract_options!
          attribute = args.first

          static_options = options.merge(
            readonly: true,
            disabled: true,
            bootstrap_form: {
              field_class: bootstrap_form_options.static_field_class
            }
          )

          static_options[:value] = object.send(attribute) unless options.key?(:value)

          text_field(attribute, static_options)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.8.3 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.8.2 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.8.1 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.8.0 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.7.2 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.7.1 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.7.0 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.6.2 lib/rails_bootstrap_form/inputs/static_field.rb
rails_bootstrap_form-0.6.1 lib/rails_bootstrap_form/inputs/static_field.rb