Skip to content

Commit

Permalink
Hide or show Category graph query based on presence of categories
Browse files Browse the repository at this point in the history
  • Loading branch information
CoralineAda committed Jul 31, 2024
1 parent 88c89b4 commit 264c96c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions app/views/codebooks/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<% end %>

<h2>Derived categories:</h2>

<% if @categories_histogram %>
<% if @enqueued_at %>
<p>Category derivation was started at <%= @enqueued_at %>. Please allow up to 2 minutes for the process to complete. You can reload the page to monitor progress.</p>
<% end %>

<% if @total_codes.to_i > 0 %>
<ul class="word-cloud">
<% @categories_histogram.keys.sort{|a,b| @categories_histogram[a] <=> @categories_histogram[b]}.reverse.each do |category| %>
Expand All @@ -25,23 +25,25 @@
<% end %>
</ul>
<% end %>

<% unless @enqueued_at %>
<%= button_to "Derive Categories", codebook_enqueue_categories_path(@context, params: { enqueued: true }, method: :put ) %>
<% end %>

<h2>tmi-graph query:</h2>
<p class="code">
<%= Codebook.category_query(@context_key)[:explainer] %><br />
<a href="#query" id="copy-to-clipboard" onclick="copyToClipboard('copy-to-clipboard')"><%= Codebook.category_query(@context_key)[:query] %></a>
</p>

<% if @categories_histogram.keys.any? %>
<h2>tmi-graph query:</h2>
<p class="code">
<%= Codebook.category_query(@context_key)[:explainer] %><br />
<a href="#query" id="copy-to-clipboard" onclick="copyToClipboard('copy-to-clipboard')"><%= Codebook.category_query(@context_key)[:query] %></a>
</p>
<% end %>

<% else %>

<p>By design, identities are not categorized.</p>

<% end %>

<div class="two-column">
<div class="column">
<h3>Alphabetically</h3>
Expand Down

0 comments on commit 264c96c

Please sign in to comment.