mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-02-03 15:01:11 +00:00
started to shape out the controllers
This commit is contained in:
parent
160fccd118
commit
0f05829bcc
4 changed files with 32 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
class MatchProposalsController < ApplicationController
|
class MatchProposalsController < ApplicationController
|
||||||
def index
|
def index
|
||||||
|
@match = Match.find(params[:match_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -42,6 +42,7 @@ class Match < ActiveRecord::Base
|
||||||
has_many :users, through: :matchers
|
has_many :users, through: :matchers
|
||||||
has_many :predictions, dependent: :destroy
|
has_many :predictions, dependent: :destroy
|
||||||
has_many :comments, as: :commentable, order: "created_at", 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 :challenge
|
||||||
belongs_to :contest
|
belongs_to :contest
|
||||||
belongs_to :contester1, class_name: "Contester", include: "team"
|
belongs_to :contester1, class_name: "Contester", include: "team"
|
||||||
|
|
|
@ -1,2 +1,24 @@
|
||||||
<h1>MatchProposals#show</h1>
|
<h1>Proposals</h1>
|
||||||
<p>Find me in app/views/match_proposals/show.html.erb</p>
|
<%= link_to 'Back', match_path(@match), class: 'button' %>
|
||||||
|
<% if @match.match_proposals.empty? %>
|
||||||
|
<h4>There are no proposals yet</h4>
|
||||||
|
<% else %>
|
||||||
|
|
||||||
|
<table id="proposals" class="striped">
|
||||||
|
<tr>
|
||||||
|
<th>Team</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
<% @match.match_proposals.each do |proposal| %>
|
||||||
|
<tr class="<%=cycle('even', 'odd') %>">
|
||||||
|
<td><%= proposal.team.name %></td>
|
||||||
|
<td><%= longtime proposal.proposed_time %> </td>
|
||||||
|
<td><%= proposal.status %></td>
|
||||||
|
<td>test</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to 'Back', match_path(@match), class: 'button' %><%= link_to 'Propose match time', new_match_proposal_path(@match), class: 'button' %>
|
|
@ -116,6 +116,11 @@
|
||||||
<p><%= @match.report.html_safe %></p>
|
<p><%= @match.report.html_safe %></p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if cuser and (cuser.admin? or @match.of_user cuser) %>
|
||||||
|
<div class="referee">
|
||||||
|
<%= link_to 'Proposals', match_proposals_path(@match), class: 'button' %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if cuser and @match.can_update? cuser, [:report] %>
|
<% if cuser and @match.can_update? cuser, [:report] %>
|
||||||
<div class="referee">
|
<div class="referee">
|
||||||
|
@ -130,6 +135,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= add_comments @match %>
|
<%= add_comments @match %>
|
||||||
|
|
Loading…
Reference in a new issue