Module: Cms

Extended by:
Caching
Defined in:
app/models/cms/templates.rb,
app/models/cms/tag.rb,
app/models/cms/site.rb,
app/models/cms/task.rb,
app/models/cms/user.rb,
app/models/cms/portlet.rb,
app/models/cms/section.rb,
app/models/cms/tagging.rb,
app/models/cms/category.rb,
app/models/cms/redirect.rb,
app/models/cms/connector.rb,
app/models/cms/attachment.rb,
app/models/cms/file_block.rb,
app/models/cms/group_type.rb,
app/models/cms/guest_user.rb,
app/models/cms/html_block.rb,
app/models/cms/permission.rb,
app/models/cms/image_block.rb,
app/helpers/cms/menu_helper.rb,
app/helpers/cms/page_helper.rb,
app/helpers/cms/path_helper.rb,
app/models/cms/content_type.rb,
app/models/cms/dynamic_view.rb,
app/models/cms/page_partial.rb,
app/models/cms/view_context.rb,
app/models/cms/category_type.rb,
app/models/cms/email_message.rb,
app/models/cms/group_section.rb,
app/models/cms/page_template.rb,
app/helpers/cms/form_tag_helper.rb,
app/models/cms/group_permission.rb,
app/helpers/cms/rendering_helper.rb,
app/helpers/cms/template_support.rb,
app/models/cms/page_route_option.rb,
app/models/cms/content_type_group.rb,
app/controllers/cms/error_handling.rb,
app/helpers/cms/application_helper.rb,
app/helpers/cms/ui_elements_helper.rb,
app/models/cms/abstract_file_block.rb,
app/controllers/cms/base_controller.rb,
app/controllers/cms/home_controller.rb,
app/controllers/cms/tags_controller.rb,
app/models/cms/email_message_mailer.rb,
app/models/cms/page_route_condition.rb,
app/controllers/cms/cache_controller.rb,
app/controllers/cms/links_controller.rb,
app/controllers/cms/pages_controller.rb,
app/controllers/cms/tasks_controller.rb,
app/controllers/cms/users_controller.rb,
app/helpers/cms/content_block_helper.rb,
app/helpers/cms/section_nodes_helper.rb,
app/models/cms/group_type_permission.rb,
app/models/cms/user_group_membership.rb,
app/controllers/cms/groups_controller.rb,
app/controllers/cms/routes_controller.rb,
app/models/cms/forgot_password_mailer.rb,
app/models/cms/page_route_requirement.rb,
app/controllers/cms/content_controller.rb,
app/controllers/cms/portlet_controller.rb,
app/controllers/cms/toolbar_controller.rb,
app/controllers/cms/portlets_controller.rb,
app/controllers/cms/resource_controller.rb,
app/controllers/cms/sessions_controller.rb,
app/controllers/cms/dashboard_controller.rb,
app/controllers/cms/redirects_controller.rb,
app/controllers/cms/categories_controller.rb,
app/controllers/cms/connectors_controller.rb,
app/controllers/cms/application_controller.rb,
app/controllers/cms/attachments_controller.rb,
app/controllers/cms/file_blocks_controller.rb,
app/controllers/cms/html_blocks_controller.rb,
app/controllers/cms/page_routes_controller.rb,
app/controllers/cms/image_blocks_controller.rb,
app/controllers/cms/content_block_controller.rb,
app/controllers/cms/content_types_controller.rb,
app/controllers/cms/dynamic_views_controller.rb,
app/controllers/cms/section_nodes_controller.rb,
app/controllers/cms/category_types_controller.rb,
app/controllers/cms/email_messages_controller.rb,
app/controllers/cms/page_route_options_controller.rb,
app/controllers/cms/page_route_conditions_controller.rb,
app/controllers/cms/page_route_requirements_controller.rb,
lib/cms/init.rb,
lib/cms/engine.rb,
lib/cms/module.rb,
lib/cms/caching.rb,
lib/cms/version.rb,
lib/cms/addressable.rb,
lib/cms/data_loader.rb,
lib/cms/date_picker.rb,
lib/cms/error_pages.rb,
lib/cms/acts/cms_user.rb,
lib/cms/engine_helper.rb,
lib/cms/domain_support.rb,
lib/cms/extensions/nil.rb,
lib/cms/extensions/hash.rb,
lib/cms/upgrades/v3_4_0.rb,
lib/cms/behaviors/hiding.rb,
lib/cms/commands/actions.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,
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/installation_actions.rb,
lib/cms/behaviors/namespacing.rb,
lib/cms/behaviors/categorizing.rb,
lib/cms/behaviors/userstamping.rb,
lib/cms/behaviors/soft_deleting.rb,
lib/cms/authentication/controller.rb,
lib/cms/content_rendering_support.rb,
lib/cms/extensions/action_view/base.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,
lib/generators/cms/install/install_generator.rb,
lib/generators/cms/portlet/portlet_generator.rb,
lib/generators/cms/template/template_generator.rb,
lib/generators/cms/content_block/content_block_generator.rb

