summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-06 20:03:32 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-06 20:03:32 -0400
commitdc417a48ec2abc83a3ffad742c3c4a4207054300 (patch)
tree5684ba9d2c1fcf1c1b33e4ffa9f9abf2e44c53f2
parent94d5a5012910b531aaeb040ed01f821dde45961e (diff)
Dragging to Rank
-rw-r--r--app/assets/javascripts/application.js3
-rw-r--r--app/assets/stylesheets/matches.css.scss24
-rw-r--r--app/views/layouts/application.html.erb5
-rw-r--r--app/views/matches/show.html.erb36
4 files changed, 44 insertions, 24 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index d6925fa..cb6edeb 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -14,3 +14,6 @@
//= require jquery_ujs
//= require turbolinks
//= require_tree .
+//= require 'drag.js'
+//= require 'dragsort.js'
+//= require 'coordinates.js'
diff --git a/app/assets/stylesheets/matches.css.scss b/app/assets/stylesheets/matches.css.scss
index 4c396e3..3ef9170 100644
--- a/app/assets/stylesheets/matches.css.scss
+++ b/app/assets/stylesheets/matches.css.scss
@@ -1,3 +1,27 @@
// Place all the styles related to the matches controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+#boxes li {
+ cursor: move;
+ position: relative;
+ float: left;
+ margin: 5px;
+ width: 180px;
+ height: 240px;
+ border: 1px solid rgb(0, 0, 0);
+ text-align: center;
+ padding-top: 10px;
+ background-color: rgb(238, 238, 255);
+}
+#numeric li {
+ cursor: move;
+ position: relative;
+ float: left;
+ margin: 5px;
+ width: 180px;
+ height: 240px;
+ border: 1px solid rgb(0, 0, 0);
+ text-align: center;
+ padding-top: 10px;
+ background-color: rgb(238, 238, 255);
+} \ No newline at end of file
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 976ee85..8a5f985 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>
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 6fb4042..ffa7682 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,38 @@
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 %>