Skip to content

Commit

Permalink
Add button to answer the main topic post
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Nov 27, 2024
1 parent 8c18137 commit a876871
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
10 changes: 8 additions & 2 deletions resources/js/pages/forum/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import VuePoll from "../../components/forum/poll.vue";
import VuePostWrapper from "../../components/forum/post-wrapper.vue";
import VuePagination from "../../components/pagination.vue";
import {PostCommentSaved, PostSaved, PostVoted, Subscriber} from "../../libs/live";
import {PostOrdering} from "../../treeTopic/postOrdering";
import store from "../../store/index";
import {notify} from "../../toast";
import {Post} from "../../types/models";
import {PostOrdering} from "../../treeTopic/postOrdering";
import {Post, Topic} from "../../types/models";

export default {
name: 'Posts',
Expand Down Expand Up @@ -81,6 +81,12 @@ export default {
changePage(page: number) {
window.location.href = `?page=${page}`;
},
replyTopicPost() {
const topic: Topic = store.state.topics.topics[0];
if (this.is_mode_tree) {
this.treeShowAnswerForm(topic.first_post_id!);
}
},
reply(post: Post, scrollIntoForm = true) {
const username = post.user ? post.user.name : post.user_name!;
if (this.is_mode_tree) {
Expand Down
22 changes: 14 additions & 8 deletions resources/views/forum/topic.twig
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,20 @@
:post="undefinedPost"
@save="savedForm"
></vue-form>
<div class="alert alert-press" v-else>
Kliknij
<span style="border: 1px solid rgba(119,119,119,0.3); padding:2px 2px 2px 4px; border-radius:4px; margin:0 6px 0 4px;">
{{ icon('postAnswerQuote') }}
Odpowiedz
</span>
przy wybranym poście, żeby na niego odpowiedzieć.
</div>
<template v-else>
<div class="alert alert-press">
Kliknij
<span style="border: 1px solid rgba(119,119,119,0.3); padding:2px 2px 2px 4px; border-radius:4px; margin:0 6px 0 4px;">
{{ icon('postAnswerQuote') }}
Odpowiedz
</span>
przy wybranym poście, żeby na niego odpowiedzieć.
</div>
<div class="alert alert-press" v-else>
<span style="text-decoration:underline; cursor:pointer;" @click="replyTopicPost">Kliknij tutaj</span>,
by odpowiedzieć na główny post wątku.
</div>
</template>
{% endif %}

<section class="page-change-category d-flex my-3">
Expand Down

0 comments on commit a876871

Please sign in to comment.