diff --git a/app/controllers/universal_tables_controller.rb b/app/controllers/universal_tables_controller.rb index 2be32dc..ec4c2c7 100644 --- a/app/controllers/universal_tables_controller.rb +++ b/app/controllers/universal_tables_controller.rb @@ -257,8 +257,13 @@ class UniversalTablesController < ApplicationController } if text != "" end sorted = rows.sort{ |k,v| k["order"] <=> v["order"] } + entry.inc(view_count: 1) { - "entry" => sorted + "entry" => sorted, + "extras" => { + "view_count_head": I18n.t("view_count"), + "view_count" => entry.view_count + } } end end diff --git a/app/models/table_entry.rb b/app/models/table_entry.rb index 4691df1..f298471 100644 --- a/app/models/table_entry.rb +++ b/app/models/table_entry.rb @@ -5,6 +5,7 @@ class TableEntry attr_accessor :sort_value field :sort_number, type: Integer + field :view_count, type: Integer, default: 0 has_many :column_entries, :dependent => :destroy belongs_to :u_table, index: true diff --git a/modules/universal_table/show.html.erb b/modules/universal_table/show.html.erb index 14f24dc..2d690ae 100644 --- a/modules/universal_table/show.html.erb +++ b/modules/universal_table/show.html.erb @@ -19,3 +19,7 @@ +
+ {{view_count_head}}: + {{view_count}} +
\ No newline at end of file