Module: Cms

Extended by:
Caching
Defined in:
lib/cms/version.rb,
lib/cms/init.rb,
lib/cms/caching.rb,
lib/cms/data_loader.rb,
lib/cms/domain_support.rb,
lib/cms/extensions/nil.rb,
lib/cms/extensions/hash.rb,
lib/cms/behaviors/hiding.rb,
lib/cms/acts/content_page.rb,
lib/cms/extensions/string.rb,
lib/cms/acts/content_block.rb,
lib/cms/behaviors/taggable.rb,
lib/cms/extensions/integer.rb,
app/helpers/cms/menu_helper.rb,
app/helpers/cms/page_helper.rb,
app/helpers/cms/path_helper.rb,
lib/cms/behaviors/archiving.rb,
lib/cms/behaviors/attaching.rb,
lib/cms/behaviors/rendering.rb,
lib/cms/behaviors/searching.rb,
lib/cms/authentication/model.rb,
lib/cms/behaviors/connecting.rb,
lib/cms/behaviors/pagination.rb,
lib/cms/behaviors/publishing.rb,
lib/cms/behaviors/versioning.rb,
lib/cms/behaviors/categorizing.rb,
lib/cms/behaviors/userstamping.rb,
app/helpers/cms/form_tag_helper.rb,
lib/cms/behaviors/soft_deleting.rb,
app/helpers/cms/rendering_helper.rb,
app/helpers/cms/template_support.rb,
lib/cms/authentication/controller.rb,
lib/cms/content_rendering_support.rb,
app/controllers/cms/error_handling.rb,
app/helpers/cms/application_helper.rb,
lib/cms/extensions/action_view/base.rb,
app/helpers/cms/section_nodes_helper.rb,
lib/cms/behaviors/dynamic_attributes.rb,
lib/cms/extensions/active_record/base.rb,
lib/cms/behaviors/flush_cache_on_change.rb,
lib/cms/extensions/active_record/errors.rb

Overview

Methods added to this helper will be available to all templates in the cms.

Defined Under Namespace

Modules: Acts, ApplicationHelper, Authentication, Behaviors, Caching, ContentRenderingSupport, DataLoader, DomainSupport, ErrorHandling, Errors, Extensions, FormTagHelper, MenuHelper, PageHelper, PathHelper, RenderingHelper, Routes, SectionNodesHelper, TemplateSupport Classes: ApplicationController, AttachmentsController, BaseController, CacheController, CategoriesController, CategoryTypesController, ConnectorsController, ContentBlockController, ContentController, ContentTypesController, DashboardController, DynamicViewsController, EmailMessagesController, FileBlocksController, FormBuilder, GroupsController, HomeController, HtmlBlocksController, ImageBlocksController, LinksController, PageRouteConditionsController, PageRouteOptionsController, PageRouteRequirementsController, PageRoutesController, PagesController, PortletController, PortletsController, RedirectsController, ResourceController, RoutesController, SectionNodesController, SectionsController, SessionsController, TagsController, TasksController, ToolbarController, UsersController

Constant Summary collapse

VERSION =
"3.1.3"

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Caching

caching_enabled?, flush_cache

Class Attribute Details

.attachment_file_permissionObject

Returns the value of attribute attachment_file_permission.



9
10
11
# File 'lib/cms/init.rb', line 9

def attachment_file_permission
  @attachment_file_permission
end

Class Method Details

.add_generator_paths(src_root, *files) ⇒ Object

This is used by CMS modules to register with the CMS generator which files should be copied over to the app when the CMS generator is run. src_root is the absolute path to the root of the files, then each argument after that is a Dir.glob pattern string.



42
43
44
# File 'lib/cms/init.rb', line 42

def add_generator_paths(src_root, *files)
  generator_paths << [src_root, files]
end

.add_to_rails_paths(path) ⇒ Object



50
51
52
# File 'lib/cms/init.rb', line 50

def add_to_rails_paths(path)
  ActiveSupport::Dependencies.load_paths << File.join(path, "app", "portlets")
end

.add_to_routes(route) ⇒ Object



54
55
56
# File 'lib/cms/init.rb', line 54

def add_to_routes(route)
  routes << route
end

.generator_pathsObject



46
47
48
# File 'lib/cms/init.rb', line 46

def generator_paths
  @generator_paths ||= []
end

.initObject

This is called after the environment is ready



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cms/init.rb', line 20

def init
  ActionController::Routing::RouteSet::Mapper.send :include, Cms::Routes
  ActiveSupport::Dependencies.load_paths += %W( #{RAILS_ROOT}/app/portlets )
  ActiveSupport::Dependencies.load_paths += %W( #{RAILS_ROOT}/app/portlets/helpers )      
  ActionController::Base.append_view_path DynamicView.base_path
  ActionView::Base.default_form_builder = Cms::FormBuilder
  
  # ActiveRecord JDBC adapter depends on no database connection having
  # been established to work properly.
  require 'jdbc_adapter' if defined?(JRUBY_VERSION)
  
  # This is just to be safe
  # dynamic views are stored in a tmp dir
  # so they could be blown away on a server restart or something
  # so this just makes sure they get written out
  DynamicView.write_all_to_disk! if DynamicView.table_exists?
end

.load_rake_tasksObject



15
16
17
# File 'lib/cms/init.rb', line 15

def load_rake_tasks
  load "#{Cms.root}/lib/tasks/cms.rake"
end

.markdown?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/cms/init.rb', line 69

def markdown?
  Object.const_defined?("Markdown")
end

.reserved_pathsObject



73
74
75
# File 'lib/cms/init.rb', line 73

def reserved_paths
  @reserved_paths ||= ["/cms", "/cache"]
end

.routesObject



57
58
59
# File 'lib/cms/init.rb', line 57

def routes
  @routes ||=[]
end

.scrub_path(path) ⇒ Object

This next ‘hack’ is to allow script/generate browser_cms to work on Windows machines. I’m not sure why this is necessary.

This Generator is adding an absolute file path to the manifest, which is file (like a .js or migration) in the gem directory on the developers’s machine, rather than just a relative path with the rails_generator directory. On windows, this will mean you are basically doing this.

m.file “C:/Ruby/lib/ruby/gems/1.8/gems/browsercms-3.0.0/public/javascripts/jquery-ui.js”, “testing/jquery-ui.js”

When the generator hits this command during playback, it will throw an error like this:

Pattern 'c' matches more than one generator: content_block, controller

The generator then fails and stops copying. Stripping the C: off the front seems to fix this problem. I.e. This command correctly copies the file on Windows XP.

m.file "/Ruby/lib/ruby/gems/1.8/gems/browsercms-3.0.0/public/javascripts/jquery-ui.js", "testing/jquery-ui.js"


91
92
93
94
# File 'lib/cms/init.rb', line 91

def scrub_path(path)
  windows_drive_pattern =  /\b[A-Za-z]:\//    # Works on drives labeled A-Z:
  scrubbed_source_file_name = path.gsub(windows_drive_pattern, "/")
end

.versionObject



11
12
13
# File 'lib/cms/init.rb', line 11

def version
  @version = SPEC.version.version
end

.wysiwig_jsObject



61
62
63
# File 'lib/cms/init.rb', line 61

def wysiwig_js
  @wysiwig_js ||= ['/bcms/ckeditor/ckeditor.js', '/bcms/ckeditor/editor.js']
end

.wysiwig_js=(path_array) ⇒ Object



65
66
67
# File 'lib/cms/init.rb', line 65

def wysiwig_js=(path_array)
  @wysiwig_js = path_array
end