Skip to content

Commit 467322f

Browse files
committed
Merge branch 'release/v1.4.1'
2 parents 07b8de5 + e445709 commit 467322f

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
## Release notes
44

5-
### Version 1.4
5+
### Version 1.4.1 - 20200323
6+
7+
- add link, route, view for todos in progress
8+
9+
### Version 1.4 - 20200322
610

711
- add page index to list all todos
812
- status design (currents / done)

app/Http/Controllers/TodoController.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class TodoController extends Controller
99
{
1010
/**
11-
* Display a listing of the resource.
11+
* Display a listing of all todos.
1212
*
1313
* @return \Illuminate\Http\Response
1414
*/
@@ -27,6 +27,15 @@ public function done()
2727
return view('todos.index', compact('datas'));
2828
}
2929

30+
/**
31+
* Display a listing of undone's todos
32+
*/
33+
public function undone()
34+
{
35+
$datas = Todo::where('done', 0)->paginate(10);
36+
return view('todos.index', compact('datas'));
37+
}
38+
3039

3140
/**
3241
* Action to change todo's status to done

resources/views/todos/index.blade.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
@extends('layouts.app')
22

33
@section('content')
4-
<a name="" id="" class="btn btn-warning my-4" href="{{ route('todos.create') }}" role="button">Ajouter une todo</a>
5-
{{-- Done todos link --}}
4+
<a name="" id="" class="btn btn-primary my-4" href="{{ route('todos.create') }}" role="button">Ajouter une todo</a>
5+
{{-- Done's todos link --}}
66
@if (Route::currentRouteName() == 'todos.index')
7+
<a name="" id="" class="btn btn-warning my-4" href="{{ route('todos.undone') }}" role="button">Voir les todos
8+
ouvertes</a>
79
<a name="" id="" class="btn btn-success my-4" href="{{ route('todos.done') }}" role="button">Voir les todos
810
terminées</a>
911
{{-- All todos --}}
1012
@elseif (Route::currentRouteName() == 'todos.done')
11-
<a name="" id="" class="btn btn-info my-4" href="{{ route('todos.index') }}" role="button">Voir toutes les Todos</a>
13+
<a name="" id="" class="btn btn-dark my-4" href="{{ route('todos.index') }}" role="button">Voir toutes les todos</a>
14+
<a name="" id="" class="btn btn-warning my-4" href="{{ route('todos.undone') }}" role="button">Voir les todos
15+
ouvertes</a>
16+
{{-- Undone's todos link --}}
17+
@elseif (Route::currentRouteName() == 'todos.undone')
18+
<a name="" id="" class="btn btn-dark my-4" href="{{ route('todos.index') }}" role="button">Voir toutes les todos</a>
19+
<a name="" id="" class="btn btn-success my-4" href="{{ route('todos.done') }}" role="button">Voir les todos
20+
terminées</a>
1221
@endif
1322
{{-- All todos title --}}
1423
@if (Route::currentRouteName() == 'todos.index')
1524
<h1>Toutes les todos</h1>
16-
{{-- Done todos links --}}
25+
{{-- Undone's todos title --}}
26+
@elseif (Route::currentRouteName() == 'todos.undone')
27+
<h1>Toutes les todos ouvertes</h1>
1728
@else
29+
{{-- Done's todos title --}}
1830
<h1>Todos terminées</h1>
1931
@endif
2032
@foreach ($datas as $data)

routes/web.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
Route::get('/a-propos', 'AproposController@index')->name('apropos');
2727

28+
Route::get('todos/undone', 'TodoController@undone')->name('todos.undone');
2829
Route::get('todos/done', 'TodoController@done')->name('todos.done');
2930
Route::put('todos/makedone/{todo}', 'TodoController@makedone')->name('todos.makedone');
3031
Route::resource('todos', 'TodoController');

0 commit comments

Comments
 (0)