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
<address> | |
<%= deal.value %><br> | |
<%= deal.background %><br> | |
</address> | |
<div class="no-radio"> | |
<div class="btn-group" data-toggle="buttons-radio"> | |
<%= form_tag status_deal_path(deal), :remote => true, :class => "deals_status" do %> | |
<%= radio_button_tag :state, "won"+deal.id.to_s, deal.state == "won", :class => "toggle-btn-left toggle-btn" %> |
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 status_deal_path(deal), :remote => true, :class => "deals_status" do %> | |
<%= radio_button_tag :state, "won"+deal.id.to_s, deal.state == "won", :class => "toggle-btn-left toggle-btn", :value =>"won" %> | |
<%= label_tag 'state_won'+deal.id.to_s, "won", :class=>"btn" %> | |
<%= radio_button_tag :state, "lost"+deal.id.to_s, deal.state == 'lost', :class => "toggle-btn-center toggle-btn",:value => "lost" %> | |
<%= label_tag 'state_lost'+deal.id.to_s, "lost",:class=>"btn" %> | |
<%= radio_button_tag :state, "pending"+deal.id.to_s, deal.state == 'pending',:class => "toggle-btn-right toggle-btn", :value => "pending" %> | |
<%= label_tag 'state_pending'+deal.id.to_s, "pending", :class=>"btn" %> | |
<% 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
# == Schema Information | |
# | |
# Table name: deals | |
# | |
# id :integer not null, primary key | |
# company_id :integer | |
# name :text | |
# background :text | |
# currency :text | |
# value :float |
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
tasks_tasklist /tasks/tasklist(.:format) tasks#image_gallery | |
tasks_status POST /tasks/status(.:format) tasks#status | |
companies_deal_status POST /companies/deal_status(.:format) companies#deal_status | |
companies_status POST /companies/status(.:format) companies#status | |
deals GET /deals(.:format) deals#index | |
POST /deals(.:format) deals#create | |
new_deal GET /deals/new(.:format) deals#new | |
edit_deal GET /deals/:id/edit(.:format) deals#edit | |
deal GET /deals/:id(.:format) deals#show | |
PUT /deals/:id(.:format) deals#update |
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, :class => "deals_status" do %> | |
<%= hidden_field_tag 'deal_id', d.id.to_s %> | |
<%= radio_button_tag( :state, "won"+d.id.to_s, d.state == "won", :class => "toggle-btn-left toggle-btn", :value =>"won") %> | |
<%= label_tag 'state_won'+d.id.to_s, "won", :class=>"btn" %> | |
<%= radio_button_tag :state, "lost"+d.id.to_s, d.state == 'lost', :class => "toggle-btn-center toggle-btn",:value => "lost" %> | |
<%= label_tag 'state_lost'+d.id.to_s, "lost",:class=>"btn" %> |
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[:state] | |
d.save | |
@deal_id = deal_id | |
@deal = d |
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_" + @deal.id.to_s, :class => "deals_status") do %> | |
<%= hidden_field_tag 'deal_id', @deal.id.to_s %> | |
<%= radio_button_tag( :state, "won", @deal.state == 'won' ) %> | |
<%= label_tag( :state_won, "Won" ) %> | |
<%= radio_button_tag( :state, "lost", @deal.state == 'lost' ) %> | |
<%= label_tag( :state_lost, "Lost" ) %> |
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(); | |
$(this).prop('checked', true); | |
}); |
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 accept-charset="UTF-8" action="deal_status" class="deals_status" data-remote="true" id="deal22" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="Nhflt/o9HdfsWXpsSaKddd5yvItOsGtDoFD5N/Rbfns="></div> | |
<input id="deal_id" name="deal_id" type="hidden" value="22"> | |
<input id="state_won" name="state" type="radio" value="won"> | |
<label for="state_won">Won</label> | |
<input checked="checked" id="state_lost" name="state" type="radio" value="lost"> | |
<label for="state_lost">Lost</label> |
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'); | |
}); |