aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-12-08 01:26:57 -0500
committerTeddy Wing2015-12-08 01:26:57 -0500
commita6c33077c7ac124e6c4db6ad272ab67226aba354 (patch)
tree9d4e7be8afa09ac666a9b70f170391aaf25bdf3c
parent61e3141fb526e6a967e9eee01de4fae474b4e9cc (diff)
downloadRuby-Web-Sessions-Exercise-a6c33077c7ac124e6c4db6ad272ab67226aba354.tar.bz2
Add layout.erb
Move boilerplate code from `index.erb` into `layout.erb` to allow us to use it in additional templates.
-rw-r--r--views/index.erb37
-rw-r--r--views/layout.erb10
2 files changed, 24 insertions, 23 deletions
diff --git a/views/index.erb b/views/index.erb
index 4425304..ff06792 100644
--- a/views/index.erb
+++ b/views/index.erb
@@ -1,24 +1,15 @@
-<!doctype html>
-<html lang="en">
-<head>
- <meta charset="utf-8">
- <title>Ruby Session Exercise</title>
-</head>
-<body>
- <h1>Login</h1>
+<h1>Login</h1>
+
+<form action="." method="post">
+ <div>
+ Username: <input type="text" name="username" />
+ </div>
- <form action="." method="post">
- <div>
- Username: <input type="text" name="username" />
- </div>
-
- <div>
- Password: <input type="password" name="password" />
- </div>
-
- <div>
- <input type="submit" value="Login" />
- </div>
- </form>
-</body>
-</html>
+ <div>
+ Password: <input type="password" name="password" />
+ </div>
+
+ <div>
+ <input type="submit" value="Login" />
+ </div>
+</form>
diff --git a/views/layout.erb b/views/layout.erb
new file mode 100644
index 0000000..e4a6105
--- /dev/null
+++ b/views/layout.erb
@@ -0,0 +1,10 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Ruby Session Exercise</title>
+</head>
+<body>
+ <%= yield %>
+</body>
+</html>