I am starting to develop a simple Redmine plugin that will allow a user to edit and save a specific Redmine Issue custom field. I am completely new to Rails and to writing Redmine plugins, so please excuse me if this is a very simple and easy question to answer.
What I have so far is a table which shows Issues from a given Product and Version, along with other custom fields. Please see the image here:
What I would like to do is to change the the custom field "Note Description" (inside the text area) and when I hit the "Save changes" I would like to send the controller a hash with all the fields of this form (including Issue ID and Issue Note Description), whenever the check-box is clicked for a given row. The controller will then receive the new descriptions for a given Issue number and update the Issue field "Note description" with the new string entered by the user.
Here are the relevant code snippets.
index.html.erb:
<h3>Changelog</h3>
<table>
<%= form_tag(controller: "polls", action: "save", method: "get",
project_id: @project, id: @version_selected_combo) do %>
<tr>
<th class="checkbox"></th>
<th class="tracker">Tracker</th>
<th class="issue">Issue ID</th>
<th class="status">Status</th>
<th class="description">Note Description</th>
<th class="subject">Subject</th>
</tr>
<% @improvement_issues.each_with_index do |issue, index| %>
<tr>
<td class="checkbox"><%= check_box_tag 'issue_checkbox' %></td>
<td class="tracker"><font color="LimeGreen">
<%= issue.to_s.split(' ').at(0) %></font></td>
<td class="issue">
<%= label_tag(:issue_id, issue.to_s.split(' ').at(1)[1..-2]) %></td>
<td class="status"><%= @improvement_issues_descriptions[index] %></td>
<td class="description">
<%= text_area_tag(:transfer_note_description,
@transfer_notes_descriptions[index],
:cols => "100", :rows => "1") %></td>
<td class="subject"><%= sanitize issue.to_s.partition(': ')[2] %></td>
</tr>
<% end %>
<tr>
<td><%= submit_tag("Save changes") %></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<% end %>
</table>
As you can see I am using a Form Helper inside a table, I don't know if this is the correct or better way to do it.
polls_controller.rb:
def save
p params
end
This is just the method called after hitting the "Save changes" button.
The log I get if I check both check-boxes is the following:
[ 2014-10-21 15:55:21.2754 21609/7f0234d4e700 Pool2/Implementation.cpp:1291 ]: [App 21695 stdout] {"utf8"=>"✓", "issue_checkbox"=>"1", "transfer_note_description"=>"description for the note here", "commit"=>"Save changes", "id"=>"trunk", "method"=>"get", "project_id"=>"sandbox", "action"=>"save", "controller"=>"polls"}
I am not being able to send the controller the note descriptions and issue numbers.
I have no model because I don't need one, as all the data is already in the redmine database. When the user submits the form I want the controller to get a hash with the issue number and the issue note description.
I want to use rails as much as possible, and as such, I don't want to use javascript if I can avoid it.
Any help will be welcome. Thanks in advance for your time.