Bladeren bron

Add static_pages controller

Frans Bergman 7 jaren geleden
bovenliggende
commit
15ef1b387e

+ 3 - 0
app/assets/javascripts/static_pages.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/

+ 3 - 0
app/assets/stylesheets/static_pages.scss

@@ -0,0 +1,3 @@
+// Place all the styles related to the StaticPages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/

+ 7 - 0
app/controllers/static_pages_controller.rb

@@ -0,0 +1,7 @@
+class StaticPagesController < ApplicationController
+  def home
+  end
+
+  def about
+  end
+end

+ 2 - 0
app/helpers/static_pages_helper.rb

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

+ 6 - 0
app/views/static_pages/about.html.erb

@@ -0,0 +1,6 @@
+<h1>About</h1>
+<p>
+  School Platform, abbreviated as <i>SchPlat</i>, <i>SPlat</i> or simply
+  <i>SP</i> is a communications platform for students, teachers and
+  administrative staff in a school environment.
+</p>

+ 2 - 0
app/views/static_pages/home.html.erb

@@ -0,0 +1,2 @@
+<h1>StaticPages#home</h1>
+<p>Find me in app/views/static_pages/home.html.erb</p>

+ 4 - 1
config/routes.rb

@@ -1,3 +1,6 @@
 Rails.application.routes.draw do
-  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
+  root 'static_pages#home'
+
+  get '/home', to: 'static_pages#home'
+  get '/about', to: 'static_pages#about'
 end

+ 14 - 0
test/controllers/static_pages_controller_test.rb

@@ -0,0 +1,14 @@
+require 'test_helper'
+
+class StaticPagesControllerTest < ActionDispatch::IntegrationTest
+  test "should get home" do
+    get home_url
+    assert_response :success
+  end
+
+  test "should get about" do
+    get about_url
+    assert_response :success
+  end
+
+end