contentable 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/contentable.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{contentable}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["metasoarous"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-20}
|
13
13
|
s.description = %q{Contentable allows rails developers to place chunks of content in "content_items" whcih store content text, titles and descriptions in order to make content more easily updateable manageable.}
|
14
14
|
s.email = %q{metasoarous@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/contentable.rb
CHANGED
@@ -24,7 +24,7 @@ module Contentable
|
|
24
24
|
# Model module in the model class
|
25
25
|
module Helpers
|
26
26
|
def display_textile(text)
|
27
|
-
RedCloth.new(text).to_html
|
27
|
+
RedCloth.new(text).to_html.html_safe
|
28
28
|
end
|
29
29
|
def display_content(content_item, edit = false)
|
30
30
|
html = display_textile(content_item.text)
|
@@ -85,6 +85,7 @@ module Contentable
|
|
85
85
|
else
|
86
86
|
@content_item = ContentItem.safe_find_by_name("content_missing")
|
87
87
|
end
|
88
|
+
return @content_item
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
@@ -13,7 +13,16 @@ class ContentItemsController < ApplicationController
|
|
13
13
|
# GET /content_items/1
|
14
14
|
# GET /content_items/1.xml
|
15
15
|
def show
|
16
|
-
|
16
|
+
find_content_item
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @content_item }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def show_with_direct_attribute_assign
|
25
|
+
@content_item = find_content_item
|
17
26
|
|
18
27
|
respond_to do |format|
|
19
28
|
format.html # show.html.erb
|
@@ -34,7 +43,7 @@ class ContentItemsController < ApplicationController
|
|
34
43
|
|
35
44
|
# GET /content_items/1/edit
|
36
45
|
def edit
|
37
|
-
|
46
|
+
find_content_item
|
38
47
|
end
|
39
48
|
|
40
49
|
# POST /content_items
|
@@ -1,60 +1,61 @@
|
|
1
1
|
AppRoot::Application.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
2
|
+
resources :content_items
|
3
|
+
|
4
|
+
match "content/:name" => "content_items#view"
|
5
|
+
# The priority is based upon order of creation:
|
6
|
+
# first created -> highest priority.
|
7
|
+
|
8
|
+
# Sample of regular route:
|
9
|
+
# match 'products/:id' => 'catalog#view'
|
10
|
+
# Keep in mind you can assign values other than :controller and :action
|
11
|
+
|
12
|
+
# Sample of named route:
|
13
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
14
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
15
|
+
|
16
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
17
|
+
# resources :products
|
18
|
+
|
19
|
+
# Sample resource route with options:
|
20
|
+
# resources :products do
|
21
|
+
# member do
|
22
|
+
# get 'short'
|
23
|
+
# post 'toggle'
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# collection do
|
27
|
+
# get 'sold'
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
|
31
|
+
# Sample resource route with sub-resources:
|
32
|
+
# resources :products do
|
33
|
+
# resources :comments, :sales
|
34
|
+
# resource :seller
|
35
|
+
# end
|
36
|
+
|
37
|
+
# Sample resource route with more complex sub-resources
|
38
|
+
# resources :products do
|
39
|
+
# resources :comments
|
40
|
+
# resources :sales do
|
41
|
+
# get 'recent', :on => :collection
|
42
|
+
# end
|
43
|
+
# end
|
44
|
+
|
45
|
+
# Sample resource route within a namespace:
|
46
|
+
# namespace :admin do
|
47
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
48
|
+
# # (app/controllers/admin/products_controller.rb)
|
49
|
+
# resources :products
|
50
|
+
# end
|
51
|
+
|
52
|
+
# You can have the root of your site routed with "root"
|
53
|
+
# just remember to delete public/index.html.
|
54
|
+
# root :to => "welcome#index"
|
55
|
+
|
56
|
+
# See how all your routes lay out with "rake routes"
|
57
|
+
|
58
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
59
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
60
|
+
# match ':controller(/:action(/:id(.:format)))'
|
60
61
|
end
|
@@ -28,4 +28,33 @@ A paragraph
|
|
28
28
|
result.should include "<p>"
|
29
29
|
end
|
30
30
|
end
|
31
|
-
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe ContentItemsController do
|
34
|
+
before :all do
|
35
|
+
@content = Factory :content_item, :name => "some_content"
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "find_content_item method" do
|
39
|
+
it "should assign a content item to @content_item implicitly" do
|
40
|
+
get "content/some_content"
|
41
|
+
assigns[:content_item].should.be_a_kind_of ContentItem
|
42
|
+
end
|
43
|
+
it "should assign the correct content item to @content_item" do
|
44
|
+
get "content/some_content"
|
45
|
+
assigns[:content_item].should == @content
|
46
|
+
end
|
47
|
+
it "should assign a content item to @content_item explicitly" do
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
# Things to spec:
|
55
|
+
#
|
56
|
+
# Make sure that the find_content_item method doesn't return a string
|
57
|
+
# This is sure to be confusing to people
|
58
|
+
#
|
59
|
+
# Spec out the way it is written to respond here though (that is, by
|
60
|
+
# assigning directly to the attribute within the method)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- metasoarous
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-20 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|