Commit e31bc0a0 by tady

Merge pull request #50 from tadyjp/wip/140306_breadcrumb

[WIP] パンくず
parents ca366ef6 494b8ea4
...@@ -3,7 +3,7 @@ source 'https://rubygems.org' ...@@ -3,7 +3,7 @@ source 'https://rubygems.org'
ruby '2.0.0' ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.0' gem 'rails', '~> 4'
# Use SCSS for stylesheets # Use SCSS for stylesheets
gem 'sass-rails' gem 'sass-rails'
...@@ -67,7 +67,7 @@ group :development do ...@@ -67,7 +67,7 @@ group :development do
gem 'pry-rails' gem 'pry-rails'
# profiler # profiler
gem 'rack-mini-profiler' # gem 'rack-mini-profiler'
# rubocop # rubocop
gem 'rubocop' gem 'rubocop'
...@@ -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'
...@@ -40,7 +40,7 @@ GEM ...@@ -40,7 +40,7 @@ GEM
arel (4.0.2) arel (4.0.2)
ast (1.1.0) ast (1.1.0)
atomic (1.1.15) atomic (1.1.15)
aws-sdk (1.35.0) aws-sdk (1.36.0)
json (~> 1.4) json (~> 1.4)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
uuidtools (~> 2.1) uuidtools (~> 2.1)
...@@ -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
...@@ -133,7 +135,7 @@ GEM ...@@ -133,7 +135,7 @@ GEM
lumberjack (~> 1.0) lumberjack (~> 1.0)
pry (>= 0.9.12) pry (>= 0.9.12)
thor (>= 0.18.1) thor (>= 0.18.1)
guard-rspec (4.2.7) guard-rspec (4.2.8)
guard (~> 2.1) guard (~> 2.1)
rspec (>= 2.14, < 4.0) rspec (>= 2.14, < 4.0)
guard-rubocop (1.0.2) guard-rubocop (1.0.2)
...@@ -160,7 +162,7 @@ GEM ...@@ -160,7 +162,7 @@ GEM
launchy (2.4.2) launchy (2.4.2)
addressable (~> 2.3) addressable (~> 2.3)
libv8 (3.16.14.3) libv8 (3.16.14.3)
listen (2.6.2) listen (2.7.0)
celluloid (>= 0.15.2) celluloid (>= 0.15.2)
celluloid-io (>= 0.15.0) celluloid-io (>= 0.15.0)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
...@@ -182,7 +184,7 @@ GEM ...@@ -182,7 +184,7 @@ GEM
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.5.2) mini_portile (0.5.2)
minitest (4.7.5) minitest (4.7.5)
multi_json (1.8.4) multi_json (1.9.0)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
mysql2 (0.3.15) mysql2 (0.3.15)
...@@ -191,7 +193,7 @@ GEM ...@@ -191,7 +193,7 @@ GEM
net-scp (1.1.2) net-scp (1.1.2)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (2.8.0) net-ssh (2.8.0)
newrelic_rpm (3.7.2.195) newrelic_rpm (3.7.3.199)
nio4r (1.0.0) nio4r (1.0.0)
nokogiri (1.6.1) nokogiri (1.6.1)
mini_portile (~> 0.5.0) mini_portile (~> 0.5.0)
...@@ -218,7 +220,7 @@ GEM ...@@ -218,7 +220,7 @@ GEM
paper_trail (3.0.0) paper_trail (3.0.0)
activerecord (>= 3.0, < 5.0) activerecord (>= 3.0, < 5.0)
activesupport (>= 3.0, < 5.0) activesupport (>= 3.0, < 5.0)
parser (2.1.6) parser (2.1.7)
ast (~> 1.1) ast (~> 1.1)
slop (~> 3.4, >= 3.4.5) slop (~> 3.4, >= 3.4.5)
poltergeist (1.5.0) poltergeist (1.5.0)
...@@ -238,8 +240,6 @@ GEM ...@@ -238,8 +240,6 @@ GEM
pry-rails (0.3.2) pry-rails (0.3.2)
pry (>= 0.9.10) pry (>= 0.9.10)
rack (1.5.2) rack (1.5.2)
rack-mini-profiler (0.9.0)
rack (>= 1.1.3)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.0.3) rails (4.0.3)
...@@ -287,7 +287,8 @@ GEM ...@@ -287,7 +287,8 @@ GEM
parser (~> 2.1.3) parser (~> 2.1.3)
powerpack (~> 0.0.6) powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
sass (3.2.14) sass (3.3.0)
rake
sass-rails (4.0.1) sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10) sass (>= 3.1.10)
...@@ -358,6 +359,7 @@ DEPENDENCIES ...@@ -358,6 +359,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)
...@@ -387,8 +389,7 @@ DEPENDENCIES ...@@ -387,8 +389,7 @@ DEPENDENCIES
poltergeist poltergeist
premailer premailer
pry-rails pry-rails
rack-mini-profiler rails (~> 4)
rails (~> 4.0)
rspec-rails rspec-rails
rubocop rubocop
sass-rails sass-rails
......
...@@ -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>
<%= render_breadcrumbs %>
<div class="row"> <div class="row">
<div> <div>
<%= render partial: 'posts/show_fragment' %> <%= render partial: 'posts/show_fragment' %>
......
<%= render_breadcrumbs %>
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
......
...@@ -6,7 +6,6 @@ defaults: &defaults ...@@ -6,7 +6,6 @@ defaults: &defaults
google_api: google_api:
client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com" client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx" secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
bucket_name: "xxxxxxxxxxxxxx"
s3: s3:
access_key_id: "xxxxxxxxxxxxxxxxxxxxx" access_key_id: "xxxxxxxxxxxxxxxxxxxxx"
secret_access_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" secret_access_key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
......
require 'spec_helper'
describe "posts/show.html.erb" do
describe "パンくず" do
pending
end
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