mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-21 12:47:48 +01:00
new users controller
This commit is contained in:
parent
cc4bf8d277
commit
c211b29395
8 changed files with 54 additions and 0 deletions
3
app/assets/javascripts/user.coffee
Normal file
3
app/assets/javascripts/user.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/user.css.scss
Normal file
3
app/assets/stylesheets/user.css.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the user controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
8
app/controllers/user_controller.rb
Normal file
8
app/controllers/user_controller.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class UserController < ApplicationController
|
||||
def show
|
||||
@user = User.find_by_screen_name(params[:username])
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
end
|
2
app/helpers/user_helper.rb
Normal file
2
app/helpers/user_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module UserHelper
|
||||
end
|
2
app/views/user/edit.html.haml
Normal file
2
app/views/user/edit.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
<h1>User#edit</h1>
|
||||
<p>Find me in app/views/user/edit.html.erb</p>
|
18
app/views/user/show.html.haml
Normal file
18
app/views/user/show.html.haml
Normal file
|
@ -0,0 +1,18 @@
|
|||
.container.user-page
|
||||
.col-md-3.col-xs-12.col-sm-3
|
||||
.panel.panel-default
|
||||
.panel-body
|
||||
.row
|
||||
.col-md-12.col-xs-12.col-sm-9
|
||||
%img.img-rounded.img-profile
|
||||
%h1
|
||||
= @user.screen_name
|
||||
%ul.list-group
|
||||
%li.list-group-item
|
||||
Followers
|
||||
%span.badge#follower-count= @user.follower_count
|
||||
%li.list-group-item
|
||||
Followings
|
||||
%span.badge#friend-count= @user.friend_count
|
||||
.col-md-9.col-xs-12.col-sm-9
|
||||
= render 'shared/questionbox'
|
14
test/controllers/user_controller_test.rb
Normal file
14
test/controllers/user_controller_test.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UserControllerTest < ActionController::TestCase
|
||||
test "should get show" do
|
||||
get :show
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get :edit
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
4
test/helpers/user_helper_test.rb
Normal file
4
test/helpers/user_helper_test.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UserHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in a new issue