1
0
mirror of https://github.com/cydrobolt/polr.git synced 2024-11-09 11:42:28 +01:00

Merge branch 'master' into 346-show-uniques

This commit is contained in:
Evan McMahon 2018-03-29 18:28:50 +11:00 committed by GitHub
commit dd0fc51eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 13 deletions

View File

@ -123,6 +123,12 @@ class AdminPaginationController extends Controller {
</a>';
}
public function renderControlLinkCell($link){
return '<div class="btn-group" role="group">
' . $this->renderToggleLinkActiveCell($link) . $this->renderDeleteLinkCell($link) . '
</div>';
}
/* DataTables bindings */
public function paginateAdminUsers(Request $request) {
@ -143,8 +149,7 @@ class AdminPaginationController extends Controller {
$admin_links = Link::select(['short_url', 'long_url', 'clicks', 'created_at', 'creator', 'is_disabled']);
return Datatables::of($admin_links)
->addColumn('disable', [$this, 'renderToggleLinkActiveCell'])
->addColumn('delete', [$this, 'renderDeleteLinkCell'])
->addColumn('control', [$this, 'renderControlLinkCell'])
->editColumn('clicks', [$this, 'renderClicksCell'])
->editColumn('long_url', [$this, 'renderLongUrlCell'])
->escapeColumns(['short_url', 'creator'])

View File

@ -30,6 +30,7 @@ class UserController extends Controller {
public function performLogoutUser(Request $request) {
$request->session()->forget('username');
$request->session()->forget('role');
return redirect()->route('index');
}

View File

@ -21,3 +21,13 @@
.qr-code-container img {
display: inline !important;
}
.input-group {
width: 40vw;
margin: 0 auto;
}
.input-group-addon {
padding: 0px 10px;
cursor: pointer;
}

View File

@ -152,15 +152,12 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) {
"ajax": BASE_API_PATH + 'admin/get_admin_links',
"columns": [
{className: 'wrap-text', data: 'short_url', name: 'short_url'},
{className: 'wrap-text', data: 'short_url', name: 'short_url', width: '10%'},
{className: 'wrap-text', data: 'long_url', name: 'long_url'},
{data: 'clicks', name: 'clicks'},
{data: 'created_at', name: 'created_at'},
{data: 'creator', name: 'creator'},
{data: 'disable', name: 'disable', orderable: false, searchable: false},
{data: 'delete', name: 'delete', orderable: false, searchable: false}
{data: 'clicks', name: 'clicks', width: '10%'},
{data: 'created_at', name: 'created_at', width: '18%'},
{data: 'creator', name: 'creator', width: '20%'},
{data: 'control', name: 'control', orderable: false, searchable: false, width: '15%'},
]
}, datatables_config));
}

7
public/js/clipboard.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,19 @@ $('#generate-qr-code').click(function () {
container.show();
});
var clipboard = new Clipboard('#clipboard-copy');
clipboard.on('success', function(e) {
e.clearSelection();
$('#clipboard-copy').tooltip('show');
});
$('#clipboard-copy').on('blur',function () {
$(this).tooltip('destroy');
}).on('mouseleave',function () {
$(this).tooltip('destroy');
});
$(function () {
original_link = $('.result-box').val();
select_text();

View File

@ -6,7 +6,12 @@
@section('content')
<h3>Shortened URL</h3>
<input type='text' class='result-box form-control' value='{{$short_url}}' />
<div class="input-group">
<input type='text' class='result-box form-control' value='{{$short_url}}' id='short_url' />
<div class='input-group-addon' id='clipboard-copy' data-clipboard-target='#short_url' data-toggle='tooltip' data-placement='bottom' data-title='Copied!'>
<i class='fa fa-clipboard' aria-hidden='true' title='Copy to clipboard'></i>
</div>
</div>
<a id="generate-qr-code" class='btn btn-primary'>Generate QR Code</a>
<a href='{{route('index')}}' class='btn btn-info'>Shorten another</a>
@ -17,5 +22,6 @@
@section('js')
<script src='/js/qrcode.min.js'></script>
<script src='/js/clipboard.min.js'></script>
<script src='/js/shorten_result.js'></script>
@endsection

View File

@ -8,8 +8,7 @@
@if ($table_id == "admin_links_table")
{{-- Show action buttons only if admin view --}}
<th>Creator</th>
<th>Disable</th>
<th>Delete</th>
<th>Control</th>
@endif
</tr>
</thead>