radiant-templates-extension 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,19 @@
1
+ The Templates extension provides internal structure to Radiant pages, adding a layer of flexibility in Layout development. This allows a single Layout to serve as a wireframe for the entire site, with many different template page designs filling the "content well." Using templates, you now only need a single <r:content /> tag within the Layout. Thus we simplify and ensure layout consistency in the creation of pages by the end user of the CMS.
2
+
3
+ h2. Usage
4
+
5
+ See "Template Help for Designing":/admin/help/extension/templates/designer
6
+
7
+ h2. Template Part Types
8
+
9
+ h3. Access
10
+
11
+ Only Admin users have access to create and edit part types. Default part types should not be removed. Care should be taken in editing them, since any change to part type will affect every template which uses it, and hence potentially every page which is built with any of those templates.
12
+
13
+ h3. Management
14
+
15
+ Each Part type has Name and Field Type (e.g. radio_button, or text_field). They also have optional Field Class and Field Style, by which the admin user can alter the display characteristics of the parts to the page editors.
16
+
17
+ Normally new part types would only be created to refine display characteristics. For example, you might want a "Small Textarea" part type, which would be exactly the same as the default "Plain Textarea" part type, except that Field Style would have "height:80px".
18
+
19
+
@@ -61,19 +61,3 @@ h4. Changing the template for an existing page
61
61
  * To change to another template, simply select it, and then save the page (Simply selecting it will not change it -- you must save the page).
62
62
 
63
63
  WARNING: For page parts of your old template, if your new template does a page parts of the same name, then that content will be lost. This is a good reason to follow naming standards when creating templates, e.g. define a page part "main_content" for all your templates.
64
-
65
- h2. Admin
66
-
67
- h3. Template Part Types (Admin users only)
68
-
69
- h4. Access
70
-
71
- Only Admin users have access to create and edit part types. Default part types should not be removed. Care should be taken in editing them, since any change to part type will affect every template which uses it, and hence potentially every page which is built with any of those templates.
72
-
73
- h4. Management
74
-
75
- Each Part type has Name and Field Type (e.g. radio_button, or text_field). They also have optional Field Class and Field Style, by which the admin user can alter the display characteristics of the parts to the page editors.
76
-
77
- Normally new part types would only be created to refine display characteristics. For example, you might want a "Small Textarea" part type, which would be exactly the same as the default "Plain Textarea" part type, except that Field Style would have "height:80px".
78
-
79
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -54,6 +54,10 @@ module Templates::Helper
54
54
  field_html.join("\n")
55
55
  end
56
56
 
57
+ def children_for(page)
58
+ page.allowed_children
59
+ end
60
+
57
61
  def child_menu_for(page)
58
62
  children = children_for(page)
59
63
  return nil if children.size < 2
@@ -3,11 +3,9 @@ module Templates::PageExtensions
3
3
  def self.included(base)
4
4
  base.class_eval do
5
5
  before_save :match_with_template
6
-
7
6
  def allowed_children
8
7
  [default_child, Template.all].flatten
9
8
  end
10
-
11
9
  end
12
10
  end
13
11
 
@@ -5,17 +5,18 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{radiant-templates-extension}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew vonderLuft", "Sean Cribbs"]
12
- s.date = %q{2011-04-06}
12
+ s.date = %q{2011-04-22}
13
13
  s.description = %q{Imposes structure on pages via content templates.}
14
14
  s.email = %q{avonderluft@avlux.net}
15
15
  s.extra_rdoc_files = [
16
16
  "README.textile"
17
17
  ]
