mirror of
https://github.com/cydrobolt/polr.git
synced 2024-11-09 19:52:28 +01:00
Add shortcut to stats in link tables
This commit is contained in:
parent
a3c697a865
commit
b73048cdc0
@ -113,6 +113,16 @@ class AdminPaginationController extends Controller {
|
||||
Delete
|
||||
</a>';
|
||||
})
|
||||
->editColumn('clicks', function ($link) {
|
||||
if (env('SETTING_ADV_ANALYTICS')) {
|
||||
return $link->clicks . ' <a target="_blank" class="stats-icon" href="/admin/stats/' . e($link->short_url) . '">
|
||||
<i class="fa fa-area-chart" aria-hidden="true"></i>
|
||||
</a>';
|
||||
}
|
||||
else {
|
||||
return $link->clicks;
|
||||
}
|
||||
})
|
||||
->escapeColumns(['short_url', 'long_url', 'creator'])
|
||||
->make(true);
|
||||
}
|
||||
@ -125,7 +135,17 @@ class AdminPaginationController extends Controller {
|
||||
->select(['short_url', 'long_url', 'clicks', 'created_at']);
|
||||
|
||||
return Datatables::of($user_links)
|
||||
->escapeColumns()
|
||||
->editColumn('clicks', function ($link) {
|
||||
if (env('SETTING_ADV_ANALYTICS')) {
|
||||
return $link->clicks . ' <a target="_blank" class="stats-icon" href="/admin/stats/' . e($link->short_url) . '">
|
||||
<i class="fa fa-area-chart" aria-hidden="true"></i>
|
||||
</a>';
|
||||
}
|
||||
else {
|
||||
return $link->clicks;
|
||||
}
|
||||
})
|
||||
->escapeColumns(['short_url', 'long_url'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,9 @@ class StatsController extends Controller {
|
||||
if ($link == null) {
|
||||
return redirect(route('admin'))->with('error', 'Cannot show stats for nonexistent link.');
|
||||
}
|
||||
if (!env('SETTING_ADV_ANALYTICS')) {
|
||||
return redirect(route('login'))->with('error', 'Please enable advanced analytics to view this page.');
|
||||
}
|
||||
|
||||
$link_id = $link->id;
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.stats-icon {
|
||||
margin-left: 0.3em;
|
||||
}
|
||||
|
||||
.change-password {
|
||||
width: 150px;
|
||||
}
|
||||
|
@ -14,3 +14,7 @@
|
||||
.ng-root {
|
||||
margin-bottom: 4em;
|
||||
}
|
||||
|
||||
h4 {
|
||||
display: inline-block;
|
||||
}
|
||||
|
@ -12,16 +12,20 @@
|
||||
<div class="stats-header">
|
||||
<h3>Stats</h3>
|
||||
<p>
|
||||
<b>Short Link: </b> {{ env('APP_ADDRESS') }}/{{ $link->short_url }}
|
||||
<b>Short Link: </b>
|
||||
<a target="_blank" href="{{ env('APP_PROTOCOL') }}/{{ env('APP_ADDRESS') }}/{{ $link->short_url }}">
|
||||
{{ env('APP_ADDRESS') }}/{{ $link->short_url }}
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<b>Long Link: </b> {{ $link->long_url }}
|
||||
<b>Long Link: </b>
|
||||
<a target="_blank" href="{{ $link->long_url }}">{{ $link->long_url }}</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="row bottom-padding">
|
||||
<div class="col-md-8">
|
||||
<h4>Traffic over Time</h4>
|
||||
<h4>Traffic over Time</h4> (total: {{ $link->clicks }})
|
||||
<canvas id="dayChart"></canvas>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
|
Loading…
Reference in New Issue
Block a user