mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-19 01:06:05 +01:00
added Inbox controller
This commit is contained in:
parent
d00575f65e
commit
a7f37fb31c
8 changed files with 35 additions and 0 deletions
3
app/assets/javascripts/inbox.coffee
Normal file
3
app/assets/javascripts/inbox.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/
|
3
app/assets/stylesheets/inbox.css.scss
Normal file
3
app/assets/stylesheets/inbox.css.scss
Normal 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/
|
5
app/controllers/inbox_controller.rb
Normal file
5
app/controllers/inbox_controller.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class InboxController < ApplicationController
|
||||
def show
|
||||
@inbox = Inbox.where(user: current_user).order(:created_at).reverse_order
|
||||
end
|
||||
end
|
2
app/helpers/inbox_helper.rb
Normal file
2
app/helpers/inbox_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module InboxHelper
|
||||
end
|
7
app/views/inbox/show.html.haml
Normal file
7
app/views/inbox/show.html.haml
Normal file
|
@ -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
|
||||
|
|
9
test/controllers/inbox_controller_test.rb
Normal file
9
test/controllers/inbox_controller_test.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
require 'test_helper'
|
||||
|
||||
class InboxControllerTest < ActionController::TestCase
|
||||
test "should get show" do
|
||||
get :show
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
4
test/helpers/inbox_helper_test.rb
Normal file
4
test/helpers/inbox_helper_test.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class InboxHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in a new issue