Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

782 B
Raw Blame
<%
  form_preview = Class.new(ApplicationForm) do
    form do |f|
      f.text_field(
        name: :answer,
        value: answer,
        label: "Answer",
        data: { action: "change->form-preview#submit" },
        required: true,
        validation_message: answer.nil? ? "Field is required" : nil,
        caption: if answer.nil?
                   "Fill in the field to make the validation error instantly go away."
                 else
                   "Yay, no more errors!"
                 end,
        input_width: :auto
      )
    end
  end
%>

<%=
  primer_form_with(
    url: "/foo",
    method: :get,
    data: {
      controller: "form-preview",
      "form-preview-url-value": preview_path
    }
  ) do |f|
%>
  <%= render(form_preview.new(f)) %>
<% end %>