18
18
  s.files = [
19
+ "HELP_admin.textile",
19
20
  "HELP_designer.textile",
20
21
  "README.textile",
21
22
  "Rakefile",
@@ -69,6 +70,7 @@ Gem::Specification.new do |s|
69
70
  "lib/templates/page_extensions.rb",
70
71
  "lib/templates/tags.rb",
71
72
  "pkg/radiant-templates-extension-1.0.0.gem",
73
+ "pkg/radiant-templates-extension-1.0.1.gem",
72
74
  "public/images/admin/menu_arrow.png",
73
75
  "public/images/admin/move_higher.png",
74
76
  "public/images/admin/move_lower.png",
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  # We only have this spec because setting up an isolated view spec would be too
4
4
  # complicated. Instead we have a quasi-integration test.
5
- describe Admin::PagesController, "edit view controlled by templates" do
5
+ describe Admin::PagesController do
6
6
  integrate_views
7
7
  dataset :users_and_pages, :templates
8
8
  before :each do
@@ -11,51 +11,64 @@ describe Admin::PagesController, "edit view controlled by templates" do
11
11
  @page.stub!(:children).and_return([])
12
12
  login_as :designer
13
13
  end
14
-
15
- def do_get
16
- get :edit, :id => @page.id
17
- end
18
14
 
19
- it "should include a hidden field containing the body/structure" do
20
- do_get
21
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[0][name]', 'value' => 'body'})
22
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[0][content]'})
23
- end
24
-
25
- it "should display a template part with style and class attributes" do
26
- do_get
27
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[1][name]', 'value' => 'Part 1'})
28
- response.should have_tag('textarea', :attributes => {'name' => 'part[0][content]', 'class' => 'wysiwyg', 'style' => 'width: 100%'})
29
- end
30
-
31
- it "should display a textarea template part" do
32
- do_get
33
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[1][name]', 'value' => 'extended'})
34
- response.should have_tag('textarea', :attributes => {'name' => 'part[1][content]', 'class' => 'plaintext'})
35
- end
36
-
37
- it "should display a radio_button template part" do
38
- do_get
39
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[2][name]', 'value' => 'featured?'})
40
- response.should have_tag('input', :attributes => {'type' => 'radio_button', 'name' => 'part[2][content]', 'value' => 'true'})
41
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[2][content]', 'value' => 'false'})
42
- end
43
-
44
- it "should display a hidden template part" do
45
- do_get
46
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[3][name]', 'value' => 'Feature image'})
47
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[3][content]'})
15
+ describe "index view controlled by templates" do
16
+ def do_get
17
+ get :index
18
+ end
19
+ it "should display the page index" do
20
+ do_get
21
+ response.should be_success
22
+ end
48
23
  end
49
-
50
- it "should display a text field template part" do
51
- do_get
52
- response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[4][name]', 'value' => 'Tagline'})
53
- response.should have_tag('input', :attributes => {'type' => 'text', 'name' => 'part[4][content]'})
24
+
25
+ describe "edit view controlled by templates" do
26
+ def do_get
27
+ get :edit, :id => @page.id
28
+ end
29
+
30
+ it "should include a hidden field containing the body/structure" do
31
+ do_get
32
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[0][name]', 'value' => 'body'})
33
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[0][content]'})
34
+ end
35
+
36
+ it "should display a template part with style and class attributes" do
37
+ do_get
38
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[1][name]', 'value' => 'Part 1'})
39
+ response.should have_tag('textarea', :attributes => {'name' => 'part[0][content]', 'class' => 'wysiwyg', 'style' => 'width: 100%'})
40
+ end
41
+
42
+ it "should display a textarea template part" do
43
+ do_get
44
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[1][name]', 'value' => 'extended'})
45
+ response.should have_tag('textarea', :attributes => {'name' => 'part[1][content]', 'class' => 'plaintext'})
46
+ end
47
+
48
+ it "should display a radio_button template part" do
49
+ do_get
50
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[2][name]', 'value' => 'featured?'})
51
+ response.should have_tag('input', :attributes => {'type' => 'radio_button', 'name' => 'part[2][content]', 'value' => 'true'})
52
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[2][content]', 'value' => 'false'})
53
+ end
54
+
55
+ it "should display a hidden template part" do
56
+ do_get
57
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[3][name]', 'value' => 'Feature image'})
58
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[3][content]'})
59
+ end
60
+
61
+ it "should display a text field template part" do
62
+ do_get
63
+ response.should have_tag('input', :attributes => {'type' => 'hidden', 'name' => 'part[4][name]', 'value' => 'Tagline'})
64
+ response.should have_tag('input', :attributes => {'type' => 'text', 'name' => 'part[4][content]'})
65
+ end
66
+
67
+ it "should override the class name field when the template has one specified" do
68
+ @page.template = templates(:another)
69
+ do_get
70
+ response.should have_tag('input', :attributes => {'name' => 'page[class_name]', 'value' => 'FileNotFoundPage'})
71
+ end
54
72
  end
55
73
 
56
- it "should override the class name field when the template has one specified" do
57
- @page.template = templates(:another)
58
- do_get
59
- response.should have_tag('input', :attributes => {'name' => 'page[class_name]', 'value' => 'FileNotFoundPage'})
60
- end
61
74
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-templates-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew vonderLuft
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-04-06 00:00:00 -07:00
19
+ date: 2011-04-22 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -44,6 +44,7 @@ extensions: []
44
44
  extra_rdoc_files:
45
45
  - README.textile
46
46
  files:
47
+ - HELP_admin.textile
47
48
  - HELP_designer.textile
48
49
  - README.textile
49
50
  - Rakefile
@@ -97,6 +98,7 @@ files:
97
98
  - lib/templates/page_extensions.rb
98
99
  - lib/templates/tags.rb
99
100
  - pkg/radiant-templates-extension-1.0.0.gem
101
+ - pkg/radiant-templates-extension-1.0.1.gem
100
102
  - public/images/admin/menu_arrow.png
101
103
  - public/images/admin/move_higher.png
102
104
  - public/images/admin/move_lower.png