Module: Caboose

Defined in:
app/models/caboose/order.rb,
lib/caboose.rb,
lib/caboose/version.rb,
app/models/caboose/review.rb,
app/models/caboose/vendor.rb,
app/models/caboose/address.rb,
app/models/caboose/authnet.rb,
app/models/caboose/message.rb,
app/models/caboose/product.rb,
app/models/caboose/variant.rb,
app/models/caboose/calendar.rb,
app/models/caboose/category.rb,
app/models/caboose/discount.rb,
app/models/caboose/tax_line.rb,
app/models/caboose/gift_card.rb,
app/models/caboose/line_item.rb,
app/models/caboose/order_pdf.rb,
app/models/caboose/std_class.rb,
app/models/caboose/ab_testing.rb,
app/models/caboose/crumbtrail.rb,
app/models/caboose/page_cache.rb,
app/models/caboose/block_cache.rb,
app/models/caboose/page_cacher.rb,
app/models/caboose/store_config.rb,
app/helpers/caboose/pages_helper.rb,
app/mailers/caboose/login_mailer.rb,
app/models/caboose/order_package.rb,
app/models/caboose/product_image.rb,
app/models/caboose/search_filter.rb,
app/mailers/caboose/orders_mailer.rb,
app/models/caboose/calendar_event.rb,
app/models/caboose/order_discount.rb,
app/models/caboose/tax_calculator.rb,
app/models/caboose/shipping_method.rb,
app/models/caboose/stackable_group.rb,
app/helpers/caboose/checkout_helper.rb,
app/helpers/caboose/products_helper.rb,
app/models/caboose/block_cache_file.rb,
app/models/caboose/block_type_icons.rb,
app/models/caboose/shipping_package.rb,
app/models/caboose/block_cache_image.rb,
app/models/caboose/order_transaction.rb,
app/helpers/caboose/categories_helper.rb,
app/models/caboose/page_bar_generator.rb,
app/models/caboose/pending_orders_pdf.rb,
app/helpers/caboose/application_helper.rb,
app/helpers/caboose/permissions_helper.rb,
app/models/caboose/category_membership.rb,
app/models/caboose/shipping_calculator.rb,
app/controllers/caboose/cart_controller.rb,
app/controllers/caboose/smtp_controller.rb,
app/models/caboose/calendar_event_group.rb,
app/controllers/caboose/admin_controller.rb,
app/controllers/caboose/login_controller.rb,
app/controllers/caboose/modal_controller.rb,
app/controllers/caboose/pages_controller.rb,
app/controllers/caboose/posts_controller.rb,
app/controllers/caboose/roles_controller.rb,
app/controllers/caboose/sites_controller.rb,
app/controllers/caboose/store_controller.rb,
app/controllers/caboose/users_controller.rb,
app/models/caboose/product_image_variant.rb,
app/controllers/caboose/blocks_controller.rb,
app/controllers/caboose/events_controller.rb,
app/controllers/caboose/images_controller.rb,
app/controllers/caboose/logout_controller.rb,
app/controllers/caboose/orders_controller.rb,
app/controllers/caboose/social_controller.rb,
app/models/caboose/rich_text_block_parser.rb,
app/models/caboose/shipping_method_loader.rb,
app/controllers/caboose/domains_controller.rb,
app/controllers/caboose/reviews_controller.rb,
app/controllers/caboose/station_controller.rb,
app/controllers/caboose/vendors_controller.rb,
app/models/caboose/shipping_package_method.rb,
app/controllers/caboose/checkout_controller.rb,
app/controllers/caboose/products_controller.rb,
app/controllers/caboose/products_controller.rb,
app/controllers/caboose/register_controller.rb,
app/controllers/caboose/settings_controller.rb,
app/controllers/caboose/variants_controller.rb,
app/models/caboose/customization_membership.rb,
app/models/caboose/order_package_calculator.rb,
app/controllers/caboose/calendars_controller.rb,
app/controllers/caboose/redirects_controller.rb,
app/controllers/caboose/ab_options_controller.rb,
app/controllers/caboose/categories_controller.rb,
app/controllers/caboose/gift_cards_controller.rb,
app/controllers/caboose/line_items_controller.rb,
app/controllers/caboose/ab_variants_controller.rb,
app/controllers/caboose/application_controller.rb,
app/controllers/caboose/block_types_controller.rb,
app/controllers/caboose/permissions_controller.rb,
app/controllers/caboose/event_groups_controller.rb,
app/controllers/caboose/order_packages_controller.rb,
app/controllers/caboose/product_images_controller.rb,
app/controllers/caboose/block_type_store_controller.rb,
app/controllers/caboose/media_categories_controller.rb,
app/controllers/caboose/page_permissions_controller.rb,
app/controllers/caboose/stackable_groups_controller.rb,
app/controllers/caboose/shipping_packages_controller.rb,
app/controllers/caboose/block_type_sources_controller.rb,
app/controllers/caboose/shipping_addresses_controller.rb,
app/controllers/caboose/block_type_categories_controller.rb,
lib/caboose/engine.rb

Overview

Note:

For includes to work with namespaces other than the root namespace, the 
full namespaced class_name has to be set in the model on the association 
being included.  For example:

class Animals::Dog
  has_many :friends, :class_name => 'Animals::Dog'
end

Defined Under Namespace

