summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-24 19:03:41 -0400
committernfoy <nfoy@purdue.edu>2014-04-24 19:03:41 -0400
commit1b11684986136ee87da6242c3ba6aba5ef581510 (patch)
treed7ec999baced4836a9b3b7b31eee39cfe09410c9 /app
parent9823642115ef52f0a21b9466cef412098a124f3d (diff)
parentdb073045ff7cf5d8a2fb4a3349ed6a9a6ac019d3 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/custom.css.scss3
-rw-r--r--app/assets/stylesheets/matches.css.scss15
-rw-r--r--app/controllers/matches_controller.rb4
-rw-r--r--app/controllers/tournaments_controller.rb4
-rw-r--r--app/models/api_request.rb2
-rw-r--r--app/models/api_requests.rb2
-rw-r--r--app/models/tournament.rb12
-rw-r--r--app/views/matches/index.html.erb7
8 files changed, 27 insertions, 22 deletions
diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss
index 4104235..b456893 100644
--- a/app/assets/stylesheets/custom.css.scss
+++ b/app/assets/stylesheets/custom.css.scss
@@ -36,13 +36,14 @@ a, input[type="submit"] {
}
-input[type="text"], input[type="password"]{
+input[type="text"], input[type="password"], textarea{
-webkit-box-shadow: inset 0 0 8px rgba(0,0,0,0.1), 0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow: inset 0 0 8px rgba(0,0,0,0.1), 0 0 16px rgba(0,0,0,0.1);
box-shadow: inset 0 0 8px rgba(0,0,0,0.1), 0 0 16px rgba(0,0,0,0.1);
border: 3px inset #A5A5A5;
padding: 8px;
+ color: $orange !important;
background: rgba(0,0,0,0.5);
margin: 0 0 5px 0;
}
diff --git a/app/assets/stylesheets/matches.css.scss b/app/assets/stylesheets/matches.css.scss
index 66da68e..ee43ab4 100644
--- a/app/assets/stylesheets/matches.css.scss
+++ b/app/assets/stylesheets/matches.css.scss
@@ -51,4 +51,19 @@
form {
color: #333;
}
+}
+
+svg {
+ min-width: 600px;
+}
+
+@media (max-width: 900px) {
+ svg text {
+ font-size: 200%;
+ }
+}
+@media (max-width: 700px) {
+ svg text {
+ font-size: 150%;
+ }
} \ No newline at end of file
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 1ad86d0..138cf28 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -23,8 +23,8 @@ class MatchesController < ApplicationController
@match.teams.each do |team|
team.users.each do |user|
- players_id.push(user.remote_usernames[0]["json_value"]["id"])
- players.push(user.remote_usernames[0]["json_value"]["id"])
+ players_id.push(user.remote_usernames[0].value["id"])
+ players.push(user.remote_usernames[0].value["name"])
end
end
diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb
index ebc54c1..1354ad6 100644
--- a/app/controllers/tournaments_controller.rb
+++ b/app/controllers/tournaments_controller.rb
@@ -116,8 +116,8 @@ class TournamentsController < ApplicationController
success = true
ActiveRecord::Base.transaction do
success &= @tournament.save &&
- success &= @tournament.tournament_stages.create(scheduling: "elimination")
- success &= @tournament.tournament_stages.first.create_matches
+ success &= @tournament.stages.create(scheduling: "elimination")
+ success &= @tournament.stages.first.create_matches
end
if success
format.html { redirect_to @tournament, notice: 'You have started this tournament.' }
diff --git a/app/models/api_request.rb b/app/models/api_request.rb
new file mode 100644
index 0000000..ffb7267
--- /dev/null
+++ b/app/models/api_request.rb
@@ -0,0 +1,2 @@
+class ApiRequest < ActiveRecord::Base
+end
diff --git a/app/models/api_requests.rb b/app/models/api_requests.rb
deleted file mode 100644
index 19c76e2..0000000
--- a/app/models/api_requests.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class ApiRequests < ActiveRecord::Base
-end
diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index e21ccb1..861be6c 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -1,20 +1,10 @@
class Tournament < ActiveRecord::Base
belongs_to :game
- has_many :tournament_stages
+ has_many :stages, class_name: "TournamentStage"
has_many :settings_raw, class_name: "TournamentSetting"
has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments"
has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments"
- def stages_ordered
- h = {}
- i = 1
- self.tournament_stages.order(:id).each do |s|
- h[i] = s
- i += 1
- end
- return h
- end
-
def settings
@settings ||= Settings.new(self)
end
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index 8a50fee..784d7db 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -12,8 +12,7 @@
</tr>
</thead>
<tbody>
- <% @tournament.stages_ordered.keys.sort.each do |stage_key| %>
- <% stage = @tournament.stages_ordered[stage_key] %>
+ <% @tournament.stages.order(:id).each do |stage| %>
<% stage.matches_ordered.keys.sort.reverse.each do |match_key| %><tr>
<% match = stage.matches_ordered[match_key] %>
<td><%= "Match #{match.id}" %></td>
@@ -36,6 +35,6 @@
<br>
-<% @tournament.stages_ordered.keys.sort.each do |stage_key| %>
- <div class="graph"><%= raw @tournament.stages_ordered[stage_key].to_svg(current_user) %></div>
+<% @tournament.stages.order(:id).each do |stage| %>
+ <div class="graph"><%= raw stage.to_svg(current_user) %></div>
<% end %>