diff options
author | Tomer Kimia <tkimia@purdue.edu> | 2014-03-04 19:51:46 -0500 |
---|---|---|
committer | Tomer Kimia <tkimia@purdue.edu> | 2014-03-04 19:51:46 -0500 |
commit | d73a82b74685df29eb37c1a8b250951827dc164b (patch) | |
tree | e9fc3e56cc60e4262f4870e834b7dbc5f13e31d2 /app | |
parent | 7ea754bef9e07405a86ce3fc9b0597fef3c1aa35 (diff) | |
parent | 6db29eb669a85e5b0aac7a1e8879781a1cb77772 (diff) |
I REALLY hope I'm not overwriting anything
Merge branch 'master' of https://github.com/LukeShu/leaguer
Conflicts:
app/assets/stylesheets/custom.css.scss
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/ajax.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/application.js | 16 | ||||
-rw-r--r-- | app/assets/stylesheets/custom.css.scss | 13 | ||||
-rw-r--r-- | app/assets/stylesheets/scaffolds.css.scss | 4 | ||||
-rw-r--r-- | app/controllers/sessions_controller.rb | 10 | ||||
-rw-r--r-- | app/controllers/tournaments_controller.rb | 9 | ||||
-rw-r--r-- | app/views/common/_signout.html.erb | 5 | ||||
-rw-r--r-- | app/views/layouts/application.html.erb | 11 | ||||
-rw-r--r-- | app/views/tournaments/_selected.html.erb | 30 | ||||
-rw-r--r-- | app/views/tournaments/index.html.erb | 27 | ||||
-rw-r--r-- | app/views/tournaments/new.html.erb | 12 |
11 files changed, 95 insertions, 48 deletions
diff --git a/app/assets/javascripts/ajax.js b/app/assets/javascripts/ajax.js index 31578dd..040c100 100644 --- a/app/assets/javascripts/ajax.js +++ b/app/assets/javascripts/ajax.js @@ -12,4 +12,8 @@ function populate() { ; } }; -}
\ No newline at end of file + +//$.ajax(url: "/selected").done (html) -> $("#ajax-form").append html + +} + diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..d6925fa --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,16 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. +// +// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require jquery_ujs +//= require turbolinks +//= require_tree . diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss index 906780e..489914b 100644 --- a/app/assets/stylesheets/custom.css.scss +++ b/app/assets/stylesheets/custom.css.scss @@ -7,6 +7,7 @@ header > nav { #log-buttons { margin-top: 8px; +<<<<<<< HEAD } .signup { @extend .btn; @@ -43,3 +44,15 @@ p.errors { } +======= + form { display: inline; } + a, input[type="submit"] { + @extend .btn; + &.user { @extend .btn-info; } + &.signup { @extend .btn-success; } + &.signin { @extend .btn-info; } + &.signout { @extend .btn-danger; } + } + } +} +>>>>>>> 6db29eb669a85e5b0aac7a1e8879781a1cb77772 diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss index 9400133..07c7676 100644 --- a/app/assets/stylesheets/scaffolds.css.scss +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -25,10 +25,10 @@ pre { a { color: #000; &:visited { - color: white; + color: #000; } &:hover { - color: white; + color: green; text-decoration: none; } } diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 25af8a1..9e539ac 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -13,12 +13,12 @@ class SessionsController < ApplicationController respond_to do |format| if @user && @user.authenticate(params[:session][:password]) sign_in @user - format.html { redirect_to root_path } + format.html { redirect_to root_path } else - format.html { render action: 'new' } - format.json { render json: @user.errors, status: :unprocessable_entity } - end - end + format.html { render action: 'new' } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end end # DELETE /sessions/current diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index 27ba020..5c53693 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -15,6 +15,7 @@ class TournamentsController < ApplicationController # GET /tournaments/new def new @game_names = Game.all.collect + @game = params[:game] @tournament = Tournament.new end @@ -22,12 +23,6 @@ class TournamentsController < ApplicationController def edit end - def selected - render :update do |page| - page.replace_html 'ajax-form', :partial => 'selected' - end - end - # POST /tournaments # POST /tournaments.json def create @@ -76,6 +71,6 @@ class TournamentsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def tournament_params - params.require(:tournament).permit(:game_id) + params.require(:tournament).permit(:game_id, :game) end end diff --git a/app/views/common/_signout.html.erb b/app/views/common/_signout.html.erb new file mode 100644 index 0000000..2bdda0c --- /dev/null +++ b/app/views/common/_signout.html.erb @@ -0,0 +1,5 @@ +<%= +form_tag(sessions_path+"/current", method: "delete") do + submit_tag("Sign out", :class => "signout") +end +%> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 9cc30bc..75a9d4e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,7 +9,7 @@ </head> <body> <header><nav> - <div class="navbar-brand no-dec"><%= link_to('Leaguer', root_path, nil) %></div> + <div class="navbar-brand no-dec"><%= link_to('Leaguer', root_path, :style => "color:white") %></div> <div> <%= form_tag("/search", method: "get", :class => "navbar-form navbar-right") do %> <%= text_field_tag(:query, nil, :placeholder => "Search") %> @@ -19,12 +19,11 @@ <div id="log-buttons"> <% if signed_in? %> - <%= current_user.user_name.upcase %> - <%= link_to "Sign out", "/signout", method: "delete", :class => "signout", :role => "button" %> + <%= link_to current_user.user_name, current_user, :class => "user" %> + <%= render "common/signout" %> <% else %> - <%= link_to "Log in", new_session_path, :class => "signin", :role => "button" %> - <%= link_to "Sign up", new_user_path, :class => "signup", :role => "button" - %> + <%= link_to "Log in", new_session_path, :class => "signin" %> + <%= link_to "Sign up", new_user_path, :class => "signup" %> <% end %> </div> </nav></header> diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb index 302283d..3b14404 100644 --- a/app/views/tournaments/_selected.html.erb +++ b/app/views/tournaments/_selected.html.erb @@ -1,25 +1,5 @@ -<form accept-charset="UTF-8" action="/users" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="6WQoPLFISlDYCsi4LhAgT0hgrht19yydD3w5TlKfb7I=" /></div> - <p> - <label for="GameType">Game</label><br> - <input id="GameType" name="League of Legends" type="text" /> - </p> - <p> - <label for="players_per_team">Number of Players</label><br> - <input id="players_per_team" name="5" type="text" /> - </p> - <p> - <label for="teams_per_match">Teams per Match</label><br> - <input id="teams_per_match" name="2" type="text" /> - </p> - <p> - <label for="set_rounds">Set Number of Rounds?</label><br> - <input id="set_rounds" name="1" type="text" /> - </p> - <p> - <label for="randomized_teams">Randomized Teams?</label><br> - <input id="randomized_teams" name="0" type="text" /> - </p> - <p> - <input name="create" type="submit" value="Create Tournament" /> - </p> -</form>
\ No newline at end of file + + <%= content_tag(:p, "Hello World") %> + + +<%= tag(:label, for: 'GameType') %>
\ No newline at end of file diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb new file mode 100644 index 0000000..26d0643 --- /dev/null +++ b/app/views/tournaments/index.html.erb @@ -0,0 +1,27 @@ +<h1>Listing tournaments</h1> + +<table> + <thead> + <tr> + <th>Tournament ID</th> + <th>Show Tournament</th> + <th>Edit Tournament</th> + <th>Delete Tournament</th> + </tr> + </thead> + + <tbody> + <% @tournaments.each do |tournament| %> + <tr> + <td><%= tournament.id %></td> + <td><%= link_to 'Show', tournament %></td> + <td><%= link_to 'Edit', edit_tournament_path(tournament) %></td> + <td><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Tournament', new_tournament_path, :class => "btn btn-warning btn-lg" %> diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb index f1dec90..a6dfa4d 100644 --- a/app/views/tournaments/new.html.erb +++ b/app/views/tournaments/new.html.erb @@ -1,11 +1,19 @@ +<%= javascript_include_tag :defaults %> + <h1>New tournament</h1> -<%= select_tag 'tournament_id', options_for_select(["Select a Game Type"] + Game.all.collect {|game| game.name}), :onchange => 'populate()' %> +<%= select_tag 'tournament_id', options_for_select(["Select a Game Type"] + Game.all.collect {|game| game.name}), :onchange => 'populate()' %> <%= link_to 'Select', 'new?game=1', :class => "btn btn-warning btn-lg" %> + + <br /> <div id='ajax-form'> - <% render :partial => "selected" %> + <% if not @game.nil? %> + <%= render 'selected' %> + <% end %> </div> <br /><br /> +<%= link_to 'Select', 'selected', :class => "btn btn-warning btn-lg" %> + <%= link_to 'Back', tournaments_path %> |