<%= form_for @dashboard, url: (@dashboard.persisted? ? dashboard_path(@dashboard, variable_params) : dashboards_path(variable_params)), html: {id: "app", class: "small-form"} do |f| %> <% if @dashboard.errors.any? %>
<%= @dashboard.errors.full_messages.first %>
<% end %>
<%= f.label :name %> <%= f.text_field :name, class: "form-control" %>
<%= f.label :charts %>
<%= f.label :query_id, "Add Chart" %> <%= select_tag :query_id, nil, {include_blank: true, placeholder: "Select chart"} %>

<% if @dashboard.persisted? %> <%= link_to "Delete", dashboard_path(@dashboard), method: :delete, "data-confirm" => "Are you sure?", class: "btn btn-danger"%> <% end %> <%= f.submit "Save", class: "btn btn-success" %> <%= link_to "Back", :back, class: "btn btn-link" %>

<% end %>