add cached word count to revision index

This commit is contained in:
Andrew Brown 2025-04-01 13:08:23 -07:00
parent 6863887c62
commit b208dd63c1
4 changed files with 8 additions and 1 deletions

View File

@ -88,6 +88,8 @@ gem 'discordrb'
# Smarts
gem 'word_count_analyzer'
gem 'will_paginate', '~> 4.0'
# Workers
gem 'sidekiq'
gem 'redis'

View File

@ -1682,6 +1682,7 @@ GEM
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
will_paginate (4.0.1)
word_count_analyzer (1.0.1)
engtagger
zeitwerk (2.6.16)
@ -1760,6 +1761,7 @@ DEPENDENCIES
uglifier (>= 1.3.0)
web-console
webpacker
will_paginate (~> 4.0)
word_count_analyzer
RUBY VERSION

View File

@ -10,6 +10,7 @@
<tr>
<th>Title</th>
<th>Backed up</th>
<th>Word Count</th>
<th>Actions</th>
</tr>
</thead>
@ -18,13 +19,14 @@
<tr>
<td><%= @document.title %></td>
<td>Latest version</td>
<td><%= @document.cached_word_count %></td>
<td><%= link_to 'Edit document', edit_document_path(@document), class: 'btn' %></td>
</tr>
<% @document_revisions.each do |document_revision| %>
<tr>
<td><%= document_revision.title %></td>
<td><span class="tooltipped" data-tooltip="Backed up at <%= document_revision.created_at %>"><%= time_ago_in_words document_revision.created_at %> ago</span></td>
<td>
<td><%= document_revision.cached_word_count %></td>
<%= link_to 'View', document_document_revision_path(id: document_revision.id), class: 'btn' %>
<%= link_to 'Delete', document_document_revision_path(document: @document, id: document_revision.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn red lighten-5 red-text' %>
</td>

View File

@ -1938,6 +1938,7 @@ ActiveRecord::Schema.define(version: 2023_05_12_222601) do
t.string "name", null: false
t.string "type_of"
t.text "description"
t.string "map"
t.string "population"
t.string "language"
t.string "currency"