Skip to content

Business intelligence made simple

Reduced jQuery on dashboard form [skip ci]

Andrew Kaned71190dd62db
diff --git a/app/views/blazer/dashboards/_form.html.erb b/app/views/blazer/dashboards/_form.html.erb
index aa3889ae..fc950dc2 100644
--- a/app/views/blazer/dashboards/_form.html.erb
+++ b/app/views/blazer/dashboards/_form.html.erb
@@ -12,11 +12,11 @@
<ul id="queries" class="list-group">
</ul>
</div>
- <div class="form-group cloak">
+ <div class="form-group hide" id="charts-group">
<%= f.label :query_id, "Add Chart" %>
<%= select_tag :query_id, nil, {include_blank: true, placeholder: "Select chart"} %>
</div>
- <p style="padding-bottom: 140px;" class="cloak">
+ <p style="padding-bottom: 140px;" class="hide" id="actions">
<% if @dashboard.persisted? %>
<%= link_to "Delete", dashboard_path(@dashboard), method: :delete, "data-confirm" => "Are you sure?", class: "btn btn-danger" %>
<% end %>
@@ -66,7 +66,7 @@
}
})
- $("#query_id").selectize({
+ $(document.getElementById("query_id")).selectize({
options: queries,
highlight: false,
maxOptions: 100,
@@ -89,7 +89,8 @@
}
})
- $(".cloak").removeClass("cloak")
+ document.getElementById("charts-group").classList.remove("hide")
+ document.getElementById("actions").classList.remove("hide")
Sortable.create(queriesList)
<% end %>