mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-25 10:32:31 +01:00
add typeahead support for owner email when adding new server
closes #144 pic: http://s3.pterodactyl.io/UpPSJ.png
This commit is contained in:
parent
f9f751b7f2
commit
bef717b202
@ -10,6 +10,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
|
||||
* Support for filtering servers within Admin CP to narrow down results by name, email, allocation, or defined fields.
|
||||
* Setup scripts (user, mail, env) now support argument flags for use in containers and other non-terminal environments.
|
||||
* New API endpoints for individual users to control their servers with at `/api/me/*`.
|
||||
* Typeahead support for owner email when adding a new server.
|
||||
|
||||
### Changed
|
||||
* Creating a user, server, or node now returns `HTTP/1.1 200` and a JSON element with the user/server/node's ID.
|
||||
|
@ -63,6 +63,8 @@ Socket.io - [license](https://github.com/socketio/socket.io/blob/master/LICENSE)
|
||||
|
||||
SweetAlert - [license](https://github.com/t4t5/sweetalert/blob/master/LICENSE) - [homepage](http://t4t5.github.io/sweetalert/)
|
||||
|
||||
Typeahead — [license](https://github.com/bassjobsen/Bootstrap-3-Typeahead/blob/master/bootstrap3-typeahead.js) — [homepage](https://github.com/bassjobsen/Bootstrap-3-Typeahead)
|
||||
|
||||
### Additional License Information
|
||||
Some Javascript and CSS used within the panel is licensed under a `MIT` or `Apache 2.0`. Please check their respective header files for more information.
|
||||
|
||||
|
@ -130,4 +130,12 @@ class UserController extends Controller
|
||||
return redirect()->route('admin.users.view', $user);
|
||||
}
|
||||
|
||||
public function getJson(Request $request)
|
||||
{
|
||||
foreach(User::select('email')->get() as $user) {
|
||||
$resp[] = $user->email;
|
||||
}
|
||||
return $resp;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -73,6 +73,11 @@ class AdminRoutes {
|
||||
'uses' => 'Admin\UserController@getIndex'
|
||||
]);
|
||||
|
||||
$router->get('/accounts.json', [
|
||||
'as' => 'admin.users.json',
|
||||
'uses' => 'Admin\UserController@getJson'
|
||||
]);
|
||||
|
||||
// View Specific Account
|
||||
$router->get('/view/{id}', [
|
||||
'as' => 'admin.users.view',
|
||||
|
21
public/js/vendor/typeahead/typeahead.min.js
vendored
Normal file
21
public/js/vendor/typeahead/typeahead.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -23,6 +23,11 @@
|
||||
Create New Server
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
@parent
|
||||
{!! Theme::js('js/vendor/typeahead/typeahead.min.js') !!}
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="col-md-12">
|
||||
<ul class="breadcrumb">
|
||||
@ -44,6 +49,8 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="owner" class="control-label">Owner Email</label>
|
||||
<div>
|
||||
{{-- Hacky workaround to prevent Safari and Chrome from trying to suggest emails here --}}
|
||||
<input id="fake_user_name" name="fake_user[name]" style="position:absolute; top:-10000px;" type="text" value="Autofill Me">
|
||||
<input type="text" autocomplete="off" name="owner" class="form-control" value="{{ old('owner', Input::get('email')) }}" />
|
||||
</div>
|
||||
</div>
|
||||
@ -253,6 +260,17 @@ $(document).ready(function () {
|
||||
$('input[name="custom_image_name"]').val('').prop('disabled', !($(this).is(':checked')));
|
||||
});
|
||||
|
||||
// Typeahead
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('admin.users.json') }}',
|
||||
}).done(function (data) {
|
||||
$('input[name="owner"]').typeahead({ fitToElement: true, source: data });
|
||||
}).fail(function (jqXHR) {
|
||||
alert('Could not initialize user email typeahead.')
|
||||
console.log(jqXHR);
|
||||
});
|
||||
|
||||
var nodeData = null;
|
||||
var currentLocation = null;
|
||||
var currentNode = null;
|
||||
|
Loading…
Reference in New Issue
Block a user