Overview

This module can be added to Controllers to provide support for rendering CMS content pages.

Defined Under Namespace

Modules: Acts, Addressable, ApplicationHelper, Authentication, Authoring, Behaviors, Caching, Commands, ContentBlockHelper, ContentRenderingSupport, DataLoader, DomainSupport, EngineHelper, ErrorHandling, ErrorPages, Errors, Extensions, FormTagHelper, Generators, InstallationActions, MenuHelper, Module, Namespacing, PageHelper, PathHelper, RenderingHelper, RouteExtensions, SectionNodesHelper, TemplateSupport, Templates, UiElementsHelper, Upgrades Classes: AbstractFileBlock, ApplicationController, Attachment, AttachmentsController, BaseController, CacheController, CategoriesController, Category, CategoryType, CategoryTypesController, Connector, ConnectorsController, ContentBlockController, ContentController, ContentType, ContentTypeGroup, ContentTypesController, DashboardController, DatePicker, DynamicView, DynamicViewsController, EmailMessage, EmailMessageMailer, EmailMessagesController, Engine, FileBlock, FileBlocksController, ForgotPasswordMailer, FormBuilder, Group, GroupPermission, GroupSection, GroupType, GroupTypePermission, GroupsController, GuestUser, HomeController, HtmlBlock, HtmlBlocksController, ImageBlock, ImageBlocksController, InstallGenerator, Link, LinksController, ModuleInstallation, Page, PagePartial, PageRoute, PageRouteCondition, PageRouteConditionsController, PageRouteOption, PageRouteOptionsController, PageRouteRequirement, PageRouteRequirementsController, PageRoutesController, PageTemplate, PagesController, Permission, Portlet, PortletController, PortletsController, Redirect, RedirectsController, ResourceController, RoutesController, Section, SectionNode, SectionNodesController, SectionsController, SessionsController, Site, Tag, Tagging, TagsController, Task, TasksController, ToolbarController, User, UserGroupMembership, UsersController, ViewContext

Constant Summary collapse

VERSION =
"3.4.0"

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.



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

def attachment_file_permission
  @attachment_file_permission
end

Class Method Details

.add_generator_paths(src_root, *files) ⇒ Object Also known as: add_paths_to_copied_into_project

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.

Parameters:

  • src_root (String)

    The root directory of the gem

  • files (Array of String)

    A list of all file names to be copied



32
33
34
# File 'lib/cms/init.rb', line 32

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

.add_to_rails_paths(path) ⇒ Object



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

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

.add_to_routes(route) ⇒ Object



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

def add_to_routes(route)
  routes << route
end

.content_editorObject

Determines which WYSIWYG editor is the ‘default’ for a BrowserCMS project

bcms modules can changes this by overriding it in their configuration.



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

def content_editor
  @wysiwig_editor ||= "ckeditor"
end

.content_editor=(editor) ⇒ Object



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

def content_editor=(editor)
  @wysiwig_editor = editor
end

.generator_pathsObject



38
39
40
# File 'lib/cms/init.rb', line 38

def generator_paths
  @generator_paths ||= []
end

.initObject

This is no longer really needed since Engines handle initialization.



21
22
23
# File 'lib/cms/init.rb', line 21

def init
   puts "BrowserCMS init has been called!!!!!!!"
end

.load_rake_tasksObject



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

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

.markdown?Boolean

Returns:

  • (Boolean)


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

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

.reserved_pathsObject



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

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

.routesObject



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

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"


86
87
88
89
# File 'lib/cms/init.rb', line 86

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

.table_name_prefixObject

By setting this, ActiveRecord will automatically prefix all tables in the Cms

module to start with the value of prefix_

Defaults to “” if not specified.



25
26
27
# File 'lib/cms/behaviors/namespacing.rb', line 25

def self.table_name_prefix
  self.table_prefix ? self.table_prefix : ""
end

.table_prefixString

Returns the table name prefix for models in the Cms

Namespace

Prefer calling table_name_prefix to this methods

Returns:

  • (String)

    nil if no namespace has been set.



19
20
21
# File 'lib/cms/behaviors/namespacing.rb', line 19

def self.table_prefix
  @table_prefix
end

.table_prefix=(prefix) ⇒ Object

Provides a global configuration setting to set a table prefix for all CMS tables.

For example, Cms.table_prefix = “cms_” would create tables like:

cms_html_blocks cms_pages

rather than

html_blocks pages


10
11
12
# File 'lib/cms/behaviors/namespacing.rb', line 10

def self.table_prefix=(prefix)
  @table_prefix = prefix
end

.versionObject



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

def version
  @version = Cms::VERSION
end