Skip to content

Instantly share code, notes, and snippets.

@pobo380
Created May 23, 2012 06:43
Show Gist options
  • Save pobo380/2773584 to your computer and use it in GitHub Desktop.
Save pobo380/2773584 to your computer and use it in GitHub Desktop.
#2-1 投稿ページを作ろう (URLとHTMLの追加)
# coding: utf-8
require 'rubygems'
require 'sinatra'
## トップページ
get '/' do
erb :index
end
## 投稿ページ
get '/new' do
erb :new
end
## 投稿データの受取り
post '/posted' do
end
__END__
@@ layout
<html>
<head>
<title>My Blog</title>
</head>
<body>
<%= yield %>
</body>
</html>
@@ index
<h1>pobo380 on a leash.</h1>
<p>私のブログです</p>
@@ new
<h2>新しい記事を投稿</h2>
<form action="/posted" method="post">
<div>title : <input name="title" type="text"></div>
<div>text : <textarea name="text" cols="80" rows="20"></textarea></div>
<input type="submit" value="submit">
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment