added Inbox controller
This commit is contained in:
parent
d00575f65e
commit
a7f37fb31c
|
@ -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,3 @@
|
|||
// Place all the styles related to the inbox controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,5 @@
|
|||
class InboxController < ApplicationController
|
||||
def show
|
||||
@inbox = Inbox.where(user: current_user).order(:created_at).reverse_order
|
||||
end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module InboxHelper
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
%ul
|
||||
- @inbox.each do |i|
|
||||
%li
|
||||
%strong
|
||||
= user_screen_name i.question.user
|
||||
asked
|
||||
= i.question.content
|
|
@ -27,6 +27,8 @@ Rails.application.routes.draw do
|
|||
match '/ask', to: 'question#create', via: :post, as: :ask
|
||||
end
|
||||
|
||||
match '/inbox', to: 'inbox#show', via: 'get'
|
||||
|
||||
match '/user/:username', to: 'user#show', via: 'get'
|
||||
match '/@:username', to: 'user#show', via: 'get', as: :show_user_profile
|
||||
match '/:username', to: 'user#show', via: 'get', as: :show_user_profile_alt
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class InboxControllerTest < ActionController::TestCase
|
||||
test "should get show" do
|
||||
get :show
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class InboxHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in New Issue