Module: Cms

Extended by:
Caching
Defined in:
lib/cms/domain_support.rb,
lib/cms/init.rb,
lib/cms/caching.rb,
lib/cms/data_loader.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, TaskItemsController, ToolbarController, UsersController

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.



40
41
42
# File 'lib/cms/init.rb', line 40

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

.add_to_rails_paths(path) ⇒ Object



48
49
50
# File 'lib/cms/init.rb', line 48

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

.build_numberObject



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

def build_number; 252 end

.generator_pathsObject



44
45
46
# File 'lib/cms/init.rb', line 44

def generator_paths
  @generator_paths ||= []
end

.initObject

This is called after the environment is ready



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

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
  
  # This is jsut 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



17
18
19
# File 'lib/cms/init.rb', line 17

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

.markdown?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/cms/init.rb', line 52

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

.reserved_pathsObject



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

def reserved_paths
  @reserved_paths ||= ["/cms", "/cache"]
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"


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

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