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

1.5 KB
Raw Blame
<%
  default_form = Class.new(ApplicationForm) do
    form do |f|
      f.text_field(
        name: :ultimate_answer,
        label: "Ultimate answer",
        required: true,
        caption: "The answer to life, the universe, and everything",
        input_width: :medium
      )

      f.select_list(
        name: "cities",
        label: "Cool cities",
        caption: "Select your favorite!",
        include_blank: true,
        input_width: :small
      ) do |city_list|
        city_list.option(label: "Lopez Island", value: "lopez_island")
        city_list.option(label: "Bellevue", value: "bellevue")
        city_list.option(label: "Seattle", value: "seattle")
      end
    end
  end
%>

<%= render(Primer::OpenProject::CollapsibleSection.new) do |component| %>
  <% component.with_title { "A collapsible form" } %>
  <% component.with_caption { "(click me)" } %>
  <% component.with_additional_information do %>
    <%= render(Primer::Alpha::ActionMenu.new) do |menu|
          menu.with_show_button(icon: "kebab-horizontal", "aria-label": "More", scheme: :invisible)
          menu.with_item(tag: :a, label: "Foo", href: "/foo") do |item|
            item.with_leading_visual_icon(icon: :pencil)
            "foo"
          end
        end %>
  <% end %>
  <% component.with_collapsible_content do %>
    <%= render(Primer::Alpha::Banner.new(mb: 3)) { "The collapsible section can contain everything you want" } %>
    <%= primer_form_with(url: "/foo") do |f| %>
      <% render(default_form.new(f)) %>
    <% end %>
  <% end %>
<% end %>