From 41886223ebffcb48afc61423db136a779be8fbb2 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 22 Dec 2015 23:15:24 -0500 Subject: [PATCH] added scss --- Gemfile | 2 +- Gemfile.lock | 7 +++++++ app/controllers/static_pages_controller.rb | 3 +++ app/views/layouts/application.html.erb | 11 ++++++++--- app/views/static_pages/home.html.erb | 19 +++++++++++++------ config/routes.rb | 2 ++ .../static_pages_controller_test.rb | 7 +++++++ 7 files changed, 41 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index a7164e1..9a56a15 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.5' - +gem 'bootstrap-sass' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets diff --git a/Gemfile.lock b/Gemfile.lock index 5807c02..1ceeee0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,8 +38,14 @@ GEM tzinfo (~> 1.1) ansi (1.5.0) arel (6.0.3) + autoprefixer-rails (6.2.1) + execjs + json binding_of_caller (0.7.3.pre1) debug_inspector (>= 0.0.1) + bootstrap-sass (3.3.6) + autoprefixer-rails (>= 5.2.1) + sass (>= 3.3.4) builder (3.2.2) byebug (3.4.0) columnize (~> 0.8) @@ -195,6 +201,7 @@ PLATFORMS ruby DEPENDENCIES + bootstrap-sass byebug (= 3.4.0) coffee-rails (~> 4.1.0) guard-minitest (= 2.3.1) diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb index 19f79a9..0ef8363 100644 --- a/app/controllers/static_pages_controller.rb +++ b/app/controllers/static_pages_controller.rb @@ -7,4 +7,7 @@ def help def about end + + def contact + end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4682a16..b72877e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,12 +2,17 @@ <%= full_title(yield(:title)) %> - <%= stylesheet_link_tag 'application', media: 'all', - 'data-turbolinks-track' => true %> + <%= stylesheet_link_tag 'application', media: 'all', + 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> + <%= render 'layouts/shim' %> - <%= yield %> + <%= render 'layouts/header' %> +
+ <%= yield %> + <%= render 'layouts/footer' %> +
\ No newline at end of file diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb index 9dd1177..9428fb4 100644 --- a/app/views/static_pages/home.html.erb +++ b/app/views/static_pages/home.html.erb @@ -1,7 +1,14 @@ +
+

Welcome to the Sample App

-

Sample App

-

- This is the home page for the - Ruby on Rails Tutorial - sample application. -

\ No newline at end of file +

+ This is the home page for the + Ruby on Rails Tutorial + sample application. +

+ + <%= link_to "Sign up now!", '#', class: "btn btn-lg btn-primary" %> +
+ +<%= link_to image_tag("rails.png", alt: "Rails logo"), + 'http://rubyonrails.org/' %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index dc3b62c..6da4672 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,6 +4,7 @@ get 'static_pages/help' get 'static_pages/about' + get 'static_pages/contact' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". @@ -11,6 +12,7 @@ # You can have the root of your site routed with "root" # root 'welcome#index' root 'static_pages#home' + # Example of regular route: # get 'products/:id' => 'catalog#view' diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb index 3dc3a3c..b75d345 100644 --- a/test/controllers/static_pages_controller_test.rb +++ b/test/controllers/static_pages_controller_test.rb @@ -1,6 +1,7 @@ require 'test_helper' class StaticPagesControllerTest < ActionController::TestCase + test "should get home" do get :home assert_response :success @@ -18,4 +19,10 @@ class StaticPagesControllerTest < ActionController::TestCase assert_response :success assert_select "title", "About | Ruby on Rails Tutorial Sample App" end + + test "should get contact" do + get :contact + assert_response :success + assert_select "title", "Contact | Ruby on Rails Tutorial Sample App" + end end \ No newline at end of file