Add description for visually impaired field

Signed-off-by: Marcin Mikołajczak <me@m4sk.in>
This commit is contained in:
Marcin Mikołajczak 2018-06-01 22:27:27 +02:00
parent 1b794c8508
commit ba454e38e8
9 changed files with 76 additions and 14 deletions

View file

@ -30,8 +30,9 @@ class StatusController extends Controller
$user = Auth::user(); $user = Auth::user();
$this->validate($request, [ $this->validate($request, [
'photo' => 'required|image|max:15000', 'photo' => 'required|image|max:15000',
'caption' => 'string|max:150' 'caption' => 'string|max:150',
'nullable' => 'string|max:420'
]); ]);
$monthHash = hash('sha1', date('Y') . date('m')); $monthHash = hash('sha1', date('Y') . date('m'));
@ -43,6 +44,7 @@ class StatusController extends Controller
$status = new Status; $status = new Status;
$status->profile_id = $profile->id; $status->profile_id = $profile->id;
$status->caption = $request->caption; $status->caption = $request->caption;
$status->description = $request->description;
$status->save(); $status->save();
$media = new Media; $media = new Media;

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDescriptionColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('statuses', function (Blueprint $table) {
$table->string('description')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('statuses', function (Blueprint $table) {
$table->dropColumn('description');
});
}
}

View file

@ -11,7 +11,11 @@
@foreach($media as $status) @foreach($media as $status)
<div class="col-12 col-md-4 mb-4"> <div class="col-12 col-md-4 mb-4">
<a class="card" href="{{$status->url()}}"> <a class="card" href="{{$status->url()}}">
<img class="card-img-top" src="{{$status->thumb()}}" width="150px" height="150px"> <img class="card-img-top" src="{{$status->thumb()}}" width="150px" height="150px"
@if($status->description)
alt="{{$status->description}}"
@endif
>
</a> </a>
</div> </div>
@endforeach @endforeach

View file

@ -33,7 +33,11 @@
@foreach($posts as $status) @foreach($posts as $status)
<div class="col-12 col-md-4 mb-4"> <div class="col-12 col-md-4 mb-4">
<a class="card" href="{{$status->url()}}"> <a class="card" href="{{$status->url()}}">
<img class="card-img-top" src="{{$status->thumb()}}" width="300px" height="300px"> <img class="card-img-top" src="{{$status->thumb()}}" width="300px" height="300px"
@if($status->description)
alt="{{$status->description}}"
@endif
>
</a> </a>
</div> </div>
@endforeach @endforeach

View file

@ -101,7 +101,11 @@
@foreach($timeline as $status) @foreach($timeline as $status)
<div class="col-12 col-md-4 mb-4"> <div class="col-12 col-md-4 mb-4">
<a class="card" href="{{$status->url()}}"> <a class="card" href="{{$status->url()}}">
<img class="card-img-top" src="{{$status->thumb()}}" width="300px" height="300px"> <img class="card-img-top" src="{{$status->thumb()}}" width="300px" height="300px"
@if($status->description)
alt="{{$status->description}}"
@endif
>
</a> </a>
</div> </div>
@endforeach @endforeach

View file

@ -9,7 +9,11 @@
<div class="card-body p-0"> <div class="card-body p-0">
<div class="row"> <div class="row">
<div class="col-12 col-md-8 status-photo"> <div class="col-12 col-md-8 status-photo">
<img src="{{$status->mediaUrl()}}" width="100%"> <img src="{{$status->mediaUrl()}}" width="100%"
@if($status->description)
alt="{{$status->description}}"
@endif
>
</div> </div>
<div class="col-12 col-md-4" style="height:100%"> <div class="col-12 col-md-4" style="height:100%">
<div class="status-username d-inline-flex align-items-center pr-3 pt-3"> <div class="status-username d-inline-flex align-items-center pr-3 pt-3">

View file

@ -18,7 +18,11 @@
</div> </div>
</div> </div>
<a href="{{$item->url()}}"> <a href="{{$item->url()}}">
<img class="card-img-top" src="{{$item->mediaUrl()}}"> <img class="card-img-top" src="{{$item->mediaUrl()}}"
@if($item->description)
alt="{{$item->description}}"
@endif
>
</a> </a>
<div class="card-body"> <div class="card-body">
<div class="reactions h3"> <div class="reactions h3">

View file

@ -30,6 +30,10 @@
<label class="font-weight-bold text-muted small">Caption</label> <label class="font-weight-bold text-muted small">Caption</label>
<input type="text" class="form-control" name="caption" placeholder="Add a caption here"> <input type="text" class="form-control" name="caption" placeholder="Add a caption here">
</div> </div>
<div class="form-group">
<label class="font-weight-bold text-muted small">Alternative text</label>
<input type="text" class="form-control" name="description" placeholder="Describe for the visually impaired">
</div>
<button type="submit" class="btn btn-outline-primary btn-block">Post</button> <button type="submit" class="btn btn-outline-primary btn-block">Post</button>
</form> </form>
</div> </div>

View file

@ -30,6 +30,10 @@
<label class="font-weight-bold text-muted small">Caption</label> <label class="font-weight-bold text-muted small">Caption</label>
<input type="text" class="form-control" name="caption" placeholder="Add a caption here"> <input type="text" class="form-control" name="caption" placeholder="Add a caption here">
</div> </div>
<div class="form-group">
<label class="font-weight-bold text-muted small">Alternative text</label>
<input type="text" class="form-control" name="description" placeholder="Describe for the visually impaired">
</div>
<button type="submit" class="btn btn-outline-primary btn-block">Post</button> <button type="submit" class="btn btn-outline-primary btn-block">Post</button>
</form> </form>
</div> </div>