From 8a67cb847df7dfe977617a4285541aed3a11195a Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 11 Jan 2017 00:19:25 -0600 Subject: [PATCH 1/2] Fix artist commentary dialog submitting wrong form. --- app/assets/javascripts/artist_commentaries.js | 4 ++-- app/views/artist_commentaries/_form.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/artist_commentaries.js b/app/assets/javascripts/artist_commentaries.js index 6e3b0a5ee..bd422705f 100644 --- a/app/assets/javascripts/artist_commentaries.js +++ b/app/assets/javascripts/artist_commentaries.js @@ -36,7 +36,7 @@ width: 500, buttons: { "Submit": function() { - $("#add-commentary-dialog form").submit(); + $("#add-commentary-dialog #edit-commentary").submit(); $(this).dialog("close"); }, "Cancel": function() { @@ -45,7 +45,7 @@ } }); - $('#add-commentary-dialog form').submit(function() { + $('#add-commentary-dialog #edit-commentary').submit(function() { $('#add-commentary-dialog').dialog('close'); }); diff --git a/app/views/artist_commentaries/_form.html.erb b/app/views/artist_commentaries/_form.html.erb index 0c7fd6e02..5e740eb0c 100644 --- a/app/views/artist_commentaries/_form.html.erb +++ b/app/views/artist_commentaries/_form.html.erb @@ -10,7 +10,7 @@ -<%= form_tag(create_or_update_artist_commentaries_path(:format => :js), :remote => true, :class => "simple_form", :method => :put) do %> +<%= form_tag(create_or_update_artist_commentaries_path(:format => :js), :remote => true, :id => "edit-commentary", :class => "simple_form", :method => :put) do %> <%= hidden_field :artist_commentary, :post_id, :value => @post.id %>
From 34b6f225942c1e22a128e2de6c4eca975ff211c8 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 11 Jan 2017 00:21:03 -0600 Subject: [PATCH 2/2] Clean up artcomms partial. --- app/views/artist_commentaries/_form.html.erb | 20 ++++++++++---------- app/views/posts/show.html.erb | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/artist_commentaries/_form.html.erb b/app/views/artist_commentaries/_form.html.erb index 5e740eb0c..01967ca01 100644 --- a/app/views/artist_commentaries/_form.html.erb +++ b/app/views/artist_commentaries/_form.html.erb @@ -4,36 +4,36 @@
<%= select_tag :commentary_source_type, options_for_select(%w[Source Post]) %> - <%= text_field_tag :commentary_source, @post.source %> - <%= text_field_tag :commentary_post_id, (@post.parent.try(&:id) || @post.children.first.try(&:id)), :style => "display: none;" %> + <%= text_field_tag :commentary_source, post.source %> + <%= text_field_tag :commentary_post_id, (post.parent.try(&:id) || post.children.first.try(&:id)), :style => "display: none;" %> <%= button_tag "Fetch" %>
<%= form_tag(create_or_update_artist_commentaries_path(:format => :js), :remote => true, :id => "edit-commentary", :class => "simple_form", :method => :put) do %> - <%= hidden_field :artist_commentary, :post_id, :value => @post.id %> + <%= hidden_field :artist_commentary, :post_id, :value => post.id %>
- <%= text_field :artist_commentary, :original_title, :value => artist_commentary.try(:original_title) %> + <%= text_field :artist_commentary, :original_title, :value => post.artist_commentary.try(:original_title) %>
- <%= text_area :artist_commentary, :original_description, :size => "40x6", :value => artist_commentary.try(:original_description) %> + <%= text_area :artist_commentary, :original_description, :size => "40x6", :value => post.artist_commentary.try(:original_description) %>
- <%= text_field :artist_commentary, :translated_title, :value => artist_commentary.try(:translated_title) %> + <%= text_field :artist_commentary, :translated_title, :value => post.artist_commentary.try(:translated_title) %>
- <%= text_area :artist_commentary, :translated_description, :size => "40x6", :value => artist_commentary.try(:translated_description) %> + <%= text_area :artist_commentary, :translated_description, :size => "40x6", :value => post.artist_commentary.try(:translated_description) %>
- <% if @post.has_tag?("commentary") %> + <% if post.has_tag?("commentary") %>
<% end %> - <% if @post.has_tag?("commentary_request") %> + <% if post.has_tag?("commentary_request") %>
<% end %> - <% if @post.has_tag?("check_commentary") %> + <% if post.has_tag?("check_commentary") %>