Refactor method names/views for Notes

This commit is contained in:
Jonny Barnes 2017-02-15 18:39:39 +00:00
parent e320bec899
commit 5edb495bcb
5 changed files with 11 additions and 11 deletions

View file

@ -24,7 +24,7 @@ class NotesController extends Controller
* @param Illuminate\Http\Request request; * @param Illuminate\Http\Request request;
* @return \Illuminte\View\Factory view * @return \Illuminte\View\Factory view
*/ */
public function showNotes(Request $request) public function index(Request $request)
{ {
$notes = Note::orderBy('id', 'desc')->with('webmentions', 'place', 'media')->paginate(10); $notes = Note::orderBy('id', 'desc')->with('webmentions', 'place', 'media')->paginate(10);
foreach ($notes as $note) { foreach ($notes as $note) {
@ -63,7 +63,7 @@ class NotesController extends Controller
$homepage = ($request->path() == '/'); $homepage = ($request->path() == '/');
return view('notes', compact('notes', 'homepage')); return view('notes.index', compact('notes', 'homepage'));
} }
/** /**
@ -72,7 +72,7 @@ class NotesController extends Controller
* @param string The id of the note * @param string The id of the note
* @return \Illuminate\View\Factory view * @return \Illuminate\View\Factory view
*/ */
public function singleNote($urlId) public function show($urlId)
{ {
$numbers = new Numbers(); $numbers = new Numbers();
$authorship = new Authorship(); $authorship = new Authorship();
@ -161,7 +161,7 @@ class NotesController extends Controller
} }
$note->photoURLs = $photoURLs; $note->photoURLs = $photoURLs;
return view('note', compact('note', 'replies', 'reposts', 'likes')); return view('notes.show', compact('note', 'replies', 'reposts', 'likes'));
} }
/** /**
@ -170,7 +170,7 @@ class NotesController extends Controller
* @param string The decimal id of he note * @param string The decimal id of he note
* @return \Illuminate\Routing\RedirectResponse redirect * @return \Illuminate\Routing\RedirectResponse redirect
*/ */
public function singleNoteRedirect($decId) public function redirect($decId)
{ {
$numbers = new Numbers(); $numbers = new Numbers();
$realId = $numbers->numto60($decId); $realId = $numbers->numto60($decId);
@ -186,7 +186,7 @@ class NotesController extends Controller
* @param string The tag * @param string The tag
* @return \Illuminate\View\Factory view * @return \Illuminate\View\Factory view
*/ */
public function taggedNotes($tag) public function tagged($tag)
{ {
$notes = Note::whereHas('tags', function ($query) use ($tag) { $notes = Note::whereHas('tags', function ($query) use ($tag) {
$query->where('tag', $tag); $query->where('tag', $tag);
@ -196,7 +196,7 @@ class NotesController extends Controller
$note->human_time = $note->updated_at->diffForHumans(); $note->human_time = $note->updated_at->diffForHumans();
} }
return view('taggednotes', compact('notes', 'tag')); return view('notes.tagged', compact('notes', 'tag'));
} }
/** /**

View file

@ -93,10 +93,10 @@ Route::group(['domain' => config('url.longurl')], function () {
Route::post('notes/new', 'MicropubClientController@postNewNote'); Route::post('notes/new', 'MicropubClientController@postNewNote');
//Notes pages using NotesController //Notes pages using NotesController
Route::get('notes', 'NotesController@showNotes'); Route::get('notes', 'NotesController@index');
Route::get('note/{id}', 'NotesController@singleNoteRedirect'); Route::get('notes/{id}', 'NotesController@show');
Route::get('notes/{id}', 'NotesController@singleNote'); Route::get('note/{id}', 'NotesController@redirect');
Route::get('notes/tagged/{tag}', 'NotesController@taggedNotes'); Route::get('notes/tagged/{tag}', 'NotesController@tagged');
//indieauth //indieauth
Route::any('beginauth', 'IndieAuthController@beginauth'); Route::any('beginauth', 'IndieAuthController@beginauth');