orthorings 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -42,10 +42,15 @@ Here is some example usage (more docs to come, this is still a WIP and some aspe
42
42
  feed "/blog.rss", "Blog" do
43
43
  id "our-blog"
44
44
  end
45
+
46
+ static_page "/about-us", "About Us" do
47
+ view "public/about_us"
48
+ end
45
49
 
46
50
  category "/writings" do
47
51
  keywords "lets, do, some, seo"
48
52
  description "a more apt description for this section of the site"
53
+ view "writings/index"
49
54
 
50
55
  page "/writings/why", "Why we write"
51
56
  page_path "/writings/:id"
@@ -56,6 +61,7 @@ Here is some example usage (more docs to come, this is still a WIP and some aspe
56
61
  end
57
62
 
58
63
  category "/writings/announcements" do
64
+ view "writings/announcements"
59
65
  page_path "/writings/announcements/:id"
60
66
  end
61
67
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -18,7 +18,7 @@ class OrthorContentController < ApplicationController
18
18
  @meta_description = resource.description
19
19
  @orthor_feeds = resource.respond_to?(:feeds) ? resource.feeds : []
20
20
 
21
- render :action => "orthor_content", :layout => Orthor::Site.layout.to_s
21
+ render :action => (resource.view || "orthor_content"), :layout => Orthor::Site.layout.to_s
22
22
  end
23
23
  end
24
24
  end
data/config/routes.rb CHANGED
@@ -4,7 +4,7 @@ ActionController::Routing::Routes.draw do |map|
4
4
  map.send("#{resource.path_name}_pages", resource.page_path, :controller => "orthor_content", :action => "orthor_content")
5
5
  end
6
6
  if resource.is_a?(::Orthor::StaticPage)
7
- map.send(resource.path_name, resource.path, :controller => resource.controller.to_s, :action => resource.action.to_s)
7
+ map.send(resource.path_name, resource.path, :controller => resource.controller.to_s, :action => "orthor_content")
8
8
  else
9
9
  map.send(resource.path_name, resource.path, :controller => "orthor_content", :action => "orthor_content")
10
10
  end
data/lib/orthor/object.rb CHANGED
@@ -4,7 +4,7 @@ module Orthor
4
4
  include Orthor::MetaData
5
5
 
6
6
  attr_accessor :path
7
- dsl_accessor :name, :id
7
+ dsl_accessor :name, :id, :view
8
8
 
9
9
  def initialize(path, object_name = nil, &block)
10
10
  @path = path
@@ -4,7 +4,7 @@ module Orthor
4
4
  include Orthor::MetaData
5
5
 
6
6
  attr_accessor :path
7
- dsl_accessor :name, :action, :controller
7
+ dsl_accessor :name, :view, :controller
8
8
 
9
9
  def initialize(path, page_name, &block)
10
10
  @path = path
@@ -22,7 +22,7 @@ module Sinatra
22
22
  get resource.page_path do |id|
23
23
  @orthor_content = orthor_content(id)
24
24
  handle_request(resource)
25
- erb :orthor_content, { :layout => ::Orthor::Site.layout }
25
+ erb (resource.view || "orthor_content").to_sym, { :layout => ::Orthor::Site.layout }
26
26
  end
27
27
  end
28
28
 
@@ -32,11 +32,11 @@ module Sinatra
32
32
  resource.content
33
33
  elsif resource.is_a?(::Orthor::StaticPage)
34
34
  handle_request(resource)
35
- erb resource.action.to_sym, { :layout => ::Orthor::Site.layout }
35
+ erb resource.view.to_sym, { :layout => ::Orthor::Site.layout }
36
36
  else
37
37
  @orthor_content = resource.content
38
38
  handle_request(resource)
39
- erb :orthor_content, { :layout => ::Orthor::Site.layout }
39
+ erb (resource.view || "orthor_content").to_sym, { :layout => ::Orthor::Site.layout }
40
40
  end
41
41
  end
42
42
  end
data/orthorings.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{orthorings}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Anthony Langhorne"]
12
- s.date = %q{2010-01-31}
12
+ s.date = %q{2010-02-02}
13
13
  s.email = %q{anthony@orthor.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -85,6 +85,7 @@ describe Orthor::Site, "orthor site dsl" do
85
85
  name "Writings"
86
86
  id "blog-writings"
87
87
  cache_for 900
88
+ view "writings/index"
88
89
 
89
90
  page "/writings/why" do
90
91
  name "Why we write"
@@ -110,11 +111,15 @@ describe Orthor::Site, "orthor site dsl" do
110
111
  @category_2 = Orthor::Site.categories.first.categories.first
111
112
  end
112
113
 
113
- it "should have one categories" do
114
+ it "should have one category at the top level" do
114
115
  Orthor::Site.categories.length.should == 1
115
116
  @category.name.should == "Writings"
116
117
  end
117
118
 
119
+ it "should allow you to set a custom view file" do
120
+ @category.view.should == "writings/index"
121
+ end
122
+
118
123
  it "should support categories in categories" do
119
124
  @category.categories.length.should == 1
120
125
  @category_2.name.should == "Announcements"
@@ -162,6 +167,7 @@ describe Orthor::Site, "orthor site dsl" do
162
167
  name "Home"
163
168
  cache_for 3600
164
169
  id "homepage"
170
+ view "public/home"
165
171
  end
166
172
  end
167
173
  @page_1 = Orthor::Site.pages[0]
@@ -181,6 +187,11 @@ describe Orthor::Site, "orthor site dsl" do
181
187
  @page_3.path.should == "/"
182
188
  end
183
189
 
190
+ it "should be able to specify a view to render" do
191
+ @page_3.view.should == "public/home"
192
+ @page_1.view.should be_nil
193
+ end
194
+
184
195
  it "id should be inferred from the path if none is given" do
185
196
  @page_1.id.should == "about-us"
186
197
  @page_2.id.should == "contact"
@@ -244,7 +255,7 @@ describe Orthor::Site, "orthor site dsl" do
244
255
  static_page "/" do
245
256
  name "Home"
246
257
  cache_for 3600
247
- action :blah
258
+ view :blah
248
259
  controller :asdf
249
260
  end
250
261
  end
@@ -258,7 +269,7 @@ describe Orthor::Site, "orthor site dsl" do
258
269
  end
259
270
 
260
271
  it 'should support setting action' do
261
- @page_3.action.should == :blah
272
+ @page_3.view.should == :blah
262
273
  end
263
274
 
264
275
  it 'should support setting controller' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthorings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Langhorne
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-31 00:00:00 +11:00
12
+ date: 2010-02-02 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency