Created
June 17, 2011 17:24
-
-
Save alexch/1031836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HowManyLicks < QuestionForm | |
def content | |
overview do | |
title_element "How many licks?" | |
text_element "Please tell us how many licks it takes to get to the center of these things." | |
formattedcontent do | |
rawtext "<![CDATA[\n" | |
p do | |
a :href => "http://tootsiepop.com/instructions.html" do | |
b "Click here to read the instructions!" | |
end | |
end | |
rawtext "\n]]>" | |
end | |
end | |
@items.each do |item| | |
question do | |
questionidentifier item.id | |
displayname item.name | |
isrequired true | |
questioncontent do | |
text_element do | |
text item.name | |
text "?" | |
end | |
end | |
answerspecification do | |
selectionanswer do | |
minselectioncount 0 | |
stylesuggestion "radiobutton" | |
selections do | |
selection do | |
selectionidentifier "1" | |
text_element "One" | |
end | |
selection do | |
selectionidentifier "2" | |
text_element "Two" | |
end | |
selection do | |
selectionidentifier "3" | |
text_element "Three" | |
end | |
end | |
end | |
end | |
end | |
end | |
question do | |
questionidentifier "comments" | |
questioncontent do | |
text_element "Do you have any comments?" | |
end | |
answerspecification do | |
freetextanswer | |
end | |
end | |
end | |
end | |
# assuming your own domain object called "Item" | |
HowManyLicks.new(:items => [Item.new(99, "Tootsie Pop")]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment