module ReadOnly::FormHelper

Public Instance Methods

read_only(object_name, method, options={}) click to toggle source
# File lib/read_only.rb, line 6
def read_only object_name, method, options={}
  options[:value] = Rails.application.message_verifier(method).generate(options[:value]) if options.key?(:value)
  label = label(object_name, "_#{method}")
  input = text_field(object_name, "_#{method}", options)
  content_tag(:div, label + tag(:br) + input, style: 'margin: 5px 0; display: none')
end