Skip to content

Instantly share code, notes, and snippets.

class BulkOrder
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :amex, :billing_address, :billing_city, :billing_company,
:billing_email_address, :billing_fax, :billing_phone,
:billing_state, :billing_zip, :bulk_order_date, :check,
:corporate_gifting, :corporate_loyalty_program, :credit_card,
@ornerymoose
ornerymoose / a_model.rb
Created May 8, 2012 17:58
Not the dryest by any means but gets the job done
class BulkOrder
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :amex, :billing_address, :billing_city, :billing_company,
:billing_email_address, :billing_fax, :billing_phone,
:billing_state, :billing_zip, :bulk_order_date, :check,
:corporate_gifting, :corporate_loyalty_program, :credit_card,
@ornerymoose
ornerymoose / controller.rb
Created May 8, 2012 18:35
mah controller
class BulkOrdersController < ApplicationController
def new
@bulk_order = BulkOrder.new
end
def create
@bulk_order = BulkOrder.new(params[:bulk_order])
if @bulk_order.save
redirect_to bulk_orders_url
@ornerymoose
ornerymoose / test_checkboxes.html
Created May 9, 2012 22:04
The checkboxes are displaying, but I can still select more than one.
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var $unique = $('input.unique');
$unique.click(function() {
$unique.removeAttr('checked');
$(this).attr('checked', true);
/*!
* jQuery JavaScript Library v1.7.2
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
%h3 Payment Method
.fields#check_checkbox
= f.label :check
= f.check_box :check
.fields#check_description
%p
%strong Payable to:
%p CouponTrade, Inc.
%p 214 West Ohio Street, Suite 4
%p Chicago, IL 60654
- @shipment_portion.line_items.each do |item|
- if item.product.electronic
%h1{ :style => "font-size: 23px; color: #192b5b;" } Congrats! Your gift card has been sold, funds are now pending.
%p{ :style => "font-size: 13px; color: #848687;" }
Your gift card
= "#{item.variant.product.name}, #{number_to_currency(item.product.value)}"
has sold for
= "#{number_to_currency(item.product.price)}."
- if item.transaction
We will deposit
@ornerymoose
ornerymoose / gist:2660368
Created May 11, 2012 15:15
portion of the template for the email
%p{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.check ? 'Check' : ''
%p{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.credit_card ? 'Credit Card' : ''
%ul
%li{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.discover ? 'Discover' : ''
%li{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.amex ? 'America Express' : ''
%li{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.mc ? 'Mastercard' : ''
%li{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.visa ? 'Visa' : ''
%p{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.check=="1" ? 'Check' : ''
%p{ :style => "font-size: 13px; color: #848687;" }= @bulk_order.credit_card=="1" ? 'Credit Card' : ''
class BulkOrder
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :amex, :billing_address, :billing_city,
:billing_company, :billing_email_address,
:billing_fax, :billing_phone, :billing_state,
:billing_zip, :bulk_order_date, :check,