Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added breadcrumbs to posts #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
@import "bootstrap-sprockets";
@import "bootstrap";

.breadcrumb {
background-color: white;
}
.user-info {
margin-top: 9px;
}

.nav {
margin-top: 5px;
}
}
7 changes: 5 additions & 2 deletions app/assets/stylesheets/votes.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Place all the styles related to the Votes controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

.votes {
margin-top:20px;
margin-bottom:10px;
}
.vote-arrows {
width: 40px;
text-align: center;
}
}
2 changes: 1 addition & 1 deletion app/views/posts/_post.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
<%= post.comments.count %> Comments
</small>
</div>
</div>
</div>
59 changes: 36 additions & 23 deletions app/views/posts/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
<div>
<%= render partial: 'votes/voter', locals: { post: @post } %>
<h1>
<%= @post.title %> <br>
<small>
submitted <%= time_ago_in_words(@post.created_at) %> ago by <%= @post.user.name %>
</small>
</h1>
<div class="row">
<ol class="breadcrumb col-md-12">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to @post.topic.name, @post.topic %></li>
<li class="active"><%= @post.title %></li>
</ol>
</div>

<div class="row">
<div class="col-md-8">
<p><%= @post.body %></p>
<div>
<h3>Comments</h3>
<%= render @post.comments %>
</div>
<% if current_user %>
<%= render 'comments/form', comment: Comment.new, post: @post %>
<% end %>
<div class="col-md-1">
<%= render partial: 'votes/voter', locals: { post: @post } %>
</div>
<div class="col-md-9">
<h2>
<%= @post.title %> <br>
<small>submitted <%= time_ago_in_words(@post.created_at) %> ago by <%= @post.user.name %></small>
</h2>
</div>
<% if user_is_authorized_for_post?(@post) %>
<div class="col-md-4">
<div class="col-md-2">
<%= link_to "Edit", edit_topic_post_path(@post.topic, @post), class: 'btn btn-success' %>
<%= link_to "Delete Post", [@post.topic, @post], method: :delete, class: 'btn btn-danger', data: {confirm: 'Are you sure you want to delete this post?'} %>
</div>
<% end %>
<div class="col-md-4">
<h3>
</div>

<div class="row">
<div class="col-md-10">
<p><%= @post.body %></p>
</div>
<div class="col-md-2">
<h4>
<%= pluralize(@post.points, 'point') %>
<div>
<small>
<%= pluralize(@post.up_votes, 'up vote') %>
<%= pluralize(@post.down_votes, 'down vote') %>
</small>
</div>
</h3>
</h4>
</div>
</div>
<div class="row">
<div class="col-md-10">
<h4>Comments</h4>
<%= render @post.comments %>
<% if current_user %>
<%= render 'comments/form', comment: Comment.new, post: @post %>
<% end %>
</div>
<div class="col-md-2">
<% if current_user %>
<%= render partial: 'favorites/favorite', locals: { post: @post } %>
<% end %>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/votes/_voter.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if current_user %>
<div class="vote-arrows pull-left">
<div class="vote-arrows pull-left votes">
<div><%= link_to " ", post_up_vote_path(post), class: 'glyphicon glyphicon-chevron-up', method: :post %></div>
<div><strong><%= post.points %></strong></div>
<div><%= link_to " ", post_down_vote_path(post), class: 'glyphicon glyphicon-chevron-down', method: :post %></div>
</div>
<% end %>
<% end %>