Commit a44eaa40 by tady

Merge commit '80f78bec' into wip/140309_turnip

parents 27832df8 80f78bec
......@@ -3,7 +3,7 @@ source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.0'
gem 'rails', '~> 4'
# Use SCSS for stylesheets
gem 'sass-rails'
......@@ -67,7 +67,7 @@ group :development do
gem 'pry-rails'
# profiler
gem 'rack-mini-profiler'
# gem 'rack-mini-profiler'
# rubocop
gem 'rubocop'
......@@ -127,3 +127,5 @@ gem 'paper_trail', '~> 3.0.0'
gem 'aws-sdk'
gem 'newrelic_rpm'
gem 'breadcrumble'
......@@ -52,6 +52,8 @@ GEM
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
breadcrumble (4.0.0)
rails (>= 4.0.0)
builder (3.1.4)
capistrano (3.1.0)
i18n
......@@ -240,8 +242,6 @@ GEM
pry-rails (0.3.2)
pry (>= 0.9.10)
rack (1.5.2)
rack-mini-profiler (0.9.0)
rack (>= 1.1.3)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.3)
......@@ -364,6 +364,7 @@ DEPENDENCIES
aws-sdk
better_errors
binding_of_caller
breadcrumble
capistrano (~> 3.1)
capistrano-bundler (~> 1.1.2)
capistrano-rails (~> 1.1)
......@@ -393,8 +394,7 @@ DEPENDENCIES
poltergeist
premailer
pry-rails
rack-mini-profiler
rails (~> 4.0)
rails (~> 4)
rspec-rails
rubocop
sass-rails
......
......@@ -3,6 +3,8 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
add_breadcrumb("Rendezvous", '/')
def require_login
unless user_signed_in?
flash[:alert] = 'You need Login!'
......
require 'nkf'
class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
before_action :set_post, only: [:show, :edit, :update, :destroy, :slideshow]
before_action :require_login
include RV::Mailer
......@@ -19,6 +19,11 @@ class PostsController < ApplicationController
# GET /posts/1
# GET /posts/1.json
def show
@post.tags.each do |_tag|
add_breadcrumb("##{_tag.name}", _tag.decorate.show_path)
end
add_breadcrumb(@post.title)
if params[:fragment].present?
render layout: false, partial: 'posts/show_fragment'
else
......@@ -112,6 +117,11 @@ class PostsController < ApplicationController
end
end
# Show presentation view
def slideshow
render layout: 'slideshow'
end
private
# Use callbacks to share common setup or constraints between actions.
......
......@@ -55,4 +55,9 @@ class Post < ActiveRecord::Base
_forked_post
end
# slideshow用のbody
def body_for_slideshow
self.body.gsub(/^#/, "---\n\n#")
end
end
<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>
<!DOCTYPE html>
<html lang="ja">
<head>
<title>Rendezvous</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body class="rails-<%= params[:controller] %>-<%= params[:action] %>">
<%= yield %>
<script src="http://gnab.github.io/remark/downloads/remark-0.6.0.min.js" type="text/javascript">
</script>
<script type="text/javascript">
var slideshow = remark.create();
</script>
</body>
</html>
......@@ -30,6 +30,9 @@
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="<%= slideshow_post_path(@post) %>" target="_blank">Slideshow</a></li>
<li><a href="https://github.com/gnab/remark" target="_blank" class="small">What is Slideshow?</a></li>
<li class="divider"></li>
<li><a href="<%= fork_post_path(@post) %>">Fork</a></li>
<li><a href="#" data-toggle="modal" data-target="#myModal">Mail to...</a></li>
<li class="divider"></li>
......
<%= render_breadcrumbs %>
<div class="row">
<div>
<%= render partial: 'posts/show_fragment' %>
......
<textarea id="source">
class: center, middle
<%= @post.title %>
<%= @post.author.name %> (<%= @post.updated_at.strftime('%Y-%m-%d') %>)
<%= @post.body_for_slideshow %>
</textarea>
<%= render_breadcrumbs %>
<div class="row">
<div class="col-xs-8">
......
......@@ -8,6 +8,7 @@ Rendezvous::Application.routes.draw do
get 'posts/:id/fork' => 'posts#fork', as: 'fork_post'
post 'posts/:id/mail' => 'posts#mail', as: 'mail_post'
post 'posts/:id/comment' => 'posts#comment', as: 'comment_post'
get 'posts/:id/slideshow' => 'posts#slideshow', as: 'slideshow_post'
resources :posts
post 'tags/:name/merge_to/:merge_to_name' => 'tags#merge_to', as: 'merge_to_tag'
......
......@@ -6,7 +6,6 @@ defaults: &defaults
google_api:
client_id: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"
secret: "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
bucket_name: "xxxxxxxxxxxxxx"
s3:
access_key_id: "xxxxxxxxxxxxxxxxxxxxx"
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