Commit 035c27af by tady

refactore layout

parent 5e7bf6a5
...@@ -15,3 +15,7 @@ ...@@ -15,3 +15,7 @@
#app-search-form { #app-search-form {
width: 200px; width: 200px;
} }
.container-main{
min-height: 400px;
}
class HomeController < ApplicationController class HomeController < ApplicationController
skip_before_action :require_login skip_before_action :require_login
layout 'welcome'
def top def top
if user_signed_in? if user_signed_in?
......
...@@ -3,7 +3,6 @@ require 'nkf' ...@@ -3,7 +3,6 @@ require 'nkf'
class PostsController < ApplicationController class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy] before_action :set_post, only: [:show, :edit, :update, :destroy]
before_action :require_login before_action :require_login
layout 'app'
include RV::Mailer include RV::Mailer
......
class TagsController < ApplicationController class TagsController < ApplicationController
before_action :set_tag, only: [:show, :edit, :update, :destroy] before_action :set_tag, only: [:show, :edit, :update, :destroy]
layout 'app'
def index def index
end end
def show def show
@posts = @tag.posts
end end
def new def new
...@@ -18,11 +16,10 @@ class TagsController < ApplicationController ...@@ -18,11 +16,10 @@ class TagsController < ApplicationController
def create def create
@tag = Tag.new(tag_params) @tag = Tag.new(tag_params)
@tag.author = current_user
respond_to do |format| respond_to do |format|
if @tag.save if @tag.save
format.html { redirect_to root_path(id: @tag.id), flash: { notice: 'Tag was successfully created.' } } format.html { redirect_to @tag.show_path, flash: { notice: 'Tag was successfully created.' } }
format.json { render action: 'show', status: :created, location: @tag } format.json { render action: 'show', status: :created, location: @tag }
else else
format.html { render action: 'new' } format.html { render action: 'new' }
...@@ -32,11 +29,9 @@ class TagsController < ApplicationController ...@@ -32,11 +29,9 @@ class TagsController < ApplicationController
end end
def update def update
@tag.author = current_user
respond_to do |format| respond_to do |format|
if @tag.update(tag_params) if @tag.update(tag_params)
format.html { redirect_to root_path(id: @tag.id), flash: { notice: 'Tag was successfully updated.' } } format.html { redirect_to @tag.show_path, flash: { notice: 'Tag was successfully updated.' } }
format.json { head :no_content } format.json { head :no_content }
else else
format.html { render action: 'edit' } format.html { render action: 'edit' }
...@@ -69,5 +64,8 @@ class TagsController < ApplicationController ...@@ -69,5 +64,8 @@ class TagsController < ApplicationController
@tag = tag.decorate @tag = tag.decorate
end end
def tag_params
params.require(:tag).permit(:name, :body).to_hash
end
end end
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<div class="col-lg-4"> <div class="col-lg-4">
<img class="img-circle" src="http://placehold.it/140x140&amp;text=Rendezvous" alt="Generic placeholder image"> <img class="img-circle" src="http://placehold.it/140x140&amp;text=Rendezvous" alt="Generic placeholder image">
<h2>Rendezvous</h2> <h2>Rendezvous</h2>
<p>Rendezvousはチームの`Stock`と`Flow`の<br>2の情報を蓄積・検索・共有する<br>オープンソースのソフトウェアです。</p> <p>Rendezvousはチームの`Stock`と`Flow`の<br>2種類の情報を蓄積・検索・共有する<br>オープンソースのソフトウェアです。</p>
<p><a class="btn btn-lg btn-primary" href="<%= user_omniauth_authorize_path(:google_oauth2) %>" role="button">Sign up with Google</a></p> <p><a class="btn btn-lg btn-primary" href="<%= user_omniauth_authorize_path(:google_oauth2) %>" role="button">Sign up with Google</a></p>
</div><!-- /.col-lg-4 --> </div><!-- /.col-lg-4 -->
<div class="col-lg-4"> <div class="col-lg-4">
......
<!DOCTYPE html> <!DOCTYPE html><!--
Have a nice $$$$$$$\ $$\
$$ __$$\ $$ |
$$ | $$ | $$$$$$\ $$$$$$$\ $$$$$$$ | $$$$$$\ $$$$$$$$\$$\ $$\ $$$$$$\ $$\ $$\ $$$$$$$\
$$$$$$$ |$$ __$$\ $$ __$$\ $$ __$$ |$$ __$$\\____$$ \$$\ $$ |$$ __$$\ $$ | $$ |$$ _____|
$$ __$$< $$$$$$$$ |$$ | $$ |$$ / $$ |$$$$$$$$ | $$$$ _/ \$$\$$ / $$ / $$ |$$ | $$ |\$$$$$$\
$$ | $$ |$$ ____|$$ | $$ |$$ | $$ |$$ ____|$$ _/ \$$$ / $$ | $$ |$$ | $$ | \____$$\
$$ | $$ |\$$$$$$$\ $$ | $$ |\$$$$$$$ |\$$$$$$$\$$$$$$$$\ \$ / \$$$$$$ |\$$$$$$ |$$$$$$$ |
\__| \__| \_______|\__| \__| \_______| \_______\________| \_/ \______/ \______/ \_______/ with your team.
-->
<html lang="ja"> <html lang="ja">
<head> <head>
<title>Rendezvous</title> <title>Rendezvous</title>
...@@ -16,9 +25,11 @@ ...@@ -16,9 +25,11 @@
<%= render partial: 'partials/header_notifications' %> <%= render partial: 'partials/header_notifications' %>
<%- if params[:controller] != 'home' -%>
<%= render partial: 'partials/app_header' %> <%= render partial: 'partials/app_header' %>
<%- end -%>
<div class="container"> <div class="container container-main">
<%= yield %> <%= yield %>
</div><!--/.container--> </div><!--/.container-->
...@@ -32,6 +43,7 @@ ...@@ -32,6 +43,7 @@
window.RV.AllTags = JSON.parse('<%= raw Tag.all.pluck(:name).to_json %>'); window.RV.AllTags = JSON.parse('<%= raw Tag.all.pluck(:name).to_json %>');
</script> </script>
<hr>
<footer> <footer>
<div class="container"> <div class="container">
<a href="https://github.com/tadyjp/rendezvous">Github</a> <a href="https://github.com/tadyjp/rendezvous">Github</a>
......
<!DOCTYPE html>
<html lang="ja">
<head>
<title>Rendezvous</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= stylesheet_link_tag "application", media: "all" %>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css">
<%= render_style %>
<%= csrf_meta_tags %>
</head>
<body class="<%= params[:controller] %>-<%= params[:action] %>">
<%= render partial: 'partials/header_notifications' %>
<%= yield %>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
<script type="text/javascript">
window.RV = window.RV || {};
window.RV.AllTags = JSON.parse('<%= raw Tag.all.pluck(:name).to_json %>');
</script>
<footer>
<div class="container">
<a href="https://github.com/tadyjp/rendezvous">Github</a>
|
<a href="https://twitter.com/tady_jp">@tady_jp</a>
</div>
</footer>
<%= javascript_include_tag "application" %>
<%= yield :footer_js %>
</body>
</html>
<div id="tag-form"> <div id="tag-form">
<%= form_for(@tag) do |f| %> <%= form_for(@tag, url: @tag.show_path) do |f| %>
<% if @tag.errors.any? %> <% if @tag.errors.any? %>
<div id="error_explanation"> <div id="error_explanation">
......
<div class="row"> この ページ は まだ そんざい しません
<div class="col-xs-6 col-md-4" id="sidebar" role="navigation">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-list" data-toggle="tab">List</a></li>
<li><a href="#tab-tree" data-toggle="tab">Tag Tree</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab-list">
<div class="list-group">
<% @posts.each_with_index do |post, i| %>
<a href="#" data-post-id="<%= post.id %>" class="list-group-item post-list"><%= post.title %></a>
<% end %>
</div>
</div><!-- /.tab-pane -->
<div class="tab-pane" id="tab-tree">
<% cache('tag-tree', :expires_in => 1.hour) do %>
<div class="list-group">
<%= Tag.all.decorate.tree_view %>
</div>
<% end %>
</div><!-- /.tab-pane -->
</div><!-- /.tab-content -->
</div><!--/span-->
<div class="col-xs-12 col-sm-6 col-md-8">
<div id="list_post">
<p id="posts-placeholder" style="color:#aaa;font-size:30px">&lt;-- Select a post...</p>
</div>
</div><!--/span-->
</div><!--/row-->
...@@ -27,7 +27,11 @@ ...@@ -27,7 +27,11 @@
<%= @tag.name %>」とは <%= @tag.name %>」とは
</div> </div>
<div class="panel-body"> <div class="panel-body">
<%- if @tag.body.present? -%>
<%= h_application_format_markdown(@tag.body) %>
<%- else -%>
まだ「<%= @tag.name %>」の情報がありません。 まだ「<%= @tag.name %>」の情報がありません。
<%- end -%>
</div> </div>
</div> </div>
</div> </div>
...@@ -35,7 +39,7 @@ ...@@ -35,7 +39,7 @@
<div class="col-xs-4"> <div class="col-xs-4">
<div class="list-group"> <div class="list-group">
<h2><small><%= @tag.name %>」のタグが付いた記事</small></h2> <h2><small><%= @tag.name %>」のタグが付いた記事</small></h2>
<% @posts.each_with_index do |post, i| %> <% @tag.posts.each_with_index do |post, i| %>
<a href="<%= post_path(post) %>" class="list-group-item post-list"><%= post.title %></a> <a href="<%= post_path(post) %>" class="list-group-item post-list"><%= post.title %></a>
<% end %> <% end %>
</div> </div>
......
json.extract! @post, :title, :body, :created_at, :updated_at json.extract! @tag, :name, :body, :created_at, :updated_at
...@@ -21,7 +21,7 @@ describe Post do ...@@ -21,7 +21,7 @@ describe Post do
end end
it 'valid title' do it 'valid title' do
expect(@new_post.title).to eq('sample title') expect(@new_post.title).to eq('sample title のコピー')
end end
it 'valid body' do it 'valid body' do
......
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