diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb
index 08272ed..21a7c03 100644
--- a/app/controllers/static_pages_controller.rb
+++ b/app/controllers/static_pages_controller.rb
@@ -1,6 +1,8 @@
class StaticPagesController < ApplicationController
-
+ def my_tournaments
+ @tournaments = current_user.tournaments
+ end
def not_allowed
end
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index 7944337..0430cc8 100644
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -8,7 +8,8 @@
<%= link_to "About", "/static_pages/about" %>
<% if user_signed_in? %>
<%=link_to "Log out", destroy_user_session_url ,:method => 'delete' %>
- <%=link_to "Edit user", edit_user_registration_path %>
+ <%=link_to "Edit user", edit_user_registration_path %>
+ <%=link_to "My tournaments","/static_pages/my_tournaments" %>
<% else %>
<%= link_to "Log In" , new_user_session_path %>
<% end %>
diff --git a/app/views/static_pages/my_tournaments.html.erb b/app/views/static_pages/my_tournaments.html.erb
new file mode 100644
index 0000000..ad689d1
--- /dev/null
+++ b/app/views/static_pages/my_tournaments.html.erb
@@ -0,0 +1,38 @@
+My Tournaments
+
+<% if user_signed_in? %>
+ <%= link_to 'New Tournament', new_tournament_path, :class=>"btn btn-success" %>
+<% end %>
+
+
+
+
+
+ | Name |
+ |
+
+
+
+
+ <% @tournaments.each do |tournament| %>
+
+ | <%= tournament.name %> |
+ <%= link_to 'Show', tournament, :class=>"btn btn-default" %>
+ <% if tournament_permissions(tournament) %>
+ <%= link_to 'Edit', edit_tournament_path(tournament), :class=>"btn btn-primary" %>
+ <%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-danger" %>
+ <% end %>
+ |
+
+ <% end %>
+
+
+
+
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 00838c5..5ad9ab4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,6 +26,7 @@ Wrestling::Application.routes.draw do
get 'static_pages/control_match'
get 'static_pages/not_allowed'
get 'static_pages/about'
+ get 'static_pages/my_tournaments'
get 'tournaments/:id/weigh_in/:weight' => 'tournaments#weigh_in_weight'
post 'tournaments/:id/weigh_in/:weight' => 'tournaments#weigh_in_weight'
diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb
index 02471ee..ba2a24b 100644
--- a/test/controllers/static_pages_controller_test.rb
+++ b/test/controllers/static_pages_controller_test.rb
@@ -29,6 +29,10 @@ class StaticPagesControllerTest < ActionController::TestCase
get :home
success
end
-
+ test "get my_tournaments" do
+ sign_in_owner
+ get :my_tournaments
+ success
+ end
end