Skip to content

Business intelligence made simple

Better docs for new installs

Andrew Kane552030aecfc0
diff --git a/app/controllers/blazer/queries_controller.rb b/app/controllers/blazer/queries_controller.rb
index 89da2468..4d882ac3 100644
--- a/app/controllers/blazer/queries_controller.rb
+++ b/app/controllers/blazer/queries_controller.rb
@@ -182,6 +182,9 @@ module Blazer
def docs
@schema = @data_source.schema
+ @smart_variables = @data_source.smart_variables
+ @linked_columns = @data_source.linked_columns
+ @smart_columns = @data_source.smart_columns
end
def cancel
diff --git a/app/views/blazer/queries/docs.html.erb b/app/views/blazer/queries/docs.html.erb
index 4d83f601..7304a453 100644
--- a/app/views/blazer/queries/docs.html.erb
+++ b/app/views/blazer/queries/docs.html.erb
@@ -4,66 +4,78 @@
<h2>Smart Variables</h2>
-<p>Use these variable names to get a dropdown.</p>
+<% if @smart_variables.any? %>
+ <p>Use these variable names to get a dropdown.</p>
-<table class="table" style="max-width: 500px;">
- <thead>
- <tr>
- <th>Variable</th>
- </tr>
- </thead>
- <tbody>
- <% @data_source.smart_variables.each do |k, _| %>
+ <table class="table" style="max-width: 500px;">
+ <thead>
<tr>
- <td><code>{<%= k %>}</code></td>
+ <th>Variable</th>
</tr>
- <% end %>
- </tbody>
-</table>
+ </thead>
+ <tbody>
+ <% @smart_variables.each do |k, _| %>
+ <tr>
+ <td><code>{<%= k %>}</code></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
-<p>Use <code>{start_time}</code> and <code>{end_time}</code> for a date range selector. End a variable name with <code>_at</code> for a date selector.</p>
+ <p>Use <code>{start_time}</code> and <code>{end_time}</code> for a date range selector. End a variable name with <code>_at</code> for a date selector.</p>
+<% else %>
+ <p>None set - add them in <code>config/blazer.yml</code>.</p>
+<% end %>
<h2>Linked Columns</h2>
-<p>Use these column names to link results to other pages.</p>
+<% if @linked_columns.any? %>
+ <p>Use these column names to link results to other pages.</p>
-<table class="table" style="max-width: 500px;">
- <thead>
- <tr>
- <th style="width: 20%;">Name</th>
- <th>URL</th>
- </tr>
- </thead>
- <tbody>
- <% @data_source.linked_columns.each do |k, v| %>
+ <table class="table" style="max-width: 500px;">
+ <thead>
<tr>
- <td><%= k %></td>
- <td><%= v %></td>
+ <th style="width: 20%;">Name</th>
+ <th>URL</th>
</tr>
- <% end %>
- </tbody>
-</table>
+ </thead>
+ <tbody>
+ <% @linked_columns.each do |k, v| %>
+ <tr>
+ <td><%= k %></td>
+ <td><%= v %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
-<p>Values that match the format of a URL will be linked automatically.</p>
+ <p>Values that match the format of a URL will be linked automatically.</p>
+<% else %>
+ <p>None set - add them in <code>config/blazer.yml</code>.</p>
+<% end %>
<h2>Smart Columns</h2>
-<p>Use these column names to show additional data.</p>
+<% if @smart_columns.any? %>
+ <p>Use these column names to show additional data.</p>
-<table class="table" style="max-width: 500px;">
- <thead>
- <tr>
- <th>Name</th>
- </tr>
- </thead>
- <tbody>
- <% @data_source.smart_columns.each do |k, _| %>
+ <table class="table" style="max-width: 500px;">
+ <thead>
<tr>
- <td><%= k %></td>
+ <th>Name</th>
</tr>
- <% end %>
- </tbody>
-</table>
+ </thead>
+ <tbody>
+ <% @smart_columns.each do |k, _| %>
+ <tr>
+ <td><%= k %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+<% else %>
+ <p>None set - add them in <code>config/blazer.yml</code>.</p>
+<% end %>
<h2>Charts</h2>