Add view count.
This commit is contained in:
parent
0265cbc9bd
commit
d202a8ad0a
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,3 +19,7 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="view_count pull-right">
|
||||
<i class="fa fa-eye">{{view_count_head}}:</i>
|
||||
<span class="view-count">{{view_count}}</span>
|
||||
</div>
|
Loading…
Reference in New Issue