diff options
Diffstat (limited to 'app/views')
60 files changed, 600 insertions, 79 deletions
diff --git a/app/views/alerts/_form.html.erb b/app/views/alerts/_form.html.erb new file mode 100644 index 0000000..b60eaf2 --- /dev/null +++ b/app/views/alerts/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@alert) do |f| %> + <% if @alert.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@alert.errors.count, "error") %> prohibited this alert from being saved:</h2> + + <ul> + <% @alert.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :author_id %><br> + <%= f.text_field :author_id %> + </div> + <div class="field"> + <%= f.label :message %><br> + <%= f.text_area :message %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/alerts/edit.html.erb b/app/views/alerts/edit.html.erb new file mode 100644 index 0000000..ad99164 --- /dev/null +++ b/app/views/alerts/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing alert</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @alert %> | +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/index.html.erb b/app/views/alerts/index.html.erb new file mode 100644 index 0000000..458b951 --- /dev/null +++ b/app/views/alerts/index.html.erb @@ -0,0 +1,29 @@ +<h1>Listing alerts</h1> + +<table> + <thead> + <tr> + <th>Author</th> + <th>Message</th> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @alerts.each do |alert| %> + <tr> + <td><%= alert.author %></td> + <td><%= alert.message %></td> + <td><%= link_to 'Show', alert %></td> + <td><%= link_to 'Edit', edit_alert_path(alert) %></td> + <td><%= link_to 'Destroy', alert, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Alert', new_alert_path %> diff --git a/app/views/alerts/index.json.jbuilder b/app/views/alerts/index.json.jbuilder new file mode 100644 index 0000000..0911a5c --- /dev/null +++ b/app/views/alerts/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@alerts) do |alert| + json.extract! alert, :id, :author_id, :message + json.url alert_url(alert, format: :json) +end diff --git a/app/views/alerts/new.html.erb b/app/views/alerts/new.html.erb new file mode 100644 index 0000000..6d04589 --- /dev/null +++ b/app/views/alerts/new.html.erb @@ -0,0 +1,5 @@ +<h1>New alert</h1> + +<%= render 'form' %> + +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/show.html.erb b/app/views/alerts/show.html.erb new file mode 100644 index 0000000..5dda2c9 --- /dev/null +++ b/app/views/alerts/show.html.erb @@ -0,0 +1,12 @@ +<p> + <strong>Author:</strong> + <%= @alert.author %> +</p> + +<p> + <strong>Message:</strong> + <%= @alert.message %> +</p> + +<%= link_to 'Edit', edit_alert_path(@alert) %> | +<%= link_to 'Back', alerts_path %> diff --git a/app/views/alerts/show.json.jbuilder b/app/views/alerts/show.json.jbuilder new file mode 100644 index 0000000..95481eb --- /dev/null +++ b/app/views/alerts/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @alert, :id, :author_id, :message, :created_at, :updated_at diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb new file mode 100644 index 0000000..8941c59 --- /dev/null +++ b/app/views/games/_form.html.erb @@ -0,0 +1,37 @@ +<%= form_for(@game) do |f| %> + <% if @game.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@game.errors.count, "error") %> prohibited this game from being saved:</h2> + + <ul> + <% @game.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :name %><br> + <%= f.text_area :name %> + </div> + <div class="field"> + <%= f.label :players_per_team %><br> + <%= f.number_field :players_per_team %> + </div> + <div class="field"> + <%= f.label :teams_per_match %><br> + <%= f.number_field :teams_per_match %> + </div> + <div class="field"> + <%= f.label :set_rounds %><br> + <%= f.number_field :set_rounds %> + </div> + <div class="field"> + <%= f.label :randomized_teams %><br> + <%= f.number_field :randomized_teams %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/games/edit.html.erb b/app/views/games/edit.html.erb new file mode 100644 index 0000000..d72bd2e --- /dev/null +++ b/app/views/games/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing game</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @game %> | +<%= link_to 'Back', games_path %> diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb index ccd0f63..ac362cd 100644 --- a/app/views/games/index.html.erb +++ b/app/views/games/index.html.erb @@ -32,4 +32,8 @@ <br> +<<<<<<< HEAD <%= link_to 'New Game', new_game_path %> +======= +<%= link_to 'New Game', new_game_path, {:class => "btn btn-warning"} %> +>>>>>>> aca85cf084702c29014a17eafb090421061fae8b diff --git a/app/views/games/index.json.jbuilder b/app/views/games/index.json.jbuilder new file mode 100644 index 0000000..7e5c1a1 --- /dev/null +++ b/app/views/games/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@games) do |game| + json.extract! game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams + json.url game_url(game, format: :json) +end diff --git a/app/views/games/new.html.erb b/app/views/games/new.html.erb new file mode 100644 index 0000000..ab95f70 --- /dev/null +++ b/app/views/games/new.html.erb @@ -0,0 +1,5 @@ +<h1>New game</h1> + +<%= render 'form' %> + +<%= link_to 'Back', games_path %> diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb new file mode 100644 index 0000000..88bf91c --- /dev/null +++ b/app/views/games/show.html.erb @@ -0,0 +1,27 @@ +<p> + <strong>Name:</strong> + <%= @game.name %> +</p> + +<p> + <strong>Players per team:</strong> + <%= @game.players_per_team %> +</p> + +<p> + <strong>Teams per match:</strong> + <%= @game.teams_per_match %> +</p> + +<p> + <strong>Set rounds:</strong> + <%= @game.set_rounds %> +</p> + +<p> + <strong>Randomized teams:</strong> + <%= @game.randomized_teams %> +</p> + +<%= link_to 'Edit', edit_game_path(@game) %> | +<%= link_to 'Back', games_path %> diff --git a/app/views/games/show.json.jbuilder b/app/views/games/show.json.jbuilder new file mode 100644 index 0000000..1a2d0c7 --- /dev/null +++ b/app/views/games/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @game, :id, :name, :players_per_team, :teams_per_match, :set_rounds, :randomized_teams, :created_at, :updated_at diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b36c0c5..d817484 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,35 +8,33 @@ <%= yield :head %> </head> <body> -<div role="navigation" class="navbar navbar-inverse"> -<header> - <div class="navbar-brand no-dec"> - <%= link_to('Leaguer', '/', nil) %> - </div> +<header><nav> + <div class="navbar-brand no-dec"><%= link_to('Leaguer', root_path, nil) %></div> <div> - <%= form_tag("/search", method: "get", :class => "navbar-form navbar-right") do %> - <%= text_field_tag(:query, nil, :placeholder => "Search") %> - <%= submit_tag("Go", {:class => "btn btn-warning"}) %> - <% end %> + <%= form_tag("/search", method: "get", :class => "navbar-form navbar-right") do %> + <%= text_field_tag(:query, nil, :placeholder => "Search") %> + <%= submit_tag("Go", {:class => "btn btn-warning"}) %> + <% end %> </div> - <% if signed_in? %> - <li> <%= current_user.user_name.upcase %> </li> - <% end %> - <li> - <%= if signed_in? do %> - <%= link_to "Sign out", signout_path, method: "delete" %> - <% end; end %> - </li> -</header> - </div> + <ul> + <% if signed_in? %> + <li><%= current_user.user_name.upcase %></li> + <li><%= link_to "Sign out", session_path("current"), method: "delete" %></li> + <% else %> + <li><%= link_to "Log in", new_session_path %></li> + <li><%= link_to "Sign up", new_user_path %></li> + <% end %> + </ul> +</nav></header> + +<% if notice %><div id="notice"><p><%= notice %></p></div><% end %> + +<div class="container"><%= yield %></div> -<div class="container"> -<%= yield %> -</div> <hr> <footer id="footer"> -<p> Tomer Kimia Andrew Murrell Luke Shumaker Nathaniel Foy Davis Webb Guntas Grewal </p> -<p> The Leaguer System © <%= Time.now.year %> </p> </footer> - <%= debug(params) if Rails.env.development? %> + <p>Leaguer is copyright © 2014, Tomer Kimia, Andrew Murrell, Luke Shumaker, Nathaniel Foy, Davis Webb, and Guntas Grewal</p> +</footer> +<%= debug(params) if Rails.env.development? %> </body> </html> diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb new file mode 100644 index 0000000..c5f1ba8 --- /dev/null +++ b/app/views/matches/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@match) do |f| %> + <% if @match.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@match.errors.count, "error") %> prohibited this match from being saved:</h2> + + <ul> + <% @match.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :tournament_id %><br> + <%= f.text_field :tournament_id %> + </div> + <div class="field"> + <%= f.label :name %><br> + <%= f.text_field :name %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/matches/edit.html.erb b/app/views/matches/edit.html.erb new file mode 100644 index 0000000..38b7d70 --- /dev/null +++ b/app/views/matches/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing match</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @match %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb new file mode 100644 index 0000000..0742770 --- /dev/null +++ b/app/views/matches/index.html.erb @@ -0,0 +1,29 @@ +<h1>Listing matches</h1> + +<table> + <thead> + <tr> + <th>Tournament</th> + <th>Name</th> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @matches.each do |match| %> + <tr> + <td><%= match.tournament %></td> + <td><%= match.name %></td> + <td><%= link_to 'Show', match %></td> + <td><%= link_to 'Edit', edit_match_path(match) %></td> + <td><%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Match', new_match_path %> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder new file mode 100644 index 0000000..08ae0ef --- /dev/null +++ b/app/views/matches/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@matches) do |match| + json.extract! match, :id, :tournament_id, :name + json.url match_url(match, format: :json) +end diff --git a/app/views/matches/new.html.erb b/app/views/matches/new.html.erb new file mode 100644 index 0000000..bd4c78c --- /dev/null +++ b/app/views/matches/new.html.erb @@ -0,0 +1,5 @@ +<h1>New match</h1> + +<%= render 'form' %> + +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb new file mode 100644 index 0000000..9c9cbb4 --- /dev/null +++ b/app/views/matches/show.html.erb @@ -0,0 +1,12 @@ +<p> + <strong>Tournament:</strong> + <%= @match.tournament %> +</p> + +<p> + <strong>Name:</strong> + <%= @match.name %> +</p> + +<%= link_to 'Edit', edit_match_path(@match) %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder new file mode 100644 index 0000000..128550f --- /dev/null +++ b/app/views/matches/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @match, :id, :tournament_id, :name, :created_at, :updated_at diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb new file mode 100644 index 0000000..480e308 --- /dev/null +++ b/app/views/pms/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@pm) do |f| %> + <% if @pm.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@pm.errors.count, "error") %> prohibited this pm from being saved:</h2> + + <ul> + <% @pm.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :author_id %><br> + <%= f.text_field :author_id %> + </div> + <div class="field"> + <%= f.label :recipient_id %><br> + <%= f.text_field :recipient_id %> + </div> + <div class="field"> + <%= f.label :message %><br> + <%= f.text_area :message %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/pms/edit.html.erb b/app/views/pms/edit.html.erb new file mode 100644 index 0000000..074a4fd --- /dev/null +++ b/app/views/pms/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing pm</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @pm %> | +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb new file mode 100644 index 0000000..cb7fe4b --- /dev/null +++ b/app/views/pms/index.html.erb @@ -0,0 +1,31 @@ +<h1>Listing pms</h1> + +<table> + <thead> + <tr> + <th>Author</th> + <th>Recipient</th> + <th>Message</th> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @pms.each do |pm| %> + <tr> + <td><%= pm.author %></td> + <td><%= pm.recipient %></td> + <td><%= pm.message %></td> + <td><%= link_to 'Show', pm %></td> + <td><%= link_to 'Edit', edit_pm_path(pm) %></td> + <td><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Pm', new_pm_path %> diff --git a/app/views/pms/index.json.jbuilder b/app/views/pms/index.json.jbuilder new file mode 100644 index 0000000..fcfca84 --- /dev/null +++ b/app/views/pms/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@pms) do |pm| + json.extract! pm, :id, :author_id, :recipient_id, :message + json.url pm_url(pm, format: :json) +end diff --git a/app/views/pms/new.html.erb b/app/views/pms/new.html.erb new file mode 100644 index 0000000..29e24ec --- /dev/null +++ b/app/views/pms/new.html.erb @@ -0,0 +1,5 @@ +<h1>New pm</h1> + +<%= render 'form' %> + +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb new file mode 100644 index 0000000..2a03716 --- /dev/null +++ b/app/views/pms/show.html.erb @@ -0,0 +1,17 @@ +<p> + <strong>Author:</strong> + <%= @pm.author %> +</p> + +<p> + <strong>Recipient:</strong> + <%= @pm.recipient %> +</p> + +<p> + <strong>Message:</strong> + <%= @pm.message %> +</p> + +<%= link_to 'Edit', edit_pm_path(@pm) %> | +<%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.json.jbuilder b/app/views/pms/show.json.jbuilder new file mode 100644 index 0000000..94252e9 --- /dev/null +++ b/app/views/pms/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @pm, :id, :author_id, :recipient_id, :message, :created_at, :updated_at diff --git a/app/views/servers/_form.html.erb b/app/views/servers/_form.html.erb new file mode 100644 index 0000000..b08654b --- /dev/null +++ b/app/views/servers/_form.html.erb @@ -0,0 +1,17 @@ +<%= 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> + + <ul> + <% @server.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/servers/edit.html.erb b/app/views/servers/edit.html.erb new file mode 100644 index 0000000..a92cdb5 --- /dev/null +++ b/app/views/servers/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing server</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @server %> | +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/index.html.erb b/app/views/servers/index.html.erb new file mode 100644 index 0000000..f45d393 --- /dev/null +++ b/app/views/servers/index.html.erb @@ -0,0 +1,25 @@ +<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 new file mode 100644 index 0000000..2776abc --- /dev/null +++ b/app/views/servers/index.json.jbuilder @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000..0422009 --- /dev/null +++ b/app/views/servers/new.html.erb @@ -0,0 +1,5 @@ +<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 new file mode 100644 index 0000000..67f7647 --- /dev/null +++ b/app/views/servers/show.html.erb @@ -0,0 +1,2 @@ +<%= link_to 'Edit', edit_server_path(@server) %> | +<%= link_to 'Back', servers_path %> diff --git a/app/views/servers/show.json.jbuilder b/app/views/servers/show.json.jbuilder new file mode 100644 index 0000000..972b1c0 --- /dev/null +++ b/app/views/servers/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @server, :id, :created_at, :updated_at diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index f942cf6..a820b2f 100644 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -1,5 +1,7 @@ <h1>Sign in</h1> - +<% if @fail %> + <p class="error">Email and password combination not found</p> +<% end %> <div class="row"> <div class="span6 offset3"> <%= form_for(:session, url: sessions_path) do |f| %> @@ -13,6 +15,6 @@ <%= f.submit "Sign in", class: "btn btn-large btn-primary" %> <% end %> - <p>New user? <%= link_to "Sign up now!", signup_path %></p> + <p>New user? <%= link_to "Sign up now!", new_user_path %></p> </div> </div> diff --git a/app/views/static/homepage.html.erb b/app/views/static/homepage.html.erb index 4d52e5b..3ca8176 100644 --- a/app/views/static/homepage.html.erb +++ b/app/views/static/homepage.html.erb @@ -1,10 +1,18 @@ <div role="main" class="container theme-showcase"> - <!-- Main jumbotron for a primary marketing message or call to action --> <div class="jumbotron"> <h1>Welcome to Leaguer</h1> <p>This is a tournment management system designed to be used for any team sport. Our peer review system ensures that the best players move on to the next round! Try creating a new tournament and having people sign up for it. </p> - <p id="jumbo-buttons"><%= link_to 'Log In / Sign Up', "signup", :class => "btn btn-warning btn-lg", :role => "button" %> <%= link_to 'See Ongoing Tournaments', tournaments_path, :class => "btn btn-warning btn-lg", :role => "button" %> </p> + <p id="jumbo-buttons"> + <% if !signed_in? %> + <%= link_to 'Log In', new_session_path, :class => "btn btn-warning btn-lg", :role => "button" %> + <%= link_to 'Sign Up', new_user_path, :class => "btn btn-warning btn-lg", :role => "button" %> + <% else %> + <%= link_to 'Start a Tournament', new_tournament_path, :class => "btn btn-warning btn-lg", :role => "button" %> + <% end %> + <%= link_to 'See Ongoing Tournaments', tournaments_path, :class => "btn btn-warning btn-lg", :role => "button" %> + + </p> </div> </div> diff --git a/app/views/teams/_form.html.erb b/app/views/teams/_form.html.erb new file mode 100644 index 0000000..fd10129 --- /dev/null +++ b/app/views/teams/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@team) do |f| %> + <% if @team.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@team.errors.count, "error") %> prohibited this team from being saved:</h2> + + <ul> + <% @team.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/teams/edit.html.erb b/app/views/teams/edit.html.erb new file mode 100644 index 0000000..49858ad --- /dev/null +++ b/app/views/teams/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing team</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @team %> | +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/index.html.erb b/app/views/teams/index.html.erb new file mode 100644 index 0000000..b077e10 --- /dev/null +++ b/app/views/teams/index.html.erb @@ -0,0 +1,25 @@ +<h1>Listing teams</h1> + +<table> + <thead> + <tr> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @teams.each do |team| %> + <tr> + <td><%= link_to 'Show', team %></td> + <td><%= link_to 'Edit', edit_team_path(team) %></td> + <td><%= link_to 'Destroy', team, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Team', new_team_path %> diff --git a/app/views/teams/index.json.jbuilder b/app/views/teams/index.json.jbuilder new file mode 100644 index 0000000..b29428b --- /dev/null +++ b/app/views/teams/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@teams) do |team| + json.extract! team, :id + json.url team_url(team, format: :json) +end diff --git a/app/views/teams/new.html.erb b/app/views/teams/new.html.erb new file mode 100644 index 0000000..433d944 --- /dev/null +++ b/app/views/teams/new.html.erb @@ -0,0 +1,5 @@ +<h1>New team</h1> + +<%= render 'form' %> + +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/show.html.erb b/app/views/teams/show.html.erb new file mode 100644 index 0000000..ab49d65 --- /dev/null +++ b/app/views/teams/show.html.erb @@ -0,0 +1,2 @@ +<%= link_to 'Edit', edit_team_path(@team) %> | +<%= link_to 'Back', teams_path %> diff --git a/app/views/teams/show.json.jbuilder b/app/views/teams/show.json.jbuilder new file mode 100644 index 0000000..1538019 --- /dev/null +++ b/app/views/teams/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @team, :id, :created_at, :updated_at diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb new file mode 100644 index 0000000..1fd63e9 --- /dev/null +++ b/app/views/tournaments/_form.html.erb @@ -0,0 +1,21 @@ +<%= form_for(@tournament) do |f| %> + <% if @tournament.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@tournament.errors.count, "error") %> prohibited this tournament from being saved:</h2> + + <ul> + <% @tournament.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :game_id %><br> + <%= f.text_field :game_id %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb new file mode 100644 index 0000000..302283d --- /dev/null +++ b/app/views/tournaments/_selected.html.erb @@ -0,0 +1,25 @@ +<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 diff --git a/app/views/tournaments/edit.html.erb b/app/views/tournaments/edit.html.erb new file mode 100644 index 0000000..2913025 --- /dev/null +++ b/app/views/tournaments/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing tournament</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @tournament %> | +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/index.html.erb b/app/views/tournaments/index.html.erb deleted file mode 100644 index 6006cad..0000000 --- a/app/views/tournaments/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<h1>Listing tournaments</h1> - -<table> - <thead> - <tr> - <th></th> - <th></th> - <th></th> - <th></th> - </tr> - </thead> - - <tbody> - <% @tournaments.each do |tournament| %> - <tr> - <td><%= tournament.game %></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/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder new file mode 100644 index 0000000..e6f3b49 --- /dev/null +++ b/app/views/tournaments/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@tournaments) do |tournament| + json.extract! tournament, :id, :game_id + json.url tournament_url(tournament, format: :json) +end diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb index dee18fb..f1dec90 100644 --- a/app/views/tournaments/new.html.erb +++ b/app/views/tournaments/new.html.erb @@ -4,9 +4,8 @@ <br /> <div id='ajax-form'> + <% render :partial => "selected" %> </div> <br /><br /> -<p id=jumbo-buttons> -<%= link_to 'Create Tournament', "#", :class => "btn btn-warning btn-lg" %> <%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb new file mode 100644 index 0000000..0d9dd10 --- /dev/null +++ b/app/views/tournaments/show.html.erb @@ -0,0 +1,7 @@ +<p> + <strong>Game:</strong> + <%= @tournament.game %> +</p> + +<%= link_to 'Edit', edit_tournament_path(@tournament) %> | +<%= link_to 'Back', tournaments_path %> diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder new file mode 100644 index 0000000..0fe65a6 --- /dev/null +++ b/app/views/tournaments/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @tournament, :id, :game_id, :created_at, :updated_at diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 56d9f90..4d28738 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -13,11 +13,15 @@ <div class="field"> <%= f.label :name %><br> - <%= f.text_area :name %> + <%= f.text_field :name %> </div> <div class="field"> - <%= f.label :pw_hash %><br> - <%= f.text_area :pw_hash %> + <%= f.label :email %><br> + <%= f.text_field :email %> + </div> + <div class="field"> + <%= f.label :user_name %><br> + <%= f.text_field :user_name %> </div> <div class="actions"> <%= f.submit %> diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb deleted file mode 100644 index 99bd4cc..0000000 --- a/app/views/users/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<h1>Editing user</h1> - -<%= render 'form' %> - -<%= link_to 'Show', @user %> | -<%= link_to 'Back', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 8b9056b..d7b46da 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,10 +1,13 @@ <h1>Listing users</h1> -<table> +<table class="table table-hover"> <thead> <tr> + <th>Username</th> <th>Name</th> - <th>Pw hash</th> + <th>Email</th> + <th>User name</th> + <th></th> <th></th> <th></th> <th></th> @@ -14,8 +17,10 @@ <tbody> <% @users.each do |user| %> <tr> + <td><%= link_to("#{user.user_name}", user, nil) %></td> <td><%= user.name %></td> - <td><%= user.pw_hash %></td> + <td> ******* </td> + <td><%= user.user_name %></td> <td><%= link_to 'Show', user %></td> <td><%= link_to 'Edit', edit_user_path(user) %></td> <td><%= link_to 'Destroy', user, method: :delete, data: { confirm: 'Are you sure?' } %></td> diff --git a/app/views/users/index.json.jbuilder b/app/views/users/index.json.jbuilder index 182437e..42d8b72 100644 --- a/app/views/users/index.json.jbuilder +++ b/app/views/users/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@users) do |user| - json.extract! user, :id, :name, :pw_hash + json.extract! user, :id, :name, :email, :user_name json.url user_url(user, format: :json) end diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 2a745cc..f0ce746 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -16,11 +16,11 @@ </p> <p> <%= f.label :password %><br> - <%= f.text_field :password %> + <%= f.password_field :password %> </p> <p> <%= f.label :password_confirm %><br> - <%= f.text_field :password_confirmation %> + <%= f.password_field :password_confirmation %> </p> <p> <%= f.submit %> @@ -45,16 +45,16 @@ </p> <p> <label for="user_password">Password</label><br> - <input id="user_password" name="user[password]" type="text" /> + <input id="user_password" name="user[password]" type="password" /> </p> <p> <label for="user_password_confirm">Password confirm</label><br> - <input id="user_password_confirmation" name="user[password_confirmation]" type="text" /> + <input id="user_password_confirmation" name="user[password_confirmation]" type="password" /> </p> <p> <input name="commit" type="submit" value="Save User" /> </p> </form> -<%= link_to 'Already Have an Account? Log in', "signin", :class => "btn btn-warning btn-lg" %> +<%= link_to 'Already Have an Account? Log in', new_session_path, :class => "btn btn-warning btn-lg" %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 43c12fe..d8cc82b 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,3 +1,17 @@ -app/views/users/show.html.erb +<p> + <strong>Name:</strong> + <%= @user.name %> +</p> -<%= @user.name %>, <%= @user.email %> +<p> + <strong>Email:</strong> + <%= @user.email %> +</p> + +<p> + <strong>User name:</strong> + <%= @user.user_name %> +</p> + +<%= link_to 'Edit', edit_user_path(@user) %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/show.json.jbuilder b/app/views/users/show.json.jbuilder deleted file mode 100644 index 1262e80..0000000 --- a/app/views/users/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.extract! @user, :id, :name, :pw_hash, :created_at, :updated_at |