Skip to content

Commit

Permalink
Merge pull request #528 from amatsuda/parse_edit_field_id_dup
Browse files Browse the repository at this point in the history
Use field name instead of id for parse_edit_field
  • Loading branch information
amatsuda authored Mar 8, 2025
2 parents 22c79c9 + 89a9b8b commit 56a2fc6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/proposal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $(function() {
$('.watched').blur(function() {
$.ajax({
data: {
id: this.id,
name: this.name,
text: $(this).val()
},
url: url
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def parse_edit_field
respond_to do |format|
format.js do
render locals: {
field_id: params[:id],
field_name: params[:name],
text: markdown(params[:text])
}
end
Expand Down
6 changes: 3 additions & 3 deletions app/views/proposals/_contents.html.haml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.proposal-section
%h3.control-label Abstract
.markdown{ data: { 'field-id' => 'proposal_abstract' } }
.markdown{ data: { 'field-name' => 'proposal[abstract]' } }
= proposal.abstract_markdown

%h2.fieldset-legend For Review Committee

.proposal-section
%h3.control-label Details
.markdown{ data: { 'field-id' => 'proposal_details' } }
.markdown{ data: { 'field-name' => 'proposal[details]' } }
= proposal.details_markdown

.proposal-section
%h3.control-label Pitch
.markdown{ data: { 'field-id' => 'proposal_pitch' } }
.markdown{ data: { 'field-name' => 'proposal[pitch]' } }
=proposal.pitch_markdown

- if proposal.custom_fields.any?
Expand Down
2 changes: 1 addition & 1 deletion app/views/proposals/parse_edit_field.js.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$('[data-field-id=<%= field_id %>]')[0].innerHTML = '<%=j text %>';
$('[data-field-name="<%= field_name %>"]')[0].innerHTML = '<%=j text %>';

0 comments on commit 56a2fc6

Please sign in to comment.