添加回复帖子功能
This commit is contained in:
parent
87c70909be
commit
6ba53f534a
|
@ -33,7 +33,7 @@ class RelativeMemosController < ApplicationController
|
||||||
|
|
||||||
# GET /open_source_projects/1
|
# GET /open_source_projects/1
|
||||||
# GET /open_source_projects/1.json
|
# GET /open_source_projects/1.json
|
||||||
REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE)
|
REPLIES_PER_PAGE = 10 unless const_defined?(:REPLIES_PER_PAGE)
|
||||||
def show
|
def show
|
||||||
pre_count = REPLIES_PER_PAGE
|
pre_count = REPLIES_PER_PAGE
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class RelativeMemosController < ApplicationController
|
||||||
offset(@reply_pages.offset).
|
offset(@reply_pages.offset).
|
||||||
all
|
all
|
||||||
|
|
||||||
@mome_new = Memo.new
|
@mome_new = RelativeMemo.new
|
||||||
|
|
||||||
|
|
||||||
# @memo = Memo.find_by_id(params[:id])
|
# @memo = Memo.find_by_id(params[:id])
|
||||||
|
@ -104,7 +104,7 @@ class RelativeMemosController < ApplicationController
|
||||||
else
|
else
|
||||||
flash[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
|
flash[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
|
||||||
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
|
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
|
||||||
format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
format.html { redirect_to back_memo_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
|
||||||
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
format.json { render json: @memo.errors, status: :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<td align="right" rowspan="3">
|
<td align="right" rowspan="3">
|
||||||
<table class="borad-count">
|
<table class="borad-count">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), forum_memo_path(topic.open_source_project, topic) %></td>
|
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), open_source_project_relative_memo_path(topic.open_source_project, topic) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center">回答</td>
|
<td align="center">回答</td>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<td align="right" rowspan="3">
|
<td align="right" rowspan="3">
|
||||||
<table class="borad-count">
|
<table class="borad-count">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center" class="borad-count-digit"><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), forum_memo_path(topic.open_source_project, topic) %></td>
|
<td align="center" class="borad-count-digit"><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center">浏览</td>
|
<td align="center">浏览</td>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<%#= pagination_links_full @topic_pages, @topic_count %>
|
<%= pagination_links_full @topic_pages, @topic_count %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="nodata">
|
<p class="nodata">
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<%= form_for(@mome_new, url: open_source_project_relative_memos_path, :html => {:multipart => true}) do |f| %>
|
||||||
|
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||||
|
<%= f.hidden_field :osp_id, :required => true, value: @memo.osp_id %>
|
||||||
|
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||||
|
<%= label_tag(l(:label_reply_plural)) %>:
|
||||||
|
<!-- <p> < %= f.text_area :content, :required => true, :size => "75%", :resize => "none", id: 'editor01' %> </p> -->
|
||||||
|
<%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %></p>
|
||||||
|
|
||||||
|
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
|
||||||
|
<p><%#= l(:label_attachment_plural) %><br />
|
||||||
|
<%#= render :partial => 'attachments/form' %>
|
||||||
|
</p>
|
||||||
|
<%= f.submit value: l(:label_reply_plural), class: "replies" %>
|
||||||
|
<% end %>
|
|
@ -153,7 +153,7 @@
|
||||||
|
|
||||||
<% if User.current.login? %>
|
<% if User.current.login? %>
|
||||||
<div class="reply-box" style="">
|
<div class="reply-box" style="">
|
||||||
<%#= render :partial => 'memos/reply_box' %>
|
<%= render :partial => 'relative_memos/reply_box' %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div style="font-size: 14px;margin:20px;">
|
<div style="font-size: 14px;margin:20px;">
|
||||||
|
|
Loading…
Reference in New Issue