@@ -5,13 +5,13 @@ class PoolElementsController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id])
|
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id])
|
||||||
|
|
||||||
if @pool.present?
|
if @pool.present? && !@pool.is_deleted?
|
||||||
@post = Post.find(params[:post_id])
|
@post = Post.find(params[:post_id])
|
||||||
@pool.add!(@post)
|
@pool.add!(@post)
|
||||||
append_pool_to_session(@pool)
|
append_pool_to_session(@pool)
|
||||||
|
else
|
||||||
|
@error = "That pool does not exist"
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_with(@pool, :location => post_path(@post))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= form_tag(pool_element_path, :class => "simple_form") do %>
|
<%= form_tag(pool_element_path, :class => "simple_form", :remote => true, :format => :js) do %>
|
||||||
<%= hidden_field_tag "post_id", @post.id %>
|
<%= hidden_field_tag "post_id", @post.id %>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
|
|||||||
5
app/views/pool_elements/create.js.erb
Normal file
5
app/views/pool_elements/create.js.erb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<% if @error %>
|
||||||
|
Danbooru.error("<%= j @error.to_s %>");
|
||||||
|
<% else %>
|
||||||
|
location.reload();
|
||||||
|
<% end %>
|
||||||
Reference in New Issue
Block a user