Merge pull request #72 from Prommah/develop

Merge lineup forms & fix hound (again)
This commit is contained in:
simplefl 2015-11-07 01:02:18 +01:00
commit 5464cfa6fc
5 changed files with 54 additions and 99 deletions

View file

@ -156,6 +156,7 @@ div#match {
.team-1, .team-1,
.team-2 { .team-2 {
position: relative; position: relative;
margin-bottom: 20px;
.player { .player {
@include span-columns(12); @include span-columns(12);
@ -167,23 +168,10 @@ div#match {
position: relative; position: relative;
} }
.controls {
top: 0;
position: absolute;
z-index: 100;
input {
margin: 0;
}
}
form {
label.checkbox { label.checkbox {
padding: 0; padding: 0;
} }
} }
}
.team-1 { .team-1 {
@include span-columns(6); @include span-columns(6);
@ -193,35 +181,21 @@ div#match {
margin: 0 0 0 10px; margin: 0 0 0 10px;
} }
.controls {
left: 0;
}
form {
label.checkbox { label.checkbox {
float: right; float: right;
margin-left: 1em; margin-left: 1em;
} }
} }
}
.team-2 { .team-2 {
@include span-columns(6); @include span-columns(6);
@include omega; @include omega;
.controls {
right: 0;
}
form {
label.checkbox { label.checkbox {
float: left; float: left;
margin-right: 1em; margin-right: 1em;
} }
} }
}
&.shift .team-2 { &.shift .team-2 {
@include shift(6); @include shift(6);
@ -234,6 +208,10 @@ div#match {
margin: 0; margin: 0;
} }
} }
form .controls {
clear: both;
}
} }
.scoring { .scoring {

32
app/assets/stylesheets/themes/flat/pages/_matches.scss Normal file → Executable file
View file

@ -155,6 +155,7 @@ div#match {
.team-1, .team-1,
.team-2 { .team-2 {
position: relative; position: relative;
margin-bottom: 20px;
.player { .player {
@include span-columns(12); @include span-columns(12);
@ -166,23 +167,10 @@ div#match {
position: relative; position: relative;
} }
.controls {
top: 0;
position: absolute;
z-index: 100;
input {
margin: 0;
}
}
form {
label.checkbox { label.checkbox {
padding: 0; padding: 0;
} }
} }
}
.team-1 { .team-1 {
@include span-columns(6); @include span-columns(6);
@ -192,35 +180,21 @@ div#match {
margin: 0 0 0 10px; margin: 0 0 0 10px;
} }
.controls {
left: 0;
}
form {
label.checkbox { label.checkbox {
float: right; float: right;
margin-left: 1em; margin-left: 1em;
} }
} }
}
.team-2 { .team-2 {
@include span-columns(6); @include span-columns(6);
@include omega; @include omega;
.controls {
right: 0;
}
form {
label.checkbox { label.checkbox {
float: left; float: left;
margin-right: 1em; margin-right: 1em;
} }
} }
}
&.shift .team-2 { &.shift .team-2 {
@include shift(6); @include shift(6);
@ -233,6 +207,10 @@ div#match {
margin: 0; margin: 0;
} }
} }
form .controls {
clear: both;
}
} }
.scoring { .scoring {

6
app/views/matches/_lineup.html.erb Normal file → Executable file
View file

@ -1,7 +1,7 @@
<div class="players"> <div class="players">
<% contester.lineup.each do |teamer| %> <% contester.lineup.each do |teamer| %>
<div class="player fields"> <div class="player fields">
<% 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 %> <%= hidden_field_tag "match[matchers_attributes][#{@n}][id]", matcher.id %>
<% end %> <% end %>
@ -9,7 +9,7 @@
<%= hidden_field_tag "match[matchers_attributes][#{@n}][contester_id]", contester.id %> <%= 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}][match_id]", @match.id %>
<%= hidden_field_tag "match[matchers_attributes][#{@n}][merc]", false %> <%= 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' %> <%= label_tag "player_#{@n}", '', class: 'checkbox' %>
@ -45,5 +45,7 @@
<%= hidden_field_tag "match[matchers_attributes][#{@n}][_destroy]", "keep" %> <%= hidden_field_tag "match[matchers_attributes][#{@n}][_destroy]", "keep" %>
<%= text_field_tag "match[matchers_attributes][#{@n}][user_id]", '', placeholder: 'Mercenary' %> <%= text_field_tag "match[matchers_attributes][#{@n}][user_id]", '', placeholder: 'Mercenary' %>
<% @n = @n + 1 %>
</div> </div>
</div> </div>

22
app/views/matches/ref.html.erb Normal file → Executable file
View file

@ -16,33 +16,25 @@
<div class="lineups"> <div class="lineups">
<h3>Lineups</h3> <h3>Lineups</h3>
<div class="team-1">
<%= form_for @match do |f| %> <%= form_for @match do |f| %>
<%= f.error_messages %> <%= f.error_messages %>
<div class="controls"> <div class="team-1">
<%= f.submit 'Save Lineup' %>
</div>
<% [@match.contester1].each do |contester| %> <% [@match.contester1].each do |contester| %>
<%= render partial: "lineup", locals: { contester: contester } %> <%= render partial: "lineup", locals: { contester: contester } %>
<% end %> <% end %>
<% end %>
</div> </div>
<div class="team-2"> <div class="team-2">
<%= form_for @match do |f| %>
<%= f.error_messages %>
<div class="controls">
<%= f.submit 'Save Lineup' %>
</div>
<% [@match.contester2].each do |contester| %> <% [@match.contester2].each do |contester| %>
<%= render partial: "lineup", locals: { contester: contester } %> <%= render partial: "lineup", locals: { contester: contester } %>
<% end %> <% end %>
<% end %>
</div> </div>
<div class="controls">
<%= f.submit 'Save Lineups' %>
</div>
<% end %>
</div> </div>
<div class="scoring"> <div class="scoring">
@ -83,7 +75,7 @@
</div> </div>
<div class="controls"> <div class="controls">
<%= f.submit 'Save Scores' %> <%= f.submit 'Save Scoring' %>
</div> </div>
<% end %> <% end %>
</div> </div>

View file

@ -13,6 +13,14 @@ Style/CollectionMethods:
find: detect find: detect
find_all: select find_all: select
reduce: inject reduce: inject
Style/DotPosition:
Description: Checks the position of the dot in multi-line method calls.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
Enabled: true
EnforcedStyle: leading
SupportedStyles:
- leading
- trailing
Style/FileName: Style/FileName:
Description: Use snake_case for source file names. Description: Use snake_case for source file names.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
@ -27,7 +35,7 @@ Style/IfUnlessModifier:
Description: Favor modifier if/unless usage when you have a single-line body. Description: Favor modifier if/unless usage when you have a single-line body.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
Enabled: false Enabled: false
MaxLineLength: 80 MaxLineLength: 100
Style/OptionHash: Style/OptionHash:
Description: Don't use option hashes when you can use keyword arguments. Description: Don't use option hashes when you can use keyword arguments.
Enabled: false Enabled: false
@ -223,14 +231,11 @@ Lint/LiteralInCondition:
Lint/LiteralInInterpolation: Lint/LiteralInInterpolation:
Description: Checks for literals used in interpolation. Description: Checks for literals used in interpolation.
Enabled: false Enabled: false
Metrics/LineLength: Metrics/LineLength:
Description: Limit lines to 100 characters. Description: Limit lines to 100 characters.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
Enabled: true Enabled: true
Max: 100 Max: 100
AllowURI: true AllowURI: true
URISchemes: URISchemes:
- http - http
- https - https