<% @action_for_layout_builder = action_name == 'edit' ? 'update' : 'create' %>
<%= form_for @view_builder, :url => url_for(:controller => 'layout_builder', action: @action_for_layout_builder), remote: true, html: {class: 'hide'} do |form| %>
  <div class="form-group">
    <%= form.hidden_field :layout_id, value: params[:id] %>
  </div>

  <div class="form-group">
    <p>Select the fields that will be visible for this layout.</p>

    <%= select_tag 'layout_setting[visible_columns][]',
                    '',
                    multiple: true,
                    include_blank: false,
                    prompt: "",
                    data: { columns: @layout_setting.visible_columns.to_json },
                    id: "layout_setting_visible_columns" %>
  </div>

  <div class="actions" style="text-align: right">
    <%= form.submit "Save", class: "btn btn-primary" %>
  </div>
<% end %>
