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();
$this->validate($request, [
'photo' => 'required|image|max:15000',
'caption' => 'string|max:150'
'photo' => 'required|image|max:15000',
'caption' => 'string|max:150',
'nullable' => 'string|max:420'
]);
$monthHash = hash('sha1', date('Y') . date('m'));
@ -43,6 +44,7 @@ class StatusController extends Controller
$status = new Status;
$status->profile_id = $profile->id;
$status->caption = $request->caption;
$status->description = $request->description;
$status->save();
$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)
<div class="col-12 col-md-4 mb-4">
<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>
</div>
@endforeach
@ -21,4 +25,4 @@
<div class="d-flex justify-content-center">
{{$media->links()}}
</div>
@endsection
@endsection

View file

@ -33,7 +33,11 @@
@foreach($posts as $status)
<div class="col-12 col-md-4 mb-4">
<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>
</div>
@endforeach
@ -41,4 +45,4 @@
</section>
</div>
@endsection
@endsection

View file

@ -101,7 +101,11 @@
@foreach($timeline as $status)
<div class="col-12 col-md-4 mb-4">
<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>
</div>
@endforeach
@ -120,4 +124,4 @@
</div>
@endsection
@endsection

View file

@ -9,7 +9,11 @@
<div class="card-body p-0">
<div class="row">
<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 class="col-12 col-md-4" style="height:100%">
<div class="status-username d-inline-flex align-items-center pr-3 pt-3">
@ -70,4 +74,4 @@
</div>
</div>
@endsection
@endsection

View file

@ -18,7 +18,11 @@
</div>
</div>
<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>
<div class="card-body">
<div class="reactions h3">
@ -78,4 +82,4 @@
<input class="form-control" name="comment" placeholder="Add a comment...">
</form>
</div>
</div>
</div>

View file

@ -30,6 +30,10 @@
<label class="font-weight-bold text-muted small">Caption</label>
<input type="text" class="form-control" name="caption" placeholder="Add a caption here">
</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>
</form>
</div>
@ -59,4 +63,4 @@
</div>
@endsection
@endsection

View file

@ -30,6 +30,10 @@
<label class="font-weight-bold text-muted small">Caption</label>
<input type="text" class="form-control" name="caption" placeholder="Add a caption here">
</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>
</form>
</div>
@ -50,4 +54,4 @@
</div>
@endsection
@endsection