Commit 5c3cb5c3 by tady

breadcrumble パンくず追加

parent d711f79f
...@@ -126,3 +126,5 @@ gem 'paper_trail', '~> 3.0.0' ...@@ -126,3 +126,5 @@ gem 'paper_trail', '~> 3.0.0'
gem 'aws-sdk' gem 'aws-sdk'
gem 'newrelic_rpm' gem 'newrelic_rpm'
gem 'breadcrumble'
...@@ -52,6 +52,8 @@ GEM ...@@ -52,6 +52,8 @@ GEM
erubis (>= 2.6.6) erubis (>= 2.6.6)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
breadcrumble (4.0.0)
rails (>= 4.0.0)
builder (3.1.4) builder (3.1.4)
capistrano (3.1.0) capistrano (3.1.0)
i18n i18n
...@@ -358,6 +360,7 @@ DEPENDENCIES ...@@ -358,6 +360,7 @@ DEPENDENCIES
aws-sdk aws-sdk
better_errors better_errors
binding_of_caller binding_of_caller
breadcrumble
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (~> 1.1.2) capistrano-bundler (~> 1.1.2)
capistrano-rails (~> 1.1) capistrano-rails (~> 1.1)
......
...@@ -3,6 +3,8 @@ class ApplicationController < ActionController::Base ...@@ -3,6 +3,8 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception protect_from_forgery with: :exception
add_breadcrumb("Rendezvous", '/')
def require_login def require_login
unless user_signed_in? unless user_signed_in?
flash[:alert] = 'You need Login!' flash[:alert] = 'You need Login!'
......
...@@ -19,6 +19,11 @@ class PostsController < ApplicationController ...@@ -19,6 +19,11 @@ class PostsController < ApplicationController
# GET /posts/1 # GET /posts/1
# GET /posts/1.json # GET /posts/1.json
def show def show
@post.tags.each do |_tag|
add_breadcrumb("##{_tag.name}", _tag.decorate.show_path)
end
add_breadcrumb(@post.title)
if params[:fragment].present? if params[:fragment].present?
render layout: false, partial: 'posts/show_fragment' render layout: false, partial: 'posts/show_fragment'
else else
......
<ol class="breadcrumb">
<% breadcrumbs.each_with_index do |crumb, i| %>
<li itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
<% span_title = content_tag(:span, crumb[:name], itemprop: "title") %>
<% if crumb[:url] == nil %>
<%= span_title %>
<% else %>
<%= link_to_unless_current span_title, crumb[:url], itemprop: "url" %>
<% end %>
</li>
<% end %>
</ol>
<span itemscope="child" itemtype="http://data-vocabulary.org/Breadcrumb">
<% span_title = content_tag(:span, trail[0][:name], itemprop: "title") %>
<% if trail[0][:url] == nil %>
<%= span_title %>
<% else %>
<%= link_to_unless_current span_title, trail[0][:url], itemprop: "url" %>
<% end %>
<% if trail.size > 1 %>
&gt;<%= render partial: 'breadcrumble/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
<% end %>
</span>
<div>
<% breadcrumb_trails.each do |trail| %>
<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<% span_title = content_tag(:span, trail[0][:name], itemprop: "title") %>
<% if trail[0][:url] == nil %>
<%= span_title %>
<% else %>
<%= link_to_unless_current span_title, trail[0][:url], itemprop: "url" %>
<% end %>
<% if trail.size > 1 %>
&gt;<%= render partial: 'breadcrumble/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
<% end %>
</div>
<% end %>
</div>
...@@ -29,6 +29,10 @@ Have a nice $$$$$$$\ $$\ ...@@ -29,6 +29,10 @@ Have a nice $$$$$$$\ $$\
<%= render partial: 'partials/app_header' %> <%= render partial: 'partials/app_header' %>
<%- end -%> <%- end -%>
<div class="container">
<%= render_breadcrumbs %>
</div><!--/.container-->
<div class="container container-main"> <div class="container container-main">
<%= yield %> <%= yield %>
</div><!--/.container--> </div><!--/.container-->
......
require 'spec_helper'
describe "posts/show.html.erb" do
pending "パンくず"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment