diff --git a/lib/phlex/rails/form.rb b/lib/phlex/rails/form.rb deleted file mode 100644 index f32d0e63..00000000 --- a/lib/phlex/rails/form.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -module Phlex - module Rails - # @api private - class Form < Phlex::HTML - def initialize(model) - @model = model - end - - def self.input_field(method_name, type:) - define_method method_name do |field, value: @model.attributes[field.to_s], **attributes| - input( - name: field_name(field), - type: type, - value: value, - **attributes - ) - end - end - - def template(&block) - form action: @url, method: @method do - authenticity_token_field - yield_content(&block) - end - end - - def authenticity_token_field - input( - name: "authenticity_token", - type: "hidden", - value: helpers.form_authenticity_token - ) - end - - def submit(value) - input( - name: "commit", - type: "submit", - value: value - ) - end - - def url - helpers.url_for(@model) - end - - def field_name(*field) - helpers.field_name(ActiveModel::Naming.param_key(@model.class), *field) - end - - input_field :url_field, type: "url" - input_field :text_field, type: "text" - input_field :date_field, type: "date" - input_field :time_field, type: "time" - input_field :week_field, type: "week" - input_field :month_field, type: "month" - input_field :email_field, type: "email" - input_field :color_field, type: "color" - input_field :hidden_field, type: "hidden" - input_field :search_field, type: "search" - input_field :password_field, type: "password" - input_field :telephone_field, type: "tel" - input_field :datetime_local_field, type: "datetime-local" - end - end -end