Skip to content

Commit

Permalink
improve tags
Browse files Browse the repository at this point in the history
  • Loading branch information
fr0tt committed Aug 22, 2022
1 parent e535578 commit 14eb031
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions app/Http/Controllers/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers;

use App\PostTag;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Tag;
Expand Down Expand Up @@ -83,6 +84,8 @@ public function destroy($id)
return response()->json('Tag not found.', 400);
}
$this->authorize('delete', $tag);

PostTag::where('tag_id', $id)->delete();
$tag->delete();

return response()->json('', 204);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "App for bookmarks and notes.",
"keywords": ["laravel", "lumen", "bookmark", "notes"],
"license": "MIT",
"version": "2.2.9-p1",
"version": "2.2.9-p2",
"type": "project",
"require": {
"php": "^7.2.5",
Expand Down
2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/service-worker.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/js/components/PostItemTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default {
}
}
.tags.item-text {
position: absolute;
margin-top: -0.875rem;
}
.tags .tag:hover {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/PostItemText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class="text-orange-600 text-xl bg-transparent font-semibold" />
<EditorContent :editor="editor" class="editorContent" />
</div>
<PostItemTags :tags="post.tags" class="item-text" />
<PostItemTags v-if="!isActive" :tags="post.tags" class="item-text" />
</div>
<svg
v-if="permission > 4"
Expand Down
6 changes: 3 additions & 3 deletions resources/js/components/pages/Post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,18 @@ export default {
})
.then((response) => {
existingTags = existingTags.concat(response.data.data)
resolve(existingTags.map((tag) => tag.id))
resolve(existingTags)
})
.catch(() => {
this.$store.dispatch('notification/setNotification', {
type: 'error',
title: 'Error',
description: 'Tag(s) could not be created.',
})
resolve(existingTags.map((tag) => tag.id))
resolve(existingTags)
})
} else {
resolve(existingTags.map((tag) => tag.id))
resolve(existingTags)
}
})
},
Expand Down
2 changes: 1 addition & 1 deletion resources/js/store/modules/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default {
params.content = post.content
params.collection_id = post.collection_id
params.is_uncategorized = (post.collection_id <= 0) | 0
params.tags = post.tags
params.tags = post.tags.map((tag) => tag.id)
if (restore) {
params.is_archived = false
}
Expand Down

0 comments on commit 14eb031

Please sign in to comment.