CSS updates, layout tweeks, domain editing/updating

This commit is contained in:
Deon George 2021-06-14 15:46:18 +10:00
parent dd648adf91
commit a3b4214040
12 changed files with 235 additions and 89 deletions

View File

@ -19,12 +19,15 @@ class DomainController extends Controller
public function add_edit(Request $request,Domain $o) public function add_edit(Request $request,Domain $o)
{ {
if ($request->post()) { if ($request->post()) {
// @todo Add validation that we can only have 1 "default" domain for a zone. $request->validate([
// The default domain is used when a node connects and doesnt use a full 5D address, eg: 10:999/1 vs 10:999/1@private 'name' => 'required|unique:domains|max:8',
'dnsdomain' => 'nullable|unique:domains|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i',
'active' => 'required',
]);
foreach (['name','dnsdomain','active','notes'] as $key) foreach (['name','dnsdomain','active','notes'] as $key)
$o->{$key} = $request->post($key); $o->{$key} = $request->post($key);
$o->active = TRUE;
$o->save(); $o->save();
return redirect()->action([self::class,'home']); return redirect()->action([self::class,'home']);

View File

@ -9,4 +9,11 @@ use App\Traits\ScopeActive;
class Domain extends Model class Domain extends Model
{ {
use ScopeActive; use ScopeActive;
/* RELATIONS */
public function zones()
{
return $this->hasMany(Zone::class);
}
} }

View File

@ -46,8 +46,8 @@ a:link {
text-transform:uppercase text-transform:uppercase
} }
div p:last-child { strong.highlight {
margin-bottom:0 color: #eee;
} }
body { body {
@ -88,7 +88,6 @@ sup:after {
z-index: 4; z-index: 4;
box-sizing: content-box box-sizing: content-box
} }
#nav-menu { #nav-menu {
color:#aaa; color:#aaa;
padding:0; padding:0;
@ -273,7 +272,7 @@ ul#navlist-desktop {
margin:24px auto 40px auto; margin:24px auto 40px auto;
box-shadow:8px 9px 0 0 #333 box-shadow:8px 9px 0 0 #333
} }
#content>h2:first-child { #content h2:first-child {
margin-top:8px margin-top:8px
} }
#content h3, #content h3,
@ -299,6 +298,13 @@ ul#navlist-desktop {
color:#c60; color:#c60;
} }
#content>div.row:first-child {
padding-top: 0px;
}
#content>div.row {
padding-top: 20px;
}
#content ul { #content ul {
margin:0 1ch; margin:0 1ch;
padding-left:1ch; padding-left:1ch;
@ -402,6 +408,10 @@ form div.row {
.greyframe h2.cap+p { .greyframe h2.cap+p {
margin-top:1em margin-top:1em
} }
.greyframe>div.row:last-child,
.greyframe>form>div.row:last-child {
padding-bottom: 15px;
}
label.form-label { label.form-label {
font-size: 75%; font-size: 75%;
@ -414,6 +424,22 @@ p {
text-align:left; text-align:left;
word-break:break-word word-break:break-word
} }
p>small {
color: #bbb;
}
p>small:before {
content: '[';
}
p>small:after {
content: ']';
}
p>small:before,
p>small:after {
color: #eee;
}
div p:last-child {
margin-bottom:0
}
.pad { .pad {
padding:1em 1.5ch; padding:1em 1.5ch;
@ -450,6 +476,78 @@ p {
transition:all .1s ease-in-out transition:all .1s ease-in-out
} }
table {
border-collapse:collapse;
color:#fff;
}
th {
font-weight:400
}
td {
padding:0 4px
}
thead {
background-color:#222;
border-top:1px solid #555;
border-bottom:3px double #555;
border-left:2px solid #555;
border-right:2px solid #555
}
tbody {
border-left:2px solid #555;
border-right:2px solid #555;
border-bottom:1px solid #555
}
.monotable {
background-color:#1e1e1e;
margin-top:.5em;
margin-bottom:1.5em;
text-indent:0
}
.monotable.sbm {
margin-bottom:.5em
}
.monotable thead {
border-top:1px solid #666;
border-left:2px solid #666;
border-right:2px solid #666;
border-bottom:0;
color:#fff;
background-color:#000
}
.monotable th {
padding:.5em 1.5ch .4em;
border-right:2px solid #666
}
.monotable tbody {
border-top:3px double #666;
border-left:2px solid #666;
border-right:2px solid #666;
border-bottom:1px solid #666;
color: #eee;
}
.monotable tbody td {
padding-left:1.5ch!important;
padding-right:1.5ch!important;
vertical-align:middle!important
}
.monotable tbody tr:first-child td {
padding-top:9px!important
}
.monotable tbody tr:last-child td {
padding-bottom:7px!important
}
.monotable tr td:not(:last-child) {
border-right:2px solid #666
}
.monotable.cozy {
text-align:left
}
.monotable.cozy td {
padding-top:8px!important;
padding-bottom:7px!important;
border-bottom:1px solid #666
}
.text-center { .text-center {
text-align:center; text-align:center;

View File

@ -1,6 +1,6 @@
@extends('layouts.app') @extends('layouts.app')
@section('main-content') @section('content')
<h2>About the FTN Clearing House</h2> <h2>About the FTN Clearing House</h2>
<p>Welcome to the FTN Clearing House.</p> <p>Welcome to the FTN Clearing House.</p>

View File

@ -26,7 +26,7 @@
<h2 class="cap">Login</h2> <h2 class="cap">Login</h2>
<form class="row g-0 needs-validation" method="post" novalidate> <form class="row g-0 needs-validation" method="post" novalidate>
{{ csrf_field() }} @csrf
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
@ -74,13 +74,13 @@
</div> </div>
</form> </form>
<div class="row pt-4"> <div class="row">
<div class="col-12"> <div class="col-12">
<a class="link-danger" href="{{ url('password/reset') }}">Forgot Password</a> <a class="link-danger" href="{{ url('password/reset') }}">Forgot Password</a>
</div> </div>
</div> </div>
<div class="row pt-1 pb-3"> <div class="row">
<div class="col-12"> <div class="col-12">
<a class="link-danger" href="{{ url('register') }}">Register</a> <a class="link-danger" href="{{ url('register') }}">Register</a>
</div> </div>

View File

@ -28,7 +28,7 @@
<label for="email" class="form-label">Email</label> <label for="email" class="form-label">Email</label>
<div class="input-group has-validation"> <div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-person-badge"></i></span> <span class="input-group-text"><i class="bi bi-person-badge"></i></span>
<input type="text" class="form-control @error('email') is-invalid @enderror" id="email" placeholder="Email" name="email" value="{{ old('email') }}" autocomplete="email" autofocus required> <input type="text" class="form-control @error('email') is-invalid @enderror" id="email" placeholder="Email" name="email" autocomplete="email" autofocus required>
@error('email') @error('email')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
{{ $message }} {{ $message }}
@ -49,7 +49,7 @@
</div> </div>
</div> </div>
<div class="row pt-4"> <div class="row">
<div class="col-12"> <div class="col-12">
<a class="link-danger" href="{{ url('login') }}">Login</a> <a class="link-danger" href="{{ url('login') }}">Login</a>
</div> </div>

View File

@ -29,7 +29,7 @@
<label for="email" class="form-label">Email</label> <label for="email" class="form-label">Email</label>
<div class="input-group has-validation"> <div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-person-badge"></i></span> <span class="input-group-text"><i class="bi bi-person-badge"></i></span>
<input type="text" class="form-control @error('email') is-invalid @enderror" id="email" placeholder="Email" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus> <input type="text" class="form-control @error('email') is-invalid @enderror" id="email" placeholder="Email" name="email" value="{{ old('email',$email) }}" required autocomplete="email" autofocus>
@error('email') @error('email')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
{{ $message }} {{ $message }}
@ -75,14 +75,13 @@
</div> </div>
</div> </div>
<div class="row pb-4"> <div class="row">
<div class="col-12"> <div class="col-12">
<a href="{{ url('/') }}" class="btn btn-danger">Cancel</a> <a href="{{ url('/') }}" class="btn btn-danger">Cancel</a>
<button type="submit" name="submit" class="btn btn-success mr-0 float-end">Sign In</button> <button type="submit" name="submit" class="btn btn-success mr-0 float-end">Sign In</button>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>

View File

@ -11,14 +11,14 @@
<h2 class="cap">Register</h2> <h2 class="cap">Register</h2>
<form class="row g-0 needs-validation" method="post" novalidate> <form class="row g-0 needs-validation" method="post" novalidate>
{{ csrf_field() }} @csrf
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<label for="name" class="form-label">Name</label> <label for="name" class="form-label">Name</label>
<div class="input-group has-validation"> <div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-person-square"></i></span> <span class="input-group-text"><i class="bi bi-person-square"></i></span>
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Full Name" name="name" required autocomplete="name" autofocus> <input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Full Name" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@error('name') @error('name')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
{{ $message }} {{ $message }}
@ -37,7 +37,7 @@
<label for="email" class="form-label">Email</label> <label for="email" class="form-label">Email</label>
<div class="input-group has-validation"> <div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-person-badge"></i></span> <span class="input-group-text"><i class="bi bi-person-badge"></i></span>
<input type="text" class="form-control @error('email') is-invalid @enderror" id="email" placeholder="Email" name="email" required autocomplete="email"> <input type="text" class="form-control @error('email') is-invalid @enderror" id="email" placeholder="Email" name="email" value="{{ old('email') }}" required autocomplete="email">
@error('email') @error('email')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
{{ $message }} {{ $message }}
@ -91,7 +91,7 @@
</div> </div>
</form> </form>
<div class="row pt-4"> <div class="row">
<div class="col-12"> <div class="col-12">
<a class="link-danger" href="{{ url('login') }}">Login</a> <a class="link-danger" href="{{ url('login') }}">Login</a>
</div> </div>

View File

@ -4,55 +4,79 @@
@if($o->exists) Update @else Add @endif Domain @if($o->exists) Update @else Add @endif Domain
@endsection @endsection
@section('main-content') @section('content')
<div class="pb-3"> <div class="row">
<h2>@if($o->exists) Update @else Add @endif Domain</h2> <div class="col-6 m-auto">
<div class="greyframe titledbox shadow0xb0 text-center">
<h2 class="cap">@if($o->exists) Update @else Add @endif Domain</h2>
<form method="POST"> <form class="row g-0 needs-validation" method="post" novalidate>
{{ csrf_field() }} @csrf
<div class="row"> <div class="row">
<div class="col-9 m-auto"> <div class="col-12">
<div class="bg-blue"> <label for="name" class="form-label">Name</label>
<div class="row m-3"> <div class="input-group has-validation">
<label class="col-3" for="name">Name:</label> <span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<input class="col-9" type="text" name="name" value="{{ $o->name }}"> <input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required autocomplete="name" autofocus>
</div> @error('name')
<span class="invalid-feedback" role="alert">
<div class="row m-3"> {{ $message }}
<label class="col-3" for="dnsdomain">DNS Domain:</label> </span>
<input class="col-9" type="text" name="dnsdomain" value="{{ $o->dnsdomain }}"> @else
</div> <span class="invalid-feedback">
A name is required.
<div class="row m-3"> </span>
<label class="col-3" for="active">Active:</label> @enderror
<div class="form-group col-3">
<div class="custom-control custom-radio mb-3">
<input type="radio" class="custom-control-input" name="active" id="active_yes" value="1" required @if($o->active)checked @endif>
<label class="custom-control-label" for="active_yes">Yes</label>
</div>
<div class="custom-control custom-radio mb-3">
<input type="radio" class="custom-control-input" name="active" id="active_no" value="0" required @if(! $o->active)checked @endif>
<label class="custom-control-label" for="active_no">No</label>
</div>
</div>
</div>
<div class="row m-3">
<label class="col-3" for="notes">Notes:</label>
<textarea class="col-9" rows=3 cols=68 name="notes" placeholder="Notes...">{{ $o->notes }}</textarea>
</div>
<div class="row m-3">
<div class="col-12">
<button type="submit" name="submit" class="btn btn-lg btn-success mr-0 float-right">@if ($o->exists)Save @else Add @endif</button>
<a href="{{ url('/') }}" class="btn btn-lg btn-primary float-right">Cancel</a>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="row">
<div class="col-12">
<label for="name" class="form-label">DNS Domain</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-globe"></i></span>
<input type="text" class="form-control @error('dnsdomain') is-invalid @enderror" id="dnsdomain" placeholder="DNS Domain (if applicable)" name="dnsdomain" value="{{ old('dnsdomain',$o->dnsdomain) }}">
@error('dnsdomain')
<span class="invalid-feedback" role="alert">
{{ $message }}
</span>
@enderror
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<label for="active" class="form-label">Active</label>
<div class="input-group has-validation">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="active" id="active_yes" value="1" required @if($o->active)checked @endif>
<label class="btn btn-outline-success" for="active_yes">Yes</label>
<input type="radio" class="btn-check btn-danger" name="active" id="active_no" value="0" required @if(! $o->active)checked @endif>
<label class="btn btn-outline-danger" for="active_no">No</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<label for="notes" class="form-label">Notes</label>
<textarea class="form-control" rows=3 cols=68 name="notes" placeholder="Notes...">{{ old('notes',$o->notes) }}</textarea>
</div>
</div>
<div class="row">
<div class="col-12">
<a href="{{ url('ftn/domain') }}" class="btn btn-danger">Cancel</a>
<button type="submit" name="submit" class="btn btn-success mr-0 float-end">@if ($o->exists)Save @else Add @endif</button>
</div>
</div>
</form>
</div> </div>
</form> </div>
</div> </div>
@endsection @endsection

View File

@ -1,45 +1,60 @@
@extends('layouts.app') @extends('layouts.app')
@section('main-content') @section('content')
<div class="row">
<div class="col-12">
<h2>About the FTN Clearing House</h2>
<p>In FTN network addresses, a domain is the 5th dimension and used when a system supports 5D addressing, ie: zone:hub/host@<strong class="highlight">domain</strong>.</p>
<p>Domains are used with zones to uniquely identify a FTN network.</p>
<p><small>Some legacy Fidonet software is not 5D aware and may behave unexpectedly when a domain is used</small></p>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-6"> <div class="col-6">
<table class="table table-bordered m-5"> <p>This system is aware of the following domains:</p>
<thead>
<tr>
<th>ID</th>
<th>Active</th>
<th>Domain</th>
<th>DNS domain</th>
</tr>
</thead>
<tbody> @if (\App\Models\Domain::count() == 0)
<tr> <p>There are no domains setup, to <a href="{{ url('ftn/domain/addedit') }}">set up your first</a>.</p>
<td colspan="4"><a href="{{ url('ftn/domain/addedit') }}">Add New Domain</a></td> @else
</tr> <table class="table monotable">
@foreach (\App\Models\Domain::cursor() as $oo) <thead>
<tr>
<th>ID</th>
<th>Active</th>
<th>Domain</th>
<th>DNS domain</th>
<th>Zones</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="5"><a href="{{ url('ftn/domain/addedit') }}">Add New Domain</a></td>
</tr>
@foreach (\App\Models\Domain::cursor() as $oo)
<tr> <tr>
<td><a href="{{ url('ftn/domain/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td> <td><a href="{{ url('ftn/domain/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td> <td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td>{{ $oo->name }}</td> <td>{{ $oo->name }}</td>
<td>{{ $oo->dnsdomain }}</td> <td>{{ $oo->dnsdomain }}</td>
<td>{{ join(', ',$oo->zones->pluck('zone_id')->toArray()) }}</td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
@endif
</div> </div>
</div> </div>
@endsection @endsection
@section('page-scripts') @section('page-scripts')
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() {
$('table tr').click(function() { $('table tr').click(function() {
var href = $(this).find("a").attr("href"); var href = $(this).find('a').attr('href');
if(href) {
if (href)
window.location = href; window.location = href;
}
}); });
});
</script> </script>
@append @append

View File

@ -1,4 +1,4 @@
@extends('layouts.app') @extends('layouts.app')
@section('main-content') @section('content')
@endsection @endsection

View File

@ -10,7 +10,7 @@
</div> </div>
<div id="content" class="with-sidebar"> <div id="content" class="with-sidebar">
@yield('main-content') @yield('content')
</div> </div>
<div id="footer" class="shifted"> <div id="footer" class="shifted">