reenable async commenting

This commit is contained in:
byte[] 2020-01-01 12:27:20 -05:00
parent df3467df7b
commit 0da19674d1
3 changed files with 5 additions and 5 deletions

View file

@ -53,9 +53,7 @@ defmodule PhilomenaWeb.Image.CommentController do
Images.reindex_image(conn.assigns.image)
UserStatistics.inc_stat(conn.assigns.current_user, :comments_posted)
conn
|> put_flash(:info, "Comment created successfully.")
|> redirect(to: Routes.image_path(conn, :show, image) <> "#comment_#{comment.id}")
index(conn, %{"comment_id" => comment.id})
_error ->
conn

View file

@ -1,4 +1,6 @@
= form_for @changeset, Routes.image_comment_path(@conn, :create, @image), fn f ->
- options = if(assigns[:remote], do: [data: [remote: "true"], id: "js-comment-form"], else: [])
= form_for @changeset, Routes.image_comment_path(@conn, :create, @image), options, fn f ->
= if @changeset.action do
.alert.alert-danger
p Oops, something went wrong! Please check the errors below.

View file

@ -19,7 +19,7 @@
= render PhilomenaWeb.BanView, "_ban_reason.html", conn: @conn
- @image.commenting_allowed ->
= render PhilomenaWeb.Image.CommentView, "_form.html", image: @image, changeset: @comment_changeset, conn: @conn
= render PhilomenaWeb.Image.CommentView, "_form.html", image: @image, changeset: @comment_changeset, remote: true, conn: @conn
- true ->