summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-06 22:20:28 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-06 22:20:28 -0400
commitbf798e57a760b68c3c7460789cef6389141c067d (patch)
tree16cd7400b7f289b4aa6ec90e253c4d30d7a1a08c /app/views
parent91fee659eadaf6bcc4d063fd5645950da1250896 (diff)
parent628173fce3de8f5d3e31109b3aa7c964fdab38ca (diff)
Merge branch 'master' of http://github.com/LukeShu/leaguer
Diffstat (limited to 'app/views')
-rw-r--r--app/views/layouts/application.html.erb8
-rw-r--r--app/views/matches/index.html.erb70
-rw-r--r--app/views/matches/show.html.erb37
-rw-r--r--app/views/servers/_form.html.erb19
-rw-r--r--app/views/servers/edit.html.erb3
-rw-r--r--app/views/servers/index.html.erb25
-rw-r--r--app/views/servers/index.json.jbuilder4
-rw-r--r--app/views/servers/new.html.erb5
-rw-r--r--app/views/servers/show.html.erb8
-rw-r--r--app/views/servers/show.json.jbuilder2
-rw-r--r--app/views/tournaments/index.html.erb14
-rw-r--r--app/views/tournaments/show.html.erb4
12 files changed, 106 insertions, 93 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 976ee85..de9f3b8 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -8,6 +8,11 @@
<%= yield :head %>
</head>
<body>
+<script>
+ window.onload = function() {
+ BetterDragSort.makeListSortable(document.getElementById("boxes"));
+ };
+</script>
<header><nav>
<div class="navbar-brand"><%= link_to('Leaguer', root_path) %></div>
<div>
@@ -21,6 +26,9 @@
<% if signed_in? %>
<%= link_to current_user.user_name, current_user, :class => "user" %>
<%= link_to "Sign out", session_path("current"), method: "delete", :class => "signout" %>
+ <% if current_user.can? :edit_server %>
+ <%= link_to "Server settings", edit_server_path, :class => "server" %>
+ <% end %>
<% else %>
<%= link_to "Log in", new_session_path, :class => "signin" %>
<%= link_to "Sign up", new_user_path, :class => "signup" %>
diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb
index 219507d..052d176 100644
--- a/app/views/matches/index.html.erb
+++ b/app/views/matches/index.html.erb
@@ -18,7 +18,15 @@
<td><%= match.id%></td>
<td><%= match.name %></td>
<td><%= link_to "Show", tournament_match_path(@tournament, match) %>
- <td><%= submit_tag("Start Match") %>
+ <td> <%# If user is the host, let them start the tournment %>
+ <% if @tournament.hosts.include?(current_user) %>
+
+ <%= form_tag(tournament_match_path(@tournament, match), method: "put") do %>
+ <input type="hidden" name="update_action" value="start">
+ <%= submit_tag("Start Match") %>
+ <% end %>
+ <% end %>
+</div></td>
</tr>
<% end %>
</tbody>
@@ -26,17 +34,51 @@
<br>
-
-<SVG version="1.1"
- baseProfile="full"
- width="<%= 300 * @matches.count / 2 + 50 %>" height="<%= 200 * @matches.count + 50 %>"
- xmlns="http://www.w3.org/2000/svg">
-
- <% (1..@matches.count).each do |i| %>
- <g class="svg-match">
- <rect rx="10"
-
- </g>
- <% end %>
-
+<div id="match-tree">
+ <SVG version="1.1"
+ baseProfile="full"
+ width="<%= @width %>" height="<%= @height = [@height, 500].max %>"
+ xmlns="http://www.w3.org/2000/svg">
+ <script type="text/ecmascript"><![CDATA[
+ function redirect(i){
+ window.location.replace("<%= request.original_url %>"+"/"+i);
+ }
+ ]]>
+ </script>
+ <% (1..@matches.count).each do |i| %>
+ <g id="svg-match-<%= i %>" onmouseover="dispStats(<%= i %>)" onclick="redirect(<%= @matches[i-1].id %>)" cursor="pointer">
+ <rect height="120px" width="213px"
+ x="<%= @width - (i-1)*50 - 250*(Math.log2(i).floor+1) %>"
+ y="<%= (@height/(Math.log2(i).floor+2)) - 60 + 250*(i - 2**(Math.log2(i).floor)) %>"
+ fill="#ffd281"
+ rx="20px"
+ stroke-width="2"
+ <% case @matches[i-1].status %>
+ <% when 0 %>
+ <% if @matches[i-1].teams.count < @tournament.min_teams_per_match %>
+ stroke="red"
+ fill-opacity="0.6"
+ <% else %>
+ stroke="green"
+ <% end %>
+ <% when 1 %>
+ stroke="orange"
+ <% when 2 %>
+ stroke="yellow"
+ <% when 3 %>
+ stroke="grey"
+ <% end %>
+ />
+ </g>
+ <% if i > 1 %>
+ <line
+ stroke="black"
+ x1="<%= @width - (i-2)*50 - 250*(Math.log2(i-1).floor+1) %>"
+ y1="<%= (@height/(Math.log2(i-1).floor+2)) - 60 + 250*((i-1) - 2**(Math.log2(i-1).floor)) + 60 %>"
+ x2="<%= @width - (i-1)*50 - 250*(Math.log2(i).floor+1) + 213 %>"
+ y2="<%= (@height/(Math.log2(i).floor+2)) - 60 + 250*(i - 2**(Math.log2(i).floor)) + 60 %>"
+ />
+ <% end %>
+ <% end %>
</SVG>
+</div>
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 6fb4042..25be7b8 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -2,7 +2,6 @@
<strong>Status:</strong>
<%= @match.status %>
</p>
-
<p>
<strong>Tournament:</strong>
<%= @match.tournament.id %>
@@ -27,49 +26,39 @@
Note:- The change of status from 1 to 2 is coming from League Data Pull (RIOT API)
-->
-<!--
- This is what the HOST will see when the Match Status is NOT 3
--->
-<% if (@tournament.hosts.include?(current_user) and @match.winner.nil?) %>
- <%= form_for([@tournament, @match], method: "put") do |f| %>
- <ul>
- <% @match.teams.each do |team| %>
- <li><label><%= f.radio_button(:winner, team.id) %>
- <%= team.users.collect{|u| u.user_name}.join(", ") %></label></li>
- <% end %>
- </ul>
- <%= f.submit("Select Winner") %>
- <% end %>
-<% end %>
<!--
This is what the Players and the Hosts of the tournament will view when the Match Status is 0
-->
-<% if (@match.status==0) %>
+<% if (@match.status==1) %>
<% if (@tournament.players.include?(current_user) || @tournament.hosts.include?(current_user)) %>
<% @match.teams.each do |team| %>
- <ul>
+ <ol>
<% team.users.collect{|u| u.user_name}.each do |k| %>
- <li><label><%= k %></label></li>
+ <li><%= k %></li>
<% end %>
- </ul>
+ </ol>
<% end %>
<% end %>
<% end %>
<!--
+ When Match Status is 2
Players see the Peer Review Page
Host see the Game Status
-->
<% if (@match.status==0) %>
- <% if (@tournament.players.include?(current_user) %>
+ <% if (@tournament.players.include?(current_user)) %>
<% @match.teams.each do |team| %>
- <ul>
+ <ol id="boxes" class="sortable">
<% team.users.collect{|u| u.user_name}.each do |k| %>
- <li><label><%= k %></label></li>
+ <li><%= k %></li>
<% end %>
- </ul>
- <% end %>
+ </ol>
+
+ <% end %>
+ <% elsif (@tournament.hosts.include?(current_user)) %>
+ <label>Game Status Page Goes here! Because you are a Host that is not a player!</label>
<% end %>
<% end %>
diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb
index b08654b..1afde11 100644
--- a/app/views/servers/_form.html.erb
+++ b/app/views/servers/_form.html.erb
@@ -1,15 +1,16 @@
<%= form_for(@server) do |f| %>
- <% if @server.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@server.errors.count, "error") %> prohibited this server from being saved:</h2>
+ <%= render "common/error_messages", :target => @server %>
- <ul>
- <% @server.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
+ <fieldset>
+ <legend>Default permissions for new users</legend>
+ <ul>
+ <%= fields_for "server[default_user_abilities]", @server.default_user_abilities do |a| %>
+ <% @server.default_user_abilities.keys.each do |ability| %>
+ <li><label><%= a.check_box(ability) %> <%= ability.to_s.humanize %></label></li>
<% end %>
- </ul>
- </div>
- <% end %>
+ <% end %>
+ </ul>
+ </fieldset>
<div class="actions">
<%= f.submit %>
diff --git a/app/views/servers/edit.html.erb b/app/views/servers/edit.html.erb
index a92cdb5..d37864f 100644
--- a/app/views/servers/edit.html.erb
+++ b/app/views/servers/edit.html.erb
@@ -2,5 +2,4 @@
<%= render 'form' %>
-<%= link_to 'Show', @server %> |
-<%= link_to 'Back', servers_path %>
+<%= link_to server_path %>
diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb
deleted file mode 100644
index f45d393..0000000
--- a/app/views/servers/index.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<h1>Listing servers</h1>
-
-<table>
- <thead>
- <tr>
- <th></th>
- <th></th>
- <th></th>
- </tr>
- </thead>
-
- <tbody>
- <% @servers.each do |server| %>
- <tr>
- <td><%= link_to 'Show', server %></td>
- <td><%= link_to 'Edit', edit_server_path(server) %></td>
- <td><%= link_to 'Destroy', server, method: :delete, data: { confirm: 'Are you sure?' } %></td>
- </tr>
- <% end %>
- </tbody>
-</table>
-
-<br>
-
-<%= link_to 'New Server', new_server_path %>
diff --git a/app/views/servers/index.json.jbuilder b/app/views/servers/index.json.jbuilder
deleted file mode 100644
index 2776abc..0000000
--- a/app/views/servers/index.json.jbuilder
+++ /dev/null
@@ -1,4 +0,0 @@
-json.array!(@servers) do |server|
- json.extract! server, :id
- json.url server_url(server, format: :json)
-end
diff --git a/app/views/servers/new.html.erb b/app/views/servers/new.html.erb
deleted file mode 100644
index 0422009..0000000
--- a/app/views/servers/new.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<h1>New server</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Back', servers_path %>
diff --git a/app/views/servers/show.html.erb b/app/views/servers/show.html.erb
index 67f7647..54aaf66 100644
--- a/app/views/servers/show.html.erb
+++ b/app/views/servers/show.html.erb
@@ -1,2 +1,6 @@
-<%= link_to 'Edit', edit_server_path(@server) %> |
-<%= link_to 'Back', servers_path %>
+<p>
+ <strong>Default user permissions:</strong>
+ <%= @server.default_user_permissions %>
+</p>
+
+<%= link_to 'Edit', edit_server_path %>
diff --git a/app/views/servers/show.json.jbuilder b/app/views/servers/show.json.jbuilder
index 972b1c0..c566f76 100644
--- a/app/views/servers/show.json.jbuilder
+++ b/app/views/servers/show.json.jbuilder
@@ -1 +1 @@
-json.extract! @server, :id, :created_at, :updated_at
+json.extract! @server, :id, :default_user_permissions, :created_at, :updated_at
diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb
index e174de7..72eacba 100644
--- a/app/views/tournaments/index.html.erb
+++ b/app/views/tournaments/index.html.erb
@@ -15,13 +15,17 @@
<h3><%= t.name %></h3>
<% end %>
- <div class="row">
+ <div class="row" style="margin-left:2%;">
<div class="col-md-4 host">
Hosted by: <%= t.hosts.first.name %>
</div>
- <div class="col-md-8 things">
- <p> Players per team </p>
- <p> two </p>
+ <div class="col-md-4 things">
+ <p> Players per team: <%= t.min_players_per_team %></p>
+ <p> Players signed up: <%= t.players.count %> </p>
+ </div>
+ <div class="col-md-4 things">
+ <p> <%= (t.randomized_teams)? "Teams are Random" : "Teams are Chosen" %></p>
+ <p> Players signed up: <%= t.players.count %> </p>
</div>
</div>
@@ -36,7 +40,7 @@
<%= submit_tag("Join") %>
<% end %>
<% else %>
- <p> You've signed up for this tournament! </p>
+ <p style="margin-top:10px;"> You've signed up for this tournament! </p>
<% end %>
</div>
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
index b654804..e80e0e8 100644
--- a/app/views/tournaments/show.html.erb
+++ b/app/views/tournaments/show.html.erb
@@ -66,13 +66,13 @@
<% if @tournament.joinable_by?(current_user) && !@tournament.players.include?(current_user) %>
<%= form_tag(tournament_path(@tournament), method: "put") do %>
<input type="hidden" name="update_action" value="join">
- <%= submit_tag("Join Tournamnet") %>
+ <%= submit_tag("Join Tournament") %>
<% end %>
<% elsif @tournament.players.include?(current_user) %>
<%= form_tag(tournament_path(@tournament), method: "put") do %>
<input type="hidden" name="update_action" value="leave">
- <%= submit_tag("Leave Tournamnet") %>
+ <%= submit_tag("Leave Tournament") %>
<% end %>
<% end %>