チェックインノートの改行を表示に反映し、URLっぽい文字列をリンク化するようにした
This commit is contained in:
parent
efea60fc81
commit
53f34c12cc
@ -2,8 +2,18 @@
|
||||
|
||||
namespace App\Utilities;
|
||||
|
||||
use Misd\Linkify\Linkify;
|
||||
|
||||
class Formatter
|
||||
{
|
||||
/** @var Linkify */
|
||||
private $linkify;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->linkify = new Linkify();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通算秒数を日数と時分にフォーマットします。
|
||||
* @param int|float $value 通算秒数
|
||||
@ -16,4 +26,14 @@ class Formatter
|
||||
$minutes = floor($value % 3600 / 60);
|
||||
return "{$days}日 {$hours}時間 {$minutes}分";
|
||||
}
|
||||
|
||||
/**
|
||||
* テキスト内のURLをHTMLのリンクに置き換えます。
|
||||
* @param string $text テキスト
|
||||
* @return string URLをリンクに置き換えた文字列
|
||||
*/
|
||||
public function linkify($text)
|
||||
{
|
||||
return $this->linkify->processUrls($text);
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@
|
||||
"php": ">=7.0.0",
|
||||
"laravel/framework": "5.5.*",
|
||||
"laravel/tinker": "~1.0",
|
||||
"misd/linkify": "^1.1",
|
||||
"parsedown/laravel": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
47
composer.lock
generated
47
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "8fd656953b9909fbcbecf476db92f15c",
|
||||
"content-hash": "49697b9f7b0f02fe37b2bff14bddf200",
|
||||
"packages": [
|
||||
{
|
||||
"name": "dnoegel/php-xdg-base-dir",
|
||||
@ -623,6 +623,51 @@
|
||||
],
|
||||
"time": "2017-08-06T17:41:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "misd/linkify",
|
||||
"version": "v1.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/misd-service-development/php-linkify.git",
|
||||
"reference": "3481b148806a23b4001712de645247a1a4dcc10a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/misd-service-development/php-linkify/zipball/3481b148806a23b4001712de645247a1a4dcc10a",
|
||||
"reference": "3481b148806a23b4001712de645247a1a4dcc10a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0 || ^5.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Misd\\Linkify\\": "src/Misd/Linkify"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "Converts URLs and email addresses in text into HTML links",
|
||||
"homepage": "https://github.com/misd-service-development/php-linkify",
|
||||
"keywords": [
|
||||
"convert",
|
||||
"email address",
|
||||
"link",
|
||||
"url"
|
||||
],
|
||||
"time": "2017-08-17T08:33:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.23.0",
|
||||
|
@ -20,7 +20,7 @@
|
||||
</form>
|
||||
@if (Auth::check())
|
||||
<ul id="accountMenu" class="dropdown-content">
|
||||
<li><a href="{{ route('profile') }}">プロフィール</a></li>
|
||||
<li><a href="{{ route('user.profile') }}">プロフィール</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">ログアウト</a></li>
|
||||
</ul>
|
||||
@ -45,7 +45,7 @@
|
||||
|
||||
<ul id="nav-mobile" class="side-nav">
|
||||
<li><a href="#">{{ Auth::user()->display_name }} さん</a></li>
|
||||
<li><a href="{{ route('profile') }}">プロフィール</a></li>
|
||||
<li><a href="{{ route('user.profile') }}">プロフィール</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">ログアウト</a></li>
|
||||
</ul>
|
||||
|
@ -41,7 +41,7 @@
|
||||
<!-- note -->
|
||||
@if (!empty($ejaculation['note']))
|
||||
<p class="mb-0">
|
||||
{{ $ejaculation['note'] }}
|
||||
{!! Formatter::linkify(nl2br(e($ejaculation['note']))) !!}
|
||||
</p>
|
||||
@endif
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user