From f5d8960647c6ee407c7cace71345af5ae1d02585 Mon Sep 17 00:00:00 2001 From: Prommah Date: Fri, 6 Nov 2015 19:43:30 +0000 Subject: [PATCH] Merge lineup forms --- .../themes/default/pages/_matches.scss | 48 +++++-------------- .../themes/flat/pages/_matches.scss | 48 +++++-------------- app/views/matches/_lineup.html.erb | 6 ++- app/views/matches/ref.html.erb | 38 ++++++--------- 4 files changed, 45 insertions(+), 95 deletions(-) mode change 100644 => 100755 app/assets/stylesheets/themes/default/pages/_matches.scss mode change 100644 => 100755 app/assets/stylesheets/themes/flat/pages/_matches.scss mode change 100644 => 100755 app/views/matches/_lineup.html.erb mode change 100644 => 100755 app/views/matches/ref.html.erb diff --git a/app/assets/stylesheets/themes/default/pages/_matches.scss b/app/assets/stylesheets/themes/default/pages/_matches.scss old mode 100644 new mode 100755 index 7c02079..1cf2924 --- a/app/assets/stylesheets/themes/default/pages/_matches.scss +++ b/app/assets/stylesheets/themes/default/pages/_matches.scss @@ -156,6 +156,7 @@ div#match { .team-1, .team-2 { position: relative; + margin-bottom: 20px; .player { @include span-columns(12); @@ -167,21 +168,8 @@ div#match { position: relative; } - .controls { - top: 0; - position: absolute; - z-index: 100; - - input { - margin: 0; - } - } - - form { - - label.checkbox { - padding: 0; - } + label.checkbox { + padding: 0; } } @@ -193,16 +181,9 @@ div#match { margin: 0 0 0 10px; } - .controls { - left: 0; - } - - form { - - label.checkbox { - float: right; - margin-left: 1em; - } + label.checkbox { + float: right; + margin-left: 1em; } } @@ -210,16 +191,9 @@ div#match { @include span-columns(6); @include omega; - .controls { - right: 0; - } - - form { - - label.checkbox { - float: left; - margin-right: 1em; - } + label.checkbox { + float: left; + margin-right: 1em; } } @@ -234,6 +208,10 @@ div#match { margin: 0; } } + + form .controls { + clear: both; + } } .scoring { diff --git a/app/assets/stylesheets/themes/flat/pages/_matches.scss b/app/assets/stylesheets/themes/flat/pages/_matches.scss old mode 100644 new mode 100755 index 8ce9e99..92d98cc --- a/app/assets/stylesheets/themes/flat/pages/_matches.scss +++ b/app/assets/stylesheets/themes/flat/pages/_matches.scss @@ -155,6 +155,7 @@ div#match { .team-1, .team-2 { position: relative; + margin-bottom: 20px; .player { @include span-columns(12); @@ -166,21 +167,8 @@ div#match { position: relative; } - .controls { - top: 0; - position: absolute; - z-index: 100; - - input { - margin: 0; - } - } - - form { - - label.checkbox { - padding: 0; - } + label.checkbox { + padding: 0; } } @@ -192,16 +180,9 @@ div#match { margin: 0 0 0 10px; } - .controls { - left: 0; - } - - form { - - label.checkbox { - float: right; - margin-left: 1em; - } + label.checkbox { + float: right; + margin-left: 1em; } } @@ -209,16 +190,9 @@ div#match { @include span-columns(6); @include omega; - .controls { - right: 0; - } - - form { - - label.checkbox { - float: left; - margin-right: 1em; - } + label.checkbox { + float: left; + margin-right: 1em; } } @@ -233,6 +207,10 @@ div#match { margin: 0; } } + + form .controls { + clear: both; + } } .scoring { diff --git a/app/views/matches/_lineup.html.erb b/app/views/matches/_lineup.html.erb old mode 100644 new mode 100755 index 0f9ba3a..b610794 --- a/app/views/matches/_lineup.html.erb +++ b/app/views/matches/_lineup.html.erb @@ -1,7 +1,7 @@
<% contester.lineup.each do |teamer| %>
- <% if matcher = @match.matchers.first(conditions: { user_id: teamer.user_id }) %> + <% if matcher = @match.matchers.first(conditions: { user_id: teamer.user_id, contester_id: contester.id }) %> <%= hidden_field_tag "match[matchers_attributes][#{@n}][id]", matcher.id %> <% end %> @@ -9,7 +9,7 @@ <%= hidden_field_tag "match[matchers_attributes][#{@n}][contester_id]", contester.id %> <%= hidden_field_tag "match[matchers_attributes][#{@n}][match_id]", @match.id %> <%= hidden_field_tag "match[matchers_attributes][#{@n}][merc]", false %> - <%= check_box_tag "match[matchers_attributes][#{@n}][_destroy]", "keep", @match.users.exists?(teamer.user), { id: "player_#{@n}" } %> + <%= check_box_tag "match[matchers_attributes][#{@n}][_destroy]", "keep", !matcher.nil?, { id: "player_#{@n}" } %> <%= label_tag "player_#{@n}", '', class: 'checkbox' %> @@ -45,5 +45,7 @@ <%= hidden_field_tag "match[matchers_attributes][#{@n}][_destroy]", "keep" %> <%= text_field_tag "match[matchers_attributes][#{@n}][user_id]", '', placeholder: 'Mercenary' %> + + <% @n = @n + 1 %>
diff --git a/app/views/matches/ref.html.erb b/app/views/matches/ref.html.erb old mode 100644 new mode 100755 index 5e8a0aa..fe0fa40 --- a/app/views/matches/ref.html.erb +++ b/app/views/matches/ref.html.erb @@ -16,33 +16,25 @@

Lineups

-
- <%= form_for @match do |f| %> - <%= f.error_messages %> - -
- <%= f.submit 'Save Lineup' %> -
+ <%= form_for @match do |f| %> + <%= f.error_messages %> +
<% [@match.contester1].each do |contester| %> - <%= render partial: "lineup", locals: { contester: contester } %> + <%= render partial: "lineup", locals: { contester: contester } %> <% end %> - <% end %> -
- -
- <%= form_for @match do |f| %> - <%= f.error_messages %> - -
- <%= f.submit 'Save Lineup' %> -
- +
+ +
<% [@match.contester2].each do |contester| %> - <%= render partial: "lineup", locals: { contester: contester } %> + <%= render partial: "lineup", locals: { contester: contester } %> <% end %> - <% end %> -
+
+ +
+ <%= f.submit 'Save Lineups' %> +
+ <% end %>
@@ -83,7 +75,7 @@
- <%= f.submit 'Save Scores' %> + <%= f.submit 'Save Scoring' %>
<% end %>