Created
August 22, 2013 06:08
-
-
Save kmelkon/6303714 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(".deals_status :radio").on('change', function(){ | |
$(this).closest("form").submit(); | |
alert('ss'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deal_status | |
deal_id = params[:deal_id] | |
d = Deal.find_by_id(deal_id) | |
d.state = params[:deal_status] | |
d.save | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_tag("deal_status", :remote=>true, :id=>"deal" + d.id.to_s, :class => "deals_status") do %> | |
<%= hidden_field_tag 'deal_id', d.id.to_s %> | |
<%= radio_button_tag( :state, "won" ) %> | |
<%= label_tag( :state_won, "Won" ) %> | |
<%= radio_button_tag( :state, "lost" ) %> | |
<%= label_tag( :state_lost, "Lost" ) %> | |
<%= radio_button_tag( :state, "pending" ) %> | |
<%= label_tag( :state_pending, "Pending" ) %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment