Refactor method names/views for Notes

This commit is contained in:
Jonny Barnes 2017-02-15 18:39:39 +00:00
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

@ -0,0 +1,45 @@
@extends('master')
@section('title')
Notes «
@stop
@section('content')
<div class="h-feed">
<!-- the following span stops microformat parses going haywire generating
a name property for the h-feed -->
<span class="p-name"></span>
@foreach ($notes as $note)
<div class="h-entry">
@include('templates.note', ['note' => $note])
</div>
@endforeach
</div>
{!! $notes->render() !!}
@stop
@section('scripts')
<script defer src="/assets/js/links.js"></script>
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
<script defer src="/assets/js/maps.js"></script>
<script defer src="/assets/prism/prism.js"></script>
<link rel="stylesheet" href="/assets/prism/prism.css">
@stop
@section('bio')
@if ($homepage === true)
<div class="h-card">
<p>My name is <span class="p-name p-author">Jonny Barnes</span>, and <a rel="me" href="https://jonnybarnes.uk" class="u-url"><code>jonnybarnes.uk</code></a> is my site. I’m from <a href="https://en.wikipedia.org/wiki/Manchester" class="h-adr p-adr"><span class="p-locality">Manchester</span>, <abbr class="p-country-name" title="United Kingdom">UK</abbr></a>.</p>
<p>I am active to varying degrees on several <a href="https://indieweb.org/silo">silos</a>:</p>
<ul class="social-list">
<li>I keep in touch with friends on <a rel="me" href="https://www.facebook.com/jonnybarnes" class="u-url">Facebook</a></li>
<li>I follow people I find interesting on <a rel="me" href="https://twitter.com/jonnybarnes" class="u-url">Twitter</a></li>
<li>I push code to <a rel="me" href="https://github.com/jonnybarnes" class="u-url">GitHub</a></li>
<li>I scrobble songs to <a rel="me" href="https://last.fm/user/jonnymbarnes" class="u-url">last.fm</a> that I listen to on <a rel="me" href="https://open.spotify.com/user/jonnybarnes89" class="u-url">Spotify</a></li>
</ul>
<p>My usual online nickname is normally <code class="nickname">jonnybarnes</code> for other services. Here’s a <a href="/assets/img/jmb-bw.png" class="u-photo photo">profile pic</a>. I also have a <a class="pgpkey" href="/assets/jonnybarnes-public-key-ecc.asc">PGP key</a>, with <a href="/notes/5g">fingerprint</a>. You can email me at jonny at my domain, or message me on XMPP using the same address.</p>
</div>
@endif
@stop

View file

@ -0,0 +1,44 @@
@extends('master')
@section('title')
{{ strip_tags($note->note) }} « Notes «
@stop
@section('content')
<div class="h-entry">
@include('templates.note', ['note' => $note])
@foreach($replies as $reply)
<div class="u-comment h-cite">
<a class="u-author h-card mini-h-card" href="{{ $reply['url'] }}">
<img src="{{ $reply['photo'] }}" alt="" class="photo u-photo logo"> <span class="fn">{{ $reply['name'] }}</span>
</a> said at <a class="dt-published u-url" href="{{ $reply['source'] }}">{{ $reply['date'] }}</a>
<div class="e-content p-name">
{!! $reply['reply'] !!}
</div>
</div>
@endforeach
@if(count($likes) > 0)<h1 class="notes-subtitle">Likes</h1>@endif
@foreach($likes as $like)
<a href="{{ $like['url'] }}"><img src="{{ $like['photo'] }}" alt="profile picture of {{ $like['name'] }}" class="like-photo"></a>
@endforeach
@if(count($reposts) > 0)<h1 class="notes-subtitle">Reposts</h1>@endif
@foreach($reposts as $repost)
<p><a class="h-card vcard mini-h-card p-author" href="{{ $repost['url'] }}">
<img src="{{ $repost['photo'] }}" alt="profile picture of {{ $repost['name'] }}" class="photo u-photo logo"> <span class="fn">{{ $repost['name'] }}</span>
</a> reposted this at <a href="{{ $repost['source'] }}">{{ $repost['date'] }}</a>.</p>
@endforeach
<!-- these empty tags are for https://brid.gy’s publishing service -->
<a href="https://brid.gy/publish/twitter"></a>
<a href="https://brid.gy/publish/facebook"></a>
</div>
@stop
@section('scripts')
<script defer src="/assets/js/links.js"></script>
<link rel="stylesheet" href="/assets/frontend/mapbox-gl.css">
<script defer src="/assets/js/maps.js"></script>
<script src="/assets/prism/prism.js"></script>
<link rel="stylesheet" href="/assets/prism/prism.css">
@stop

View file

@ -0,0 +1,13 @@
@extends('master')
@section('title')
Tagged Notes «
@stop
@section('content')
<h2>Notes tagged with <em>{{ $tag }}</em></h2>
@foreach ($notes as $note)
<div>{!! $note->note !!}
<a href="/note/{{ $note->id }}">{{ $note->human_time }}</a></div>
@endforeach
@stop

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');