Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
added bootstrap styles
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybrueder committed Sep 29, 2014
1 parent 8acc465 commit 3b24b7a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 18 deletions.
2 changes: 1 addition & 1 deletion views/about/index.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href="/">Back to home page</a>
<a class="btn btn-primary" href="/">Back to home page</a>

<h1>About me</h1>

Expand Down
29 changes: 29 additions & 0 deletions views/layout.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<html lang="en">
<head>
<title>My Blog</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="/">My Blog</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/about">About</a></li>
</ul>
</div>
</div>
</div>

<div class="container" style="margin-top:60px; padding-top:20px">

<div class="starter-template">
<%= yield %>
</div>

</div>
</body>
</html>
10 changes: 5 additions & 5 deletions views/posts/edit.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<h1>Edit - <%= @post.title %></h1>

<form action="/posts/<%= @post.id %>" method="post">
<form action="/posts/<%= @post.id %>" method="post" role="form">
<input type="hidden" name="_method" value="put" />

<label for="post_title">Title:</label><br />
<input id="post_title" name="post[title]" type="text" value="<%= @post.title %>" />
<input id="post_title" class="form-control" name="post[title]" type="text" value="<%= @post.title %>" />
<br />

<label for="post_text">Body:</label><br />
<textarea id="post_text" name="post[text]" rows="5"><%= @post.text %></textarea>
<textarea id="post_text" class="form-control" name="post[text]" rows="5"><%= @post.text %></textarea>
<br />

<input type="submit" value="Update" />
<input class="btn btn-success" type="submit" value="Update" />
</form>

<h2>Delete this post</h2>

<form action="/posts/<%= @post.id %>" method="post">
<input type="hidden" name="_method" value="delete" />
<input type="submit" value="Delete" />
<input class="btn btn-danger" type="submit" value="Delete" />
</form>
13 changes: 5 additions & 8 deletions views/posts/index.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<h1>My Blog</h1>
<a class="btn btn-success" href="/posts/new">Create new post</a>

<a href="/posts/new">Create new post</a>
<a href="/about">About</a>

<ul>
<% @posts.each do |post| %>
<li id="post_<%= post.title.downcase.tr(" ", "_") %>">
<div class="panel panel-default" style="margin-top:20px">
<div class="panel-body" id="post_<%= post.title.downcase.tr(" ", "_") %>">
<h2>
<a href="/posts/<%= post.id %>"><%= post.title %></a>
</h2>
Length: <%= post.number_of_characters %>
<a href="/posts/<%= post.id %>/edit">Edit</a>
</li>
</div>
</div>
<% end %>
</ul>
8 changes: 4 additions & 4 deletions views/posts/new.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<h1>New Post</h1>

<form action="/posts" method="post">
<form action="/posts" method="post" role="form">
<label for="post_title">Title:</label><br />
<input id="post_title" name="post[title]" type="text" value="<%= @post.title %>" />
<input id="post_title" class="form-control" name="post[title]" type="text" value="<%= @post.title %>" />
<br />

<label for="post_text">Body:</label><br />
<textarea id="post_text" name="post[text]" rows="5"><%= @post.text %></textarea>
<textarea id="post_text" class="form-control" name="post[text]" rows="5"><%= @post.text %></textarea>
<br />

<input type="submit" value="Save" />
<input type="submit" value="Save" class="btn btn-success" />
</form>

0 comments on commit 3b24b7a

Please sign in to comment.