diff --git a/anne-survey.rb b/anne-survey.rb index 79a1394..0211c61 100644 --- a/anne-survey.rb +++ b/anne-survey.rb @@ -54,7 +54,7 @@ module Anne::Helpers def next_image all_images = - Pathname.glob(IMAGE_DIR + "*.jpg").map { |img| img.basename.to_s } + Pathname.glob(IMAGE_DIR + "*-l.png").map { |img| img.basename.to_s.sub("-l.png", "") } all_votes = Anne::Models::Vote.find(:all, :conditions => { :user_id => @state["user"].id }) @@ -101,8 +101,8 @@ module Anne::Controllers end def post - choice = if @input.left then "left" - elsif @input.right then "right" + choice = if @input["left.x"] then "left" + elsif @input["right.x"] then "right" else raise "no choice made!" end vote = Anne::Models::Vote.create( :user_id => @state["user"].id, @@ -115,7 +115,7 @@ module Anne::Controllers class ImageX def get(file) unless file =~ /\.\./ - headers["Content-Type"] = "image/jpeg" + headers["Content-Type"] = "image/png" headers["X-Sendfile"] = (IMAGE_DIR + file).to_s else @status = 403 @@ -230,13 +230,14 @@ module Anne::Views def vote(image, progress = 0) h2 "Welk beeld is ruimtelijker?" - # FIXME: resize all images - # FIXME: split all images in two parts and make it possible two select an image. - img :src => R(ImageX, image), :width => "80%" + # FIXME: offset the two images in the same way as in the original + # composited image. form :action => R(Vote), :method => :post do input :type => "hidden", :name => "image", :value => image - input :type => "submit", :name => "left", :value => "Links" - input :type => "submit", :name => "right", :value => "Rechts" + input :type => "image", :src => R(ImageX, "#{image}-l.png"), :name => "left" + input :type => "image", :src => R(ImageX, "#{image}-r.png"), :name => "right" + #input :type => "submit", :name => "left", :value => "Links" + #input :type => "submit", :name => "right", :value => "Rechts" end # FIXME: make a nice div with two spans of the following. p "Woep, je bent al op #{progress}%!"