From 6ba53f534a0e905e057dbf1df9d6c48214653438 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Mon, 28 Apr 2014 11:04:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=9E=E5=A4=8D=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/relative_memos_controller.rb | 6 +++--- .../open_source_projects/_show_topics.html.erb | 6 +++--- app/views/relative_memos/_reply_box.html.erb | 14 ++++++++++++++ app/views/relative_memos/show.html.erb | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 app/views/relative_memos/_reply_box.html.erb diff --git a/app/controllers/relative_memos_controller.rb b/app/controllers/relative_memos_controller.rb index 4c891e0a6..f8741365b 100644 --- a/app/controllers/relative_memos_controller.rb +++ b/app/controllers/relative_memos_controller.rb @@ -33,7 +33,7 @@ class RelativeMemosController < ApplicationController # GET /open_source_projects/1 # 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 pre_count = REPLIES_PER_PAGE @@ -56,7 +56,7 @@ class RelativeMemosController < ApplicationController offset(@reply_pages.offset). all - @mome_new = Memo.new + @mome_new = RelativeMemo.new # @memo = Memo.find_by_id(params[:id]) @@ -104,7 +104,7 @@ class RelativeMemosController < ApplicationController else 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) - 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 } end end diff --git a/app/views/open_source_projects/_show_topics.html.erb b/app/views/open_source_projects/_show_topics.html.erb index 47903d5c4..3ede2730e 100644 --- a/app/views/open_source_projects/_show_topics.html.erb +++ b/app/views/open_source_projects/_show_topics.html.erb @@ -17,7 +17,7 @@ - + @@ -26,7 +26,7 @@
<%= link_to (topic.replies_count), forum_memo_path(topic.open_source_project, topic) %><%= link_to (topic.replies_count), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
回答 - + @@ -57,7 +57,7 @@ <% end %> <% else %>

diff --git a/app/views/relative_memos/_reply_box.html.erb b/app/views/relative_memos/_reply_box.html.erb new file mode 100644 index 000000000..98f1f31a0 --- /dev/null +++ b/app/views/relative_memos/_reply_box.html.erb @@ -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)) %>: + + <%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %>

+ + +

<%#= l(:label_attachment_plural) %>
+ <%#= render :partial => 'attachments/form' %> +

+ <%= f.submit value: l(:label_reply_plural), class: "replies" %> +<% end %> \ No newline at end of file diff --git a/app/views/relative_memos/show.html.erb b/app/views/relative_memos/show.html.erb index 0b51ec1f4..2d85a19aa 100644 --- a/app/views/relative_memos/show.html.erb +++ b/app/views/relative_memos/show.html.erb @@ -153,7 +153,7 @@ <% if User.current.login? %>
- <%#= render :partial => 'memos/reply_box' %> + <%= render :partial => 'relative_memos/reply_box' %>
<% else %>
<%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), forum_memo_path(topic.open_source_project, topic) %><%= link_to (topic.viewed_count_crawl+topic.viewed_count_local), open_source_project_relative_memo_path(topic.open_source_project, topic) %>
浏览