Skip to content

Instantly share code, notes, and snippets.

View kmelkon's full-sized avatar
👨‍💻

Karam Malkon kmelkon

👨‍💻
View GitHub Profile
@kmelkon
kmelkon / deal.rb
Last active December 21, 2015 17:09
# == Schema Information
#
# Table name: deals
#
# id :integer not null, primary key
# company_id :integer
# name :text
# background :text
# currency :text
# value :float
<%= 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 %>
<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" %>
<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 %>
<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", :value =>"won" %>
<%= form_for [@company, @activity], :remote=> true, :validate => true do |f| %>
<%= f.label :title %>
<%= f.text_field :title, :class => "input-width bottom-border"%>
<%= f.label :background %>
<%= f.text_area :background, :class => "area-height area-width bottom-border" %>
<%= f.collection_select(:activity_category_id, ActivityCategory.all, :id, :activity_category) %>
<fieldset>
<div class="control-group">
<%= f.label :place, :class => "remember control-label" %>
<div class="controls">
<%= f.select :place, ['Work', 'Mobile', 'Other'], {}, { :class => "input-xlarge" } %>
</div>
</div>
<div class="control-group">
<%= f.label :number, :class => "control-label" %>
<div class="controls">
<%= form_for [@company, @activity], :remote=> true, :validate=>true do |f| %>
<%= f.label :title %>
<%= f.text_field :title, :class => "input-width bottom-border"%>
<%= f.label :activity_category_id %>
<%= f.collection_select(:activity_category_id, ActivityCategory.all, :id, :activity_category) %>
<%= f.label :background %>
<%= f.text_area :background, :class => "area-height area-width bottom-border" %>
@grouped = {}
Deal.all.each do |deal|
letter = deal.background.slice(0,1).upcase
@grouped[letter] ||= []
@grouped[letter] << deal
end

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})