rethoth 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +26 -0
- data/bin/thoth +233 -0
- data/lib/proto/config.ru +45 -0
- data/lib/proto/thoth.conf.sample +206 -0
- data/lib/thoth/cache.rb +53 -0
- data/lib/thoth/config.rb +158 -0
- data/lib/thoth/controller/admin.rb +75 -0
- data/lib/thoth/controller/api/comment.rb +73 -0
- data/lib/thoth/controller/api/page.rb +134 -0
- data/lib/thoth/controller/api/post.rb +122 -0
- data/lib/thoth/controller/api/tag.rb +59 -0
- data/lib/thoth/controller/archive.rb +50 -0
- data/lib/thoth/controller/comment.rb +173 -0
- data/lib/thoth/controller/main.rb +193 -0
- data/lib/thoth/controller/media.rb +172 -0
- data/lib/thoth/controller/page.rb +167 -0
- data/lib/thoth/controller/post.rb +310 -0
- data/lib/thoth/controller/search.rb +86 -0
- data/lib/thoth/controller/tag.rb +107 -0
- data/lib/thoth/controller.rb +48 -0
- data/lib/thoth/errors.rb +35 -0
- data/lib/thoth/helper/admin.rb +86 -0
- data/lib/thoth/helper/cookie.rb +45 -0
- data/lib/thoth/helper/error.rb +122 -0
- data/lib/thoth/helper/pagination.rb +131 -0
- data/lib/thoth/helper/wiki.rb +77 -0
- data/lib/thoth/helper/ysearch.rb +89 -0
- data/lib/thoth/importer/pants.rb +81 -0
- data/lib/thoth/importer/poseidon.rb +54 -0
- data/lib/thoth/importer/thoth.rb +103 -0
- data/lib/thoth/importer.rb +131 -0
- data/lib/thoth/layout/default.rhtml +47 -0
- data/lib/thoth/middleware/minify.rb +82 -0
- data/lib/thoth/migrate/001_create_schema.rb +108 -0
- data/lib/thoth/migrate/002_add_media_size.rb +37 -0
- data/lib/thoth/migrate/003_add_post_draft.rb +38 -0
- data/lib/thoth/migrate/004_add_comment_email.rb +37 -0
- data/lib/thoth/migrate/005_add_page_position.rb +37 -0
- data/lib/thoth/migrate/006_add_comment_close_delete.rb +43 -0
- data/lib/thoth/migrate/007_add_comment_summary.rb +37 -0
- data/lib/thoth/model/comment.rb +216 -0
- data/lib/thoth/model/media.rb +87 -0
- data/lib/thoth/model/page.rb +204 -0
- data/lib/thoth/model/post.rb +262 -0
- data/lib/thoth/model/tag.rb +80 -0
- data/lib/thoth/model/tags_posts_map.rb +34 -0
- data/lib/thoth/monkeypatch/sequel/model/errors.rb +37 -0
- data/lib/thoth/plugin/thoth_delicious.rb +105 -0
- data/lib/thoth/plugin/thoth_flickr.rb +86 -0
- data/lib/thoth/plugin/thoth_pinboard.rb +98 -0
- data/lib/thoth/plugin/thoth_tags.rb +68 -0
- data/lib/thoth/plugin/thoth_twitter.rb +175 -0
- data/lib/thoth/plugin.rb +59 -0
- data/lib/thoth/public/css/admin.css +223 -0
- data/lib/thoth/public/css/thoth.css +592 -0
- data/lib/thoth/public/images/admin-sprite.png +0 -0
- data/lib/thoth/public/images/thoth-sprite.png +0 -0
- data/lib/thoth/public/js/admin/comments.js +116 -0
- data/lib/thoth/public/js/admin/name.js +244 -0
- data/lib/thoth/public/js/admin/tagcomplete.js +332 -0
- data/lib/thoth/public/js/lazyload-min.js +4 -0
- data/lib/thoth/public/js/thoth.js +203 -0
- data/lib/thoth/public/robots.txt +5 -0
- data/lib/thoth/version.rb +37 -0
- data/lib/thoth/view/admin/index.rhtml +1 -0
- data/lib/thoth/view/admin/login.rhtml +23 -0
- data/lib/thoth/view/admin/toolbar.rhtml +117 -0
- data/lib/thoth/view/admin/welcome.rhtml +58 -0
- data/lib/thoth/view/archive/index.rhtml +24 -0
- data/lib/thoth/view/comment/comment.rhtml +47 -0
- data/lib/thoth/view/comment/delete.rhtml +15 -0
- data/lib/thoth/view/comment/form.rhtml +81 -0
- data/lib/thoth/view/comment/index.rhtml +68 -0
- data/lib/thoth/view/comment/list.rhtml +48 -0
- data/lib/thoth/view/media/delete.rhtml +15 -0
- data/lib/thoth/view/media/edit.rhtml +12 -0
- data/lib/thoth/view/media/form.rhtml +7 -0
- data/lib/thoth/view/media/list.rhtml +35 -0
- data/lib/thoth/view/media/media.rhtml +44 -0
- data/lib/thoth/view/media/new.rhtml +7 -0
- data/lib/thoth/view/page/delete.rhtml +15 -0
- data/lib/thoth/view/page/edit.rhtml +15 -0
- data/lib/thoth/view/page/form.rhtml +57 -0
- data/lib/thoth/view/page/index.rhtml +9 -0
- data/lib/thoth/view/page/list.rhtml +49 -0
- data/lib/thoth/view/page/new.rhtml +15 -0
- data/lib/thoth/view/post/comments.rhtml +12 -0
- data/lib/thoth/view/post/compact.rhtml +48 -0
- data/lib/thoth/view/post/delete.rhtml +15 -0
- data/lib/thoth/view/post/edit.rhtml +15 -0
- data/lib/thoth/view/post/form.rhtml +83 -0
- data/lib/thoth/view/post/index.rhtml +48 -0
- data/lib/thoth/view/post/list.rhtml +61 -0
- data/lib/thoth/view/post/new.rhtml +15 -0
- data/lib/thoth/view/post/tiny.rhtml +4 -0
- data/lib/thoth/view/search/index.rhtml +45 -0
- data/lib/thoth/view/tag/index.rhtml +34 -0
- data/lib/thoth/view/thoth/css.rhtml +9 -0
- data/lib/thoth/view/thoth/footer.rhtml +15 -0
- data/lib/thoth/view/thoth/header.rhtml +23 -0
- data/lib/thoth/view/thoth/index.rhtml +11 -0
- data/lib/thoth/view/thoth/js.rhtml +6 -0
- data/lib/thoth/view/thoth/sidebar.rhtml +38 -0
- data/lib/thoth/view/thoth/util/pager.rhtml +23 -0
- data/lib/thoth/view/thoth/util/simple_pager.rhtml +15 -0
- data/lib/thoth/view/thoth/util/table_sortheader.rhtml +20 -0
- data/lib/thoth.rb +394 -0
- metadata +409 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
<% if @drafts && @drafts.count > 0 %>
|
2
|
+
<h2>Draft Blog Posts</h2>
|
3
|
+
|
4
|
+
<table class="list posts drafts" summary="List of all draft blog posts">
|
5
|
+
<%= Thoth::MainController.render_view('util/table_sortheader') %>
|
6
|
+
<tfoot></tfoot>
|
7
|
+
<tbody>
|
8
|
+
<% row = 'even' %>
|
9
|
+
<% @drafts.all do |draft| %>
|
10
|
+
<tr class="<%= row == 'even' ? row = 'odd' : row = 'even' %>">
|
11
|
+
<td class="id"><%= draft.id %></td>
|
12
|
+
<td class="title">
|
13
|
+
<a href="<%== Thoth::PostController.r(:edit, draft.id) %>#post-form"><%== draft.title %></a>
|
14
|
+
</td>
|
15
|
+
<td class="created">
|
16
|
+
<%= draft.created_at(Thoth::Config.timestamp['short']) %>
|
17
|
+
</td>
|
18
|
+
<td class="updated">
|
19
|
+
<%= draft.updated_at(Thoth::Config.timestamp['short']) %>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<h2>Published Blog Posts</h2>
|
28
|
+
|
29
|
+
<%= Thoth::MainController.render_view('util/pager') %>
|
30
|
+
|
31
|
+
<table class="list posts" summary="List of all published blog posts">
|
32
|
+
<%= Thoth::MainController.render_view('util/table_sortheader') %>
|
33
|
+
<tfoot></tfoot>
|
34
|
+
<tbody>
|
35
|
+
<% row = 'even' %>
|
36
|
+
<% @posts.all do |post| %>
|
37
|
+
<tr class="<%= row == 'even' ? row = 'odd' : row = 'even' %>">
|
38
|
+
<td class="id"><%= post.id %></td>
|
39
|
+
<td class="title">
|
40
|
+
<a href="<%== post.url %>"><%== post.title %></a>
|
41
|
+
</td>
|
42
|
+
<td class="created">
|
43
|
+
<%= post.created_at(Thoth::Config.timestamp['short']) %>
|
44
|
+
</td>
|
45
|
+
<td class="updated">
|
46
|
+
<%= post.updated_at(Thoth::Config.timestamp['short']) %>
|
47
|
+
</td>
|
48
|
+
</tr>
|
49
|
+
<% end %>
|
50
|
+
|
51
|
+
<% if @pager.record_count == 0 %>
|
52
|
+
<tr class="empty">
|
53
|
+
<td colspan="4">
|
54
|
+
No blog posts to display.
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<% end %>
|
58
|
+
</tbody>
|
59
|
+
</table>
|
60
|
+
|
61
|
+
<%= Thoth::MainController.render_view('util/pager') %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<h2>New Blog Post</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,45 @@
|
|
1
|
+
<h2>Search Results</h2>
|
2
|
+
|
3
|
+
<div class="search">
|
4
|
+
<% unless @error.nil? %>
|
5
|
+
<p><%== @error %></p>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% if @data[:results].empty? %>
|
9
|
+
<p>There were no results for the query <strong><%== @query %></strong></p>
|
10
|
+
<% else %>
|
11
|
+
<p class="robots-nocontent">
|
12
|
+
Results
|
13
|
+
<strong><%== @data[:start] %></strong> -
|
14
|
+
<strong><%== @data[:end] %></strong> of about
|
15
|
+
<strong><%== @data[:available] %></strong> for
|
16
|
+
<strong><%== @query %></strong>
|
17
|
+
</p>
|
18
|
+
|
19
|
+
<%=
|
20
|
+
Thoth::MainController.render_view('util/simple_pager',
|
21
|
+
:prev_text => '« Prev',
|
22
|
+
:next_text => 'Next »')
|
23
|
+
%>
|
24
|
+
|
25
|
+
<ul>
|
26
|
+
<% @data[:results].each do |result| %>
|
27
|
+
<li>
|
28
|
+
<h4><a href="<%= result[:url] %>"><%= result[:title] %></a></h4>
|
29
|
+
<div class="summary"><%= result[:summary] %></div>
|
30
|
+
<span class="url"><%= result[:url].gsub(/https?:\/\//i, '') %></span>
|
31
|
+
</li>
|
32
|
+
<% end %>
|
33
|
+
</ul>
|
34
|
+
|
35
|
+
<%=
|
36
|
+
Thoth::MainController.render_view('util/simple_pager',
|
37
|
+
:prev_text => '« Prev',
|
38
|
+
:next_text => 'Next »')
|
39
|
+
%>
|
40
|
+
|
41
|
+
<p class="plug">
|
42
|
+
Powered by <a href="http://search.yahoo.com/">Yahoo! Search</a>
|
43
|
+
</p>
|
44
|
+
<% end %>
|
45
|
+
</div>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<h2>Posts tagged with "<%== @tag.name %>"</h2>
|
2
|
+
|
3
|
+
<div class="search">
|
4
|
+
<% if @pager.record_count == 0 %>
|
5
|
+
<p>There are no posts with this tag.</p>
|
6
|
+
<% else %>
|
7
|
+
<p class="robots-nocontent">
|
8
|
+
Displaying posts
|
9
|
+
<strong><%== @pager.current_page_record_range.first %></strong> -
|
10
|
+
<strong><%== @pager.current_page_record_range.last %></strong> of
|
11
|
+
<strong><%== @pager.record_count %></strong>
|
12
|
+
</p>
|
13
|
+
|
14
|
+
<%=
|
15
|
+
Thoth::MainController.render_view('util/pager',
|
16
|
+
:prev_text => '« Newer stuff',
|
17
|
+
:next_text => 'Older stuff »')
|
18
|
+
%>
|
19
|
+
|
20
|
+
<ul>
|
21
|
+
<% @posts.all do |post| %>
|
22
|
+
<li>
|
23
|
+
<%= Thoth::PostController.render_view(:tiny, :post => post) %>
|
24
|
+
</li>
|
25
|
+
<% end %>
|
26
|
+
</ul>
|
27
|
+
|
28
|
+
<%=
|
29
|
+
Thoth::MainController.render_view('util/pager',
|
30
|
+
:prev_text => '« Newer stuff',
|
31
|
+
:next_text => 'Older stuff »')
|
32
|
+
%>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<link rel="stylesheet" type="text/css" href="/css/thoth.css" />
|
2
|
+
|
3
|
+
<% if auth_key_valid? %>
|
4
|
+
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% Thoth::Config.site['css'].each do |url| %>
|
8
|
+
<link rel="stylesheet" type="text/css" href="<%== url %>" />
|
9
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div id="ft">
|
2
|
+
Copyright © <%= Time.now.year %>
|
3
|
+
|
4
|
+
<% if Thoth::Config.admin['email'].empty? %>
|
5
|
+
<%== Thoth::Config.admin['name'] %>.
|
6
|
+
<% else %>
|
7
|
+
<a href="mailto:<%== Thoth::Config.admin['email'] %>">
|
8
|
+
<%== Thoth::Config.admin['name'] %></a>.
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
All rights reserved.
|
12
|
+
|
13
|
+
<br />
|
14
|
+
Powered by <a href="http://thothblog.org/">Thoth</a>.
|
15
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div id="hd">
|
2
|
+
<h1>
|
3
|
+
<a href="<%== Thoth::MainController.r() %>" rel="home">
|
4
|
+
<%== Thoth::Config.site['name'] %>
|
5
|
+
</a>
|
6
|
+
</h1>
|
7
|
+
|
8
|
+
<div id="toolbar">
|
9
|
+
<div class="subtitle">
|
10
|
+
<%== Thoth::Config.site['desc'] %>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<ul class="robots-nocontent">
|
14
|
+
<li><a href="<%== Thoth::MainController.r() %>" rel="home">Home</a></li>
|
15
|
+
<li><a href="<%== Thoth::ArchiveController.r() %>">Archives</a></li>
|
16
|
+
<% if Thoth::Config.site['enable_comments'] %>
|
17
|
+
<li><a href="<%== Thoth::CommentController.r() %>">Comments</a></li>
|
18
|
+
<% end %>
|
19
|
+
</ul>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<%= Thoth::AdminController.render_view('toolbar') %>
|
23
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<div class="hfeed">
|
2
|
+
<% @posts.all do |post| %>
|
3
|
+
<%= Thoth::PostController.render_view('compact', :post => post) %>
|
4
|
+
<% end %>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<%=
|
8
|
+
render_view('util/pager',
|
9
|
+
:prev_text => '« Newer stuff',
|
10
|
+
:next_text => 'Older stuff »')
|
11
|
+
%>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<script type="text/javascript" src="/js/lazyload-min.js"></script>
|
2
|
+
<script type="text/javascript">
|
3
|
+
LazyLoad.js(['<%== (Thoth::Config.site["core_js"] + Thoth::Config.site["js"]).uniq.join("','") %>'], function () {
|
4
|
+
Thoth.init(<%== auth_key_valid? ? "true, '#{form_token}'" : '' %>);
|
5
|
+
});
|
6
|
+
</script>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div id="sidebar" class="robots-nocontent">
|
2
|
+
<dl>
|
3
|
+
<dt>Search</dt>
|
4
|
+
<dd>
|
5
|
+
<form id="search" action="http://www.google.com/search" method="get">
|
6
|
+
<p>
|
7
|
+
<input type="text" id="search-query" name="q" maxlength="255"
|
8
|
+
value="<%== request[:q] ? request[:q] : '' %>" />
|
9
|
+
<input type="hidden" name="sitesearch" value="<%== Thoth::Config.site['url'] %>" />
|
10
|
+
</p>
|
11
|
+
</form>
|
12
|
+
</dd>
|
13
|
+
|
14
|
+
<dt>Feeds</dt>
|
15
|
+
<dd>
|
16
|
+
<a href="<%= Thoth::MainController.r(:atom) %>" type="application/atom+xml">
|
17
|
+
<span class="icon feed"></span>
|
18
|
+
Posts
|
19
|
+
</a>
|
20
|
+
</dd>
|
21
|
+
<% if Thoth::Config.site['enable_comments'] %>
|
22
|
+
<dd>
|
23
|
+
<a href="<%= Thoth::CommentController.r(:atom) %>" type="application/atom+xml">
|
24
|
+
<span class="icon feed"></span>
|
25
|
+
Comments
|
26
|
+
</a>
|
27
|
+
</dd>
|
28
|
+
<% end %>
|
29
|
+
<% if @feeds; @feeds.each do |feed| %>
|
30
|
+
<dd>
|
31
|
+
<a href="<%== feed[:href] %>" rel="alternate" type="<%== feed[:type] %>">
|
32
|
+
<span class="icon feed"></span>
|
33
|
+
<%== feed[:title] %>
|
34
|
+
</a>
|
35
|
+
</dd>
|
36
|
+
<% end; end %>
|
37
|
+
</dl>
|
38
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% if @pager.navigation? %>
|
2
|
+
<div class="pg robots-nocontent">
|
3
|
+
<% if @pager.prev_url %>
|
4
|
+
<a rel="prev" class="prev" href="<%== @pager.prev_url %>">
|
5
|
+
<%= @prev_text || '« Previous' %>
|
6
|
+
</a>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% @pager.navigate do |page, url| %>
|
10
|
+
<% if page == @pager.current_page %>
|
11
|
+
<strong><%= page %></strong>
|
12
|
+
<% else %>
|
13
|
+
<a href="<%== url %>"><%= page %></a>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% if @pager.next_url %>
|
18
|
+
<a rel="next" class="next" href="<%== @pager.next_url %>">
|
19
|
+
<%= @next_text || 'Next »' %>
|
20
|
+
</a>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if @prev_url || @next_url %>
|
2
|
+
<div class="pg robots-nocontent">
|
3
|
+
<% if @prev_url %>
|
4
|
+
<a rel="prev" class="prev" href="<%== @prev_url %>">
|
5
|
+
<%= @prev_text || '« Previous' %>
|
6
|
+
</a>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% if @next_url %>
|
10
|
+
<a rel="next" class="next" href="<%== @next_url %>">
|
11
|
+
<%= @next_text || 'Next »' %>
|
12
|
+
</a>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<thead>
|
2
|
+
<tr>
|
3
|
+
<% @columns.each do |field| %>
|
4
|
+
<% label = field.to_s.capitalize.gsub(/_.*$/, '') %>
|
5
|
+
<th class="<%== field.to_s + (@sort == field ? ' sortfield' : '') %>">
|
6
|
+
<% if @nosort && @nosort.include?(field) %>
|
7
|
+
<%= label %>
|
8
|
+
<% else %>
|
9
|
+
<% if @sort == field %>
|
10
|
+
<span class="adminicon sort <%= @order %>"></span>
|
11
|
+
<% end %>
|
12
|
+
<% order = @sort == field ? (@order == :asc ? :desc : :asc) : :asc %>
|
13
|
+
<a href="<%== @sort_url %>?sort=<%= u(field) %>&order=<%= order %>">
|
14
|
+
<%= label %>
|
15
|
+
</a>
|
16
|
+
<% end %>
|
17
|
+
</th>
|
18
|
+
<% end %>
|
19
|
+
</tr>
|
20
|
+
</thead>
|