fix CSS & add description

This commit is contained in:
2020-08-02 11:22:19 +02:00
parent 8d49c38115
commit 81b600339f
6 changed files with 12 additions and 7 deletions

View File

@@ -79,7 +79,7 @@ class BookmarkController extends Controller
if(empty($matches)) { if(empty($matches)) {
$metas['favicon'] = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST).$metas['favicon']; $metas['favicon'] = parse_url($url, PHP_URL_SCHEME).'://'.parse_url($url, PHP_URL_HOST).$metas['favicon'];
} }
// dd($metas['favicon'], $matches, !isset($matches[1]), empty($matches)); //dd($metas['favicon'], $matches, !isset($matches[1]), empty($matches));
} else { } else {
$metas['favicon'] = null; $metas['favicon'] = null;
} }

View File

@@ -21,6 +21,7 @@ class Bookmark extends JsonResource
'attributes' => [ 'attributes' => [
'data' => [ 'data' => [
'name' => $this->name, 'name' => $this->name,
'description' => $this->description,
'url' => $this->url, 'url' => $this->url,
'favicon' => $this->favicon, 'favicon' => $this->favicon,
'created_at' => $this->created_at->diffForHumans(), 'created_at' => $this->created_at->diffForHumans(),

View File

@@ -17,6 +17,7 @@ class CreateBookmarksTable extends Migration
$table->id(); $table->id();
$table->unsignedBigInteger('user_id'); $table->unsignedBigInteger('user_id');
$table->string('name')->nullable(); $table->string('name')->nullable();
$table->string('description')->nullable();
$table->string('url'); $table->string('url');
$table->string('favicon')->nullable(); $table->string('favicon')->nullable();
$table->timestamps(); $table->timestamps();

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="bg-gray-300 rounded text-black m-2 p-2"> <div class="bg-white rounded text-black m-2 p-2">
<div v-if="!edit" class="edit flex flex-wrap items-center"> <div v-if="!edit" class="edit flex flex-wrap items-center">
<a :href="bookmark.data.attributes.data.url" <a :href="bookmark.data.attributes.data.url"
class="flex-1"> class="flex-1">

View File

@@ -6,8 +6,8 @@
<InputField name="name" label="Title" placeholder="Your Title" @update:field="name = $event" :errors="errors" classes="border" /> <InputField name="name" label="Title" placeholder="Your Title" @update:field="name = $event" :errors="errors" classes="border" />
<InputField name="name" label="Url" placeholder="Website Url" required @update:field="url = $event" :errors="errors" classes="border" /> <InputField name="name" label="Url" placeholder="Website Url" required @update:field="url = $event" :errors="errors" classes="border" />
<div class="flex justify-center mx-2 my-4"> <div class="flex justify-center mx-2 my-4">
<button class="btn mr-2" @click="modal = ! modal">Cancel</button> <button class="btn-primary mr-2" @click="create">Create</button>
<button class="btn-primary" @click="create">Create</button> <button class="btn" @click="modal = ! modal">Cancel</button>
</div> </div>
</div> </div>
<div class="flex justify-between mb-1"> <div class="flex justify-between mb-1">
@@ -16,7 +16,7 @@
<a href="#" class="btn-primary" @click="modal = ! modal">Add Bookmark</a> <a href="#" class="btn-primary" @click="modal = ! modal">Add Bookmark</a>
</div> </div>
<Loader v-if="loading" /> <Loader v-if="loading" />
<div v-else class="flex flex-wrap -m-2 mt-2"> <div v-else class="flex flex-wrap -mx-2 mt-2">
<div v-if="bookmarks.length < 1" class="font-bold p-2">No Bookmark Yet</div> <div v-if="bookmarks.length < 1" class="font-bold p-2">No Bookmark Yet</div>
<div v-else <div v-else
v-for="(bookmark, index) in bookmarks" v-for="(bookmark, index) in bookmarks"

View File

@@ -25,8 +25,9 @@ class BookmarkTest extends TestCase
$this->assertCount(1, Bookmark::all()); $this->assertCount(1, Bookmark::all());
$this->assertEquals('Test Name', $bookmark->name); $this->assertEquals('Test Name', $bookmark->name);
$this->assertEquals('Test Description', $bookmark->description);
$this->assertEquals('https://portal.bricooli.fr', $bookmark->url); $this->assertEquals('https://portal.bricooli.fr', $bookmark->url);
$this->assertEquals('https://portal.bricooli.fr/img/logo.svg', $bookmark->favicon); // $this->assertEquals('https://portal.bricooli.fr/img/logo.svg', $bookmark->favicon);
$response->assertStatus(201); $response->assertStatus(201);
$response->assertJson([ $response->assertJson([
@@ -36,8 +37,9 @@ class BookmarkTest extends TestCase
'attributes' => [ 'attributes' => [
'data' => [ 'data' => [
'name' => $bookmark->name, 'name' => $bookmark->name,
'description' => $bookmark->description,
'url' => $bookmark->url, 'url' => $bookmark->url,
'favicon' => $bookmark->favicon, // 'favicon' => $bookmark->favicon,
] ]
], ],
], ],
@@ -205,6 +207,7 @@ class BookmarkTest extends TestCase
{ {
return [ return [
'name' => 'Test Name', 'name' => 'Test Name',
'description' => 'Test Description',
'url' => 'https://portal.bricooli.fr', 'url' => 'https://portal.bricooli.fr',
'favicon' => 'https://portal.bricooli.fr/img/logo.svg', 'favicon' => 'https://portal.bricooli.fr/img/logo.svg',
]; ];