Skip to content

Instantly share code, notes, and snippets.

View index.js
$('.btn-submit').each(function() {
$(this).click(function(e) {
e.preventDefault();
console.log($(".annualized_comp_value").val());
});
});
View new.html.erb
<%= form_tag charges_path(id: @cart.id) do %>
<article>
<%= number_to_currency(@cart.total_price) %>
</article>
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<%= Rails.configuration.stripe[:publishable_key] %>"
data-description="One-time Charge"
data-amount="<%= @cart.total_price * 100 %>"
data-shipping-address="false"
View charges_controller.rb
class ChargesController < ApplicationController
after_filter :destroy_cart, :only => [:show]
def new
@cart = Cart.find(params[:id])
end
def create
begin
View gist:10772847
class ChargesController < ApplicationController
after_filter :destroy_cart, :only => [:show]
def new
@cart = Cart.find(params[:id])
end
def create
begin
View charge_mailer.rb
7 class ChargeMailer < ActionMailer::Base
6 default :from => "mygmailaddress@gmail.com"
5
4 def registration_confirmation(cust)
3 @@customer = cust
2 mail(:to => "#{cust.email}", :subject => "Your Order Confirmation")
1 end
0 end
~
View charges_controller.rb
class ChargesController < ApplicationController
after_filter :destroy_cart, :only => [:create]
def new
@cart = Cart.find(params[:id])
end
def create
begin
View gist:10915065
// Place all the styles related to the Products controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
/* TOP BANNER CONTENT - BEGIN */
#transparent-box
{
margin-left: auto;
margin-right: auto;
position: absolute;
@ornerymoose
ornerymoose / mycssfile.css
Created Apr 17, 2014
currently the .innerdiv logo_red.png is affected by the opacity set in .outerdiv. How do I remove the opacity on the .innerdiv?
View mycssfile.css
.outerdiv
{
margin-left: auto;
margin-right: auto;
margin-top: 40px;
width: 800px;
height: 150px;
background-color: white;
opacity: 0.5;
border-radius: 5px;
View charges_controller.rb
class ChargesController < ApplicationController
after_filter :destroy_cart, :only => [:show]
def new
@cart = Cart.find(params[:id])
end
def create
begin
@ornerymoose
ornerymoose / _cart.html.erb
Created Apr 17, 2014
cart partial as is in app/views/carts
View _cart.html.erb
<div class="cart_title">Your Cart</div>
<table>
<%= render(@cart.line_items) %>
<tr class="total_line">
<td colspan="2">Total</td>
<td class="total_cell"><%= number_to_currency(@cart.total_price) %></td>
</tr>
</table>
<%= button_to 'Empty cart', @cart, method: :delete, confirm: 'Are you sure?' %>
<%= link_to 'Checkout', new_charge_path(id: @cart.id) %>