Modules: ApplicationHelper, CategoriesHelper, CheckoutHelper, PagesHelper, PermissionsHelper, ProductsHelper Classes: AbOption, AbOptionsController, AbTesting, AbValue, AbVariant, AbVariantsController, Address, AdminController, ApplicationController, ApprovalRequest, Asset, Authenticator, Authnet, Block, BlockCache, BlockCacheFile, BlockCacheImage, BlockType, BlockTypeCategoriesController, BlockTypeCategory, BlockTypeIcons, BlockTypeSiteMembership, BlockTypeSource, BlockTypeSourcesController, BlockTypeStoreController, BlockTypeSummary, BlockTypesController, BlocksController, CaboosePlugin, Calendar, CalendarEvent, CalendarEventGroup, CalendarsController, CartController, CategoriesController, Category, CategoryMembership, CheckoutController, CorePlugin, Crumbtrail, CustomizationMembership, DatabaseSession, Discount, Domain, DomainsController, Engine, EventGroupsController, EventsController, GiftCard, GiftCardsController, ImagesController, LineItem, LineItemsController, LoginController, LoginMailer, LogoutController, MediaCategoriesController, MediaCategory, MediaFile, MediaImage, MenuBlock, Message, ModalController, Order, OrderDiscount, OrderPackage, OrderPackageCalculator, OrderPackagesController, OrderPdf, OrderTransaction, OrdersController, OrdersMailer, Page, PageBarGenerator, PageCache, PageCacher, PagePermission, PagePermissionsController, PageTag, Pager, PagesController, PendingOrdersPdf, PermanentRedirect, Permission, PermissionsController, Post, PostCategory, PostCategoryMembership, PostsController, Product, ProductImage, ProductImageVariant, ProductImagesController, ProductsController, RedirectsController, RegisterController, Review, ReviewsController, RichTextBlockParser, Role, RoleMembership, RolePermission, RolesController, Schema, SearchFilter, Setting, SettingsController, ShippingAddressesController, ShippingCalculator, ShippingMethod, ShippingMethodLoader, ShippingPackage, ShippingPackageMethod, ShippingPackagesController, Site, SiteMembership, SitesController, SmtpConfig, SmtpController, SocialConfig, SocialController, StackableGroup, StackableGroupsController, States, StationController, StdClass, StoreConfig, StoreController, TaxCalculator, TaxLine, User, UsersController, Variant, VariantsController, Vendor, VendorsController

Constant Summary collapse

VERSION =
'0.5.112'
@@salt =
"This needs to be changed pronto."
@@assets_path =
"assets"
@@plugins =
['Caboose::CorePlugin']
@@modeljs_js_files =
[]
@@modeljs_js_paths =
[]
@@modeljs_css_files =
[]
@@authenticator_class =
'Caboose::Authenticator'
@@use_url_params =
true
@@use_ab_testing =
true
@@website_name =
"Website"
@@website_domain =
"http://www.google.com"
@@cdn_domain =
""
@@email_from =
"[email protected]"
@@javascripts =
[]
@@stylesheets =
[]
@@session_length =
24
@@parse_richtext_blocks =
true
@@timezone =
'Central Time (US & Canada)'
@@register_layout =
'caboose/modal'
@@login_layout =
'caboose/modal'
@@use_store =
false
@@store_url =
''
@@payment_processor =
{
  :name => 'stripe',
  :api_key => '',
  :username => '',
  :password => ''
}
@@store_shipping =
{
  :ups    => { :username => '', :password => '', :key => '' },  
  :usps   => { :username => 'avondalebrewing', :password => 'Missfancy2011', :key => '' },  
  :origin => { :country  => '', :state => '', :city => '', :zip => '' },
  :allowed_shipping_method_codes => [],
  :default_shipping_method_code => ''  
}
@@store_fulfillment_email =
''
@@store_shipping_email =
''
@@store_contact_email =
''
@@store_handling_percentage =
''
@@from_address =
''

Class Method Summary collapse

Class Method Details

.json(obj, defaultvalue = "", options = {}) ⇒ Object



46
47
48
49
# File 'lib/caboose/engine.rb', line 46

def Caboose.json(obj, defaultvalue = "", options = {})
  return defaultvalue.to_json if obj.nil?
  return obj.to_json(options)
end

.log(message, title = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/caboose/engine.rb', line 20

def Caboose.log(message, title = nil)
  if (Rails.logger.nil?)
    puts "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
    puts title.to_s unless title.nil?
    puts message
    puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
  else
    Rails.logger.info("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
    Rails.logger.info(title.to_s) unless title.nil?
    Rails.logger.info(message)
    Rails.logger.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")
  end                
end

.plugin_hook(*args) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/caboose/engine.rb', line 34

def Caboose.plugin_hook(*args)
  resp = nil
  args[0] = args[0].to_sym 
  Caboose.plugins.each do |mod|
    #resp = mod.constantize.send(*args)      
    if (mod.constantize.respond_to?(args[0]))
      resp = mod.constantize.send(*args)
    end
  end
  return resp
end

.rootObject



5
6
7
# File 'lib/caboose.rb', line 5

def self.root
  File.expand_path '../..', __FILE__
end

.teaser_text(str, length = 100) ⇒ Object

Strips html and returns the text that breaks closest to the given length



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/caboose/engine.rb', line 52

def Caboose.teaser_text(str, length = 100)
  return '' if str.nil?    
  str2 = ActionController::Base.helpers.strip_tags(str).gsub("\n", ' ')
  return '' if str2.nil? || str2.length == 0
  if str2.length > length
    i = str2.index(' ', length)
    if i.nil?
      i = length
    else
      i = i - 1
    end
    str2 = str2[0..i]
    str2[str2.length-1] = "" if str2.ends_with?(",")
    str2 = "#{str2}..."
  end
  return str2
end