Permalink
Browse files

refactored frame partials again and broke bonus

  • Loading branch information...
1 parent 440b920 commit 6276a4b885aa1f90fa7feec729ffe4daf6b8d5c1 @tritchie committed Oct 2, 2011
@@ -48,7 +48,7 @@ def bonusboxes
[box1, box2]
end
def bonusattrs
- if Frame.find(@game.current_frame).position == 11
+ if Frame.find(@game.currentframe).position == 11
{:class => 'bonusbox'}
else
{:class => 'box2'}
@@ -57,4 +57,15 @@ def bonusattrs
def bonusframe?
@frame.position == 11
end
+ def bonus
+ @frame = frameat 11
+ if active?
+ render :partial => 'frames/activeframe'
+ else
+ render :partial => 'frames/inactiveframe'
+ end
+ end
+ def frameat(position)
+ @game.frames.where(:position => position)[0]
+ end
end
@@ -1,16 +1,11 @@
-%table
- = form_for(@frame) do |f|
- %tr
- %td.ball1
- = f.text_field :ball1, :size => 1, :onchange => "this.form.submit();"
- %td.ball2
- = f.text_field :ball2, :size => 1, :onchange => "this.form.submit();"
- -if @frame.ball1 == nil
- :javascript
- document.getElementById("frame_ball1").focus();
- -elsif @frame.ball2 == nil
- :javascript
- document.getElementById("frame_ball2").focus();
- %tr
- %td 1st
- %td 2nd
+= form_for(@frame) do |f|
+ %td.ball1
+ = f.text_field :ball1, :size => 1, :onchange => "this.form.submit();"
+ %td.ball2
+ = f.text_field :ball2, :size => 1, :onchange => "this.form.submit();"
+ -if @frame.ball1 == nil
+ :javascript
+ document.getElementById("frame_ball1").focus();
+ -elsif @frame.ball2 == nil
+ :javascript
+ document.getElementById("frame_ball2").focus();
@@ -0,0 +1,4 @@
+%td{bonusattrs}
+ =bonusboxes[0]
+%td{bonusattrs}
+ =bonusboxes[1]
@@ -1,16 +1,8 @@
--#(:url => {:controller => 'games', :action => 'update', :id => @game.id})}
--#{:onclick => (:url => {:controller => 'games', :action => 'update', :game => {:current_frame => @frame.id}})}
-%table
- %tr
- %td.box1
- = box1
- %td.box2
- = box2
- -if @frame.position == 10
- %td{bonusattrs}
- =bonusboxes[0]
- %td{bonusattrs}
- =bonusboxes[1]
- %tr
- %td.total{:colspan => 2}
- = total
+%td
+ -editable? ? link = {:href => "/games/#{@game.id}/update/#{@frame.id}"} : link = {}
+ %a{link}
+ %table
+ %td.box1
+ = box1
+ %td.box2
+ = box2
@@ -1,7 +1,17 @@
%td{frameattrs}
-if active?
- =render :partial => 'frames/activeframe'
+ %table
+ %tr
+ =render :partial => 'frames/activeframe'
+ =bonus if @frame.position == 10
+ %tr
+ %td 1st
+ %td 2nd
-else
- -editable? ? link = {:href => "/games/#{@game.id}/update/#{@frame.id}"} : link = {}
- %a{link}
- =render :partial => 'frames/inactiveframe'
+ %table
+ %tr
+ =render :partial => 'frames/inactiveframe'
+ =bonus if @frame.position == 10
+ %tr
+ %td.total{:colspan => 2}
+ = total

0 comments on commit 6276a4b

Please sign in to comment.