Closed hdgarrood closed 11 years ago
I have been actually trying to solve this right now. But unfortunately unlike 1.2 case the structure is f.text, f.issue_id in the form. However, adding a normal check_box_tag, that corresponded to 'marked completed', this displays the check-box - but post the corresponding parameter. I cann't f.chec_box because that is not a parameter in release_note table.
I may be horribly limited in my knowledge of RoR and redmine. However, my simple question is - will this be impossible to implement without extending the issue model class?
I am making sense in putting this up? I really need this urgently - before I fully move from 1.2 to 1.3.1 .
No, this shouldn't require changes to the Issue
class. I guess you're editing the partial issues/release_notes
?
I would just use something like: <%= check_box_tag 'mark_complete' %>
in the view, to get an <input>
which isn't associated with the model -- they don't all need to be f.foo
. Then in the create and update actions in ReleaseNotesController
you'll have params[:mark_complete]
which you can use to update the issue.
It might be worth taking a look at what the ReleaseNotesController
looked like before I refactored this whole lot: https://github.com/hdgarrood/redmine_release_notes/blob/v1.2.1/app/controllers/release_notes_controller.rb#L131
I would also say that I don't really like this approach; it feels hacky. However I can't see a better way of doing it.
I tried exactly what you said - but the issue is that params[:mark_complete] is not visible on form post/update. May be I will cross check this once again.
Ha. It works now. but partially.
Actually , as per "this":http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-check_box - the issue was that unchecked values won't get posted!
What do you think should be the approach now? Some say that we can add an additional hidden fields which rails manages well? Whats your approach?
Another things is - after updating the custom value - somehow the redirect doesn't work. Any hint?
If an unchecked checkbox is omitted from the POST data, then that's easy -- we can just do:
if params[:mark_complete]
# checkbox was checked
set_custom_field_value_to_done
else
# params[:mark_complete] was nil because the checkbox was not checked
set_custom_field_value_to_todo
end
Re the redirect -- Maybe submit a pull request so that I can see the code?
Yes. I did that only. Have added journal changes as well.
Now everything works except that redirect to issue page back. See: https://github.com/dipanm/redmine_release_notes
Will also put the pull request.
Closed with #77
Yaaa.. please bring this functionality back - 1.2 had an ability to set 'Release notes done' field by a 'check' which is very essential.
Please establish this again.