grat 0.0.5.1 → 0.0.5.2

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.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('grat', '0.0.5.1') do |p|
6
+ Echoe.new('grat', '0.0.5.2') do |p|
7
7
  p.summary = "Minimal CMS for Rack and MongoDB."
8
8
  p.description = "Basic interface for making webpages with Haml and Erb. Supports nested templates."
9
9
  p.url = "http://samsm.com/"
data/grat.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{grat}
5
- s.version = "0.0.5.1"
5
+ s.version = "0.0.5.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Schenkman-Moore"]
9
- s.date = %q{2009-11-03}
9
+ s.date = %q{2009-11-04}
10
10
  s.description = %q{Basic interface for making webpages with Haml and Erb. Supports nested templates.}
11
11
  s.email = %q{samsm@samsm.com}
12
12
  s.extra_rdoc_files = ["README", "lib/environment.rb", "lib/grat.rb", "lib/grat/content.rb", "lib/grat/hash_binding.rb", "lib/grat/mongomapper_patches.rb", "lib/grat/system.rb"]
data/lib/grat/content.rb CHANGED
@@ -10,7 +10,11 @@ class Grat::Content
10
10
 
11
11
  before_save :detect_default_content_vars
12
12
  key :default_content_vars, Hash
13
-
13
+
14
+ def attributes_for_variables
15
+ attributes.reject {|k,v| k == '_id' }
16
+ end
17
+
14
18
  def editable_fields
15
19
  attributes.reject {|k,v| uneditable_keys.include? k }
16
20
  end
@@ -64,15 +68,6 @@ class Grat::Content
64
68
  else
65
69
  :erb
66
70
  end
67
- #
68
- #
69
- # @render_engine ||= case render_engine_name
70
- # when 'haml',nil # the default for now
71
- # require 'haml'
72
- # Haml::Engine.new(content)
73
- # when 'erb'
74
- # raise 'Unimplemented!'
75
- # end
76
71
  end
77
72
 
78
73
  def detect_default_content_vars
data/lib/grat.rb CHANGED
@@ -37,12 +37,10 @@ class Grat::Application < Sinatra::Base
37
37
  pass if content.new_record?
38
38
  locals = {}
39
39
  template_chain.inject('') do |sum, template|
40
- locals.merge!(template.default_content_vars.merge(template.attributes))
41
-
40
+ locals = template.default_content_vars.
41
+ merge(template.attributes_for_variables).
42
+ merge(locals)
42
43
  combine_docs(sum,template, locals)
43
- # require 'haml'
44
- # haml_template = Haml::Engine.new(template.content)
45
- # result = haml_template.render(haml_template, locals) { sum }
46
44
  end
47
45
  end
48
46
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.1
4
+ version: 0.0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Schenkman-Moore
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-03 00:00:00 -05:00
12
+ date: 2009-11-04 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency