diff --git a/app/assets/javascripts/local.js b/app/assets/javascripts/local.js
index 98c816b..936b86f 100644
--- a/app/assets/javascripts/local.js
+++ b/app/assets/javascripts/local.js
@@ -49,6 +49,20 @@ $(function() {
});
// Submit TODO
+ $("form.edit_match_proposal a").on('click', function() {
+ var form = $(this).closest('form.edit_match_proposal');
+ form.children("input#match_proposal_status").val($(this).dataset.id);
+ $.post(form.attr('action'),form.serialize(), function(data) {
+ tr = form.closest('tr');
+ tr.children('td').eq(2).text(data.status);
+ if(data.status === 'Revoked' || data.status === 'Rejected') tr.children('td').eq(3).empty();
+ }, 'json')
+ .error(function (err) {
+ errjson = JSON.parse(err.responseText);
+ alert(errjson.error.message);
+ });
+ }
+ );
$("a.submit").on('click', function() {
$(this).closest('form').submit()
@@ -122,6 +136,10 @@ function QuoteText(id, type) {
});
}
+// Match proposal
+
+
+
// Fields removing and adding dynamically
function remove_fields(link) {
diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb
index 2a7f5f6..9aeb7a1 100644
--- a/app/helpers/polls_helper.rb
+++ b/app/helpers/polls_helper.rb
@@ -1,5 +1,6 @@
module PollsHelper
def add_option_link(name, form)
+ # FIXME: not used atm.
link_to_function name do |page|
option = render :partial => 'option', :locals => { :pf => form, :options => Option.new }
page << %{
diff --git a/app/views/match_proposals/index.html.erb b/app/views/match_proposals/index.html.erb
index 7a7835a..e38d5b7 100644
--- a/app/views/match_proposals/index.html.erb
+++ b/app/views/match_proposals/index.html.erb
@@ -14,7 +14,7 @@
<% end %>
<% @match.match_proposals.each do |proposal| %>
-
+
-
<%= proposal.team.name %> |
<%= longtime proposal.proposed_time %> |
<%= MatchProposal.status_strings[proposal.status] %> |
@@ -22,18 +22,19 @@
<% unless proposal.state_immutable? %>
<%= form_for proposal, url: match_proposal_path(@match, proposal) do |f| %>
+ <%= f.hidden_field :id, value: 0 %>
<%= f.hidden_field :status, value: 0 %>
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_CONFIRMED) %>
- <%= link_to_function icon('check'), "proposalStateSubmit(#{MatchProposal::STATUS_CONFIRMED},#{proposal.id})", title: 'Confirm' %>
+ <%= link_to icon('check'), "#", 'data-id': "#{MatchProposal::STATUS_CONFIRMED}", title: 'Confirm' %>
<% end %>
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_REJECTED) %>
- <%= link_to_function icon('times'), "proposalStateSubmit(#{MatchProposal::STATUS_REJECTED},#{proposal.id})", title: 'Reject' %>
- <% end %>
+ <%= link_to icon('times'), "#", 'data-id': "#{MatchProposal::STATUS_REJECTED}", title: 'Reject' %>
+ <% end %>
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_REVOKED) %>
- <%= link_to_function icon('undo'), "proposalStateSubmit(#{MatchProposal::STATUS_REVOKED},#{proposal.id})", title: 'Revoke' %>
+ <%= link_to icon('undo'), "#", 'data-id': "#{MatchProposal::STATUS_REVOKED}", title: 'Revoke' %>
<% end %>
<% if proposal.status_change_allowed?(cuser, MatchProposal::STATUS_DELAYED) %>
- <%= link_to_function icon('hourglass'), "proposalStateSubmit(#{MatchProposal::STATUS_DELAYED},#{proposal.id})", title: 'Delay' %>
+ <%= link_to icon('hourglass'), "#", 'data-id': "#{MatchProposal::STATUS_DELAYED}", title: 'Delay' %>
<% end %>
<% end %>
<% end %>
@@ -42,20 +43,6 @@
|
<% end %>
-
+
<% 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