orthorings 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -9,8 +9,9 @@ The 2 main things you can do with Orthorings are:
9
9
 
10
10
  ## Installation
11
11
 
12
- As a gem (coming soon)
13
- sudo gem install anthony-orthorings
12
+ As a gem (from gemcutter.org)
13
+
14
+ sudo gem install orthorings --source http://gemcutter.org
14
15
 
15
16
  ## Configuration
16
17
 
@@ -71,8 +72,6 @@ Inside of any block in the dsl, you can specify the orthor id, if you don't give
71
72
  Things that are being mulled over
72
73
 
73
74
  * Nav helpers (generate navigation based off of the DSL structure)
74
- * Static Page use needs to be defined more (perhaps define a action to render?)
75
- * Release as a 0.1 gem
76
75
  * ...I'm sure there'll be something else here soon
77
76
 
78
77
  ## Example Usage (as provided by the OrthorHelper module, defined as class methods of Orthorings)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -1,4 +1,4 @@
1
- class Orthor::ContentController < ApplicationController
1
+ class OrthorContentController < ApplicationController
2
2
  def orthor_content
3
3
  expires_in Orthor::Site.cache_for, :public => true if Orthor::Site.cache_for > 0
4
4
 
data/config/routes.rb CHANGED
@@ -3,7 +3,10 @@ ActionController::Routing::Routes.draw do |map|
3
3
  if resource.is_a?(::Orthor::Category) && !resource.page_path.nil?
4
4
  map.send("#{resource.path_name}_pages", resource.page_path, :controller => "orthor/content", :action => "orthor_content")
5
5
  end
6
-
7
- map.send(resource.path_name, resource.path, :controller => "orthor/content", :action => "orthor_content")
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)
8
+ else
9
+ map.send(resource.path_name, resource.path, :controller => "orthor_content", :action => "orthor_content")
10
+ end
8
11
  end
9
- end
12
+ end
@@ -4,7 +4,7 @@ module Orthor
4
4
  include Orthor::MetaData
5
5
 
6
6
  attr_accessor :path
7
- dsl_accessor :name
7
+ dsl_accessor :name, :action, :controller
8
8
 
9
9
  def initialize(path, page_name, &block)
10
10
  @path = path
@@ -13,5 +13,9 @@ module Orthor
13
13
 
14
14
  instance_eval &block if block_given?
15
15
  end
16
+
17
+ def path_name
18
+ @path.gsub("/", " ").strip.gsub(/[^a-z0-9]+/i, '_')
19
+ end
16
20
  end
17
- end
21
+ end
@@ -4,12 +4,11 @@ require 'erb'
4
4
  module Sinatra
5
5
  module OrthorRequestHelpers
6
6
  def handle_request(resource)
7
+ headers['Cache-Control'] = "public, max-age=#{resource.cache_for}"
7
8
  @name = resource.name
8
9
  @meta_keywords = resource.keywords
9
10
  @meta_description = resource.description
10
- @orthor_feeds = resource.respond_to?(:feeds) ? resource.feeds : []
11
- headers['Cache-Control'] = "public, max-age=#{resource.cache_for}"
12
- erb :orthor_content, { :layout => ::Orthor::Site.layout }
11
+ @orthor_feeds = resource.respond_to?(:feeds) ? resource.feeds : []
13
12
  end
14
13
  end
15
14
 
@@ -23,18 +22,21 @@ module Sinatra
23
22
  get resource.page_path do |id|
24
23
  @orthor_content = orthor_content(id)
25
24
  handle_request(resource)
25
+ erb :orthor_content, { :layout => ::Orthor::Site.layout }
26
26
  end
27
27
  end
28
28
 
29
- if resource.is_a?(::Orthor::Feed)
30
- get resource.path do
29
+ get resource.path do
30
+ if resource.is_a?(::Orthor::Feed)
31
31
  headers['Cache-Control'] = "public, max-age=#{resource.cache_for}"
32
32
  resource.content
33
- end
34
- else
35
- get resource.path do
33
+ elsif resource.is_a?(::Orthor::StaticPage)
34
+ handle_request(resource)
35
+ erb resource.action.to_sym, { :layout => ::Orthor::Site.layout }
36
+ else
36
37
  @orthor_content = resource.content
37
38
  handle_request(resource)
39
+ erb :orthor_content, { :layout => ::Orthor::Site.layout }
38
40
  end
39
41
  end
40
42
  end
data/orthorings.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{orthorings}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
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"]
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
20
20
  "README.markdown",
21
21
  "Rakefile",
22
22
  "VERSION",
23
- "app/controllers/orthor/content_controller.rb",
23
+ "app/controllers/orthor_content_controller.rb",
24
24
  "app/views/layouts/orthor_layout.html.erb",
25
- "app/views/orthor/content/orthor_content.html.erb",
25
+ "app/views/orthor_content/orthor_content.html.erb",
26
26
  "config/routes.rb",
27
27
  "lib/core_ext/dsl_accessor.rb",
28
28
  "lib/orthor/category.rb",
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Langhorne
@@ -36,9 +36,9 @@ files:
36
36
  - README.markdown
37
37
  - Rakefile
38
38
  - VERSION
39
- - app/controllers/orthor/content_controller.rb
39
+ - app/controllers/orthor_content_controller.rb
40
40
  - app/views/layouts/orthor_layout.html.erb
41
- - app/views/orthor/content/orthor_content.html.erb
41
+ - app/views/orthor_content/orthor_content.html.erb
42
42
  - config/routes.rb
43
43
  - lib/core_ext/dsl_accessor.rb
44
44
  - lib/orthor/category.rb