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,8 +8,9 @@
|
||||||
%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
|
||||||
= time_ago_in_words(a.question.created_at)
|
%a{href: show_user_answer_path(a.user.screen_name, a.id)}
|
||||||
ago
|
= time_ago_in_words(a.question.created_at)
|
||||||
|
ago
|
||||||
%p.answerbox-question-text= a.question.content
|
%p.answerbox-question-text= a.question.content
|
||||||
.panel-body
|
.panel-body
|
||||||
%p= a.content
|
%p= a.content
|
||||||
|
@ -27,4 +28,4 @@
|
||||||
- else
|
- else
|
||||||
.row
|
.row
|
||||||
.col-md-6.col-md-offset-6.col-sm-8.col-sm-offset-4.col-xs-6.col-xs-offset-6.text-right
|
.col-md-6.col-md-offset-6.col-sm-8.col-sm-offset-4.col-xs-6.col-xs-offset-6.text-right
|
||||||
= render 'shared/answerbox_buttons', a: a
|
= render 'shared/answerbox_buttons', a: a
|
||||||
|
|
|
@ -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