-
-
Save minikomi/928304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
フレームワークを作る。 | |
s - "script" | |
d - "database" | |
e - "template" | |
c - "css" | |
padrino g project blog -s jquery -d activerecord -e haml -c sass | |
cd blog | |
bundle install | |
Modelを作る | |
padrino g model Post title:string body:text date:datetime | |
DBを立ち上げる | |
padrino rake ar:create | |
padrino rake ar:migrate | |
Adminを作る (email, pw を入れる) | |
padrino g admin | |
padrino rake ar:migrate | |
padrino rake seed | |
padrino g admin_page post | |
下記のファイルを作ってください! | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/views/layouts/application.haml | |
!!! | |
%head | |
%link{:href => "/main.css", :rel=> "stylesheet", :type => "text/css"} | |
%title | |
Blog | |
%body | |
=yield |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/controllers.rb | |
Blog.controller do | |
get '/main.css' do | |
content_type 'text/css', :charset => 'utf-8' | |
sass :main | |
end | |
get '/' do | |
@posts = Post.all | |
render :index | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
そして、Root folderから | |
padrino start | |
http://localhost:3000/admin -> login | |
Post -> New -> なんか書く (Date = 19/4/2011とか。。) | |
http://localhost:3000/ -> Blog を みる |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/views/index.haml | |
#h1 | |
Awesome Blog | |
- @posts.each do |post| | |
.post | |
%h2 | |
= post.title | |
Posted: | |
%h3 | |
= "#{post.date.day} / #{post.date.month} / #{post.date.year}" | |
.body | |
= post.body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/views/main.sass | |
body | |
background: #fefefe | |
font-size: 120% | |
font-color: #222222 | |
#h1 | |
font-size: 600% | |
text-align: center | |
.post | |
width: 500px | |
margin-left: auto | |
margin-right: auto | |
border: 6px solid #bbb | |
padding: 10px | |
h2 | |
font: Georgia | |
font-size: 1.2em | |
line-height: 1em | |
margin: 0 | |
h3 | |
display: inline | |
font: Georgia | |
size: 0.8em | |
font-weight: bold | |
.body | |
font-size: 0.8em | |
font: Helvetica, sans-serif | |
border-top: 1px solid #bbb | |
padding: 10px |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment