Last active
December 21, 2015 17:09
-
-
Save kmelkon/6338861 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
<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" %> | |
<%= 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" %> | |
<%= 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" %> | |
<%= label_tag 'state_pending'+deal.id.to_s, "pending", :class=>"btn" %> | |
<% end %> | |
</div> | |
</div> |
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
$("body").on("change", "form :radio", function(){ | |
$(this).closest("form").submit(); | |
}); |
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-wrapper').append('<%= escape_javascript(render :partial => "deals/deal", :locals => {:deal => @deal}) %>'); |
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 status | |
@deal = Deal.find_by_id(params[:id]) | |
@deal.update_attribute(:state, params[:state]) | |
respond_to do |format| | |
format.js | |
end | |
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
Started POST "/__better_errors/70101218397900/variables" for 127.0.0.1 at 2013-08-26 10:29:39 +0300 | |
Task Load (0.2ms) SELECT "tasks".* FROM "tasks" WHERE "tasks"."company_id" = 31 |
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
NoMethodError at /companies/31 | |
undefined method `value' for nil:NilClass |
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
local_assigns | |
{:locals=>{:deal=>#<Deal id: 24, company_id: 31, name: "deal", background: "deak", currency: "", value: 22.0, offer: nil, deal_category_id: nil, deal_status_id: nil, user_id: nil, created_at: "2013-08-25 06:34:17", updated_at: "2013-08-26 07:12:04", status: nil, state: "won">}, :deal=>nil} |
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
Request parameters | |
{"action"=>"show", "controller"=>"companies", "id"=>"31"} |
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
<div class="deals-wrapper"> | |
<% @deals.each do |deal| %> | |
<%= render 'deals/deal', :locals => {:deal => deal} %>} %> | |
<% end %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment