From 2fdbde6e4bf715a6444e3355e923db49ebe1dc2b Mon Sep 17 00:00:00 2001 From: Karim Bogtob Date: Sun, 26 Mar 2023 15:14:50 +0200 Subject: [PATCH] Question 2.3 - Page d'accueil --- README.md | 23 +++++------------------ app/controllers/home_controller.rb | 5 +++++ app/helpers/home_helper.rb | 2 ++ app/views/home/welcome.erb | 3 +++ config/routes.rb | 2 +- test/controllers/home_controller_test.rb | 7 +++++++ 6 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 app/controllers/home_controller.rb create mode 100644 app/helpers/home_helper.rb create mode 100644 app/views/home/welcome.erb create mode 100644 test/controllers/home_controller_test.rb diff --git a/README.md b/README.md index 7db80e4..5f4fc63 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,11 @@ # README -This README would normally document whatever steps are necessary to get the -application up and running. +Commandes lancées : -Things you may want to cover: +Question 2.2 : -* Ruby version +* `rails server` -* System dependencies +Question 2.3 : -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... +* `rails generate controller HomeController` diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb new file mode 100644 index 0000000..e3cdcec --- /dev/null +++ b/app/controllers/home_controller.rb @@ -0,0 +1,5 @@ +# Contrôleur et vue générée avec `rails generate controller HomeController` +class HomeController < ApplicationController + def welcome + end +end diff --git a/app/helpers/home_helper.rb b/app/helpers/home_helper.rb new file mode 100644 index 0000000..23de56a --- /dev/null +++ b/app/helpers/home_helper.rb @@ -0,0 +1,2 @@ +module HomeHelper +end diff --git a/app/views/home/welcome.erb b/app/views/home/welcome.erb new file mode 100644 index 0000000..7707e72 --- /dev/null +++ b/app/views/home/welcome.erb @@ -0,0 +1,3 @@ +

Les joyeux de la couronne

+ +

Bienvenue !

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 262ffd5..70c2da8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,5 +2,5 @@ Rails.application.routes.draw do # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Defines the root path route ("/") - # root "articles#index" + root 'home#welcome' end diff --git a/test/controllers/home_controller_test.rb b/test/controllers/home_controller_test.rb new file mode 100644 index 0000000..eac0e33 --- /dev/null +++ b/test/controllers/home_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class HomeControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end