diff --git a/app/controllers/match_proposals_controller.rb b/app/controllers/match_proposals_controller.rb index 6079786..79e5773 100644 --- a/app/controllers/match_proposals_controller.rb +++ b/app/controllers/match_proposals_controller.rb @@ -1,6 +1,6 @@ class MatchProposalsController < ApplicationController def index - + @match = Match.find(params[:match_id]) end def new diff --git a/app/models/match.rb b/app/models/match.rb index 4626848..82495a0 100755 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -42,6 +42,7 @@ class Match < ActiveRecord::Base has_many :users, through: :matchers has_many :predictions, dependent: :destroy has_many :comments, as: :commentable, order: "created_at", dependent: :destroy + has_many :match_proposals, inverse_of: :match, dependent: :destroy belongs_to :challenge belongs_to :contest belongs_to :contester1, class_name: "Contester", include: "team" diff --git a/app/views/match_proposals/index.html.erb b/app/views/match_proposals/index.html.erb index feb7985..726f1da 100644 --- a/app/views/match_proposals/index.html.erb +++ b/app/views/match_proposals/index.html.erb @@ -1,2 +1,24 @@ -

MatchProposals#show

-

Find me in app/views/match_proposals/show.html.erb

+

Proposals

+<%= link_to 'Back', match_path(@match), class: 'button' %> +<% if @match.match_proposals.empty? %> +

There are no proposals yet

+<% else %> + + + + + + + + + <% @match.match_proposals.each do |proposal| %> + + + + + + + <% end %> +
TeamTimeStatusActions
<%= proposal.team.name %><%= longtime proposal.proposed_time %> <%= proposal.status %>test
+ <% end %> +<%= link_to 'Back', match_path(@match), class: 'button' %><%= link_to 'Propose match time', new_match_proposal_path(@match), class: 'button' %> \ No newline at end of file diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index 0592286..550f8d8 100755 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -116,6 +116,11 @@

<%= @match.report.html_safe %>

<% end %> + <% if cuser and (cuser.admin? or @match.of_user cuser) %> +
+ <%= link_to 'Proposals', match_proposals_path(@match), class: 'button' %> +
+ <% end %> <% if cuser and @match.can_update? cuser, [:report] %>
@@ -130,6 +135,7 @@ <% end %>
<% end %> + <%= add_comments @match %>