rethoth 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +26 -0
  3. data/bin/thoth +233 -0
  4. data/lib/proto/config.ru +45 -0
  5. data/lib/proto/thoth.conf.sample +206 -0
  6. data/lib/thoth/cache.rb +53 -0
  7. data/lib/thoth/config.rb +158 -0
  8. data/lib/thoth/controller/admin.rb +75 -0
  9. data/lib/thoth/controller/api/comment.rb +73 -0
  10. data/lib/thoth/controller/api/page.rb +134 -0
  11. data/lib/thoth/controller/api/post.rb +122 -0
  12. data/lib/thoth/controller/api/tag.rb +59 -0
  13. data/lib/thoth/controller/archive.rb +50 -0
  14. data/lib/thoth/controller/comment.rb +173 -0
  15. data/lib/thoth/controller/main.rb +193 -0
  16. data/lib/thoth/controller/media.rb +172 -0
  17. data/lib/thoth/controller/page.rb +167 -0
  18. data/lib/thoth/controller/post.rb +310 -0
  19. data/lib/thoth/controller/search.rb +86 -0
  20. data/lib/thoth/controller/tag.rb +107 -0
  21. data/lib/thoth/controller.rb +48 -0
  22. data/lib/thoth/errors.rb +35 -0
  23. data/lib/thoth/helper/admin.rb +86 -0
  24. data/lib/thoth/helper/cookie.rb +45 -0
  25. data/lib/thoth/helper/error.rb +122 -0
  26. data/lib/thoth/helper/pagination.rb +131 -0
  27. data/lib/thoth/helper/wiki.rb +77 -0
  28. data/lib/thoth/helper/ysearch.rb +89 -0
  29. data/lib/thoth/importer/pants.rb +81 -0
  30. data/lib/thoth/importer/poseidon.rb +54 -0
  31. data/lib/thoth/importer/thoth.rb +103 -0
  32. data/lib/thoth/importer.rb +131 -0
  33. data/lib/thoth/layout/default.rhtml +47 -0
  34. data/lib/thoth/middleware/minify.rb +82 -0
  35. data/lib/thoth/migrate/001_create_schema.rb +108 -0
  36. data/lib/thoth/migrate/002_add_media_size.rb +37 -0
  37. data/lib/thoth/migrate/003_add_post_draft.rb +38 -0
  38. data/lib/thoth/migrate/004_add_comment_email.rb +37 -0
  39. data/lib/thoth/migrate/005_add_page_position.rb +37 -0
  40. data/lib/thoth/migrate/006_add_comment_close_delete.rb +43 -0
  41. data/lib/thoth/migrate/007_add_comment_summary.rb +37 -0
  42. data/lib/thoth/model/comment.rb +216 -0
  43. data/lib/thoth/model/media.rb +87 -0
  44. data/lib/thoth/model/page.rb +204 -0
  45. data/lib/thoth/model/post.rb +262 -0
  46. data/lib/thoth/model/tag.rb +80 -0
  47. data/lib/thoth/model/tags_posts_map.rb +34 -0
  48. data/lib/thoth/monkeypatch/sequel/model/errors.rb +37 -0
  49. data/lib/thoth/plugin/thoth_delicious.rb +105 -0
  50. data/lib/thoth/plugin/thoth_flickr.rb +86 -0
  51. data/lib/thoth/plugin/thoth_pinboard.rb +98 -0
  52. data/lib/thoth/plugin/thoth_tags.rb +68 -0
  53. data/lib/thoth/plugin/thoth_twitter.rb +175 -0
  54. data/lib/thoth/plugin.rb +59 -0
  55. data/lib/thoth/public/css/admin.css +223 -0
  56. data/lib/thoth/public/css/thoth.css +592 -0
  57. data/lib/thoth/public/images/admin-sprite.png +0 -0
  58. data/lib/thoth/public/images/thoth-sprite.png +0 -0
  59. data/lib/thoth/public/js/admin/comments.js +116 -0
  60. data/lib/thoth/public/js/admin/name.js +244 -0
  61. data/lib/thoth/public/js/admin/tagcomplete.js +332 -0
  62. data/lib/thoth/public/js/lazyload-min.js +4 -0
  63. data/lib/thoth/public/js/thoth.js +203 -0
  64. data/lib/thoth/public/robots.txt +5 -0
  65. data/lib/thoth/version.rb +37 -0
  66. data/lib/thoth/view/admin/index.rhtml +1 -0
  67. data/lib/thoth/view/admin/login.rhtml +23 -0
  68. data/lib/thoth/view/admin/toolbar.rhtml +117 -0
  69. data/lib/thoth/view/admin/welcome.rhtml +58 -0
  70. data/lib/thoth/view/archive/index.rhtml +24 -0
  71. data/lib/thoth/view/comment/comment.rhtml +47 -0
  72. data/lib/thoth/view/comment/delete.rhtml +15 -0
  73. data/lib/thoth/view/comment/form.rhtml +81 -0
  74. data/lib/thoth/view/comment/index.rhtml +68 -0
  75. data/lib/thoth/view/comment/list.rhtml +48 -0
  76. data/lib/thoth/view/media/delete.rhtml +15 -0
  77. data/lib/thoth/view/media/edit.rhtml +12 -0
  78. data/lib/thoth/view/media/form.rhtml +7 -0
  79. data/lib/thoth/view/media/list.rhtml +35 -0
  80. data/lib/thoth/view/media/media.rhtml +44 -0
  81. data/lib/thoth/view/media/new.rhtml +7 -0
  82. data/lib/thoth/view/page/delete.rhtml +15 -0
  83. data/lib/thoth/view/page/edit.rhtml +15 -0
  84. data/lib/thoth/view/page/form.rhtml +57 -0
  85. data/lib/thoth/view/page/index.rhtml +9 -0
  86. data/lib/thoth/view/page/list.rhtml +49 -0
  87. data/lib/thoth/view/page/new.rhtml +15 -0
  88. data/lib/thoth/view/post/comments.rhtml +12 -0
  89. data/lib/thoth/view/post/compact.rhtml +48 -0
  90. data/lib/thoth/view/post/delete.rhtml +15 -0
  91. data/lib/thoth/view/post/edit.rhtml +15 -0
  92. data/lib/thoth/view/post/form.rhtml +83 -0
  93. data/lib/thoth/view/post/index.rhtml +48 -0
  94. data/lib/thoth/view/post/list.rhtml +61 -0
  95. data/lib/thoth/view/post/new.rhtml +15 -0
  96. data/lib/thoth/view/post/tiny.rhtml +4 -0
  97. data/lib/thoth/view/search/index.rhtml +45 -0
  98. data/lib/thoth/view/tag/index.rhtml +34 -0
  99. data/lib/thoth/view/thoth/css.rhtml +9 -0
  100. data/lib/thoth/view/thoth/footer.rhtml +15 -0
  101. data/lib/thoth/view/thoth/header.rhtml +23 -0
  102. data/lib/thoth/view/thoth/index.rhtml +11 -0
  103. data/lib/thoth/view/thoth/js.rhtml +6 -0
  104. data/lib/thoth/view/thoth/sidebar.rhtml +38 -0
  105. data/lib/thoth/view/thoth/util/pager.rhtml +23 -0
  106. data/lib/thoth/view/thoth/util/simple_pager.rhtml +15 -0
  107. data/lib/thoth/view/thoth/util/table_sortheader.rhtml +20 -0
  108. data/lib/thoth.rb +394 -0
  109. metadata +409 -0
