summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/ajax.js19
-rw-r--r--app/assets/javascripts/application.js3
-rw-r--r--app/assets/javascripts/matches_show.js.coffee2
-rw-r--r--app/assets/javascripts/tournaments_show.js.coffee30
-rw-r--r--app/assets/stylesheets/custom.css.scss71
-rw-r--r--app/assets/stylesheets/search.css.scss11
6 files changed, 72 insertions, 64 deletions
diff --git a/app/assets/javascripts/ajax.js b/app/assets/javascripts/ajax.js
deleted file mode 100644
index 040c100..0000000
--- a/app/assets/javascripts/ajax.js
+++ /dev/null
@@ -1,19 +0,0 @@
-function populate() {
- //populate optionArray
- //make a form element
- var e = document.getElementById("tournament_id");
- var gameType = e.options[e.selectedIndex].text;
- if (gameType != "Select a Game Type") {
- alert(gameType + " was Selected!");
- //populate optionArray via AJAX
- //select * from tournament_settings where gametype = GameType
- for(var option in optionArray){
- //identify the number of
- ;
- }
- };
-
-//$.ajax(url: "/selected").done (html) -> $("#ajax-form").append html
-
-}
-
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index cb6edeb..e9430a3 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -13,7 +13,8 @@
//= require jquery
//= require jquery_ujs
//= require turbolinks
-//= require_tree .
//= require 'drag.js'
//= require 'dragsort.js'
//= require 'coordinates.js'
+//
+//= require_tree ./common
diff --git a/app/assets/javascripts/matches_show.js.coffee b/app/assets/javascripts/matches_show.js.coffee
new file mode 100644
index 0000000..2609a69
--- /dev/null
+++ b/app/assets/javascripts/matches_show.js.coffee
@@ -0,0 +1,2 @@
+window.onload = ->
+ BetterDragSort.makeListSortable(document.getElementById("boxes"));
diff --git a/app/assets/javascripts/tournaments_show.js.coffee b/app/assets/javascripts/tournaments_show.js.coffee
new file mode 100644
index 0000000..1e91d3a
--- /dev/null
+++ b/app/assets/javascripts/tournaments_show.js.coffee
@@ -0,0 +1,30 @@
+Update = (tournament) ->
+ here = tournament["players"].length
+ needed = (tournament["min_teams_per_match"] * tournament["min_players_per_team"])
+ pct_complete = here / needed
+
+ $("#prog-bar").width (pct_complete * 100) + "%"
+ $("#players-needed").text here + " " + ((if here is 1 then "player has" else "players have")) + " signed up. " + needed + " players needed. "
+
+ # Update the user list
+ players = ""
+ for player in tournament["players"]
+ players = players + "<li><span class=\"black\">" + player["user_name"] + "</span></li>"
+ $("#tournament-users").html players
+
+ # Enable/disable the "start" button depending on the number of players
+ $("input[value=\"Start Tournament\"]").prop "disabled", (if (pct_complete >= 1) then false else true)
+
+ # Switch views if the tournament has been started
+ if tournament["status"] is 1
+ window.location.reload true
+
+ # Do it all again
+ setTimeout (->
+ $.ajax(url: window.location.href.replace(/\..*/,'')+".json").done Update
+ return
+ ), 2000
+
+# Now kick off the whole process
+window.onload = ->
+ $.ajax(url: window.location.href.replace(/\..*/,'')+".json").done Update
diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss
index d7f1698..d299dda 100644
--- a/app/assets/stylesheets/custom.css.scss
+++ b/app/assets/stylesheets/custom.css.scss
@@ -31,19 +31,14 @@ a, input[type="submit"] {
input[type="text"], input[type="password"]{
+ -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;
- -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);
- padding: 8px;
- background: rgba(0,0,0,0.5);
- margin: 0 0 5px 0;
+ padding: 8px;
+ background: rgba(0,0,0,0.5);
+ margin: 0 0 5px 0;
}
p.errors {
@@ -54,24 +49,34 @@ p.errors {
}
#error_explanation {
- width: 450px;
- border: 2px solid red;
- padding: 7px;
- padding-bottom: 0;
- margin-bottom: 20px;
- background-color: #f0f0f0;
- h2 {
- text-align: left;
- font-weight: bold;
- padding: 5px 5px 5px 15px;
- font-size: 12px;
- margin: -7px;
- margin-bottom: 0px;
- background-color: #c00;
- color: #fff;
- }
- ul li {
- font-size: 12px;
- list-style: square;
- }
-} \ No newline at end of file
+ width: 450px;
+ border: 2px solid red;
+ padding: 7px;
+ padding-bottom: 0;
+ margin-bottom: 20px;
+ background-color: #f0f0f0;
+ h2 {
+ text-align: left;
+ font-weight: bold;
+ padding: 5px 5px 5px 15px;
+ font-size: 12px;
+ margin: -7px;
+ margin-bottom: 0px;
+ background-color: #c00;
+ color: #fff;
+ }
+ ul li {
+ font-size: 12px;
+ list-style: square;
+ }
+}
+
+// Limitation: Only one box can be expanded at a time
+.collapsible {
+ .collapsed { display: block; }
+ .expanded { display: none; }
+ &:target {
+ .collapsed { display: none; }
+ .expanded { display: block; }
+ }
+}
diff --git a/app/assets/stylesheets/search.css.scss b/app/assets/stylesheets/search.css.scss
index 69cd1ad..22fd394 100644
--- a/app/assets/stylesheets/search.css.scss
+++ b/app/assets/stylesheets/search.css.scss
@@ -1,14 +1,3 @@
// Place all the styles related to the search controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
-
-#search-down {
- text-align: center;
- cursor: pointer;
- text-decoration: underline;
-}
-
-
-#advanced-search {
- display: none;
-} \ No newline at end of file