mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 12:19:52 +01:00
added show answer thing
This commit is contained in:
parent
2284daa161
commit
641fa1ddc3
6 changed files with 20 additions and 3 deletions
3
app/assets/javascripts/answer.coffee
Normal file
3
app/assets/javascripts/answer.coffee
Normal file
|
@ -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/
|
5
app/controllers/answer_controller.rb
Normal file
5
app/controllers/answer_controller.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AnswerController < ApplicationController
|
||||
def show
|
||||
@answer = Answer.find(params[:id])
|
||||
end
|
||||
end
|
2
app/helpers/answer_helper.rb
Normal file
2
app/helpers/answer_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module AnswerHelper
|
||||
end
|
3
app/views/answer/show.html.haml
Normal file
3
app/views/answer/show.html.haml
Normal file
|
@ -0,0 +1,3 @@
|
|||
.container.j2-page
|
||||
= render 'shared/answerbox', a: @answer
|
||||
|
|
@ -8,8 +8,9 @@
|
|||
%h6.text-muted.media-heading.answerbox-question-user
|
||||
= user_screen_name a.question.user, a.question.author_is_anonymous
|
||||
asked
|
||||
= time_ago_in_words(a.question.created_at)
|
||||
ago
|
||||
%a{href: show_user_answer_path(a.user.screen_name, a.id)}
|
||||
= time_ago_in_words(a.question.created_at)
|
||||
ago
|
||||
%p.answerbox-question-text= a.question.content
|
||||
.panel-body
|
||||
%p= a.content
|
||||
|
@ -27,4 +28,4 @@
|
|||
- else
|
||||
.row
|
||||
.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
|
||||
|
||||
root 'static#index'
|
||||
|
||||
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 '/@: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/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer_alt
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue