aslakjo-comatose 2.0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG +195 -0
  2. data/INSTALL +20 -0
  3. data/LICENSE +20 -0
  4. data/MANIFEST +91 -0
  5. data/README.markdown +159 -0
  6. data/Rakefile +176 -0
  7. data/SPECS +61 -0
  8. data/about.yml +7 -0
  9. data/bin/comatose +112 -0
  10. data/comatose.gemspec +113 -0
  11. data/generators/comatose_migration/USAGE +15 -0
  12. data/generators/comatose_migration/comatose_migration_generator.rb +74 -0
  13. data/generators/comatose_migration/templates/migration.rb +35 -0
  14. data/generators/comatose_migration/templates/v4_upgrade.rb +15 -0
  15. data/generators/comatose_migration/templates/v6_upgrade.rb +23 -0
  16. data/generators/comatose_migration/templates/v7_upgrade.rb +22 -0
  17. data/init.rb +2 -0
  18. data/install.rb +18 -0
  19. data/lib/acts_as_versioned.rb +543 -0
  20. data/lib/comatose/comatose_drop.rb +79 -0
  21. data/lib/comatose/configuration.rb +69 -0
  22. data/lib/comatose/page_wrapper.rb +119 -0
  23. data/lib/comatose/processing_context.rb +69 -0
  24. data/lib/comatose/tasks/admin.rb +60 -0
  25. data/lib/comatose/tasks/data.rb +82 -0
  26. data/lib/comatose/tasks/setup.rb +52 -0
  27. data/lib/comatose/version.rb +4 -0
  28. data/lib/comatose.rb +33 -0
  29. data/lib/comatose_admin_controller.rb +395 -0
  30. data/lib/comatose_admin_helper.rb +37 -0
  31. data/lib/comatose_controller.rb +138 -0
  32. data/lib/comatose_helper.rb +3 -0
  33. data/lib/comatose_page.rb +141 -0
  34. data/lib/liquid/block.rb +96 -0
  35. data/lib/liquid/context.rb +190 -0
  36. data/lib/liquid/document.rb +17 -0
  37. data/lib/liquid/drop.rb +48 -0
  38. data/lib/liquid/errors.rb +7 -0
  39. data/lib/liquid/extensions.rb +53 -0
  40. data/lib/liquid/file_system.rb +62 -0
  41. data/lib/liquid/htmltags.rb +64 -0
  42. data/lib/liquid/standardfilters.rb +111 -0
  43. data/lib/liquid/standardtags.rb +399 -0
  44. data/lib/liquid/strainer.rb +42 -0
  45. data/lib/liquid/tag.rb +25 -0
  46. data/lib/liquid/template.rb +88 -0
  47. data/lib/liquid/variable.rb +39 -0
  48. data/lib/liquid.rb +52 -0
  49. data/lib/redcloth.rb +1129 -0
  50. data/lib/support/class_options.rb +36 -0
  51. data/lib/support/inline_rendering.rb +48 -0
  52. data/lib/support/route_mapper.rb +50 -0
  53. data/lib/text_filters/markdown.rb +14 -0
  54. data/lib/text_filters/markdown_smartypants.rb +15 -0
  55. data/lib/text_filters/none.rb +8 -0
  56. data/lib/text_filters/rdoc.rb +13 -0
  57. data/lib/text_filters/simple.rb +8 -0
  58. data/lib/text_filters/textile.rb +15 -0
  59. data/lib/text_filters.rb +140 -0
  60. data/rails/init.rb +3 -0
  61. data/resources/layouts/comatose_admin_template.html.erb +28 -0
  62. data/resources/public/images/collapsed.gif +0 -0
  63. data/resources/public/images/expanded.gif +0 -0
  64. data/resources/public/images/no-children.gif +0 -0
  65. data/resources/public/images/page.gif +0 -0
  66. data/resources/public/images/spinner.gif +0 -0
  67. data/resources/public/images/title-hover-bg.gif +0 -0
  68. data/resources/public/javascripts/comatose_admin.js +401 -0
  69. data/resources/public/stylesheets/comatose_admin.css +404 -0
  70. data/tasks/comatose.rake +9 -0
  71. data/test/behaviors.rb +106 -0
  72. data/test/fixtures/comatose_pages.yml +96 -0
  73. data/test/functional/comatose_admin_controller_test.rb +114 -0
  74. data/test/functional/comatose_controller_test.rb +44 -0
  75. data/test/javascripts/test.html +26 -0
  76. data/test/javascripts/test_runner.js +307 -0
  77. data/test/test_helper.rb +55 -0
  78. data/test/unit/class_options_test.rb +52 -0
  79. data/test/unit/comatose_page_test.rb +136 -0
  80. data/test/unit/processing_context_test.rb +108 -0
  81. data/test/unit/text_filters_test.rb +52 -0
  82. data/views/comatose_admin/_form.html.erb +96 -0
  83. data/views/comatose_admin/_page_list_item.html.erb +60 -0
  84. data/views/comatose_admin/delete.html.erb +18 -0
  85. data/views/comatose_admin/edit.html.erb +5 -0
  86. data/views/comatose_admin/index.html.erb +29 -0
  87. data/views/comatose_admin/new.html.erb +5 -0
  88. data/views/comatose_admin/reorder.html.erb +30 -0
  89. data/views/comatose_admin/versions.html.erb +40 -0
  90. data/views/layouts/comatose_admin.html.erb +837 -0
  91. data/views/layouts/comatose_admin_customize.html.erb +28 -0
  92. data/views/layouts/comatose_content.html.erb +17 -0
  93. metadata +148 -0
@@ -0,0 +1,108 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'comatose'
3
+
4
+ class ProcessingContextTest < Test::Unit::TestCase
5
+
6
+ fixtures :comatose_pages
7
+
8
+ def setup
9
+ @root = comatose_page( :home_page )
10
+ @binding = Comatose::ProcessingContext.new(@root)
11
+ end
12
+
13
+ # should "process liquid tags with no filters correctly" do
14
+ # result = TextFilters.transform('{{ page.title }}', @binding, :none, :liquid)
15
+ # assert_equal 'Home Page', result
16
+ # end
17
+ #
18
+ should "process erb tags correctly" do
19
+ result = TextFilters.transform('<%= page.title %>', @binding, :none, :erb)
20
+ assert_equal 'Home Page', result
21
+ end
22
+
23
+ should "support text translation and processing with ERB" do
24
+ src = 'The title is *<%= title %>*'
25
+ if TextFilters.all.keys.include? 'None'
26
+ assert_equal "The title is *Home Page*", TextFilters.transform(src, @binding, :none, :erb)
27
+ end
28
+ if TextFilters.all.keys.include? 'Textile'
29
+ assert_equal "<p>The title is <strong>Home Page</strong></p>", TextFilters.transform(src, @binding, :textile, :erb)
30
+ end
31
+ if TextFilters.all.keys.include? 'Markdown'
32
+ assert_equal "<p>The title is <em>Home Page</em></p>", TextFilters.transform(src, @binding, 'Markdown', :erb)
33
+ end
34
+ if TextFilters.all.keys.include? 'RDoc'
35
+ assert_equal "<p>\nThe title is *Home Page*\n</p>\n", TextFilters.transform(src, @binding, :rdoc, :erb)
36
+ end
37
+ end
38
+
39
+ should "support text translation and processing with Liquid" do
40
+ src = 'The title is *{{ page.title }}*'
41
+ assert_equal "The title is *Home Page*", TextFilters.transform(src, @binding, :none, :liquid)
42
+ if TextFilters.all_titles.include? 'Textile'
43
+ assert_equal "<p>The title is <strong>Home Page</strong></p>", TextFilters.transform(src, @binding, :textile, :liquid)
44
+ end
45
+ if TextFilters.all_titles.include? 'Markdown'
46
+ assert_equal "<p>The title is <em>Home Page</em></p>", TextFilters.transform(src, @binding, :markdown, :liquid)
47
+ end
48
+ if TextFilters.all_titles.include? 'RDoc'
49
+ assert_equal "<p>\nThe title is *Home Page*\n</p>\n", TextFilters.transform(src, @binding, :rdoc, :liquid)
50
+ end
51
+ end
52
+
53
+ UNSAFE_PROPS = %w(version position)
54
+ SAFE_PROPS = %w(id full_path uri slug keywords title to_html filter_type author updated_on created_on)
55
+
56
+ should "allow access to safe properties and methods when processing with ERB" do
57
+ binding = Comatose::ProcessingContext.new( comatose_page(:faq) )
58
+ SAFE_PROPS.each do |prop|
59
+ assert_not_equal '', TextFilters.transform("<%= page.#{prop} %>", binding, :none, :liquid), "on page.#{prop}"
60
+ end
61
+ end
62
+
63
+ should "prevent access to protected properties and methods when processing with ERB" do
64
+ binding = Comatose::ProcessingContext.new( comatose_page(:faq) )
65
+ UNSAFE_PROPS.each do |prop|
66
+ assert_equal "<%= page.#{prop} %>", TextFilters.transform("<%= page.#{prop} %>", binding, :none, :liquid), "on page.#{prop}"
67
+ end
68
+ end
69
+
70
+ should "allow access to safe properties and methods when processing with Liquid" do
71
+ binding = Comatose::ProcessingContext.new( comatose_page(:faq) )
72
+ SAFE_PROPS.each do |prop|
73
+ assert_not_equal '', TextFilters.transform("{{ page.#{prop} }}", binding, :none, :liquid), "on page.#{prop}"
74
+ end
75
+ end
76
+
77
+ should "prevent access to protected properties and methods when processing with Liquid" do
78
+ binding = Comatose::ProcessingContext.new( comatose_page(:faq) )
79
+ UNSAFE_PROPS.each do |prop|
80
+ assert_equal '', TextFilters.transform("{{ page.#{prop} }}", binding, :none, :liquid), "on page.#{prop}"
81
+ end
82
+ end
83
+
84
+ should "allow referenceing of defined ComatoseDrops" do
85
+ Comatose.define_drop "app" do
86
+ def test
87
+ "TEST"
88
+ end
89
+ end
90
+
91
+ result = TextFilters.transform('{{ app.test }}', @binding, :none, :liquid)
92
+ assert_equal 'TEST', result
93
+
94
+ result2 = TextFilters.transform('<%= app.test %>', @binding, :none, :erb)
95
+ assert_equal 'TEST', result2
96
+ end
97
+
98
+ should "let ComatoseDrop errors bubble upward" do
99
+ Comatose.define_drop "broken" do
100
+ def test
101
+ "TEST #{crap}"
102
+ end
103
+ end
104
+
105
+ assert_raise(RuntimeError) { TextFilters.transform('{{ broken.test }}', @binding, :none, :liquid) }
106
+ end
107
+
108
+ end
@@ -0,0 +1,52 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ require 'erb'
4
+ require 'liquid'
5
+
6
+ require 'text_filters'
7
+ # require 'comatose/page'
8
+ # require 'comatose/processing_context'
9
+
10
+ class TextFiltersTest < Test::Unit::TestCase
11
+ # fixtures :comatose_pages
12
+ # self.use_instantiated_fixtures = true
13
+
14
+ should "not alter output when using filter :none" do
15
+ assert_equal "line one\nline two", TextFilters.render_text("line one\nline two", :none)
16
+ end
17
+
18
+ should "convert newlines into <br/>s when using :simple filter" do
19
+ assert_equal "line one<br/>line two", TextFilters.render_text("line one\nline two", :simple)
20
+ end
21
+
22
+ should "support Textile, if it's available, using :textile or 'Textile' as a key" do
23
+ if TextFilters.all.keys.include? 'Textile'
24
+ assert_equal "<p>testing <strong>bold</strong></p>", TextFilters.render_text("testing *bold*", :textile)
25
+ assert_equal "<p>testing <strong>bold</strong></p>", TextFilters.render_text("testing *bold*", 'Textile')
26
+ end
27
+ end
28
+
29
+ should "support Markdown, if it's available, using :markdown or 'Markdown' as a key" do
30
+ if TextFilters.all.keys.include? 'Markdown'
31
+ assert_equal "<p>testing <em>bold</em></p>", TextFilters.render_text("testing *bold*", :markdown)
32
+ end
33
+ end
34
+
35
+ should "support RDoc, if it's available, using :rdoc or 'RDoc' as a key" do
36
+ if TextFilters.all.keys.include? 'RDoc'
37
+ assert_equal "<p>\ntesting <b>bold</b>\n</p>\n", TextFilters.render_text("testing *bold*", :rdoc)
38
+ assert_equal "<p>\ntesting <b>bold</b>\n</p>\n", TextFilters.render_text("testing *bold*", 'RDoc')
39
+ end
40
+ end
41
+
42
+ should "support transformation of parameters via ERB" do
43
+ src = 'Hello, <%= name %>'
44
+ assert_equal "Hello, Matt", TextFilters.transform(src, {'name'=>'Matt'}, :none, :erb)
45
+ end
46
+
47
+ should "support transformation of parameters via Liquid" do
48
+ src = 'Hello, {{ name }}'
49
+ assert_equal "Hello, Matt", TextFilters.transform(src, {'name'=>'Matt'}, :none, :liquid)
50
+ end
51
+
52
+ end
@@ -0,0 +1,96 @@
1
+ <%= error_messages_for :page %>
2
+
3
+ <% form_for :page, @page do |f| %>
4
+ <table class="page-form" cellpadding="0" cellspacing="0">
5
+
6
+ <tr>
7
+ <td class="label"><label for="page_title">Title</label></td>
8
+ <td class="field"><%= f.text_field :title, :tabindex=>1, :maxlength=>255, :size=>50 %> <%= link_to_function "More...", "ComatoseEditForm.toggle_extra_fields(this)", :id=>'more-options' %></td>
9
+ </tr>
10
+
11
+ <tr id="slug_row" class="meta-info">
12
+ <td class="label"><label for="page_slug">Slug</label></td>
13
+ <td class="field"><%= f.text_field :slug, :tabindex=>6, :maxlength=>255, :size=>50, :disabled=>@root_pages.include?(@page) %></td>
14
+ </tr>
15
+
16
+ <% if show_field? 'keywords' %>
17
+ <tr id="keywords_row" class="meta-info">
18
+ <td class="label"><label for="page_keywords">Keywords</label></td>
19
+ <td class="field"><%= f.text_field :keywords, :tabindex=>7, :maxlength=>1000, :size=>50 %></td>
20
+ </tr>
21
+ <% end %>
22
+
23
+ <% if show_field? 'parent' %>
24
+ <tr id="parent_row" class="meta-info">
25
+ <td class="label"><label for="page_parent">Parent</label></td>
26
+ <td class="field">
27
+ <% if mode != :new and @root_pages.include? @page %>
28
+ <select id="page_parent" disabled="true"><option><%= @page.title %> is a root page</option></select>
29
+ <% else %>
30
+ <select id="page_parent" name="page[parent_id]" tabindex="8"><%= tree_select_box @root_pages, @page.parent_id, @page.id %></select>
31
+ <% end %>
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+
36
+ <tr>
37
+ <td class="label body"><label for="page_body">Body</label></td>
38
+ <td class="field"><%= f.text_area :body, :rows=>20, :tabindex=>2 %></td>
39
+ </tr>
40
+
41
+ <% if show_field? 'filter' %>
42
+ <tr id="filter_row" class="meta-info">
43
+ <td class="label"><label for="page_filter_type">Filter</label></td>
44
+ <td class="field">
45
+ <%= select_tag 'page[filter_type]', options_for_select(TextFilters.all_titles.sort, @page.filter_type || Comatose.config.default_filter), :tabindex=>3, :id=>'page_filter_type' %>
46
+ <span class="field-help">Converts plain text into html</span>
47
+ </td>
48
+ </tr>
49
+ <% end %>
50
+
51
+ <% if show_field? 'created_on' %>
52
+ <tr id="created_row" class="meta-info">
53
+ <td class="label"><label for="page_created_on">Created</label></td>
54
+ <td class="field">
55
+ <%= f.datetime_select :created_on %>
56
+ </td>
57
+ </tr>
58
+ <% end %>
59
+
60
+ </table>
61
+
62
+ <div id="button-group">
63
+ <% unless @page.updated_on.nil? %>
64
+ <div class="last-update">
65
+ <label>
66
+ Updated <%= time_ago_in_words @page.updated_on, true %> ago by
67
+ <%= @page.author %>.
68
+ <%= link_to(pluralize(@page.versions.length, 'revision', 'revisions'), :action=>'versions', :id=>@page) if @page.versions.length > 0 %>
69
+ </label>
70
+ </div>
71
+ <% end %>
72
+ <%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %>
73
+ <%= button_to_function('Preview', "ComatoseEditForm.preview_content('#{url_for :controller=>controller.controller_name, :action=>'preview', :id=>@page}')", :tabindex=>3, :id=>'preview-btn' ) if show_field? 'preview' %> &nbsp;
74
+ <%= submit_tag ((mode == :edit) ? 'Save Changes' : 'Create Page'), :tabindex=>4 %>
75
+ <% if @page.versions.length > 0 %>
76
+ &nbsp; <%= link_to "Revert", :action=>'versions', :id=>@page %>
77
+ <% end %>
78
+ or
79
+ <a href="<%= url_for :controller=>controller.controller_name, :action=>'index' %>" onlick="ComatoseEditForm.cancel(this.href); return false;" tabindex="5">Cancel</a>
80
+ </div>
81
+ <% end %>
82
+
83
+ <div id="preview-area">
84
+ <fieldset>
85
+ <legend>Page Preview</legend>
86
+ <div class="preview-body">
87
+ <div id="preview-panel"><span style='color:blue;'>Loading Preview...</span></div>
88
+ <div style="clear:both"></div>
89
+ </div>
90
+ </fieldset>
91
+ <div class="commands">
92
+ <a href="#" onclick="$('preview-area').hide();">Close Preview</a> or <a href="#">Back to top</a>
93
+ </div>
94
+ </div>
95
+
96
+ <%= javascript_tag "ComatoseEditForm.init('#{mode.to_s}');" %>
@@ -0,0 +1,60 @@
1
+ <%# Params:
2
+ # - page (Page Node)
3
+ # - level (integer indicating current tree depth)
4
+ # Called From:
5
+ # - index
6
+ # Description:
7
+ # This partial is used recursively. Render it with the root node, and it will recurse
8
+ # down all of the child nodes to build a list with proper indentation to indicate
9
+ # tree depth.
10
+ %>
11
+
12
+ <%
13
+ # Create the page-level links...
14
+ links = []
15
+ links << link_to(pluralize(page.versions.length, 'revision', 'revisions'), :action=>'versions', :id=>page) if !page.nil? and !page.versions.nil? and page.versions.length > 0
16
+ links << link_to('add child page', {:action=>'new', :parent=>page}, :title=>"Add a child to '#{page.title}'", :class=>'add-page')
17
+ links << link_to_function('reorder children', "ComatoseList.toggle_reorder('page_list_#{page.id}',this,#{page.id})", :title=>"Reorder children of '#{page.title}'", :class=>'reorder-children', :href=>url_for(:action=>'reorder', :id=>page)) if !page.children.empty? and page.children.length > 1
18
+ links << link_to('delete', {:action=>'delete', :id=>page}, :confirm=>'This will delete this page, and any children. Are you sure?', :title=>"Delete page '#{page.title}' and all it's children", :class=>'delete-page', :method=>'post', :onmouseover=>"ComatoseList.item_hover('page_#{page.id}', 'over', true)", :onmouseout=>"ComatoseList.item_hover('page_#{page.id}', 'out', true)") unless @root_pages.include? page
19
+ # Level check, one, two, three...
20
+ collapse_children = (level >= Comatose.config.default_tree_level)
21
+ %>
22
+
23
+ <li id="page_<%= page.id %>">
24
+ <table cellpadding="0" cellspacing="0">
25
+ <tr>
26
+ <td rowspan="2" valign="center">
27
+ <% if !page.children.empty? %>
28
+ <%= image_tag( ((collapse_children) ? 'comatose/collapsed.gif' : 'comatose/expanded.gif'), :title=>'Expand/Collapse', :onclick=>"ComatoseList.toggle_tree_nodes(this,#{page.id});", :class=>'tree-controller', :size=>'12x12', :id=>"page_controller_#{page.id}" ) %>
29
+ <% else %>
30
+ <%= image_tag 'comatose/no-children.gif', :size=>'12x12', :class=>'tree-controller' %>
31
+ <% end %>
32
+ </td>
33
+ <td rowspan="2" valign="center">
34
+ <%= image_tag 'comatose/page.gif', :size=>'25x31', :align=>"absmiddle" %>
35
+ <span class="handle">DRAG</span>
36
+ </td>
37
+ <td>
38
+ <%= link_to page.title, {:action=>'edit', :id=>page}, :title=>"Path:#{page.full_path}", :class=>'page' %>
39
+ </td>
40
+ </tr>
41
+ <tr>
42
+ <td class="commands">
43
+ Updated <span title="Created on <%= page.created_on %>"><%= time_ago_in_words page.updated_on, true %> ago</span><%= " by #{page.author}" unless page.author.nil? or page.author.empty? %>,
44
+ <%= links.join(', ') %>.
45
+ </td>
46
+ </tr>
47
+ </table>
48
+
49
+ <ul id="page_list_<%= page.id %>" old="lvl-<%= page.id %>" class="page-list <%= 'collapsed' if collapse_children %>" >
50
+ <% for child in page.children %>
51
+ <%= render :partial=>'page_list_item', :locals=>{ :page=>child, :level=>level+1 } %>
52
+ <% end %>
53
+ </ul>
54
+
55
+ <%= sortable_element( "page_list_#{page.id}",
56
+ :complete => visual_effect(:highlight, "page_list_#{page.id}"),
57
+ :handle=>'handle',
58
+ :update=>'flash-content',
59
+ :url => { :action => "reorder", :id=>page } ) if !page.children.empty? and page.children.length > 1 %>
60
+ </li>
@@ -0,0 +1,18 @@
1
+ <h1>
2
+ Page Delete Confirmation
3
+ </h1>
4
+
5
+ <blockquote>
6
+ <p>Are you sure you want to delete the page titled "<b><%= @page.title %></b>"?</p>
7
+ <% unless @page.children.empty? %>
8
+ <p>It has <b><%= @page.children.length %></b> child pages that will also be deleted...</p>
9
+ <% end %>
10
+ </blockquote>
11
+
12
+ <%= start_form_tag %>
13
+ <div id="button-group">
14
+ <%= submit_tag "Yes, Delete The Page" %>
15
+ or
16
+ <%= link_to "Cancel", :action=>'index' %>
17
+ </div>
18
+ <%= end_form_tag %>
@@ -0,0 +1,5 @@
1
+ <h1>
2
+ Edit Page
3
+ </h1>
4
+
5
+ <%= render :partial=>'form', :locals=>{:mode=>:edit} %>
@@ -0,0 +1,29 @@
1
+ <div class="action">
2
+ <%= link_to 'Clear Page Cache', :controller=>controller.controller_name, :action=>'expire_page_cache' %>
3
+ <% if Comatose.config.allow_import_export %>
4
+ <%= link_to 'Import', '#', :id => 'import_link2', :onclick => "$('import_form').setStyle({display: 'inline'}); return false;" %>
5
+ <%= link_to 'Export', :controller=>controller.controller_name, :action=>'export' %>
6
+ <div id="import_form" style="display: none;">
7
+ <% form_tag(url_for(:action => 'import'), :multipart => true) do %>
8
+ <%= file_field_tag 'import_file' %>
9
+ <%= submit_tag 'Upload and Import' %>
10
+ <a href="#" onclick="$('import_form').hide(); return false;">Cancel</a>
11
+ <% end %>
12
+ </div>
13
+ <% end %>
14
+ </div>
15
+
16
+ <h1>
17
+ Page List
18
+ <%= image_tag 'comatose/spinner.gif', :id=>'spinner', :align=>'absmiddle', :style=>'display:none;' %>
19
+ </h1>
20
+
21
+ <ul class="page-list root">
22
+ <% @root_pages.each do |page| %>
23
+ <%= render :partial=>'page_list_item', :locals=>{ :page=>page, :level=>1 } %>
24
+ <% end %>
25
+ </ul>
26
+
27
+ <div id="status"></div>
28
+
29
+ <%= javascript_tag "ComatoseList.init()" %>
@@ -0,0 +1,5 @@
1
+ <h1>
2
+ New Page
3
+ </h1>
4
+
5
+ <%= render :partial=>'form', :locals=>{:mode=>:new} %>
@@ -0,0 +1,30 @@
1
+ <h1>Reorder Pages</h1>
2
+
3
+ <h3>"<%= @page.title %>" child pages:</h3>
4
+
5
+ <ul class="page-list">
6
+ <% @page.children.each do |page| %>
7
+ <li>
8
+ <table cellpadding="0" cellspacing="0">
9
+ <tr>
10
+ <td rowspan="2" valign="center">
11
+ <%= image_tag 'comatose/page.gif', :size=>'25x31', :align=>"absmiddle" %>
12
+ </td>
13
+ <td>
14
+ <a class="page"><%= page.title %></a>
15
+ </td>
16
+ </tr>
17
+ <tr>
18
+ <td class="commands">
19
+ <%= link_to "Move Up", :action=>'reorder', :cmd=>'up', :page=>page.id %>,
20
+ <%= link_to "Move Down", :action=>'reorder', :cmd=>'down', :page=>page.id %>
21
+ </td>
22
+ </tr>
23
+ </table>
24
+ </li>
25
+ <% end %>
26
+ </ul>
27
+
28
+ <div id="button-group">
29
+ <%= link_to "Finished", :action=>'index' %>
30
+ </div>
@@ -0,0 +1,40 @@
1
+ <h1>Page Revisions</h1>
2
+ <form>
3
+ <div class="revisions older-content">
4
+ <div class="header">
5
+ <div class="header-actions">
6
+ <% form_tag :action => 'versions', :id => @page, :html => { :method => :get } do %>
7
+ View Version: <%= select_tag "version", options_from_collection_for_select(@page.versions, 'version', 'version', @version_num), {'onchange'=>'this.form.submit();'} %>
8
+ <%= submit_tag 'Go', {'id'=>'go-btn'} %>
9
+ <% end %>
10
+ </div>
11
+ Version <%= @version_num %>
12
+ </div>
13
+ <div class="meta">
14
+ <label class="title"><span>Title:</span><%= @version.title %></label>
15
+ <label><span>Slug:</span> <%= @version.slug %></label>
16
+ <label><span>Keywords:</span> <%= @version.keywords %></label>
17
+ </div>
18
+ <%= @version.body.split("\n").join('<br/>') unless @version.body.nil? %>
19
+ <div id="button-group" class="footer">
20
+ <% form_tag :action=>'set_version', :id => @page, :version => @version_num do %>
21
+ <%= submit_tag "Set As Current Version" %>
22
+ or
23
+ <%= link_to "Cancel", :action=>'index' %>
24
+ <% end %>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="revisions current-content">
29
+ <div class="header">
30
+ Current Version
31
+ </div>
32
+ <div class="meta">
33
+ <label class="title"><span>Title:</span><%= @page.title %></label>
34
+ <label><span>Slug:</span> <%= @page.slug %></label>
35
+ <label><span>Keywords:</span> <%= @page.keywords %></label>
36
+ </div>
37
+ <%= @page.body.split("\n").join('<br/>') unless @page.body.nil? %>
38
+ </div>
39
+
40
+ <div style="clear:both">&nbsp;</div>