From c211b2939559afba3ddcb301cd2a53f68c055438 Mon Sep 17 00:00:00 2001 From: nilsding Date: Sun, 2 Nov 2014 17:57:37 +0100 Subject: [PATCH] new users controller --- app/assets/javascripts/user.coffee | 3 +++ app/assets/stylesheets/user.css.scss | 3 +++ app/controllers/user_controller.rb | 8 ++++++++ app/helpers/user_helper.rb | 2 ++ app/views/user/edit.html.haml | 2 ++ app/views/user/show.html.haml | 18 ++++++++++++++++++ test/controllers/user_controller_test.rb | 14 ++++++++++++++ test/helpers/user_helper_test.rb | 4 ++++ 8 files changed, 54 insertions(+) create mode 100644 app/assets/javascripts/user.coffee create mode 100644 app/assets/stylesheets/user.css.scss create mode 100644 app/controllers/user_controller.rb create mode 100644 app/helpers/user_helper.rb create mode 100644 app/views/user/edit.html.haml create mode 100644 app/views/user/show.html.haml create mode 100644 test/controllers/user_controller_test.rb create mode 100644 test/helpers/user_helper_test.rb diff --git a/app/assets/javascripts/user.coffee b/app/assets/javascripts/user.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/user.coffee @@ -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/ diff --git a/app/assets/stylesheets/user.css.scss b/app/assets/stylesheets/user.css.scss new file mode 100644 index 00000000..7c5eca9c --- /dev/null +++ b/app/assets/stylesheets/user.css.scss @@ -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/ diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb new file mode 100644 index 00000000..2e9b6e42 --- /dev/null +++ b/app/controllers/user_controller.rb @@ -0,0 +1,8 @@ +class UserController < ApplicationController + def show + @user = User.find_by_screen_name(params[:username]) + end + + def edit + end +end diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb new file mode 100644 index 00000000..0147c3fe --- /dev/null +++ b/app/helpers/user_helper.rb @@ -0,0 +1,2 @@ +module UserHelper +end diff --git a/app/views/user/edit.html.haml b/app/views/user/edit.html.haml new file mode 100644 index 00000000..21cbe9f3 --- /dev/null +++ b/app/views/user/edit.html.haml @@ -0,0 +1,2 @@ +

User#edit

+

Find me in app/views/user/edit.html.erb

diff --git a/app/views/user/show.html.haml b/app/views/user/show.html.haml new file mode 100644 index 00000000..a743938f --- /dev/null +++ b/app/views/user/show.html.haml @@ -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' \ No newline at end of file diff --git a/test/controllers/user_controller_test.rb b/test/controllers/user_controller_test.rb new file mode 100644 index 00000000..af5871b2 --- /dev/null +++ b/test/controllers/user_controller_test.rb @@ -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 diff --git a/test/helpers/user_helper_test.rb b/test/helpers/user_helper_test.rb new file mode 100644 index 00000000..ad44a537 --- /dev/null +++ b/test/helpers/user_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class UserHelperTest < ActionView::TestCase +end