Commit 80f78bec by tady

Merge pull request #52 from tadyjp/wip/140308_presentation

presentation
parents e31bc0a0 005b634d
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
......@@ -117,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
<!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>
......
<textarea id="source">
class: center, middle
<%= @post.title %>
<%= @post.author.name %> (<%= @post.updated_at.strftime('%Y-%m-%d') %>)
<%= @post.body_for_slideshow %>
</textarea>
......@@ -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'
......
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