cms-lite 0.2.7 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,6 +55,17 @@ Notes:
55
55
  2. Don't mix directories it will mess up the routes. ie if you have a directory named cmslite in pages don't create a directory called cmslite under protected-pages.
56
56
  If you do Rails won't know which directory to route to.
57
57
 
58
+ Layouts:
59
+ ------------------
60
+ By default cms lite will look for a layout named 'application' and use that to render all pages. You can override that behavior with an initializer.
61
+ Add a file to config/initializers and name it cms_lite.rb. Add the following line to that file:
62
+
63
+ CmsLite.cms_layouts = { '/cms' => 'cms_template_', '/help' => 'help', :default => 'default'}
64
+
65
+ The line above will tell cms lite to render the 'cms_template' for any file located under '/content/pages/en/cms' and will also use the 'help' layout
66
+ for any pages located under '/content/pages/en/help'. You can specify a default template to be use when no other template is specified by adding
67
+ :default => 'template name'. Modify the configuration to meet your needs.
68
+
58
69
 
59
70
  Routes:
60
71
  ------------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.7
1
+ 0.3.1
@@ -18,7 +18,7 @@ class CmsLiteController < ApplicationController
18
18
  content_page = Dir.glob("/#{path}.*").first if content_page.nil?
19
19
  raise CmsLite::Exceptions::MissingTemplateError, "Could not find template for: '#{path}'" if content_page.nil?
20
20
  respond_to do |format|
21
- format.html { render :file => content_page }
21
+ format.html { render :file => content_page, :layout => choose_layout(params[:content_key]) }
22
22
  format.js { render :file => content_page, :layout => false }
23
23
  format.xml { render :file => content_page, :layout => false }
24
24
  end
@@ -27,4 +27,10 @@ class CmsLiteController < ApplicationController
27
27
  render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
28
28
  end
29
29
 
30
+ def choose_layout(content_key)
31
+ layout = CmsLite.cms_layouts[content_key]
32
+ layout = CmsLite.cms_layouts[:default] if layout.blank?
33
+ layout ||= 'application'
34
+ end
35
+
30
36
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cms-lite}
5
- s.version = "0.2.7"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Justin Ball"]
9
- s.date = %q{2009-05-08}
9
+ s.date = %q{2009-05-09}
10
10
  s.description = %q{CMS gem that makes it simple to interact with your content developers by serving pages from '/content'.}
11
11
  s.email = %q{justinball@gmail.com}
12
12
  s.extra_rdoc_files = [
@@ -31,6 +31,8 @@ Gem::Specification.new do |s|
31
31
  "lib/cms_lite/tasks.rb",
32
32
  "lib/cms_lite/tasks.rb",
33
33
  "pkg/cms-lite-0.2.7.gem",
34
+ "pkg/cms-lite-0.3.0.gem",
35
+ "pkg/cms-lite-0.3.1.gem",
34
36
  "rails/init.rb",
35
37
  "tasks/rails.rake",
36
38
  "tasks/rails.rake",
@@ -9,6 +9,14 @@ class CmsLite
9
9
 
10
10
  class << self
11
11
 
12
+ def cms_layouts=(layouts)
13
+ @@layouts = layouts
14
+ end
15
+
16
+ def cms_layouts
17
+ @@layouts
18
+ end
19
+
12
20
  def cms_routes
13
21
  get_cms_routes(PAGES_PATH)
14
22
  end
@@ -25,8 +33,13 @@ class CmsLite
25
33
  Dir.glob("#{localization_directory}/*").each do |content_item|
26
34
  path = File.basename(content_item)
27
35
  content_key = content_item.gsub(localization_directory, '')
28
- cms_routes << { :uri => "/#{path}/*content_page",
36
+ if !content_key.blank?
37
+ cms_route = { :uri => "/#{path}/*content_page",
29
38
  :content_key => content_key }
39
+ if !cms_routes.include?(cms_route)
40
+ cms_routes << cms_route
41
+ end
42
+ end
30
43
  end
31
44
  end
32
45
  end
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cms-lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-08 00:00:00 -06:00
12
+ date: 2009-05-09 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -36,6 +36,8 @@ files:
36
36
  - lib/cms_lite/languages.rb
37
37
  - lib/cms_lite/tasks.rb
38
38
  - pkg/cms-lite-0.2.7.gem
39
+ - pkg/cms-lite-0.3.0.gem
40
+ - pkg/cms-lite-0.3.1.gem
39
41
  - rails/init.rb
40
42
  - tasks/rails.rake
41
43
  - test/cms_lite_test.rb