Module: Caboose

Defined in:
app/models/caboose/page_bar_generator.rb,
lib/caboose.rb,
lib/caboose/version.rb,
lib/caboose/migrations.rb,
app/models/caboose/std_class.rb,
app/models/caboose/ab_testing.rb,
lib/caboose/migration_version.rb,
app/helpers/caboose/pages_helper.rb,
app/mailers/caboose/login_mailer.rb,
app/helpers/caboose/products_helper.rb,
app/helpers/caboose/application_helper.rb,
app/helpers/caboose/permissions_helper.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/users_controller.rb,
app/controllers/caboose/logout_controller.rb,
app/controllers/caboose/station_controller.rb,
app/controllers/caboose/register_controller.rb,
app/controllers/caboose/settings_controller.rb,
app/controllers/caboose/ab_options_controller.rb,
app/controllers/caboose/ab_variants_controller.rb,
app/controllers/caboose/application_controller.rb,
app/controllers/caboose/page_blocks_controller.rb,
app/controllers/caboose/permissions_controller.rb,
app/controllers/caboose/page_block_types_controller.rb,
app/controllers/caboose/page_permissions_controller.rb,
app/controllers/caboose/page_block_fields_controller.rb,
app/controllers/caboose/page_block_field_values_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, PagesHelper, PermissionsHelper, ProductsHelper Classes: AbOption, AbOptionsController, AbTesting, AbValue, AbVariant, AbVariantsController, AdminController, ApplicationController, ApprovalRequest, Asset, Authenticator, CaboosePlugin, CorePlugin, DatabaseSession, Engine, LoginController, LoginMailer, LogoutController, MenuBlock, ModalController, Page, PageBarGenerator, PageBlock, PageBlockField, PageBlockFieldValue, PageBlockFieldValuesController, PageBlockFieldsController, PageBlockType, PageBlockTypesController, PageBlocksController, PagePermission, PagePermissionsController, Pager, PagesController, Permission, PermissionsController, Post, PostCategory, PostCategoryMembership, PostsController, RegisterController, Role, RoleMembership, RolePermission, RolesController, Schema, Setting, SettingsController, States, StationController, StdClass, Timezone, TimezoneAbbreviation, TimezoneOffset, User, UsersController, Version

Constant Summary collapse

VERSION =
'0.3.89'
VERSIONS =
[
  Caboose::Version.new('0.2.19', 000..000),
]
@@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 =
[]
@@timezonedb_api_key =
''

Class Method Summary collapse

Class Method Details

.json(obj, defaultvalue = "") ⇒ Object



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

def Caboose.json(obj, defaultvalue = "")
  return defaultvalue.to_json if obj.nil?
  return obj.to_json
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.debug("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
    Rails.logger.debug(title.to_s) unless title.nil?
    Rails.logger.debug(message)
    Rails.logger.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\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

.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
# 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)
  if str2.length > 200
    i = str2.index(' ', 200) - 1
    i = 200 if i.nil?
    str2 = str2[0..i]
    str2[str2.length-1] = "" if str2.ends_with?(",")
    str2 = "#{str2}..."
  end
  return str2
end