blogit 1.0.0.rc1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -31
- data/Rakefile +6 -2
- data/app/assets/stylesheets/blogit/themes/default.css +4 -0
- data/app/assets/stylesheets/blogit/themes/default.css.map +7 -0
- data/app/assets/stylesheets/blogit/themes/default.min.css +2 -0
- data/app/assets/stylesheets/blogit/themes/default.min.css.map +7 -0
- data/app/assets/stylesheets/blogit/themes/default.sass +2 -0
- data/app/assets/stylesheets/blogit/themes/default/base/_colors.sass +1 -0
- data/app/assets/stylesheets/blogit/themes/default/base/_typography.sass +1 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_archives.sass +18 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_comments.sass +7 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_forms.sass +9 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_headers.sass +4 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_posts.sass +8 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_related_posts_list.sass +3 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_share_bars.sass +7 -0
- data/app/{views/blogit/posts/_no_comments.html.erb → assets/stylesheets/blogit/themes/default/blocks/_tag_list.sass} +0 -0
- data/app/assets/stylesheets/blogit/themes/default/blocks/_tags.sass +4 -0
- data/app/controllers/blogit/application_controller.rb +15 -31
- data/app/controllers/blogit/comments_controller.rb +48 -30
- data/app/controllers/blogit/posts_controller.rb +52 -86
- data/app/helpers/blogit/application_helper.rb +59 -69
- data/app/helpers/blogit/comments_helper.rb +20 -0
- data/app/helpers/blogit/layout_helper.rb +33 -0
- data/app/helpers/blogit/posts_helper.rb +36 -34
- data/app/models/blogit/post.rb +55 -6
- data/app/views/blogit/archive/_list.html.erb +5 -0
- data/app/views/blogit/archive/_month.html.erb +9 -0
- data/app/views/blogit/archive/_year.html.erb +7 -0
- data/app/views/blogit/{posts → comments}/_active_record_comments.html.erb +2 -1
- data/app/views/blogit/comments/_comment.html.erb +10 -14
- data/app/views/blogit/comments/_comments_count.html.erb +8 -0
- data/app/views/blogit/{posts → comments}/_disqus_comments.html.erb +0 -0
- data/app/views/blogit/comments/_form.html.erb +25 -18
- data/app/views/blogit/comments/_no_comments.html.erb +0 -0
- data/app/views/blogit/comments/create.js.erb +2 -2
- data/app/views/blogit/posts/_archiveable.html.erb +3 -0
- data/app/views/blogit/posts/_blog_post_spacer.html.erb +1 -1
- data/app/views/blogit/posts/_blogger_information.html.erb +9 -4
- data/app/views/blogit/posts/_meta_tags.html.erb +32 -0
- data/app/views/blogit/posts/_post.html.erb +6 -9
- data/app/views/blogit/posts/_post_footer.html.erb +1 -0
- data/app/views/blogit/posts/_post_head.html.erb +3 -2
- data/app/views/blogit/posts/_related.html.erb +7 -16
- data/app/views/blogit/posts/_related_post.html.erb +4 -0
- data/app/views/blogit/posts/_share_bar.html.erb +5 -6
- data/app/views/blogit/posts/_tags.html.erb +8 -0
- data/app/views/blogit/posts/index.html.erb +16 -11
- data/app/views/blogit/posts/show.html.erb +28 -4
- data/app/views/blogit/tags/_tag.html.erb +3 -0
- data/config/locales/en.yml +3 -2
- data/config/spring.rb +1 -0
- data/db/migrate/20150618184415_add_description_to_posts.rb +5 -0
- data/lib/blogit.rb +4 -5
- data/lib/blogit/archive.rb +8 -0
- data/lib/blogit/archive/archive_error.rb +3 -0
- data/lib/blogit/archive/archiveable.rb +20 -0
- data/lib/blogit/archive/list.rb +52 -0
- data/lib/blogit/archive/month.rb +34 -0
- data/lib/blogit/archive/year.rb +40 -0
- data/lib/blogit/blogs.rb +11 -5
- data/lib/blogit/configuration.rb +157 -147
- data/lib/blogit/parsers/html_parser.rb +6 -3
- data/lib/blogit/parsers/markdown_parser.rb +30 -5
- data/lib/blogit/parsers/textile_parser.rb +18 -8
- data/lib/blogit/renderers/html_with_albino.rb +1 -1
- data/lib/blogit/version.rb +1 -1
- data/lib/generators/templates/blogit.rb +23 -57
- data/lib/tasks/blogit.rake +42 -0
- data/lib/tasks/blogit/css.rake +22 -0
- data/lib/tasks/blogit/doc.rake +21 -0
- data/lib/tasks/seed_blog_posts.yml +95 -0
- data/lib/validators/absence_validator.rb +2 -2
- data/spec/blogit_spec.rb +3 -3
- data/spec/controllers/blogit/comments_controller_spec.rb +31 -86
- data/spec/controllers/blogit/posts_controller_spec.rb +33 -344
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/stylesheets/application.sass +7 -0
- data/spec/dummy/app/assets/stylesheets/base.sass +1 -0
- data/spec/dummy/app/assets/stylesheets/base/_html.sass +15 -0
- data/spec/dummy/app/assets/stylesheets/blocks.sass +1 -0
- data/spec/dummy/app/assets/stylesheets/blocks/_layout.sass +21 -0
- data/spec/dummy/app/views/layouts/application.html.erb +21 -18
- data/spec/dummy/app/views/layouts/custom.html.erb +2 -1
- data/spec/dummy/config.ru +0 -1
- data/spec/dummy/config/application.rb +1 -0
- data/spec/dummy/config/database.yml +5 -3
- data/spec/dummy/config/environments/production.rb +7 -2
- data/spec/dummy/config/environments/test.rb +6 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/{20140511174024_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb → 20150619080551_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb} +0 -0
- data/spec/dummy/db/migrate/{20140511174025_add_missing_unique_indices.acts_as_taggable_on_engine.rb → 20150619080552_add_missing_unique_indices.acts_as_taggable_on_engine.rb} +0 -0
- data/spec/dummy/db/migrate/{20140511174026_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb → 20150619080553_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb} +0 -0
- data/spec/dummy/db/migrate/20150619080554_add_missing_taggable_index.acts_as_taggable_on_engine.rb +10 -0
- data/spec/dummy/db/migrate/20150619080555_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +10 -0
- data/spec/dummy/db/schema.rb +9 -7
- data/spec/dummy/db/seeds.rb +17 -0
- data/spec/dummy/lib/tasks/dummy.rake +29 -0
- data/spec/dummy/log/development.log +22286 -1489
- data/spec/dummy/log/test.log +4608 -11518
- data/spec/factories.rb +10 -5
- data/spec/helpers/blogit/application_helper_spec.rb +10 -73
- data/spec/helpers/blogit/posts_helper_spec.rb +8 -63
- data/spec/injectables/dummy_archiveable.rb +6 -0
- data/spec/lib/archive/list_spec.rb +60 -0
- data/spec/lib/archive/month_spec.rb +17 -0
- data/spec/lib/archive/year_spec.rb +38 -0
- data/spec/lib/blogit/parsers/html_parser_spec.rb +1 -1
- data/spec/lib/blogit/parsers/markdown_parser_spec.rb +7 -6
- data/spec/lib/blogit/parsers/textile_parser_spec.rb +1 -1
- data/spec/lib/blogs_spec.rb +2 -2
- data/spec/lib/configuration_spec.rb +21 -49
- data/spec/models/blogit/comment_spec.rb +19 -19
- data/spec/models/blogit/post_spec.rb +63 -28
- data/spec/rails_helper.rb +28 -0
- data/spec/spec_helper.rb +2 -11
- data/spec/support/helpers/css_matchers.rb +42 -0
- metadata +193 -124
- data/app/assets/stylesheets/blogit/index.css +0 -84
- data/app/views/blogit/comments/_admin_links.html.erb +0 -3
- data/app/views/blogit/posts/_comments_count.html.erb +0 -5
- data/app/views/blogit/posts/_form.html.erb +0 -49
- data/app/views/blogit/posts/_post_body.html.erb +0 -1
- data/app/views/blogit/posts/_post_links.html.erb +0 -6
- data/app/views/blogit/posts/edit.html.erb +0 -3
- data/app/views/blogit/posts/new.html.erb +0 -3
- data/lib/tasks/blog_tasks.rake +0 -4
- data/spec/dummy/app/assets/stylesheets/application.css +0 -21
- data/spec/dummy/config/initializers/blogit.rb +0 -88
- data/spec/dummy/db/migrate/20140511174028_create_blogit_posts.blogit.rb +0 -16
- data/spec/dummy/db/migrate/20140511174029_create_blogit_comments.blogit.rb +0 -16
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/tmp/cache/assets/CB5/DD0/sprockets%2F346324d2a51df58457807bee661c449c +0 -0
- data/spec/dummy/tmp/cache/assets/CB6/ED0/sprockets%2F4390d06699f3ad4262e342be530f9f91 +0 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/230/sprockets%2F6f493a817d97133a8dbf674bcd322670 +0 -0
- data/spec/dummy/tmp/cache/assets/CEA/490/sprockets%2F9697d4fb1ed26d80f3c715611c8d4373 +0 -0
- data/spec/dummy/tmp/cache/assets/CEE/310/sprockets%2F89642af8492e579dcd7162a0e2b7f155 +0 -0
- data/spec/dummy/tmp/cache/assets/D01/8C0/sprockets%2F332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
- data/spec/dummy/tmp/cache/assets/D11/CC0/sprockets%2F3a12dfa6665b5318fa99d097203ac7e7 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/1E0/sprockets%2Ffbaabd57fa2c9d426f0c318156705667 +0 -0
- data/spec/dummy/tmp/cache/assets/D3E/920/sprockets%2F3efa8d0fc958c223647cb704183b65ca +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/D61/6F0/sprockets%2F02da53eeca228bcef0c49278517111fe +0 -0
- data/spec/dummy/tmp/cache/assets/DCA/9B0/sprockets%2Fdf0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/E02/A60/sprockets%2Fb32faeede196f7a933c3a2794e7ed0bd +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/02da53eeca228bcef0c49278517111fe +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2ff93f9f5ed9970021c7704ff93237c8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/346324d2a51df58457807bee661c449c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3a12dfa6665b5318fa99d097203ac7e7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3ed52366904e135bd833590814b6ac6d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4390d06699f3ad4262e342be530f9f91 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6f493a817d97133a8dbf674bcd322670 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/89642af8492e579dcd7162a0e2b7f155 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/89dc196c51ae83634b664c0c33052008 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8dd8236b00c868ba248fe30cd9c14c2a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9239a04d094a872c1cf77ac391072ea8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b3ffb6bd243399012806331ce393ae4f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d53accc3e58037ee4005e41221b8846b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/df0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/routing/post_routing_spec.rb +0 -49
@@ -0,0 +1,8 @@
|
|
1
|
+
<%= content_tag(:div, class: "blogit_post__comments_count",
|
2
|
+
id: "blogit_post_#{post.id}__comments_count") do %>
|
3
|
+
|
4
|
+
<%= link_to(post_path(post, anchor: "comments")) do %>
|
5
|
+
<%= t(:comments_count, scope: 'blogit.posts', count: post.comments_count) %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% end %>
|
File without changes
|
@@ -1,41 +1,48 @@
|
|
1
|
+
<%= form_for [post, comment], remote: blogit_conf.ajax_comments,
|
2
|
+
html: { class: "blogit_form" } do |f| -%>
|
1
3
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<p><%=t :leave_a_comment, scope: 'blogit.comments'%></p>
|
4
|
+
<h3 class="blogit_form__header">
|
5
|
+
<%= t :leave_a_comment, scope: 'blogit.comments' %>
|
6
|
+
</h3>
|
7
7
|
|
8
8
|
<%= field class: "hidden" do %>
|
9
|
-
<%= f.label :nickname
|
10
|
-
|
11
|
-
|
9
|
+
<%= f.label :nickname, "Nickname (Hide me using CSS)",
|
10
|
+
class: "blogit_form__label" %>
|
11
|
+
<%= f.text_field :nickname, class: "blogit_form__field" %>
|
12
12
|
<% end %>
|
13
13
|
|
14
14
|
<%= field do %>
|
15
|
-
<%= f.label :name, t(:name, scope: 'blogit.comments')
|
16
|
-
|
15
|
+
<%= f.label :name, t(:name, scope: 'blogit.comments'),
|
16
|
+
class: "blogit_form__label" %>
|
17
|
+
<%= f.text_field :name, class: "blogit_form__field", required: true %>
|
17
18
|
<%= errors_on(comment, :name) %>
|
18
19
|
<% end %>
|
19
20
|
|
20
21
|
<%= field do %>
|
21
|
-
<%= f.label :email, t(:email_never_displayed, scope: 'blogit.comments')
|
22
|
-
|
22
|
+
<%= f.label :email, t(:email_never_displayed, scope: 'blogit.comments'),
|
23
|
+
class: "blogit_form__label" %>
|
24
|
+
<%= f.email_field :email, class: "blogit_form__field", required: true %>
|
23
25
|
<%= errors_on(comment, :email) %>
|
24
26
|
<% end %>
|
25
27
|
|
26
28
|
<%= field do %>
|
27
|
-
<%= f.label :website, t(:your_website, scope: 'blogit.comments')
|
28
|
-
|
29
|
+
<%= f.label :website, t(:your_website, scope: 'blogit.comments'),
|
30
|
+
class: "blogit_form__label" %>
|
31
|
+
<%= f.url_field :website, class: "blogit_form__field" %>
|
29
32
|
<%= errors_on(comment, :website) %>
|
30
33
|
<% end %>
|
31
34
|
|
32
35
|
<%= field do %>
|
33
|
-
<%= f.label :body, t(:your_comment, scope: 'blogit.comments')
|
34
|
-
|
36
|
+
<%= f.label :body, t(:your_comment, scope: 'blogit.comments'),
|
37
|
+
class: "blogit_form__label" %>
|
38
|
+
<%= f.text_area :body, required: true,
|
39
|
+
class: "blogit_form__field blogit_form__field--textarea" %>
|
35
40
|
<%= errors_on(comment, :body) %>
|
36
41
|
<% end %>
|
37
42
|
|
38
43
|
<%= actions do %>
|
39
|
-
<%= f.submit t(:add_comment, scope: 'blogit.comments'),
|
44
|
+
<%= f.submit t(:add_comment, scope: 'blogit.comments'),
|
45
|
+
disable_with: t(:adding_comment, scope: 'blogit.comments') %>
|
40
46
|
<% end %>
|
41
|
-
|
47
|
+
|
48
|
+
<% end -%>
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
|
-
var $form = $("form
|
1
|
+
var $form = $("form.blogit_form");
|
2
2
|
<% if @comment.save %>
|
3
|
-
$("
|
3
|
+
$(".blogit_comments_list").append("<%= escape_javascript(render(@comment)) %>");
|
4
4
|
$form.get(0).reset();
|
5
5
|
<% else %>
|
6
6
|
$form.html("<%= escape_javascript(render(partial:'form', locals: { post: @comment.post, comment: @comment })) %>");
|
@@ -1 +1 @@
|
|
1
|
-
<hr class="
|
1
|
+
<hr class="blogit_post_spacer">
|
@@ -1,4 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%=
|
4
|
-
|
1
|
+
<div class="blogit_post__information">
|
2
|
+
<span class="blogit_post__blogger">
|
3
|
+
<%= t(:written_by, scope: 'blogit.posts',
|
4
|
+
author: post.blogger_display_name) %>
|
5
|
+
</span>
|
6
|
+
|
7
|
+
<%= time_tag(post.created_at, pubdate: true,
|
8
|
+
class: "blogit_post__published_at" ,format: blogit_conf.datetime_format) %>
|
9
|
+
</div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%= tag(:meta, name: "description", content: description) %>
|
2
|
+
<%= tag(:meta, property: "author", content: post.blogger_display_name) %>
|
3
|
+
|
4
|
+
<!-- Open Graph Tags: http://ogp.me -->
|
5
|
+
<%= tag(:meta, property: "og:site_name", content: "") %>
|
6
|
+
<%= tag(:meta, property: "og:url", content: url_for(params)) %>
|
7
|
+
<%= tag(:meta, property: "og:title", content: title) %>
|
8
|
+
<%= tag(:meta, property: "og:description", content: description) %>
|
9
|
+
<%= tag(:meta, property: "og:type", content: "article") %>
|
10
|
+
<% # TODO: Support images in blogit (sorry) %>
|
11
|
+
<%= tag(:meta, property: "og:image", content: nil) %>
|
12
|
+
|
13
|
+
<% for tag_name in post.tags.map(&:name) do%>
|
14
|
+
<%= tag(:meta, property: "article:tag", content: tag_name) %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% # TODO: Support published time %>
|
18
|
+
<%= tag(:meta, property: "article:published_time",
|
19
|
+
content: post.created_at.to_s(:iso8601)) %>
|
20
|
+
|
21
|
+
<%= tag(:meta, property: "article:modified_time",
|
22
|
+
content: post.updated_at.to_s(:iso8601)) %>
|
23
|
+
|
24
|
+
<!-- Twitter Card tags -->
|
25
|
+
<%= tag(:meta, property: "twitter:card", content: "summary_large_image") %>
|
26
|
+
<%= tag(:meta, property: "twitter:site", content: blogit_conf.twitter_username) %>
|
27
|
+
<%= tag(:meta, property: "twitter:creator",
|
28
|
+
content: post.blogger_twitter_username || blogit_conf.twitter_username) %>
|
29
|
+
<%= tag(:meta, property: "twitter:title", content: title) %>
|
30
|
+
<%= tag(:meta, property: "twitter:description", content: description) %>
|
31
|
+
<% # TODO: Support images in blogit (sorry) %>
|
32
|
+
<%= tag(:meta, property: "twitter:time", content: nil) %>
|
@@ -1,16 +1,13 @@
|
|
1
|
-
<%= content_tag(:article, id: "
|
1
|
+
<%= content_tag(:article, id: "blogit_post_#{post.id}",
|
2
|
+
class: "blogit_post blog_post--is_preview") do %>
|
2
3
|
|
3
4
|
<%# Render the header for this blog post %>
|
4
5
|
<%= render "blogit/posts/post_head", post: post %>
|
5
|
-
|
6
|
-
<%# Render the body of this blog post (as Markdown) %>
|
7
|
-
<%= render "blogit/posts/post_body", post: post %>
|
8
|
-
|
9
|
-
<%# Render admin links to edit/delete this post %>
|
10
|
-
<%= render "blogit/posts/post_links", post: post %>
|
11
|
-
|
12
|
-
<%# Render info about the person who wrote this post %>
|
6
|
+
|
13
7
|
<%= render "blogit/posts/blogger_information", post: post %>
|
8
|
+
|
9
|
+
<%# Render the body of this blog post (as Markdown) %>
|
10
|
+
<%= format_content(blogit_conf.show_post_description ? post.description : post.body) %>
|
14
11
|
|
15
12
|
<%# Render the no. of comments %>
|
16
13
|
<%= render "blogit/posts/comments_count",
|
@@ -0,0 +1 @@
|
|
1
|
+
<% # Left blank, but it's here to replace if you want a post footer %>
|
@@ -1,18 +1,9 @@
|
|
1
|
-
<div id="
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
</ul>
|
9
|
-
</div>
|
10
|
-
<div id="blog_related_posts">
|
11
|
-
<h2><%= t :related_posts, :scope => "blogit.posts" %></h2>
|
12
|
-
<ul>
|
13
|
-
<% post.find_related_on_tags.each do |other_post| %>
|
14
|
-
<li><%= link_to other_post.title, post_path(other_post) %></li>
|
15
|
-
<% end %>
|
16
|
-
</ul>
|
1
|
+
<div id="blogit_related_posts">
|
2
|
+
<h3 class="blogit_related_posts__header blogit_header--section">
|
3
|
+
<%= t :related_posts, :scope => "blogit.posts" %>
|
4
|
+
</h3>
|
5
|
+
<div class="blogit_related_posts__list">
|
6
|
+
<%= render partial: "blogit/posts/related_post",
|
7
|
+
collection: related_posts_for_post(post), as: :related_post %>
|
17
8
|
</div>
|
18
9
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<div id="
|
1
|
+
<div id="blogit_share_bar">
|
2
2
|
|
3
|
-
<div
|
3
|
+
<div class="blogit_share_bar__social_button blogit_share_bar__social_button--google_plus">
|
4
4
|
<!-- GOOGLE +1 -->
|
5
5
|
<g:plusone size="medium"></g:plusone>
|
6
6
|
<script type="text/javascript">
|
@@ -15,8 +15,7 @@
|
|
15
15
|
<!-- /GOOGLE +1 -->
|
16
16
|
</div>
|
17
17
|
|
18
|
-
<div
|
19
|
-
<!-- TWITTER -->
|
18
|
+
<div class="blogit_share_bar__social_button blogit_share_bar__social_button--twitter"> <!-- TWITTER -->
|
20
19
|
<a href="https://twitter.com/share" class="twitter-share-button"
|
21
20
|
data-lang="<%= I18n.default_locale %>"
|
22
21
|
data-url="http://<%= request.host_with_port %><%= request.path.gsub("//","/") %>"
|
@@ -28,7 +27,7 @@
|
|
28
27
|
<!-- /TWITTER -->
|
29
28
|
</div>
|
30
29
|
|
31
|
-
<div
|
30
|
+
<div class="blogit_share_bar__social_button blogit_share_bar__social_button--facebook">
|
32
31
|
<!-- FACEBOOK LIKE -->
|
33
32
|
<div id="fb-root"></div>
|
34
33
|
<script>(function(d, s, id) {
|
@@ -42,4 +41,4 @@
|
|
42
41
|
<!-- /FACEBOOK LIKE -->
|
43
42
|
</div>
|
44
43
|
|
45
|
-
</div>
|
44
|
+
</div>
|
@@ -1,17 +1,22 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<% if params[:tag] %>
|
2
|
+
<h2 class="blogit_header--page">
|
3
|
+
<%= t(:showing_posts_tagged_with, scope: "blogit.posts", tag: params[:tag]) %>
|
4
|
+
</h2>
|
3
5
|
<% end %>
|
4
6
|
|
5
|
-
|
7
|
+
<div class="blogit_posts_list">
|
8
|
+
<% if @posts.any? %>
|
9
|
+
<%= render partial: "blogit/posts/post",
|
10
|
+
collection: @posts,
|
11
|
+
spacer_template: "blog_post_spacer",
|
12
|
+
locals: {
|
13
|
+
show_comments_count: (Blogit.configuration.include_comments == :active_records)
|
14
|
+
} %>
|
15
|
+
<% else %>
|
6
16
|
|
7
|
-
|
8
|
-
collection: @posts,
|
9
|
-
spacer_template: "blog_post_spacer",
|
10
|
-
locals: {show_comments_count: (Blogit.configuration.include_comments == :active_records) } %>
|
11
|
-
<% else %>
|
17
|
+
<%= render partial: "blogit/posts/empty" %>
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
<% end %>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
16
21
|
|
17
22
|
<%= render "pagination" %>
|
@@ -1,4 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<%=
|
1
|
+
<% title @post.title %>
|
2
|
+
<% description @post.description.to_s %>
|
3
|
+
|
4
|
+
<%= content_tag(:article, id: "blogit_post_#{@post.id}", class: "blogit_post") do %>
|
5
|
+
|
6
|
+
|
7
|
+
<%# Render the header for this blog post %>
|
8
|
+
<%= render "blogit/posts/post_head", post: @post %>
|
9
|
+
|
10
|
+
<%= render "blogit/posts/blogger_information", post: @post %>
|
11
|
+
|
12
|
+
<%# Render the body of this blog post (as Markdown) %>
|
13
|
+
<%= format_content(@post.body) %>
|
14
|
+
|
15
|
+
<%# Render info about the person who wrote this post %>
|
16
|
+
<%= share_bar_for_post @post %>
|
17
|
+
|
18
|
+
<%# Render the no. of comments %>
|
19
|
+
<%= render "blogit/posts/comments_count",
|
20
|
+
post: post if defined?(show_comments_count) and show_comments_count %>
|
21
|
+
|
22
|
+
<%= render "blogit/posts/tags", post: @post %>
|
23
|
+
<%= render "blogit/posts/related", post: @post %>
|
24
|
+
|
25
|
+
<%= comments_for_post @post %>
|
26
|
+
|
27
|
+
<% end %>
|
28
|
+
|
data/config/locales/en.yml
CHANGED
@@ -15,6 +15,7 @@ en:
|
|
15
15
|
successfully_added_comment: "Successfully added comment!"
|
16
16
|
successfully_removed_comment: "Successfully removed comment."
|
17
17
|
posts:
|
18
|
+
showing_posts_tagged_with: "Showing posts tagged with \"%{tag}\""
|
18
19
|
written_by: "Written by %{author} on"
|
19
20
|
prohibited_this_post_from_being_saved:
|
20
21
|
one: "One error prohibited this post form being saved:"
|
@@ -38,10 +39,10 @@ en:
|
|
38
39
|
blog_post_was_successfully_destroyed: "Blog post was successfully destroyed."
|
39
40
|
related_posts: "Related posts"
|
40
41
|
tag_placeholder: "Add tags to your post"
|
41
|
-
|
42
|
+
tags: "Tags"
|
43
|
+
state: "State"
|
42
44
|
share_bar:
|
43
45
|
facebook: "en_US"
|
44
|
-
|
45
46
|
time:
|
46
47
|
formats:
|
47
48
|
plain_month_only: "%B"
|
data/config/spring.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Spring.application_root = "./spec/dummy"
|
data/lib/blogit.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Third-party requirements
|
2
2
|
require "kaminari"
|
3
3
|
require "redcarpet"
|
4
|
-
require "pingr"
|
5
4
|
|
6
5
|
require "blogit/configuration"
|
7
6
|
require "blogit/blogs"
|
@@ -17,14 +16,14 @@ module Blogit
|
|
17
16
|
# Exception raised when gem may not be configured properly
|
18
17
|
class ConfigurationError < StandardError;end
|
19
18
|
|
20
|
-
# Set global configuration options for Blogit
|
21
|
-
# @see README.md
|
19
|
+
# Set global configuration options for Blogit. {file:README.md read more}
|
22
20
|
def self.configure(&block)
|
23
21
|
block.call(configuration)
|
24
22
|
end
|
25
23
|
|
26
|
-
#
|
27
|
-
#
|
24
|
+
# Blogit's global configuration.
|
25
|
+
#
|
26
|
+
# Returns a Configuration
|
28
27
|
def self.configuration
|
29
28
|
@configuration ||= Configuration.new
|
30
29
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Blogit
|
2
|
+
module Archive
|
3
|
+
|
4
|
+
# This class is for documentation only, to define the Archiveable type
|
5
|
+
class Archiveable
|
6
|
+
|
7
|
+
# Archiveables must respond to :published_at and return a DateTime object.
|
8
|
+
attr_accessor :published_at
|
9
|
+
|
10
|
+
# Do not use this.
|
11
|
+
#
|
12
|
+
# Raises an exception.
|
13
|
+
def initialize
|
14
|
+
raise "Can't initialize an Archiveable. Class is for documentation only."
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Blogit
|
2
|
+
module Archive
|
3
|
+
|
4
|
+
# Public: The main class to be accessed when creating a HTML post archive.
|
5
|
+
class List
|
6
|
+
|
7
|
+
# Gets/Sets the list of years for this archive object.
|
8
|
+
attr_accessor :years
|
9
|
+
|
10
|
+
# Gets/Sets the list of _{Archiveable archiveable}_ objects for this Archive List.
|
11
|
+
attr_accessor :archiveables
|
12
|
+
|
13
|
+
# Create a new {List List} object
|
14
|
+
#
|
15
|
+
# archiveables - A collection of _archiveable_ objects. An archiveable is any
|
16
|
+
# object that responds to published_at.
|
17
|
+
#
|
18
|
+
def initialize(archiveables)
|
19
|
+
@archiveables = archiveables
|
20
|
+
ensure_archiveables_are_valid
|
21
|
+
@years = create_years_from_archiveables
|
22
|
+
end
|
23
|
+
|
24
|
+
# The name of the partial to load for a {List List} object
|
25
|
+
#
|
26
|
+
# Returns a String
|
27
|
+
def to_partial_path
|
28
|
+
self.class.name.underscore
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
|
35
|
+
def ensure_archiveables_are_valid
|
36
|
+
return true unless archiveables.detect { |a| !a.respond_to?(:published_at) }
|
37
|
+
raise Blogit::Archive::ArchiveError,
|
38
|
+
"Invalid archive object detected. Please make sure your archiveable objects \
|
39
|
+
respond to :published_at."
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_years_from_archiveables
|
43
|
+
years_with_archiveables.map { |year, archs| Year.new(year, archs) }
|
44
|
+
end
|
45
|
+
|
46
|
+
def years_with_archiveables
|
47
|
+
archiveables.chunk { |a| a.published_at.year }
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|