diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index 35f8ee97b..a47d8ee09 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -245,15 +245,14 @@ class ForumsController < ApplicationController # PUT /forums/1.json def update @forum = Forum.find(params[:id]) - respond_to do |format| if @forum.update_attributes(params[:forum]) - format.js {render :text=> true} + format.js format.html { redirect_to @forum, notice: l(:label_forum_update_succ) } format.json { head :no_content } else flash.now[:error] = "#{l :label_forum_update_fail}: #{@forum.errors.full_messages[0]}" - format.js { render :text=> false} + format.js format.html { render action: "edit" } format.json { render json: @forum.errors, status: :unprocessable_entity } end diff --git a/app/views/forums/_edit.html.erb b/app/views/forums/_edit.html.erb index 5e8db19a5..e19068ef1 100644 --- a/app/views/forums/_edit.html.erb +++ b/app/views/forums/_edit.html.erb @@ -5,12 +5,9 @@
- <%= labelled_form_for @forum, :html => {:id => "forum_new"} do |f| %> + <%= labelled_form_for @forum, :html => {:id => "forum_new", :remote => true} do |f| %> <%= render :partial => "forums/form", :locals => {:f => f} %> <% end %> - <%#= form_tag({:controller => 'forums', :action => 'create'}, :method => 'post', :id => "forum_new") do |f| %> - - <%# end %>
diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index fcc44196a..d07a42ed5 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -22,7 +22,9 @@
- <%= render :partial => "memos/my_count_message" %> +
+ <%= render :partial => "memos/my_count_message" %> +
diff --git a/app/views/forums/update.js.erb b/app/views/forums/update.js.erb new file mode 100644 index 000000000..721154202 --- /dev/null +++ b/app/views/forums/update.js.erb @@ -0,0 +1 @@ +$("#my_count_message").html('<%= escape_javascript( render :partial => 'memos/my_count_message') %>'); \ No newline at end of file