added show answer thing
This commit is contained in:
parent
2284daa161
commit
641fa1ddc3
|
@ -0,0 +1,3 @@
|
||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AnswerController < ApplicationController
|
||||||
|
def show
|
||||||
|
@answer = Answer.find(params[:id])
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module AnswerHelper
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
.container.j2-page
|
||||||
|
= render 'shared/answerbox', a: @answer
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
%h6.text-muted.media-heading.answerbox-question-user
|
%h6.text-muted.media-heading.answerbox-question-user
|
||||||
= user_screen_name a.question.user, a.question.author_is_anonymous
|
= user_screen_name a.question.user, a.question.author_is_anonymous
|
||||||
asked
|
asked
|
||||||
|
%a{href: show_user_answer_path(a.user.screen_name, a.id)}
|
||||||
= time_ago_in_words(a.question.created_at)
|
= time_ago_in_words(a.question.created_at)
|
||||||
ago
|
ago
|
||||||
%p.answerbox-question-text= a.question.content
|
%p.answerbox-question-text= a.question.content
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
root 'static#index'
|
root 'static#index'
|
||||||
|
|
||||||
match '/about', to: 'static#about', via: 'get'
|
match '/about', to: 'static#about', via: 'get'
|
||||||
|
@ -38,5 +39,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
match '/user/:username(/p/:page)', to: 'user#show', via: 'get', defaults: {page: 1}
|
match '/user/:username(/p/:page)', to: 'user#show', via: 'get', defaults: {page: 1}
|
||||||
match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1}
|
match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1}
|
||||||
|
match '/@:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer
|
||||||
match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1}
|
match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1}
|
||||||
|
match '/:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer_alt
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue