Commit 5e7bf6a5 by tady

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

parent 45081fe5
......@@ -2,89 +2,16 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.app {
.navbar-default .navbar-brand {
.navbar-default .navbar-brand {
background-color: #428bca;
color: #fff;
}
}
.label a {
.navbar-default .navbar-brand,
.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 {
#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 {
background-color: #fff;
border-top-left-radius: 0px;
border-top-right-radius: 0px;
}
*/
}
body[class^="posts-"],
body[class^="tags-"] {
body {
padding-top: 70px;
}
/* Style for mod-mdEditor
/* Style for mod-mdEditor.
-------------------------------------------------- */
.mod-mdEditor-title {
width: 95%;
......
......@@ -39,9 +39,17 @@ class Post < ActiveRecord::Base
# generate forked post (not saved)
def generate_fork(user)
# `id`以外をコピーする
_forked_post = Post.new(self.attributes.except('id'))
# `%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 = _forked_post.title + ' のコピー'
_forked_post.tag_ids = self.tag_ids
_forked_post.author = user
......
......@@ -3,27 +3,24 @@
<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">
<%= stylesheet_link_tag "application", media: "all" %>
<%= render_style %>
<%= csrf_meta_tags %>
</head>
<body class="<%= params[:controller] %>-<%= params[:action] %>">
<body class="rails-<%= params[:controller] %>-<%= params[:action] %>">
<%= render partial: 'partials/header_notifications' %>
<div class="app">
<%= render partial: 'partials/app_header' %>
<div class="container">
<%= yield %>
</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.string/2.3.3/underscore.string.min.js"></script>
......
......@@ -26,7 +26,8 @@
<div class="field">
<div class="input-group">
<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>
......
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