Module: Cms
- Extended by:
- Caching
- Defined in:
- app/helpers/cms/rendering_helper.rb,
app/helpers/cms/menu_helper.rb,
app/helpers/cms/page_helper.rb,
app/helpers/cms/path_helper.rb,
app/models/cms/view_context.rb,
app/helpers/cms/form_tag_helper.rb,
app/helpers/cms/template_support.rb,
app/controllers/cms/error_handling.rb,
app/helpers/cms/application_helper.rb,
app/helpers/cms/section_nodes_helper.rb,
lib/cms/init.rb,
lib/cms/engine.rb,
lib/cms/module.rb,
lib/cms/caching.rb,
lib/cms/version.rb,
lib/cms/data_loader.rb,
lib/cms/date_picker.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,
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,
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,
lib/generators/cms/upgrade_module/upgrade_module_generator.rb
Overview
This module can be added to Controllers to provide support for rendering CMS content pages.
Defined Under Namespace
Modules: Acts, ApplicationHelper, Authentication, Behaviors, Caching, ContentRenderingSupport, DataLoader, DomainSupport, ErrorHandling, Errors, Extensions, FormTagHelper, Generators, MenuHelper, Module, PageHelper, PathHelper, RenderingHelper, Routes, SectionNodesHelper, TemplateSupport Classes: ApplicationController, AttachmentsController, BaseController, CacheController, CategoriesController, CategoryTypesController, ConnectorsController, ContentBlockController, ContentController, ContentTypesController, DashboardController, DatePicker, DynamicViewsController, EmailMessagesController, Engine, FileBlocksController, FormBuilder, GroupsController, HomeController, HtmlBlocksController, ImageBlocksController, InstallGenerator, LinksController, ModuleInstallation, PageRouteConditionsController, PageRouteOptionsController, PageRouteRequirementsController, PageRoutesController, PagesController, PortletController, PortletsController, RedirectsController, ResourceController, RoutesController, SectionNodesController, SectionsController, SessionsController, TagsController, TasksController, ToolbarController, UsersController, ViewContext
Constant Summary collapse
- VERSION =
"3.3.0"
Class Attribute Summary collapse
-
.attachment_file_permission ⇒ Object
Returns the value of attribute attachment_file_permission.
Class Method Summary collapse
-
.add_generator_paths(src_root, *files) ⇒ Object
(also: 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.
- .add_to_rails_paths(path) ⇒ Object
- .add_to_routes(route) ⇒ Object
- .generator_paths ⇒ Object
-
.init ⇒ Object
This is called after the environment is ready This all needs to be moved to the Engine.
- .load_rake_tasks ⇒ Object
- .markdown? ⇒ Boolean
- .reserved_paths ⇒ Object
- .routes ⇒ Object
-
.scrub_path(path) ⇒ Object
This next ‘hack’ is to allow script/generate browser_cms to work on Windows machines.
- .version ⇒ Object
- .wysiwig_js ⇒ Object
- .wysiwig_js=(path_array) ⇒ Object
Methods included from Caching
Class Attribute Details
.attachment_file_permission ⇒ Object
Returns the value of attribute attachment_file_permission.
9 10 11 |
# File 'lib/cms/init.rb', line 9 def @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.
60 61 62 |
# File 'lib/cms/init.rb', line 60 def add_generator_paths(src_root, *files) generator_paths << [src_root, files] end |
.add_to_rails_paths(path) ⇒ Object
70 71 72 |
# File 'lib/cms/init.rb', line 70 def add_to_rails_paths(path) ActiveSupport::Dependencies.autoload_paths << File.join(path, "app", "portlets") end |
.add_to_routes(route) ⇒ Object
74 75 76 |
# File 'lib/cms/init.rb', line 74 def add_to_routes(route) routes << route end |
.generator_paths ⇒ Object
66 67 68 |
# File 'lib/cms/init.rb', line 66 def generator_paths @generator_paths ||= [] end |
.init ⇒ Object
This is called after the environment is ready This all needs to be moved to the Engine
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cms/init.rb', line 21 def init puts "BrowserCMS init has been called!!!!!!!" # ToDo: This is how we are adding new methods to the routes.rb file. Rails 3 might provide more direct way. # ActionDispatch::Routing::Mapper.send :include, Cms::Routes #need to add gem's app directories to the load path - #the list is taken from what rails has automagically added to $: for the Rails.root dirs # ActiveSupport::Dependencies.autoload_paths += %W( #{self.root}/vendor #{self.root}/app/mailers #{self.root}/app/helpers) # ActiveSupport::Dependencies.autoload_paths += %W( #{self.root}/app/controllers #{self.root}/app/models #{self.root}/app/portlets) # ActiveSupport::Dependencies.autoload_paths += %W( #{Rails.root}/app/portlets ) # ActiveSupport::Dependencies.autoload_paths += %W( #{Rails.root}/app/portlets/helpers ) # ActionController::Base.append_view_path DynamicView.base_path # ActionController::Base.append_view_path %W( #{self.root}/app/views) # 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 # Commenting out, as the app/model files don't seem to have been loaded yet at this point, so # we are getting class errors w/ STI. # DynamicView.write_all_to_disk! if DynamicView.table_exists? end |
.load_rake_tasks ⇒ Object
15 16 17 |
# File 'lib/cms/init.rb', line 15 def load_rake_tasks load "#{Cms.root}/lib/tasks/cms.rake" end |
.markdown? ⇒ Boolean
89 90 91 |
# File 'lib/cms/init.rb', line 89 def markdown? Object.const_defined?("Markdown") end |
.reserved_paths ⇒ Object
93 94 95 |
# File 'lib/cms/init.rb', line 93 def reserved_paths @reserved_paths ||= ["/cms", "/cache"] end |
.routes ⇒ Object
77 78 79 |
# File 'lib/cms/init.rb', line 77 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"
111 112 113 114 |
# File 'lib/cms/init.rb', line 111 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 |
.version ⇒ Object
11 12 13 |
# File 'lib/cms/init.rb', line 11 def version @version = Cms::VERSION end |
.wysiwig_js ⇒ Object
81 82 83 |
# File 'lib/cms/init.rb', line 81 def wysiwig_js @wysiwig_js ||= ['/bcms/ckeditor/ckeditor.js', '/bcms/ckeditor/editor.js'] end |
.wysiwig_js=(path_array) ⇒ Object
85 86 87 |
# File 'lib/cms/init.rb', line 85 def wysiwig_js=(path_array) @wysiwig_js = path_array end |