Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JM - (SPARCForms) View Response Likert Bug #1299

Merged
merged 2 commits into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/assets/javascripts/likert.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
$(document).ready ->
$(document). on 'click', '.likert-option', ->
$(this).find('input').prop('checked', true)

$("#disable-likert *").prop('disabled',true)
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
.form-group
%p.question-description
= raw(question.description)
.question-options
.question-options{ id: ['new', 'edit', 'preview'].include?(action_name) ? '' : 'disable-likert' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will give us multiple elements with the same ID which breaks DOM conventions. Is it possible to use a class instead?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, this can cause lots of problems, especially in forms.

= render "surveyor/responses/form/form_partials/#{question.question_type}_form_partial", qr: qr, question: question, question_response: question_response
- if question.errors.any?
.alert.alert-danger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
- if ['new', 'edit', 'preview'].include?(action_name)
= qr.label :content, option.content, class: "radio-inline option no-padding", data: { question_id: question.id, option_id: option.id }
- else
%label.radio-inline.option.no-padding
%label.radio-inline.option.no-padding.disabled
= option.content
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

expect(page).to have_content('System Satisfaction Survey')
expect(page).to have_selector('.question', count: 1)
expect(page).to have_selector('.likert input[disabled="disabled"]', count: 2)
expect(page).to have_selector('#disable-likert', count: 1)
expect(page).to have_selector('.likert input[checked="checked"]', count: 1)
end
end