parent
73cff897a3
commit
d08362326d
@ -1,10 +0,0 @@
|
||||
<ul>
|
||||
<% @mash_tournament.mashes.each do |mash| %>
|
||||
<% if mash.map_a.present? && mash.map_b.present? && mash.winner.present? %>
|
||||
<li><%= mash.map_a.name %> vs. <%= mash.map_b.name %>, winner = <%= mash.winner.name %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
|
||||
<%= link_to 'New!', :controller => 'mash_tournaments', :action => 'new' %>
|
@ -0,0 +1,11 @@
|
||||
- @mash_tournament.rounds.reverse.each do |round|
|
||||
%h2 Round #{round.number}
|
||||
- round.mashes.each do |mash|
|
||||
%ul
|
||||
- if mash.map_a.present? && mash.map_b.present? && mash.winner.present?
|
||||
%li
|
||||
#{mash.map_a.name} vs. #{mash.map_b.name}, winner =
|
||||
%strong #{mash.winner.name}
|
||||
|
||||
|
||||
= link_to 'New!', :controller => 'mash_tournaments', :action => 'new'
|
@ -1,32 +0,0 @@
|
||||
<% content_for :head_js do %>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.mash-image').click(function(elem) {
|
||||
$('#mash_winner_id').val($(elem.target).attr('data-map-id'));
|
||||
$('#new_mash').submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<h1>Mash the Maps!</h1>
|
||||
<p>Choose your fave.</p>
|
||||
|
||||
<% form_for(@mash) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
|
||||
<div id="maps">
|
||||
<div id="map_a" class="mash-image">
|
||||
<image src="<%= url_for @map_a %>.png" data-map-id="<%= @map_a.id %>" />
|
||||
</div>
|
||||
<div id="map_b" class="mash-image">
|
||||
<image src="<%= url_for @map_b %>.png" data-map-id="<%= @map_b.id %>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.hidden_field :map_a_id, :value => @map_a.id %>
|
||||
<%= f.hidden_field :map_b_id, :value => @map_b.id %>
|
||||
<%= f.hidden_field :winner_id, :value => -1 %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', mashes_path %>
|
@ -0,0 +1,22 @@
|
||||
- content_for :head_js do
|
||||
:javascript
|
||||
$(function() {
|
||||
$('.mash-image').click(function(elem) {
|
||||
$('#mash_winner_id').val($(elem.target).attr('data-map-id'));
|
||||
$('form[id^="edit_mash_"]').submit();
|
||||
});
|
||||
});
|
||||
|
||||
%h1 Mash the Maps!
|
||||
%p Choose your fave.
|
||||
|
||||
- form_for(@mash) do |f|
|
||||
= f.error_messages
|
||||
|
||||
#maps
|
||||
#map_a.mash-image
|
||||
%image{:src => "#{url_for @mash.map_a}.png", :'data-map-id' => @mash.map_a.id}
|
||||
#map_b.mash-image
|
||||
%image{:src => "#{url_for @mash.map_b}.png", :'data-map-id' => @mash.map_b.id}
|
||||
|
||||
= f.hidden_field :winner_id, :value => '?'
|
@ -1,12 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "/mash_tournaments/show.html.erb" do
|
||||
include MashTournamentsHelper
|
||||
before(:each) do
|
||||
assigns[:mash_tournament] = @mash_tournament = stub_model(MashTournament)
|
||||
end
|
||||
|
||||
it "renders attributes in <p>" do
|
||||
render
|
||||
end
|
||||
end
|
Loading…
Reference in new issue