Sha256: 76a1ef93a6c4a46fd8ac9334bf0436a64eb738cfe3d2046c43dd80923a464975
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
module ExpressTemplates module Components module Forms class ExpressForm < Base include Capabilities::Configurable include Capabilities::Parenting include Capabilities::Resourceful include Forms::FormSupport emits -> { form( form_args ) { form_rails_support form_method _yield } } def form_id "#{resource_name}_{{@#{resource_name}.id}}" end def form_method @config[:method] end def form_args # there are no put/patch emthods in HTML5, so we have to enforce post # need to find a better way to do this: id/action can be overridden but method # should always be :post IN THE FORM TAG args = {id: form_id, action: form_action}.merge!(@config).merge!(method: :post) if html_options = args.delete(:html_options) args.merge!(html_options) end args[:method] = args[:method].to_s.upcase args end def resource_name_for_path @config[:id].to_s end def resource_name (@config[:resource_name] || @config[:id]).to_s end private def _modifying_resource? [:put, :patch].include? form_method end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems