Add view count.
This commit is contained in:
parent
0265cbc9bd
commit
d202a8ad0a
|
@ -257,8 +257,13 @@ class UniversalTablesController < ApplicationController
|
||||||
} if text != ""
|
} if text != ""
|
||||||
end
|
end
|
||||||
sorted = rows.sort{ |k,v| k["order"] <=> v["order"] }
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ class TableEntry
|
||||||
|
|
||||||
attr_accessor :sort_value
|
attr_accessor :sort_value
|
||||||
field :sort_number, type: Integer
|
field :sort_number, type: Integer
|
||||||
|
field :view_count, type: Integer, default: 0
|
||||||
|
|
||||||
has_many :column_entries, :dependent => :destroy
|
has_many :column_entries, :dependent => :destroy
|
||||||
belongs_to :u_table, index: true
|
belongs_to :u_table, index: true
|
||||||
|
|
|
@ -19,3 +19,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</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