Skip to content

Commit

Permalink
Merge pull request #1979 from sparc-request/feedback-bug
Browse files Browse the repository at this point in the history
fixing feedback bug when use_feedback_link setting is turned off
  • Loading branch information
kayla-glick committed Sep 11, 2019
2 parents 6a1605d + 3b03503 commit d556995
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions app/controllers/feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,14 @@ def create
private

def feedback_params
params.require(:feedback).permit(
:name, :email, :date, :typeofrequest, :priority,
:browser,:version, :sparc_request_id)
if Setting.get_value('use_redcap_api')
params.require(:feedback).permit(
:name, :email, :date, :typeofrequest, :priority,
:browser,:version, :sparc_request_id)
else
params.require(:feedback).permit(
:name, :email, :message
)
end
end
end
2 changes: 1 addition & 1 deletion app/models/feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Feedback

attr_accessor :name, :email, :date, :typeofrequest, :priority, :browser, :version, :sparc_request_id, :letters

validates_presence_of :name, :email, :date, :typeofrequest, :priority, :browser, :version, :sparc_request_id
validates_presence_of :name, :email, :date, :typeofrequest, :priority, :sparc_request_id
validates_format_of :email, with: Devise::email_regexp

def initialize(attributes = {})
Expand Down
4 changes: 2 additions & 2 deletions app/views/feedback/_feedback_modal.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
- if Setting.get_value('use_redcap_api')
.form-row
.form-group.col-6
= f.label :browser, class: 'required'
= f.label :browser
= f.select :browser, options_for_select(BROWSER_VERSIONS.to_a), { prompt: 'Please Choose a Browser' }, class: 'selectpicker'
.form-group.col-6
= f.label :version, class: 'required'
= f.label :version
= f.text_field :version, class: 'form-control'
.form-row
.form-group.col-6
Expand Down

0 comments on commit d556995

Please sign in to comment.