user edit form

This commit is contained in:
2018-07-22 23:08:16 +02:00
parent ddb885b4e2
commit 1c6dedbb34
29 changed files with 730 additions and 395 deletions
+5 -5
View File
@@ -11,26 +11,26 @@
<div class="input-group">
@if($w->prepend)
<div class="input-group-prepend">
<span class="input-group-text">{{$w->prepend}}</span>
<span class="input-group-text">{!! $w->prepend !!}</span>
</div>
@endif
<input id="field-{{ $w->name }}"
name="{{ $w->name }}"
class="form-control{{ $errors->has($w->name) ? ' is-invalid' : '' }}"
class="form-control rounded-right {{ $errors->has($w->name) ? ' is-invalid' : '' }}"
value="{{ $w->value }}"
{!! $w->attributes !!}>
@if($w->append)
<div class="input-group-append">
<span class="input-group-text">{{$w->append}}</span>
<span class="input-group-text">{!! $w->append !!}</span>
</div>
@endif
@if ($errors->has($w->name))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first($w->name) }}</strong>
</span>
<strong>{{ $errors->first($w->name) }}</strong>
</span>
@endif
</div>
</div>
+4 -1
View File
@@ -22,7 +22,10 @@
@include('layouts.main-nav')
<main class="py-4">
@yield('content')
<div class="container">
@include('flash::message')
@yield('content')
</div>
</main>
@include('layouts.footer')
+40 -42
View File
@@ -3,58 +3,56 @@
@extends('layouts.app')
@section('content')
<div class="container">
<form method="POST" action="{{route('table.storeNew')}}" class="row justify-content-center"
aria-label="New Table">
<form method="POST" action="{{route('table.storeNew')}}" class="row justify-content-center"
aria-label="New Table">
@csrf
<div class="col-md-10">
@php(Widget::setLayout(3, 7))
@csrf
<div class="col-md-10">
@php(Widget::setLayout(3, 7))
{!! Widget::header(1, 'New Table') !!}
{!! Widget::header(1, 'New Table') !!}
{!! Widget::text('title', 'Title')->autoAlias('name', '-')
->help('Unique among your tables') !!}
{!! Widget::text('title', 'Title')->autoAlias('name', '-')
->help('Unique among your tables') !!}
{!! Widget::text('name', 'Name')->value('')->prepend(user()->handle.' /')
->help('Unique among your tables, and part of the URL; only letters, digits and
some symbols are allowed.') !!}
{!! Widget::text('name', 'Name')->value('')->prepend(user()->handle.' /')
->help('Unique among your tables, and part of the URL; only letters, digits and
some symbols are allowed.') !!}
{!! Widget::textarea('description', 'Description')->height('8em')
->help('Description of the table. URLs in a full format will be clickable.') !!}
{!! Widget::textarea('description', 'Description')->height('8em')
->help('Description of the table. URLs in a full format will be clickable.') !!}
{!! Widget::text('license', 'License')
->help('License applicable to the table\'s data, if any. By default, all
tables are CC0 or Public Domain.') !!}
{!! Widget::text('license', 'License')
->help('License applicable to the table\'s data, if any. By default, all
tables are CC0 or Public Domain.') !!}
{!! Widget::text('origin', 'Adapted from')
->help('If you took the data from some external site, a book, etc., write it here.
URLs in a full format will be clickable.') !!}
{!! Widget::text('origin', 'Adapted from')
->help('If you took the data from some external site, a book, etc., write it here.
URLs in a full format will be clickable.') !!}
{!! Widget::textarea('columns', 'Columns')->value($exampleColumns)->height('8em')
->help('
<div class="text-left">
Column parameters in CSV format:
<ul class="pl-3 mb-0">
<li><b>column identifier</b><br>letters, numbers, underscore
<li><b>column data type</b><br>int, string, float, bool
<li><b>column title</b><br>used for display (optional)
</ul>
</div>') !!}
{!! Widget::textarea('columns', 'Columns')->value($exampleColumns)->height('8em')
->help('
<div class="text-left">
Column parameters in CSV format:
<ul class="pl-3 mb-0">
<li><b>column identifier</b><br>letters, numbers, underscore
<li><b>column data type</b><br>int, string, float, bool
<li><b>column title</b><br>used for display (optional)
</ul>
</div>') !!}
{!! Widget::textarea('data', 'Initial data')->value($exampleData)->height('12em')
->help('
Initial table data in CSV format, columns corresponding to the
specification you entered above.') !!}
{!! Widget::textarea('data', 'Initial data')->value($exampleData)->height('12em')
->help('
Initial table data in CSV format, columns corresponding to the
specification you entered above.') !!}
<div class="row form-group">
<div class="col-md-7 offset-md-3">
<button type="submit" class="btn btn-primary">
<i class="fa-save pr-2"></i>Create Table
</button>
</div>
<div class="row form-group">
<div class="col-md-7 offset-md-3">
<button type="submit" class="btn btn-primary">
<i class="fa-save pr-2"></i>Create Table
</button>
</div>
</div>
</form>
</div>
</div>
</form>
@endsection
+26 -28
View File
@@ -7,35 +7,33 @@
@endphp
@section('content')
<div class="container">
<div class="row justify-content-center">
<h2>{{ $table->title }}</h2>
</div>
<div class="row justify-content-center">
<div class="row justify-content-center">
<h2>{{ $table->title }}</h2>
</div>
<div class="row justify-content-center">
<div class="col-md-10">
<table class="table table-hover table-sm">
<thead>
<tr>
<th>ID</th>
@foreach($columns as $col)
<th>{{ $col->title }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($rows as $row)
<tr>
<td>#{{ $row->id }}</td>
@php($rdata = json_decode($row['data'], true))
@foreach($columns as $col)
<td data-id="{{ $row->id }}">{{ $rdata[$col->name] }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="col-md-10">
<table class="table table-hover table-sm">
<thead>
<tr>
<th>ID</th>
@foreach($columns as $col)
<th>{{ $col->title }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($rows as $row)
<tr>
<td>#{{ $row->id }}</td>
@php($rdata = json_decode($row['data'], true))
@foreach($columns as $col)
<td data-id="{{ $row->id }}">{{ $rdata[$col->name] }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
+31 -30
View File
@@ -3,46 +3,47 @@
@extends('layouts.app')
@section('content')
<div class="container">
<form method="POST" action="{{route('user.store')}}" class="row justify-content-center"
aria-label="Your Profile">
@csrf
<form method="POST" action="{{route('user.store')}}" class="row justify-content-center"
aria-label="Your Profile">
@csrf
<div class="col-md-10">
@php(Widget::setLayout(3, 7))
<div class="col-md-10">
@php(Widget::setLayout(3, 7))
{!! Widget::header(1, 'Settings') !!}
{!! Widget::header(1, 'Settings') !!}
{!! Widget::text('title', 'Display Name')->value($user->title)->required()->autofocus()
->help('Shown on your profile page, tables, comments, etc.') !!}
{!! Widget::text('title', 'Display Name')->value($user->title)->required()->autofocus()
->help('Shown on your profile page, tables, comments, etc.') !!}
{!! Widget::textarea('bio', 'About Me')->value($user->bio)->required()->height('8em')
->help('This is shown in your profile box') !!}
{!! Widget::text('name', 'Username')->value($user->name)->required()
->prepend('@')
->help('Part of your vanity URL. Caution: changing this will alter URLs of your tables.') !!}
{!! Widget::text('name', 'Username')->value($user->name)->required()
->prepend('@')
->help('Part of your vanity URL. Caution: changing this will alter URLs of your tables.') !!}
{!! Widget::textarea('bio', 'About Me')->value($user->bio)->height('8em')
->help('This is shown in your profile box') !!}
{!! Widget::email('email', 'E-Mail Address')->value($user->email)->required()
->help('Used to login and for password resets.
This field is protected; a change will be applied only after you confirm
the new e-mail address via a confirmation link we\'ll send you to it.') !!}
{!! Widget::text('website', 'Website')->value($user->website)->prepend('<i class="fa-globe"></i>')
->help('Custom clickable link shown on your profile page.') !!}
{!! Widget::header(3, 'Password Change') !!}
{!! Widget::par('Leave empty to keep your current password (if any).') !!}
{!! Widget::email('email', 'E-Mail Address')->value($user->email)->required()
->help('Used to login and for password resets.
This field is protected; a change will be applied only after you confirm
the new e-mail address via a confirmation link we\'ll send you to it.') !!}
{!! Widget::password('new_password', 'New Password') !!}
{!! Widget::header(3, 'Password Change') !!}
{!! Widget::par('Leave empty to keep your current password (if any).') !!}
{!! Widget::password('new_password_confirmation', 'Confirm New Password') !!}
{!! Widget::password('new_password', 'New Password') !!}
<div class="row form-group">
<div class="col-md-7 offset-md-3">
<button type="submit" class="btn btn-primary">
<i class="fa-save pr-2"></i>Apply Changes
</button>
</div>
{!! Widget::password('new_password_confirmation', 'Confirm New Password') !!}
<div class="row form-group">
<div class="col-md-7 offset-md-3">
<button type="submit" class="btn btn-primary">
<i class="fa-save pr-2"></i>Apply Changes
</button>
</div>
</div>
</form>
</div>
</div>
</form>
@endsection
+69 -72
View File
@@ -7,89 +7,86 @@
@endphp
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="row justify-content-center">
{{-- Dash card --}}
<div class="col-md-4">
<div class="card">
<div class="card-header card-header-extra">
<i class="fa-user-circle-o fa-pr fa-large"></i>{{ $user->title }}
{{-- Dash card --}}
<div class="col-md-4">
<div class="card">
<div class="card-header card-header-extra">
<i class="fa-user-circle-o fa-pr fa-large"></i>{{ $user->title }}
@if(authed() && user()->is($user))
<a href="{{route('user.edit')}}" class="btn ml-auto">Edit</a>
@endif
</div>
@if(authed() && user()->is($user))
<a href="{{route('user.edit')}}" class="btn ml-auto">Edit</a>
@endif
</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
@if($user->bio)
@if(mb_strlen($user->bio) > 250)
<p id="bio-short" aria-hidden=true>
{{mb_substr($user->bio, 0, 250)}}…
<a class="text-muted small" title="Show more" href="#" onclick="$('#bio-short').addClass('hidden'); $('#bio-full').removeClass('hidden'); return false;">
[more]
</a>
</p>
<p id="bio-full" class="hidden">
{{ $user->bio }}
<a class="text-muted small" title="Collapse" href="#" onclick="$('#bio-full').addClass('hidden'); $('#bio-short').removeClass('hidden'); return false;">
[collapse]
</a>
</p>
@else
<p>
{{ $user->bio }}
</p>
@endif
@endif
@if($user->website)
@if($user->bio)
@if(mb_strlen($user->bio) > 250)
<p id="bio-short" aria-hidden=true>
{{mb_substr($user->bio, 0, 250)}}
<a class="text-muted small" title="Show more" href="#" onclick="$('#bio-short').addClass('hidden'); $('#bio-full').removeClass('hidden'); return false;">
[more]
</a>
</p>
<p id="bio-full" class="hidden">
{{ $user->bio }}
<a class="text-muted small" title="Collapse" href="#" onclick="$('#bio-full').addClass('hidden'); $('#bio-short').removeClass('hidden'); return false;">
[collapse]
</a>
</p>
@else
<p>
<i class="fa-link fa-pr" aria-label="User's Website" title="User's Website"></i>{{--
--}}<a href="{{ $user->website }}">{{ $user->website }}</a>
{{ $user->bio }}
</p>
@endif
@endif
<p class="mb-0">
<i class="fa-calendar fa-pr" aria-hidden=true></i>{{--
--}}Joined {{ $user->created_at->diffForHumans() }}
@if($user->website)
<p>
<i class="fa-link fa-pr" aria-label="User's Website" title="User's Website"></i>{{--
--}}<a href="{{ $user->website }}">{{ $user->website }}</a>
</p>
</div>
@endif
<p class="mb-0">
<i class="fa-calendar fa-pr" aria-hidden=true></i>{{--
--}}Joined {{ $user->created_at->diffForHumans() }}
</p>
</div>
</div>
{{-- Table list card --}}
<div class="col-md-8">
<div class="card">
<div class="card-header card-header-extra">
<span>
@if(authed() && user()->is($user))
Your Tables
@else
User's Tables
@endif
</span>
<nav class="ml-auto" aria-label="Pages of the table list">
{{ $tables->links(null, ['ulClass' => 'pagination-sm mb-0 pagination-outline-light']) }}
</nav>
@if(authed() && user()->is($user))
<a href="{{route('table.create')}}" class="btn ml-3">New</a>
@endif
</div>
@include('user._table-list')
</div>
</div>
</div>
{{-- Table list card --}}
<div class="col-md-8">
<div class="card">
<div class="card-header card-header-extra">
<span>
@if(authed() && user()->is($user))
Your Tables
@else
User's Tables
@endif
</span>
<nav class="ml-auto" aria-label="Pages of the table list">
{{ $tables->links(null, ['ulClass' => 'pagination-sm mb-0 pagination-outline-light']) }}
</nav>
@if(authed() && user()->is($user))
<a href="{{route('table.create')}}" class="btn ml-3">New</a>
@endif
</div>
@include('user._table-list')
</div>
</div>
</div>
@endsection
+6 -8
View File
@@ -3,15 +3,13 @@
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Dashboard</div>
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Dashboard</div>
<div class="card-body">
<h1>Welcome to the public landing page.</h1>
</div>
<div class="card-body">
<h1>Welcome to the public landing page.</h1>
</div>
</div>
</div>