question: only provide #show as GET

This commit is contained in:
Georg Gadinger 2023-01-21 19:55:57 +01:00 committed by Andreas Nedbal
parent b019f24aaa
commit 14f32aa3c0
3 changed files with 11 additions and 5 deletions

View File

@ -8,8 +8,11 @@
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start#paginator
= button_to question_path(@question.user.screen_name, @question.id, last_id: @answers_last_id), class: "btn btn-light" do
= t("voc.load")
= button_to t("voc.load"), question_path(@question.user.screen_name, @question.id),
class: "btn btn-light",
method: :get,
params: { last_id: @answers_last_id },
form: { data: { turbo_stream: true } }
- if user_signed_in? && !current_user.answered?(@question) && current_user != @question.user && @question.user&.privacy_allow_stranger_answers
.card#q-answer-box

View File

@ -4,5 +4,8 @@
= turbo_stream.update "paginator" do
- if @more_data_available
= button_to question_path(@question.user.screen_name, @question.id, last_id: @answers_last_id), class: "btn btn-light" do
= t("voc.load")
= button_to t("voc.load"), question_path(@question.user.screen_name, @question.id),
class: "btn btn-light",
method: :get,
params: { last_id: @answers_last_id },
form: { data: { turbo_stream: true } }

View File

@ -154,7 +154,7 @@ Rails.application.routes.draw do
get "/user/:username(/p/:page)", to: "user#show", defaults: { page: 1 }
get "/@:username(/p/:page)", to: "user#show", as: :user, defaults: { page: 1 }
get "/@:username/a/:id", to: "answer#show", via: "get", as: :answer
match "/@:username/q/:id", to: "question#show", via: [:get, :post], as: :question
get "/@:username/q/:id", to: "question#show", as: :question
get "/@:username/followers(/p/:page)", to: "user#followers", as: :show_user_followers, defaults: { page: 1 }
get "/@:username/followings(/p/:page)", to: "user#followings", as: :show_user_followings, defaults: { page: 1 }
get "/@:username/friends(/p/:page)", to: redirect("/@%{username}/followings/p/%{page}"), defaults: { page: 1 }