added Inbox controller

This commit is contained in:
nilsding 2014-11-11 07:10:41 +01:00
parent d00575f65e
commit a7f37fb31c
8 changed files with 35 additions and 0 deletions

View 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/

View File

@ -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/

View File

@ -0,0 +1,5 @@
class InboxController < ApplicationController
def show
@inbox = Inbox.where(user: current_user).order(:created_at).reverse_order
end
end

View File

@ -0,0 +1,2 @@
module InboxHelper
end

View File

@ -0,0 +1,7 @@
%ul
- @inbox.each do |i|
%li
%strong
= user_screen_name i.question.user
asked
= i.question.content

View File

@ -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

View File

@ -0,0 +1,9 @@
require 'test_helper'
class InboxControllerTest < ActionController::TestCase
test "should get show" do
get :show
assert_response :success
end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class InboxHelperTest < ActionView::TestCase
end