@@ -0,0 +1,68 @@
1
+ <% unless @today.empty? %>
2
+ <h3>Today's Comments</h3>
3
+
4
+ <ul class="comments today">
5
+ <% @today.each do |comment| %>
6
+ <li>
7
+ <a href="<%== comment.url %>">
8
+ <% if comment.title.empty? %>
9
+ <%= comment.summary %>
10
+ <% else %>
11
+ <%== comment.title %>
12
+ <% end %>
13
+ </a>
14
+ <div class="meta">
15
+ <span class="author">by
16
+ <% if comment.author_url.empty? %>
17
+ <%== comment.author %>
18
+ <% else %>
19
+ <a href="<%== comment.author_url %>" rel="nofollow">
20
+ <%== comment.author %>
21
+ </a>
22
+ <% end %>
23
+ </span>
24
+ <span class="on">
25
+ on <a href="<%== comment.post.url %>"><%== comment.post.title %></a>
26
+ </span>
27
+ </div>
28
+ </li>
29
+ <% end %>
30
+ </ul>
31
+ <% end %>
32
+
33
+ <% unless @ancient.empty? %>
34
+ <h3>Ancient History</h3>
35
+
36
+ <ul class="comments ancient">
37
+ <% @ancient.each do |comment| %>
38
+ <li>
39
+ <a href="<%== comment.url %>">
40
+ <% if comment.title.empty? %>
41
+ <%= comment.summary %>
42
+ <% else %>
43
+ <%== comment.title %>
44
+ <% end %>
45
+ </a>
46
+ <div class="meta">
47
+ <span class="author">by
48
+ <% if comment.author_url.empty? %>
49
+ <%== comment.author %>
50
+ <% else %>
51
+ <a href="<%== comment.author_url %>" rel="nofollow">
52
+ <%== comment.author %>
53
+ </a>
54
+ <% end %>
55
+ </span>
56
+ <span class="on">
57
+ on <a href="<%== comment.post.url %>"><%== comment.post.title %></a>
58
+ </span>
59
+ </div>
60
+ </li>
61
+ <% end %>
62
+ </ul>
63
+ <% end %>
64
+
65
+ <% if @today.empty? && @ancient.empty? %>
66
+ <h3>Recent Comments</h3>
67
+ <p>It's been pretty quiet around here.</p>
68
+ <% end %>
@@ -0,0 +1,48 @@
1
+ <h2>Comments</h2>
2
+
3
+ <%= Thoth::MainController.render_view('util/pager') %>
4
+
5
+ <table class="list comments" summary="List of all comments">
6
+ <%= Thoth::MainController.render_view('util/table_sortheader') %>
7
+ <tfoot></tfoot>
8
+ <tbody>
9
+ <% row = 'even' %>
10
+ <% @comments.all do |comment| %>
11
+ <tr class="<%= row == 'even' ? row = 'odd' : row = 'even' %>">
12
+ <td class="id"><%= comment.id %></td>
13
+ <td class="title">
14
+ <a href="<%== comment.url %>">
15
+ <% if comment.title.empty? %>
16
+ <%= comment.summary %>
17
+ <% else %>
18
+ <%== comment.title %>
19
+ <% end %>
20
+ </a>
21
+ </td>
22
+ <td class="author">
23
+ <% if comment.author_url && !comment.author_url.empty? %>
24
+ <a href="<%== comment.author_url %>" rel="nofollow">
25
+ <%== comment.author %>
26
+ </a>
27
+ <% else %>
28
+ <%== comment.author %>
29
+ <% end %>
30
+ </td>
31
+ <td class="created">
32
+ <%= comment.created_at(Thoth::Config.timestamp['short']) %>
33
+ </td>
34
+ <td class="deleted"><%= comment.deleted ? 'Yes' : '' %></td>
35
+ </tr>
36
+ <% end %>
37
+
38
+ <% if @pager.record_count == 0 %>
39
+ <tr class="empty">
40
+ <td colspan="4">
41
+ No comments to display.
42
+ </td>
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+
48
+ <%= Thoth::MainController.render_view('util/pager') %>
@@ -0,0 +1,15 @@
1
+ <h2>Delete Media</h2>
2
+
3
+ <p>
4
+ Are you sure you want to permanently delete the following file?
5
+ </p>
6
+
7
+ <%= Thoth::MediaController.render_view('media', :file => @file) %>
8
+
9
+ <form action="<%= Thoth::MediaController.r(:delete, @file.id) %>" method="post">
10
+ <p>
11
+ <input type="hidden" name="token" value="<%== form_token %>" />
12
+ <button name="confirm" value="yes">Yes, delete this file forever</button>
13
+ <button name="confirm" value="no">No, do not delete this file</button>
14
+ </p>
15
+ </form>
@@ -0,0 +1,12 @@
1
+ <h2>Edit Media</h2>
2
+
3
+ <%= Thoth::MediaController.render_view('media', :file => @file) %>
4
+
5
+ <% if @media_error %>
6
+ <div class="flash error"><%== @media_error %></div>
7
+ <% end %>
8
+
9
+ <fieldset class="replace">
10
+ <legend>Replace File</legend>
11
+ <%= Thoth::MediaController.render_view('form', :form_action => @form_action) %>
12
+ </fieldset>
@@ -0,0 +1,7 @@
1
+ <form class="media" action="<%== @form_action %>" method="post" enctype="multipart/form-data">
2
+ <p>
3
+ <input type="hidden" name="token" value="<%== form_token %>" />
4
+ <input type="file" name="file" id="file" />
5
+ <input type="submit" value="Upload" />
6
+ </p>
7
+ </form>
@@ -0,0 +1,35 @@
1
+ <h2>Media</h2>
2
+
3
+ <%= Thoth::MainController.render_view('util/pager') %>
4
+
5
+ <table class="list media" summary="List of all media">
6
+ <%= Thoth::MainController.render_view('util/table_sortheader') %>
7
+ <tfoot></tfoot>
8
+ <tbody>
9
+ <% row = 'even' %>
10
+ <% @files.all do |file| %>
11
+ <tr class="<%= row == 'even' ? row = 'odd' : row = 'even' %>">
12
+ <td class="filename">
13
+ <a href="<%= Thoth::MediaController.r(:edit, file.id) %>"><%== file.filename %></a>
14
+ </td>
15
+ <td class="size"><%== Thoth.filesize_format(file.size) %></td>
16
+ <td class="created">
17
+ <%= file.created_at(Thoth::Config.timestamp['short']) %>
18
+ </td>
19
+ <td class="updated">
20
+ <%= file.updated_at(Thoth::Config.timestamp['short']) %>
21
+ </td>
22
+ </tr>
23
+ <% end %>
24
+
25
+ <% if @pager.record_count == 0 %>
26
+ <tr class="empty">
27
+ <td colspan="4">
28
+ No files to display.
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
34
+
35
+ <%= Thoth::MainController.render_view('util/pager') %>
@@ -0,0 +1,44 @@
1
+ <table class="details media">
2
+ <thead></thead>
3
+ <tfoot></tfoot>
4
+
5
+ <tbody>
6
+ <tr class="filename">
7
+ <th scope="row">Filename</th>
8
+ <td><%== @file.filename %></td>
9
+ </tr>
10
+
11
+ <tr class="path">
12
+ <th scope="row">Server Path</th>
13
+ <td><%== @file.path %></td>
14
+ </tr>
15
+
16
+ <tr class="url">
17
+ <th scope="row">URL</th>
18
+ <td><a href="<%== @file.url %>"><%== @file.url %></a></td>
19
+ </tr>
20
+
21
+ <tr class="mimetype">
22
+ <th scope="row">MIME Type</th>
23
+ <td><%== @file.mimetype %></td>
24
+ </tr>
25
+
26
+ <tr class="size">
27
+ <th scope="row">Size</th>
28
+ <td><%== Thoth.filesize_format(@file.size) %></td>
29
+ </tr>
30
+ </tbody>
31
+ </table>
32
+
33
+ <% unless @delete %>
34
+ <p>
35
+ To link to this file in a blog post or page, use
36
+ <kbd>[[media:<%== @file.filename %>]]</kbd> or
37
+ <kbd>[[media:<%== @file.filename %>|link text]]</kbd>.
38
+ </p>
39
+
40
+ <p>
41
+ To insert only the URL of this file (for use in <code>&lt;img&gt;</code>,
42
+ for example), use <kbd>[[media_url:<%== @file.filename %>]]</kbd>.
43
+ </p>
44
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <h2>Upload Media</h2>
2
+
3
+ <% if @media_error %>
4
+ <div class="flash error"><%== @media_error %></div>
5
+ <% end %>
6
+
7
+ <%= Thoth::MediaController.render_view('form', :form_action => @form_action) %>
@@ -0,0 +1,15 @@
1
+ <h2>Delete Page</h2>
2
+
3
+ <p>
4
+ Are you sure you want to permanently delete the following page?
5
+ </p>
6
+
7
+ <%= Thoth::PageController.render_view(:index) %>
8
+
9
+ <form action="<%= Thoth::PageController.r(:delete, @page.id) %>" method="post">
10
+ <p>
11
+ <input type="hidden" name="token" value="<%== form_token %>" />
12
+ <button name="confirm" value="yes">Yes, delete this page forever</button>
13
+ <button name="confirm" value="no">No, do not delete this page</button>
14
+ </p>
15
+ </form>
@@ -0,0 +1,15 @@
1
+ <h2>Edit Page</h2>
2
+
3
+ <% if @page_error %>
4
+ <div class="flash error"><%== @page_error %></div>
5
+ <% end %>
6
+
7
+ <% if @page %>
8
+ <%= Thoth::PageController.render_view(:index) %>
9
+ <% end %>
10
+
11
+ <%=
12
+ Thoth::PageController.render_view(:form,
13
+ :form_action => @form_action,
14
+ :page => @page)
15
+ %>
@@ -0,0 +1,57 @@
1
+ <form id="page-form" action="<%== @form_action %>" method="post">
2
+ <fieldset class="default">
3
+ <div class="field">
4
+ <label for="name">Name</label>
5
+ <input type="text" name="name" id="name" class="name-page"
6
+ maxlength="64" value="<%== @page ? @page.name : '' %>" />
7
+
8
+ <% if @page; @page.errors.on_field(:name).each do |error| %>
9
+ <p class="flash error"><%== error %></p>
10
+ <% end; end %>
11
+ </div>
12
+
13
+ <div class="field">
14
+ <label for="title">Title</label>
15
+ <input type="text" name="title" id="title" class="title-page"
16
+ maxlength="255" value="<%== @page ? @page.title : '' %>" />
17
+
18
+ <% if @page; @page.errors.on_field(:title).each do |error| %>
19
+ <p class="flash error"><%== error %></p>
20
+ <% end; end %>
21
+ </div>
22
+
23
+ <div class="field">
24
+ <label for="body">Body</label>
25
+ <textarea name="body" id="body" rows="15" cols="60"><%== @page ? @page.body : '' %></textarea>
26
+
27
+ <% if @page; @page.errors.on_field(:body).each do |error| %>
28
+ <p class="flash error"><%== error %></p>
29
+ <% end; end %>
30
+ </div>
31
+ </fieldset>
32
+
33
+ <p class="buttons">
34
+ <input type="hidden" name="token" value="<%== form_token %>" />
35
+ <input type="submit" name="action" value="Preview" />
36
+ <input type="submit" name="action" value="Post" />
37
+ </p>
38
+ </form>
39
+
40
+ <h3>Hey, look! Tips!</h3>
41
+
42
+ <ul class="tips">
43
+ <li>
44
+ Use
45
+ <a href="http://redcloth.org/textile" target="_blank">Textile</a>
46
+ or XHTML for formatting.
47
+ </li>
48
+ <li>
49
+ To link to another page on this site, use wiki-style links like
50
+ <kbd>[[pagename]]</kbd> or <kbd>[[pagename|link text]]</kbd>.
51
+ </li>
52
+ <li>
53
+ To link to a blog post, use a link like
54
+ <kbd>[[@postname_or_id]]</kbd> or
55
+ <kbd>[[@postname_or_id|link text]]</kbd>.
56
+ </li>
57
+ </ul>
@@ -0,0 +1,9 @@
1
+ <div class="page">
2
+ <div class="hd">
3
+ <h1><%== @page.title %></h1>
4
+ </div>
5
+
6
+ <div class="bd">
7
+ <%= @page.body_rendered %>
8
+ </div>
9
+ </div>
@@ -0,0 +1,49 @@
1
+ <h2>Pages</h2>
2
+
3
+ <%= Thoth::MainController.render_view('util/pager') %>
4
+
5
+ <form action="<%= @form_action %>" method="post">
6
+ <table class="list pages" summary="List of all pages" id="page_list_table">
7
+ <%= Thoth::MainController.render_view('util/table_sortheader') %>
8
+ <tfoot></tfoot>
9
+ <tbody>
10
+ <% row = 'even' %>
11
+ <% @pages.all do |page| %>
12
+ <tr id="row_<%= page.id %>" class="<%= row == 'even' ? row = 'odd' : row = 'even' %>">
13
+ <td class="name"><%== page.name %></td>
14
+ <td class="title">
15
+ <a href="<%== page.url %>"><%== page.title %></a>
16
+ </td>
17
+ <td class="created">
18
+ <%= page.created_at(Thoth::Config.timestamp['short']) %>
19
+ </td>
20
+ <td class="updated">
21
+ <%= page.updated_at(Thoth::Config.timestamp['short']) %>
22
+ </td>
23
+ <td class="position">
24
+ <input type="text" size="2" name="position[<%= page.id %>]"
25
+ value="<%= page.position %>" maxlength="5" />
26
+ </td>
27
+ </tr>
28
+ <% end %>
29
+
30
+ <% if @pager.record_count == 0 %>
31
+ <tr class="empty">
32
+ <td colspan="5">
33
+ No pages to display.
34
+ </td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
39
+
40
+ <p>
41
+ <input type="hidden" name="order" value="<%== @order %>" />
42
+ <input type="hidden" name="sort" value="<%== @sort %>" />
43
+ <input type="hidden" name="token" value="<%== form_token %>" />
44
+ <input type="submit" value="Save Positions" />
45
+ </p>
46
+ </form>
47
+
48
+ <%= Thoth::MainController.render_view('util/pager') %>
49
+
@@ -0,0 +1,15 @@
1
+ <h2>New Page</h2>
2
+
3
+ <% if @page_error %>
4
+ <div class="flash error"><%== @page_error %></div>
5
+ <% end %>
6
+
7
+ <% if @page %>
8
+ <%= Thoth::PageController.render_view(:index) %>
9
+ <% end %>
10
+
11
+ <%=
12
+ Thoth::PageController.render_view(:form,
13
+ :form_action => @form_action,
14
+ :page => @page)
15
+ %>
@@ -0,0 +1,12 @@
1
+ <div id="comments">
2
+ <h3>Comments</h3>
3
+ <%= @comments_rendered %>
4
+ </div>
5
+
6
+ <%=
7
+ if @post.allow_comments
8
+ Thoth::CommentController.render_view(:form,
9
+ :comment => @preview,
10
+ :form_action => @comment_action)
11
+ end
12
+ %>
@@ -0,0 +1,48 @@
1
+ <div id="post-<%= @post.id || 0 %>" class="post hentry">
2
+ <div class="hd">
3
+ <h2 class="entry-title">
4
+ <a href="<%== @post.url %>" rel="bookmark" title="Permalink for this post">
5
+ <%== @post.title %>
6
+ </a>
7
+ </h2>
8
+
9
+ <address class="vcard author">
10
+ <a class="email fn" href="mailto:<%== Thoth::Config.admin['email'] %>"><%== Thoth::Config.admin['name'] %></a>
11
+ </address>
12
+
13
+ <span class="date robots-nocontent">
14
+ <abbr class="published" title="<%= @post.created_at.xmlschema %>">
15
+ <%= @post.created_at(Thoth::Config.timestamp['long']) %>
16
+ </abbr>
17
+ </span>
18
+ </div>
19
+
20
+ <div class="bd entry-content">
21
+ <%= @post.body_rendered %>
22
+ </div>
23
+
24
+ <div class="ft">
25
+ <% unless @post.tags.empty? %>
26
+ <div class="tags">
27
+ <span class="icon tag"></span>
28
+ <ul>
29
+ <% @post.tags.each do |tag| %>
30
+ <li>
31
+ <a href="<%== tag.url %>" rel="tag"><%== tag.name %></a>
32
+ </li>
33
+ <% end %>
34
+ </ul>
35
+ </div>
36
+ <% end %>
37
+
38
+ <% comment_count = @post.comments.count %>
39
+ <% if Thoth::Config.site['enable_comments'] && (comment_count > 0 || @post.allow_comments) %>
40
+ <div class="meta robots-nocontent">
41
+ <span class="icon comments"></span>
42
+ <a href="<%== @post.url %>#comments">
43
+ <%= comment_count %> comment<%= comment_count == 1 ? '' : 's' %>
44
+ </a>
45
+ </div>
46
+ <% end %>
47
+ </div>
48
+ </div>
@@ -0,0 +1,15 @@
1
+ <h2>Delete Post</h2>
2
+
3
+ <p>
4
+ Are you sure you want to permanently delete the following blog post?
5
+ </p>
6
+
7
+ <%= Thoth::PostController.render_view(:compact, :post => @post) %>
8
+
9
+ <form action="<%= Thoth::PostController.r(:delete, @post.id) %>" method="post">
10
+ <p>
11
+ <input type="hidden" name="token" value="<%== form_token %>" />
12
+ <button name="confirm" value="yes">Yes, delete this blog post forever</button>
13
+ <button name="confirm" value="no">No, do not delete this blog post</button>
14
+ </p>
15
+ </form>
@@ -0,0 +1,15 @@
1
+ <h2>Edit Blog Post<%== @post.is_draft ? ' (Draft)' : '' %></h2>
2
+
3
+ <% if @post_error %>
4
+ <div class="flash error"><%== @post_error %></div>
5
+ <% end %>
6
+
7
+ <% if @post %>
8
+ <%= Thoth::PostController.render_view(:compact, :post => @post) %>
9
+ <% end %>
10
+
11
+ <%=
12
+ Thoth::PostController.render_view(:form,
13
+ :form_action => @form_action,
14
+ :post => @post)
15
+ %>
@@ -0,0 +1,83 @@
1
+ <form id="post-form" action="<%== @form_action %>" method="post">
2
+ <fieldset class="default">
3
+ <div class="field">
4
+ <label for="name">Name</label>
5
+ <input type="text" name="name" id="name" class="name-post"
6
+ maxlength="64" value="<%== @post ? @post.name : '' %>" />
7
+
8
+ <% if @post; @post.errors.on_field(:name).each do |error| %>
9
+ <p class="flash error"><%== error %></p>
10
+ <% end; end %>
11
+ </div>
12
+
13
+ <div class="field">
14
+ <label for="title">Title</label>
15
+ <input type="text" name="title" id="title" class="title-post"
16
+ maxlength="255" value="<%== @post ? @post.title : '' %>" />
17
+
18
+ <% if @post; @post.errors.on_field(:title).each do |error| %>
19
+ <p class="flash error"><%== error %></p>
20
+ <% end; end %>
21
+ </div>
22
+
23
+ <div class="field">
24
+ <label for="body">Body</label>
25
+ <textarea name="body" id="body" rows="15" cols="60"><%== @post ? @post.body : '' %></textarea>
26
+
27
+ <% if @post; @post.errors.on_field(:body).each do |error| %>
28
+ <p class="flash error"><%== error %></p>
29
+ <% end; end %>
30
+ </div>
31
+
32
+ <div class="field">
33
+ <label for="tags">Tags</label>
34
+ <input type="text" name="tags" id="tags" class="tags-input"
35
+ maxlength="255" value="<%== @post ? @post.tags.collect{|i| i.name }.join(', ') : '' %>" />
36
+
37
+ <% if @post; @post.errors.on_field(:tags).each do |error| %>
38
+ <p class="flash error"><%== error %></p>
39
+ <% end; end %>
40
+ </div>
41
+
42
+ <fieldset>
43
+ <legend>Options</legend>
44
+
45
+ <input type="checkbox" value="1" id="allow_comments" name="allow_comments" <%= !@post || @post.allow_comments ? 'checked="checked"' : '' %>/>
46
+ <label for="allow_comments">Allow comments on this post</label>
47
+ </fieldset>
48
+ </fieldset>
49
+
50
+ <p class="buttons">
51
+ <input type="hidden" name="token" value="<%== form_token %>" />
52
+ <% if !@post || @post.is_draft %>
53
+ <input type="submit" name="action" value="Save &amp; Preview" />
54
+ <% else %>
55
+ <input type="submit" name="action" value="Preview" />
56
+ <input type="submit" name="action" value="Unpublish &amp; Save as Draft">
57
+ <% end %>
58
+ <input type="submit" name="action" value="Publish" />
59
+ </p>
60
+ </form>
61
+
62
+ <h3>Hey, look! Tips!</h3>
63
+
64
+ <ul class="tips">
65
+ <li>
66
+ Use
67
+ <a href="http://redcloth.org/textile" target="_blank">Textile</a>
68
+ or XHTML for formatting.
69
+ </li>
70
+ <li>
71
+ Separate tags with commas, like this: <kbd>monkeys, pirates,
72
+ pirate monkeys, ninjas</kbd>
73
+ </li>
74
+ <li>
75
+ To link to another page on this site, use wiki-style links like
76
+ <kbd>[[pagename]]</kbd> or <kbd>[[pagename|link text]]</kbd>.
77
+ </li>
78
+ <li>
79
+ To link to a blog post, use a link like
80
+ <kbd>[[@postname_or_id]]</kbd> or
81
+ <kbd>[[@postname_or_id|link text]]</kbd>.
82
+ </li>
83
+ </ul>
@@ -0,0 +1,48 @@
1
+ <div id="post-<%= @post.id %>" class="post hentry">
2
+ <div class="hd">
3
+ <h1 class="entry-title">
4
+ <a href="<%== @post.url %>" rel="bookmark" title="Permalink for this post">
5
+ <%== @post.title %>
6
+ </a>
7
+ </h1>
8
+
9
+ <address class="vcard author">
10
+ <a class="email fn"
11
+ href="mailto:<%== Thoth::Config.admin['email'] %>"><%== Thoth::Config.admin['name'] %></a>
12
+ </address>
13
+
14
+ <span class="date robots-nocontent">
15
+ <abbr class="published" title="<%= @post.created_at.xmlschema %>">
16
+ <%= @post.created_at(Thoth::Config.timestamp['long']) %>
17
+ </abbr>
18
+ </span>
19
+ </div>
20
+
21
+ <div class="bd entry-content">
22
+ <%= @post.body_rendered %>
23
+ </div>
24
+
25
+ <div class="ft">
26
+ <% unless @post.tags.empty? %>
27
+ <div class="tags">
28
+ <span class="icon tag"></span>
29
+ <ul>
30
+ <% @post.tags.each do |tag| %>
31
+ <li><a href="<%== tag.url %>" rel="tag"><%== tag.name %></a></li>
32
+ <% end %>
33
+ </ul>
34
+ </div>
35
+ <% end %>
36
+
37
+ <% if @post.allow_comments && Thoth::Config.site['enable_comments'] %>
38
+ <div class="meta robots-nocontent">
39
+ <span class="icon comment-post"></span>
40
+ <a href="<%== @post.url %>#post-comment">Post a comment</a>
41
+ </div>
42
+ <% end %>
43
+ </div>
44
+ </div>
45
+
46
+ <% if Thoth::Config.site['enable_comments'] && (@post.allow_comments || @post.comments.count > 0) %>
47
+ <%= Thoth::PostController.render_view(:comments, :comments => @comments) %>
48
+ <% end %>