aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-07-27 17:34:47 +0200
committerPetteri Räty <petsku@petteriraty.eu>2010-07-27 23:35:45 +0300
commit97b8d09ebcbb560cd6ba36f038b059d908d7ebec (patch)
tree5fb3abf7bdf78fd114919ce8fedb0e68224dd375 /app
parentValidate that mentors have been Gentoo developers long enough (diff)
downloadrecruiting-webapp-97b8d09ebcbb560cd6ba36f038b059d908d7ebec.tar.gz
recruiting-webapp-97b8d09ebcbb560cd6ba36f038b059d908d7ebec.tar.bz2
recruiting-webapp-97b8d09ebcbb560cd6ba36f038b059d908d7ebec.zip
Allow recruits to give feedback on documentation + tiny bug fix
A tiny bug (missing try) was discovered when making this commit: multiple choice question with no options could not be displayed. This commit fixes the bug.
Diffstat (limited to 'app')
-rw-r--r--app/models/answer.rb5
-rw-r--r--app/views/taglibs/forms.dryml4
2 files changed, 6 insertions, 3 deletions
diff --git a/app/models/answer.rb b/app/models/answer.rb
index 4d819b8..891c38a 100644
--- a/app/models/answer.rb
+++ b/app/models/answer.rb
@@ -8,6 +8,9 @@ class Answer < ActiveRecord::Base
content HoboFields::MarkdownString
approved :boolean, :default => false
reference :boolean, :default => false
+ feedback HoboFields::EnumString.for('', 'Documentation ok',
+ 'Could not find documentation', 'Documentation insufficient'),
+ :default => ''
timestamps
end
attr_readonly :reference
@@ -92,7 +95,7 @@ class Answer < ActiveRecord::Base
elsif params.include? "multiple_choice_answer"
ans_hash = params["multiple_choice_answer"]
new_ans = MultipleChoiceAnswer.new ans_hash
- new_ans.options = params["options"].inject(Array.new){ |a, cur| a.push cur.to_i }
+ new_ans.options = params["options"].try.inject(Array.new){ |a, cur| a.push cur.to_i } || []
return new_ans
end
diff --git a/app/views/taglibs/forms.dryml b/app/views/taglibs/forms.dryml
index f1370f5..9f93b8a 100644
--- a/app/views/taglibs/forms.dryml
+++ b/app/views/taglibs/forms.dryml
@@ -2,7 +2,7 @@
<form merge param="default">
<error-messages param/>
<input:question type="hidden"/>
- <field-list fields="content, reference, approved">
+ <field-list fields="content, reference, approved, feedback">
<content-label:>Your Answer:</content-label:>
</field-list>
<div param="actions">
@@ -31,7 +31,7 @@
<input:question type="hidden"/>
<input:owner type="hidden"/>
<input:options/>
- <field-list fields="reference, approved"/>
+ <field-list fields="reference, approved, feedback"/>
</table>
<div param="actions">
<submit label="#{ht 'answers.actions.save', :default=>['Save']}" param/><or-cancel param="cancel"/>