-
Notifications
You must be signed in to change notification settings - Fork 3
Answers #44
base: master
Are you sure you want to change the base?
Answers #44
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after fixing the conflics this branch looks fine to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the submit button and cracked the case on the one-click-answer submission for Answer.content, but what we still need is this conditional statement that you made - can you pull the latest master, throw that conditional on and push it back up? I just tested and re-tested the answer storage and its looking good.
app/views/legislations/show.html.erb
Outdated
<%= f.hidden_field :question_id, :value => clause.questions[1].id %> | ||
<div class="buttonspacing"> | ||
<%= f.select(:content, options_for_select([['No', 'No'], ['Yes', 'Yes']])) %> | ||
<a data-action="slideshow#next"><%= f.submit 'submit', :class => 'btn-primary' %></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, but then they would need to choose an option and then click a 'submit' button? That's what we originally had, but then it's a lot more fluid when they can just choose their option and move on. I was trying to decipher how to get the submit button to submit the content that's on it, rather than making it a two-step process. Unless I'm reading this form wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have figured it out, it was :name => "content", which signifies params[:content] - so need to do that for all of them, and also made an edit to the answers controller params[:content] .... and then to fix the not being shown twice, I had to fix where the second two answers were storing, it was a copy/paste fuck up on my end, basically the answers were being stored as the same question_id as the second one, so that's why the first and second question wouldn't show when a user already answered them but the third and fourth would. The unless loop was working, but the answer was storing as the wrong thing -_-. Its all working and storing correctly now with the values from the buttons as the :content.
@answer.content = params[:answer][:content] | ||
@answer.user_id = current_user.id | ||
@answer.question = Question.find(params[:answer][:question_id]) | ||
@answer = Answer.new(answer_params) | ||
|
||
if current_user == nil | ||
redirect_to new_user_registration_path | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
…for question[2] to question[3]
Made it so that answers get saved every time and conditional statement so that content box for suggestions only appears if person clicks on the
yes
button