Skip to content

Commit b208dd6

Browse files
committed
add cached word count to revision index
1 parent 6863887 commit b208dd6

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ gem 'discordrb'
8888
# Smarts
8989
gem 'word_count_analyzer'
9090

91+
gem 'will_paginate', '~> 4.0'
92+
9193
# Workers
9294
gem 'sidekiq'
9395
gem 'redis'

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,7 @@ GEM
16821682
websocket-driver (0.7.5)
16831683
websocket-extensions (>= 0.1.0)
16841684
websocket-extensions (0.1.5)
1685+
will_paginate (4.0.1)
16851686
word_count_analyzer (1.0.1)
16861687
engtagger
16871688
zeitwerk (2.6.16)
@@ -1760,6 +1761,7 @@ DEPENDENCIES
17601761
uglifier (>= 1.3.0)
17611762
web-console
17621763
webpacker
1764+
will_paginate (~> 4.0)
17631765
word_count_analyzer
17641766

17651767
RUBY VERSION

app/views/document_revisions/index.html.erb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<tr>
1111
<th>Title</th>
1212
<th>Backed up</th>
13+
<th>Word Count</th>
1314
<th>Actions</th>
1415
</tr>
1516
</thead>
@@ -18,13 +19,14 @@
1819
<tr>
1920
<td><%= @document.title %></td>
2021
<td>Latest version</td>
22+
<td><%= @document.cached_word_count %></td>
2123
<td><%= link_to 'Edit document', edit_document_path(@document), class: 'btn' %></td>
2224
</tr>
2325
<% @document_revisions.each do |document_revision| %>
2426
<tr>
2527
<td><%= document_revision.title %></td>
2628
<td><span class="tooltipped" data-tooltip="Backed up at <%= document_revision.created_at %>"><%= time_ago_in_words document_revision.created_at %> ago</span></td>
27-
<td>
29+
<td><%= document_revision.cached_word_count %></td>
2830
<%= link_to 'View', document_document_revision_path(id: document_revision.id), class: 'btn' %>
2931
<%= 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' %>
3032
</td>

db/schema.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,7 @@
19381938
t.string "name", null: false
19391939
t.string "type_of"
19401940
t.text "description"
1941+
t.string "map"
19411942
t.string "population"
19421943
t.string "language"
19431944
t.string "currency"

0 commit comments

Comments
 (0)