UI
This commit is contained in:
57
ui/resources/views/home.blade.php
Normal file
57
ui/resources/views/home.blade.php
Normal file
@ -0,0 +1,57 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h1>Registered Mailboxes</h1>
|
||||
<div id="mailboxes"></div>
|
||||
@endsection
|
||||
|
||||
@push('page_scripts')
|
||||
<script type="text/javascript">
|
||||
const mailboxes = {
|
||||
div_id: '',
|
||||
mailboxes: [],
|
||||
get: function() {
|
||||
const uri = '/mailboxes/registered'
|
||||
this.draw().loading()
|
||||
return Send.get(uri).then(response => {
|
||||
this.mailboxes = response.mailboxes
|
||||
this.draw().list()
|
||||
})
|
||||
},
|
||||
draw: function() {
|
||||
return {
|
||||
loading: () => {
|
||||
const parent = $(this.div_id)
|
||||
parent.html('')
|
||||
parent.append(
|
||||
$('<div></div>').addClass('ui segment').append(
|
||||
$('<p></p>').html(' ')
|
||||
).append(
|
||||
$('<div></div>').addClass('ui active dimmer').append(
|
||||
$('<div></div>').addClass('ui indeterminate elastic loader')
|
||||
)
|
||||
).append(
|
||||
$('<p></p>').html(' ')
|
||||
)
|
||||
)
|
||||
},
|
||||
list: () => {
|
||||
const parent = $(this.div_id)
|
||||
parent.html('')
|
||||
const list = $('<div></div>').addClass('ui list')
|
||||
this.mailboxes.forEach(mb => {
|
||||
list.append(
|
||||
$('<a></a>').addClass('item').attr('href', '{{$urls->base}}/emails/mailbox/' + mb.id).html(mb.name)
|
||||
)
|
||||
})
|
||||
parent.append(list)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$().ready(() => {
|
||||
mailboxes.div_id = '#mailboxes'
|
||||
mailboxes.get()
|
||||
})
|
||||
</script>
|
||||
@endpush
|
Reference in New Issue
Block a user