<div class="contextual">
  <%= link_to l(:label_ux_toolkit_my_work), ux_toolkit_my_work_path, class: 'icon icon-user' %>
</div>

<h2><%= l(:label_ux_toolkit_my_work_settings) %></h2>

<%= form_tag ux_toolkit_my_work_settings_path, method: :patch do %>
  <div class="box tabular settings">
    <p>
      <strong><%= l(:label_ux_toolkit_visible_dashboard_blocks) %></strong>
      <em class="info"><%= l(:text_ux_toolkit_my_work_settings_help) %></em>
    </p>

    <div class="ux-toolkit-dashboard-order" data-ux-toolkit-dashboard-order>
      <% @block_order.each do |block| %>
        <div class="ux-toolkit-dashboard-order-item" data-dashboard-order-item>
          <%= hidden_field_tag 'ux_toolkit_my_work[block_order][]', block, id: nil %>
          <%= check_box_tag 'ux_toolkit_my_work[visible_blocks][]',
                            block,
                            @visible_blocks.include?(block),
                            id: "ux_toolkit_my_work_visible_block_#{block}" %>
          <%= label_tag "ux_toolkit_my_work_visible_block_#{block}",
                        l(UxToolkitUserPreference.dashboard_block_label_key(block)) %>
          <span class="ux-toolkit-dashboard-order-actions">
            <%= button_tag ux_toolkit_sprite_icon('angle-up'),
                           type: 'button',
                           class: 'icon-only',
                           title: l(:label_ux_toolkit_move_block_up),
                           aria: {label: l(:label_ux_toolkit_move_block_up)},
                           data: {dashboard_move: 'up'} %>
            <%= button_tag ux_toolkit_sprite_icon('angle-down'),
                           type: 'button',
                           class: 'icon-only',
                           title: l(:label_ux_toolkit_move_block_down),
                           aria: {label: l(:label_ux_toolkit_move_block_down)},
                           data: {dashboard_move: 'down'} %>
          </span>
        </div>
      <% end %>
    </div>
  </div>

  <%= submit_tag l(:button_ux_toolkit_save_dashboard_settings) %>
<% end %>

<% html_title(l(:label_ux_toolkit_my_work_settings)) %>
