Sha256: bfafd3de7f4b2935225aeefd7aec7d753f23722273461628e7b6adf8cf9b784c

Contents?: true

Size: 1.75 KB

Versions: 135

Compression:

Stored size: 1.75 KB

Contents

<%
  add_gem_component_stylesheet("reorderable-list")

  items ||= []
  input_name ||= "ordering"
  data_attributes ||= {}
  data_attributes[:module] = "reorderable-list"
%>

<%= tag.ol class: "gem-c-reorderable-list", data: data_attributes do %>
  <% items.each_with_index do |item, index| %>
    <%= tag.li class: "gem-c-reorderable-list__item" do %>
      <%= tag.div class: "gem-c-reorderable-list__wrapper" do %>
        <%= tag.div class: "gem-c-reorderable-list__content" do %>
          <%= tag.p item[:title], class: "gem-c-reorderable-list__title" %>
          <%= tag.p(item[:description], class: "gem-c-reorderable-list__description") if item[:description].present? %>
        <% end %>
        <%= tag.div class: "gem-c-reorderable-list__actions" do %>
          <% label_text = capture do %>
            Position<span class='govuk-visually-hidden'> for <%= item[:title] %></span>
          <% end %>
          <%= render "govuk_publishing_components/components/input", {
            label: { text: label_text },
            name: "#{input_name}[#{item[:id]}]",
            type: "number",
            value: index + 1,
            width: 2
          } %>
          <%= render "govuk_publishing_components/components/button", {
            text: "Up",
            type: "button",
            aria_label: "Move \"#{item[:title]}\" up",
            classes: "js-reorderable-list-up",
            secondary_solid: true
          } %>
          <%= render "govuk_publishing_components/components/button", {
            text: "Down",
            type: "button",
            aria_label: "Move \"#{item[:title]}\" down",
            classes: "js-reorderable-list-down",
            secondary_solid: true
          } %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Version data entries

135 entries across 135 versions & 1 rubygems

Version Path
govuk_publishing_components-46.2.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-46.1.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-46.0.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.10.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.9.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.8.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.7.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.6.1 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.6.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.5.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.4.1 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.4.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.3.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.2.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.1.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-45.0.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-44.11.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-44.10.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-44.9.1 app/views/govuk_publishing_components/components/_reorderable_list.html.erb
govuk_publishing_components-44.9.0 app/views/govuk_publishing_components/components/_reorderable_list.html.erb