Commit 5e7bf6a5 by tady

fix: fork時にタグが引き継がれない問題

parent 45081fe5
...@@ -2,89 +2,16 @@ ...@@ -2,89 +2,16 @@
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
.app { .navbar-default .navbar-brand {
background-color: #428bca;
.navbar-default .navbar-brand { color: #fff;
background-color: #428bca; }
color: #fff;
}
.label a {
color: white;
}
/* .navbar-default a.btn, .navbar-default a.btn:hover{
padding: 10px 20px;
color: #fff;
margin-top: 6px;
}
*/
.box-text {
padding: 9px 14px;
margin-left: 0;
margin-right: 0;
background-color: #fff;
border-width: 1px;
border-color: #ddd;
border: 1px solid #e1e1e8;
border-radius: 4px 4px 0 0;
box-shadow: none;
}
.box-highlight {
padding: 9px 14px;
margin-bottom: 14px;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 4px;
}
.box-text + .box-highlight {
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}
#app-search-form {
width: 200px;
}
/* side tree view
-------------------------------------------------- */
/* ul {
padding-left: 1em;
}
*/
/* home#show
-------------------------------------------------- */
/* .text-box {
padding: 9px 14px;
border: 1px solid #e1e1e8;
border-radius: 4px;
}
.text-box.title {
background-color: #fff;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
font-weight: bold;
font-size: 12pt;
}
.text-box.meta {
background-color: #f7f7f9;
border-radius: 0;
.label {
display: inline-block;
}
}
.text-box.body { .navbar-default .navbar-brand,
background-color: #fff; .label a {
border-top-left-radius: 0px; color: white;
border-top-right-radius: 0px; }
}
*/
#app-search-form {
width: 200px;
} }
body[class^="posts-"], body {
body[class^="tags-"] {
padding-top: 70px; padding-top: 70px;
} }
/* Style for mod-mdEditor /* Style for mod-mdEditor.
-------------------------------------------------- */ -------------------------------------------------- */
.mod-mdEditor-title { .mod-mdEditor-title {
width: 95%; width: 95%;
......
...@@ -39,9 +39,17 @@ class Post < ActiveRecord::Base ...@@ -39,9 +39,17 @@ class Post < ActiveRecord::Base
# generate forked post (not saved) # generate forked post (not saved)
def generate_fork(user) def generate_fork(user)
# `id`以外をコピーする
_forked_post = Post.new(self.attributes.except('id')) _forked_post = Post.new(self.attributes.except('id'))
# `%Name`をユーザー名に置換
_forked_post.title = _forked_post.title.gsub(/%Name/, user.name) _forked_post.title = _forked_post.title.gsub(/%Name/, user.name)
# `%Y`などを日付に変換
_forked_post.title = Time.now.strftime(_forked_post.title) # TODO _forked_post.title = Time.now.strftime(_forked_post.title) # TODO
_forked_post.title = _forked_post.title + ' のコピー'
_forked_post.tag_ids = self.tag_ids _forked_post.tag_ids = self.tag_ids
_forked_post.author = user _forked_post.author = user
......
...@@ -3,27 +3,24 @@ ...@@ -3,27 +3,24 @@
<head> <head>
<title>Rendezvous</title> <title>Rendezvous</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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"> <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"> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css">
<%= stylesheet_link_tag "application", media: "all" %>
<%= render_style %> <%= render_style %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
</head> </head>
<body class="<%= params[:controller] %>-<%= params[:action] %>"> <body class="rails-<%= params[:controller] %>-<%= params[:action] %>">
<%= render partial: 'partials/header_notifications' %> <%= render partial: 'partials/header_notifications' %>
<div class="app"> <%= render partial: 'partials/app_header' %>
<%= render partial: 'partials/app_header' %>
<div class="container"> <div class="container">
<%= yield %> <%= yield %>
</div><!--/.container--> </div><!--/.container-->
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.string/2.3.3/underscore.string.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/underscore.string/2.3.3/underscore.string.min.js"></script>
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
<div class="field"> <div class="field">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"><%= f.label :tags %></span> <span class="input-group-addon"><%= f.label :tags %></span>
<%= hidden_field :post, :tags, class: 'mod-mdEditor-tags', style: 'width:300px', value: @post.tags.pluck(:name).join(',') %> <%= hidden_field :post, :tags, class: 'mod-mdEditor-tags', style: 'width:300px',
value: @post.tags.map{ |_tag| _tag.name }.join(',') %>
</div> </div>
</div> </div>
</div> </div>
......
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