From 64107ca5ccc9af52eafa9f2a2d66d6c8deded2da Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 19 Sep 2014 15:43:25 +0800 Subject: [PATCH] =?UTF-8?q?#1279=20=E4=B8=BB=E9=A1=B5--=E2=80=9C=E6=88=91?= =?UTF-8?q?=E8=A6=81=E6=8F=90=E9=97=AE=E2=80=9D/=E2=80=9C=E6=88=91?= =?UTF-8?q?=E8=A6=81=E5=8F=8D=E9=A6=88=E2=80=9D=20=E7=BD=AE=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=9D=A1=E4=BB=B6=E4=B8=BA=E7=A9=BA=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=8F=91=E5=B8=83=E6=8C=89=E9=92=AE=EF=BC=8C=E6=9C=AA?= =?UTF-8?q?=E7=BB=99=E5=87=BA=E7=B1=BB=E4=BC=BC=E4=BA=8E=E2=80=9C=E4=B8=BB?= =?UTF-8?q?=E9=A2=98/=E5=86=85=E5=AE=B9=E4=B8=8D=E8=83=BD=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E5=AD=97=E7=AC=A6=E2=80=9D=E7=9A=84=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF,=E7=BB=99=E5=87=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=90=8E=E8=B7=B3=E8=BD=AC=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=AD=A3=EF=BC=8C=E5=B0=86=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=B9=B6=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/memos_controller.rb | 5 ++--- app/views/memos/_topic_form.html.erb | 12 +----------- app/views/memos/new.html.erb | 2 +- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index aad575ee5..9f261c78a 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -89,10 +89,9 @@ class MemosController < ApplicationController offset(@reply_pages.offset). all if @memo.new_record? - format.html { redirect_to back_url, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } + format.html { render :new,:layout=>'base'} else - format.html { render action: :show }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } - # format.html { redirect_to back_memo_or_forum_url}#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" } + format.html { render action: :show } format.json { render json: @memo.errors, status: :unprocessable_entity } end diff --git a/app/views/memos/_topic_form.html.erb b/app/views/memos/_topic_form.html.erb index 3f5642733..d7d0aeca0 100644 --- a/app/views/memos/_topic_form.html.erb +++ b/app/views/memos/_topic_form.html.erb @@ -1,15 +1,5 @@ <%= labelled_form_for(@memo, :url => forum_memos_path) do |f| %> - <% if @memo.errors.any? %> -
-

<%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:

- -
- <% end %>

<%= f.text_field :subject, :required => true, :size => 95 %>

<%= f.text_area :content, :required => true, :id => 'editor01' %>

@@ -20,6 +10,6 @@ <%= l(:label_attachment_plural) %>
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>

- <%= f.submit :value => l(:label_memo_create) %> + <%= f.submit :value => l(:label_memo_create) %> <%= link_to l(:button_back), forum_path(@forum) %>
<% end %> \ No newline at end of file diff --git a/app/views/memos/new.html.erb b/app/views/memos/new.html.erb index bcda7896d..03a60044a 100644 --- a/app/views/memos/new.html.erb +++ b/app/views/memos/new.html.erb @@ -27,5 +27,5 @@ <%= render :partial => 'memos/topic_form' %> -<%= link_to l(:button_back), forum_path(@forum) %> +