refinerycms-blog 1.8.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +54 -0
- data/.rspec +3 -0
- data/.travis.yml +18 -0
- data/Gemfile +68 -5
- data/Guardfile +20 -0
- data/Rakefile +21 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/cog.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/comment.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/comment_cross.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/comment_tick.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/comments.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/down.gif +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/folder.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/folder_add.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/folder_edit.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/page.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/page_add.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/page_copy.png +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/icons/up.gif +0 -0
- data/{public/images/refinerycms-blog → app/assets/images/refinery/blog}/rss-feed.png +0 -0
- data/app/assets/images/refinerycms-blog/.gitkeep +0 -0
- data/{public/javascripts/refinery/refinerycms-blog.js → app/assets/javascripts/refinery/blog/backend.js} +66 -1
- data/{public/javascripts/refinerycms-blog.js → app/assets/javascripts/refinery/blog/frontend.js} +0 -0
- data/app/assets/javascripts/refinerycms-blog/.gitkeep +0 -0
- data/app/assets/stylesheets/refinery/blog/backend.css.scss +73 -0
- data/{public/stylesheets/refinerycms-blog.css → app/assets/stylesheets/refinery/blog/frontend.css.scss} +3 -3
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-icons_ef8c08_256x240.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-icons_ffd27a_256x240.png +0 -0
- data/{public/stylesheets → app/assets/stylesheets/refinery/blog}/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
- data/{public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css → app/assets/stylesheets/refinery/blog/ui-lightness/jquery-ui-1.8.13.custom.css.scss} +0 -0
- data/app/assets/stylesheets/refinerycms-blog/.gitkeep +0 -0
- data/app/controllers/.gitkeep +0 -0
- data/app/controllers/refinery/blog/admin/categories_controller.rb +12 -0
- data/app/controllers/refinery/blog/admin/comments_controller.rb +49 -0
- data/app/controllers/refinery/blog/admin/posts_controller.rb +90 -0
- data/app/controllers/refinery/blog/admin/settings_controller.rb +55 -0
- data/app/controllers/refinery/blog/blog_controller.rb +17 -0
- data/app/controllers/refinery/blog/categories_controller.rb +12 -0
- data/app/controllers/refinery/blog/posts_controller.rb +84 -0
- data/app/helpers/.gitkeep +0 -0
- data/app/helpers/refinery/blog/controller_helper.rb +29 -0
- data/app/helpers/refinery/blog/posts_helper.rb +72 -0
- data/app/mailers/refinery/blog/comment_mailer.rb +14 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/refinery/blog/category.rb +23 -0
- data/app/models/refinery/blog/comment.rb +135 -0
- data/app/models/refinery/blog/comment_mailer.rb +1 -0
- data/app/models/refinery/blog/post.rb +115 -0
- data/app/models/refinery/categorization.rb +9 -0
- data/app/sweepers/refinery/blog_sweeper.rb +26 -0
- data/app/views/.gitkeep +0 -0
- data/app/views/{admin/blog → refinery/blog/admin}/_submenu.html.erb +21 -21
- data/app/views/{admin/blog → refinery/blog/admin}/categories/_category.html.erb +3 -3
- data/app/views/{admin/blog → refinery/blog/admin}/categories/_form.html.erb +4 -4
- data/app/views/{admin/blog/comments → refinery/blog/admin/categories}/_sortable_list.html.erb +2 -2
- data/app/views/{admin/blog → refinery/blog/admin}/categories/edit.html.erb +0 -0
- data/app/views/refinery/blog/admin/categories/index.html.erb +27 -0
- data/app/views/{admin/blog → refinery/blog/admin}/categories/new.html.erb +0 -0
- data/app/views/{admin/blog → refinery/blog/admin}/comments/_comment.html.erb +4 -4
- data/app/views/{admin/blog/categories → refinery/blog/admin/comments}/_sortable_list.html.erb +2 -2
- data/app/views/refinery/blog/admin/comments/index.html.erb +30 -0
- data/app/views/refinery/blog/admin/comments/show.html.erb +63 -0
- data/app/views/{admin/blog → refinery/blog/admin}/posts/_form.html.erb +53 -39
- data/app/views/{admin/blog → refinery/blog/admin}/posts/_form_part.html.erb +0 -0
- data/app/views/{admin/blog → refinery/blog/admin}/posts/_post.html.erb +4 -7
- data/app/views/{admin/blog → refinery/blog/admin}/posts/_sortable_list.html.erb +2 -2
- data/app/views/{admin/blog → refinery/blog/admin}/posts/_teaser_part.html.erb +2 -2
- data/app/views/{admin/blog → refinery/blog/admin}/posts/edit.html.erb +0 -0
- data/app/views/refinery/blog/admin/posts/index.html.erb +27 -0
- data/app/views/{admin/blog → refinery/blog/admin}/posts/new.html.erb +0 -0
- data/app/views/refinery/blog/admin/posts/uncategorized.html.erb +27 -0
- data/app/views/{admin/blog → refinery/blog/admin}/settings/notification_recipients.html.erb +3 -3
- data/app/views/refinery/blog/categories/show.html.erb +21 -0
- data/app/views/{blog → refinery/blog}/comment_mailer/notification.html.erb +1 -1
- data/app/views/{blog → refinery/blog}/posts/_comment.html.erb +2 -2
- data/app/views/refinery/blog/posts/_comments.html.erb +40 -0
- data/app/views/refinery/blog/posts/_nav.html.erb +17 -0
- data/app/views/refinery/blog/posts/_post.html.erb +37 -0
- data/app/views/refinery/blog/posts/archive.html.erb +17 -0
- data/app/views/refinery/blog/posts/index.html.erb +20 -0
- data/app/views/refinery/blog/posts/index.rss.builder +17 -0
- data/app/views/refinery/blog/posts/show.html.erb +21 -0
- data/app/views/refinery/blog/posts/tagged.html.erb +19 -0
- data/app/views/refinery/blog/shared/_body_content_right.html.erb +9 -0
- data/app/views/{blog → refinery/blog}/shared/_categories.html.erb +3 -3
- data/app/views/{blog → refinery/blog}/shared/_post.html.erb +11 -11
- data/app/views/refinery/blog/shared/_posts.html.erb +10 -0
- data/app/views/refinery/blog/shared/_rss_feed.html.erb +2 -0
- data/app/views/{blog → refinery/blog}/shared/_tags.html.erb +1 -1
- data/app/views/refinery/blog/widgets/_blog_archive.html.erb +10 -0
- data/app/views/refinery/shared/admin/_autocomplete.html.erb +5 -0
- data/changelog.md +2 -18
- data/config/initializers/url_validator.rb +84 -0
- data/config/locales/bg.yml +139 -139
- data/config/locales/cs.yml +119 -119
- data/config/locales/de.yml +121 -121
- data/config/locales/en.yml +147 -140
- data/config/locales/es.yml +119 -150
- data/config/locales/fr.yml +136 -136
- data/config/locales/it.yml +139 -139
- data/config/locales/ja.yml +2 -3
- data/config/locales/nb.yml +28 -27
- data/config/locales/nl.yml +125 -125
- data/config/locales/pl.yml +125 -125
- data/config/locales/pt-BR.yml +129 -134
- data/config/locales/ru.yml +119 -126
- data/config/locales/sk.yml +119 -119
- data/config/locales/zh-CN.yml +119 -119
- data/config/routes.rb +37 -33
- data/db/migrate/20110803223522_create_blog_structure.rb +52 -0
- data/db/migrate/20110803223523_add_user_id_to_blog_posts.rb +7 -0
- data/db/migrate/{3_acts_as_taggable_on_migration.rb → 20110803223524_acts_as_taggable_on_migration.rb} +2 -2
- data/db/migrate/20110803223526_add_cached_slugs.rb +6 -0
- data/db/migrate/20110803223527_add_custom_url_field_to_blog_posts.rb +5 -0
- data/db/migrate/20110803223528_add_custom_teaser_field_to_blog_posts.rb +6 -0
- data/db/migrate/20110803223529_add_primary_key_to_categorizations.rb +14 -0
- data/db/migrate/20120103055909_add_source_url_to_blog_posts.rb +7 -0
- data/db/migrate/20120223022021_add_access_count_to_posts.rb +8 -0
- data/db/migrate/20120227022021_add_slug_to_posts_and_categories.rb +9 -0
- data/db/{seeds/refinerycms_blog.rb → seeds.rb} +6 -7
- data/lib/generators/refinery/blog/blog_generator.rb +27 -0
- data/lib/generators/refinery/blog/templates/config/initializers/refinery/blog.rb.erb +11 -0
- data/lib/refinery/blog.rb +37 -0
- data/lib/refinery/blog/configuration.rb +14 -0
- data/lib/refinery/blog/engine.rb +25 -0
- data/lib/refinery/blog/tabs.rb +5 -11
- data/lib/refinery/blog/version.rb +3 -3
- data/lib/refinerycms-blog.rb +1 -41
- data/readme.md +24 -15
- data/refinerycms-blog.gemspec +19 -196
- data/script/rails +6 -0
- data/spec/factories/blog_categories.rb +5 -0
- data/spec/factories/blog_comments.rb +19 -0
- data/spec/factories/blog_posts.rb +13 -0
- data/spec/helpers/refinery/blog/posts_helper_spec.rb +71 -0
- data/spec/lib/refinery/blog/engine_spec.rb +26 -0
- data/spec/models/refinery/blog/category_spec.rb +42 -0
- data/spec/models/refinery/blog/comment_spec.rb +19 -0
- data/spec/models/refinery/blog/post_spec.rb +233 -0
- data/spec/requests/refinery/blog/admin/categories_spec.rb +20 -0
- data/spec/requests/refinery/blog/admin/comments_spec.rb +121 -0
- data/spec/requests/refinery/blog/admin/menu_spec.rb +13 -0
- data/spec/requests/refinery/blog/admin/posts_spec.rb +175 -0
- data/spec/requests/refinery/blog/categories_spec.rb +24 -0
- data/spec/requests/refinery/blog/posts_spec.rb +160 -0
- data/spec/spec_helper.rb +56 -0
- data/tasks/rspec.rake +4 -0
- data/tasks/testing.rake +9 -0
- metadata +281 -170
- data/app/controllers/admin/blog/categories_controller.rb +0 -11
- data/app/controllers/admin/blog/comments_controller.rb +0 -40
- data/app/controllers/admin/blog/posts_controller.rb +0 -97
- data/app/controllers/admin/blog/settings_controller.rb +0 -53
- data/app/controllers/blog/categories_controller.rb +0 -13
- data/app/controllers/blog/posts_controller.rb +0 -109
- data/app/controllers/blog_controller.rb +0 -16
- data/app/helpers/blog_posts_helper.rb +0 -56
- data/app/mailers/blog/comment_mailer.rb +0 -13
- data/app/models/blog/comment_mailer.rb +0 -1
- data/app/models/blog_category.rb +0 -19
- data/app/models/blog_comment.rb +0 -137
- data/app/models/blog_post.rb +0 -114
- data/app/models/categorization.rb +0 -7
- data/app/views/admin/blog/categories/index.html.erb +0 -26
- data/app/views/admin/blog/comments/index.html.erb +0 -35
- data/app/views/admin/blog/comments/show.html.erb +0 -63
- data/app/views/admin/blog/posts/_form.css.erb +0 -20
- data/app/views/admin/blog/posts/_form.js.erb +0 -23
- data/app/views/admin/blog/posts/index.html.erb +0 -28
- data/app/views/admin/blog/posts/uncategorized.html.erb +0 -26
- data/app/views/blog/categories/show.html.erb +0 -21
- data/app/views/blog/posts/_nav.html.erb +0 -11
- data/app/views/blog/posts/archive.html.erb +0 -20
- data/app/views/blog/posts/index.html.erb +0 -24
- data/app/views/blog/posts/index.rss.builder +0 -17
- data/app/views/blog/posts/show.html.erb +0 -98
- data/app/views/blog/posts/tagged.html.erb +0 -22
- data/app/views/blog/shared/_archive_list.html.erb +0 -9
- data/app/views/blog/shared/_related_posts.html.erb +0 -10
- data/app/views/blog/shared/_rss_feed.html.erb +0 -2
- data/app/views/shared/admin/_autocomplete.html.erb +0 -55
- data/db/migrate/1_create_blog_structure.rb +0 -54
- data/db/migrate/2_add_user_id_to_blog_posts.rb +0 -11
- data/db/migrate/4_create_seo_meta_for_blog.rb +0 -25
- data/db/migrate/5_add_cached_slugs.rb +0 -11
- data/db/migrate/6_add_custom_url_field_to_blog_posts.rb +0 -9
- data/db/migrate/7_add_custom_teaser_field_to_blog_posts.rb +0 -10
- data/db/migrate/8_add_primary_key_to_categorizations.rb +0 -12
- data/features/authors.feature +0 -15
- data/features/category.feature +0 -23
- data/features/support/factories/blog_categories.rb +0 -5
- data/features/support/factories/blog_comments.rb +0 -8
- data/features/support/factories/blog_posts.rb +0 -9
- data/features/support/paths.rb +0 -24
- data/features/support/step_definitions/authors_steps.rb +0 -7
- data/features/support/step_definitions/category_steps.rb +0 -11
- data/features/support/step_definitions/tags_steps.rb +0 -13
- data/features/tags.feature +0 -26
- data/lib/gemspec.rb +0 -37
- data/lib/generators/refinerycms_blog_generator.rb +0 -8
- data/public/stylesheets/refinery/refinerycms-blog.css +0 -55
- data/spec/models/blog_category_spec.rb +0 -41
- data/spec/models/blog_comment_spec.rb +0 -21
- data/spec/models/blog_post_spec.rb +0 -217
@@ -3,8 +3,8 @@
|
|
3
3
|
<%= simple_format auto_link(comment.message.to_s) %>
|
4
4
|
<footer class='blog_comment_author'>
|
5
5
|
<p>
|
6
|
-
<%= t('by', :scope => 'blog.posts.comments', :who => comment.name) %>,
|
7
|
-
<%= t('time_ago', :scope => 'blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %>
|
6
|
+
<%= t('by', :scope => 'refinery.blog.posts.comments', :who => comment.name) %>,
|
7
|
+
<%= t('time_ago', :scope => 'refinery.blog.posts.comments', :time => time_ago_in_words(comment.created_at)) %>
|
8
8
|
</p>
|
9
9
|
</footer>
|
10
10
|
</article>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<aside id="comments">
|
2
|
+
<h2><%= t('title', :scope => 'refinery.blog.posts.show.comments') %></h2>
|
3
|
+
<% if (comments = @post.comments.approved).any? %>
|
4
|
+
<%= render :partial => "comment", :collection => comments %>
|
5
|
+
<% else %>
|
6
|
+
<p>
|
7
|
+
<%= t('none', :scope => 'refinery.blog.shared.comments') %>.
|
8
|
+
</p>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% flash.each do |key, value| %>
|
12
|
+
<div id='flash' class="flash flash_<%= key %>">
|
13
|
+
<%= value %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<h2><%= t('add', :scope => 'refinery.blog.posts.show.comments') %></h2>
|
18
|
+
<%= form_for [refinery, :blog, @comment] do |f| %>
|
19
|
+
<%= render :partial => "/refinery/admin/error_messages",
|
20
|
+
:locals => {
|
21
|
+
:object => f.object,
|
22
|
+
:include_object_name => true
|
23
|
+
} %>
|
24
|
+
<div class='field'>
|
25
|
+
<%= f.label :name %>
|
26
|
+
<%= f.text_field :name %>
|
27
|
+
</div>
|
28
|
+
<div class='field'>
|
29
|
+
<%= f.label :email %>
|
30
|
+
<%= f.email_field :email %>
|
31
|
+
</div>
|
32
|
+
<div class='field message_field'>
|
33
|
+
<%= f.label :message %>
|
34
|
+
<%= f.text_area :message, :rows => 6 %>
|
35
|
+
</div>
|
36
|
+
<div class='field form-actions'>
|
37
|
+
<%= f.submit t('submit', :scope => 'refinery.blog.posts.show') %>
|
38
|
+
</div>
|
39
|
+
<% end %>
|
40
|
+
</aside>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<nav id="next_prev_article">
|
2
|
+
<% if @post.next.present? -%>
|
3
|
+
<%= link_to (truncate(@post.next.title) + " »").html_safe,
|
4
|
+
refinery.blog_post_path(@post.next),
|
5
|
+
:class => 'next' %>
|
6
|
+
<% end -%>
|
7
|
+
|
8
|
+
<%= link_to t('blog_home', :scope => 'refinery.blog.posts.show'),
|
9
|
+
refinery.blog_root_path,
|
10
|
+
:class => 'home' %>
|
11
|
+
|
12
|
+
<% if @post.prev.present? -%>
|
13
|
+
<%= link_to ("« " + truncate(@post.prev.title)).html_safe,
|
14
|
+
refinery.blog_post_path(@post.prev),
|
15
|
+
:class => 'prev' %>
|
16
|
+
<% end -%>
|
17
|
+
</nav><!-- /next_prev_article -->
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% flash.each do |key, value| %>
|
2
|
+
<div id='flash' class="flash flash_<%= key %>">
|
3
|
+
<%= value %>
|
4
|
+
</div>
|
5
|
+
<% end %>
|
6
|
+
<article id="blog_post">
|
7
|
+
<header>
|
8
|
+
<h1><%= @post.title %></h1>
|
9
|
+
<section class='details'>
|
10
|
+
<time datetime="<%=l @post.published_at.to_date, :format => :default %>" class='posted_at'>
|
11
|
+
<%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(@post.published_at.to_date, :format => :short)) %>
|
12
|
+
</time>
|
13
|
+
<%= content_tag(:div, "#{t('by', :scope => 'refinery.blog.posts.show')} #{@post.author.username}", :class => "blog_author") if @post.author.present? %>
|
14
|
+
<% if @post.source_url.present? %>
|
15
|
+
<div class='blog_source'>
|
16
|
+
<%= "#{t('source', :scope => 'refinery.blog.posts.show')}: " %>
|
17
|
+
<%= link_to (@post.source_url_title.blank? ? @post.source_url : @post.source_url_title), @post.source_url %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
<% if (categories = @post.categories).any? %>
|
21
|
+
<aside class='filed_in'>
|
22
|
+
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
|
23
|
+
<% categories.each_with_index do |category, index| %>
|
24
|
+
<%= link_to category.title, refinery.blog_category_path(category) -%><%= ',' if index < ((categories.length) - 1) %>
|
25
|
+
<% end %>
|
26
|
+
</aside>
|
27
|
+
<% end %>
|
28
|
+
</section>
|
29
|
+
</header>
|
30
|
+
<%= @post.body.html_safe %>
|
31
|
+
|
32
|
+
<% if Refinery::Blog::Post::ShareThis.enabled? %>
|
33
|
+
<span class="st_sharethis" displayText="ShareThis"></span>
|
34
|
+
<% end %>
|
35
|
+
</article>
|
36
|
+
<%= render :partial => '/refinery/draft_page_message' unless @post.nil? or @post.live? -%>
|
37
|
+
<%= render 'nav' if next_or_previous?(@post) %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% content_for :title, "#{t('.blog_archive_for', :date => @archive_date.strftime('%B %Y'))}" %>
|
2
|
+
|
3
|
+
<% content_for :body_content_left do %>
|
4
|
+
<h1><%= t('.blog_archive_for', :date => @archive_date.strftime('%B %Y')) %></h1>
|
5
|
+
<% if @posts.any? %>
|
6
|
+
<section id="blog_posts">
|
7
|
+
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
|
8
|
+
</section>
|
9
|
+
<% else %>
|
10
|
+
<p><%= t('.no_blog_articles_posted', :date => @archive_date.strftime('%B %Y')) %></p>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= render :partial => '/refinery/blog/shared/body_content_right' %>
|
15
|
+
|
16
|
+
<%= render :partial => "/refinery/content_page" %>
|
17
|
+
<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<%= raw @page.content_for(Refinery::Pages.default_parts.first.to_sym) if Refinery::Pages.default_parts.any? %>
|
3
|
+
|
4
|
+
<% if @posts.any? %>
|
5
|
+
<section id="blog_posts">
|
6
|
+
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
|
7
|
+
<%= will_paginate @posts %>
|
8
|
+
</section>
|
9
|
+
<% else %>
|
10
|
+
<p><%= t('.no_blog_articles_yet') %></p>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% content_for :body_content_right_prepend do -%>
|
15
|
+
<%= raw @page.content_for(Refinery::Pages.default_parts.second.to_sym) %>
|
16
|
+
<% end if Refinery::Pages.default_parts.many? -%>
|
17
|
+
<%= render :partial => '/refinery/blog/shared/body_content_right' %>
|
18
|
+
|
19
|
+
<%= render :partial => "/refinery/content_page" %>
|
20
|
+
<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
xml.instruct! :xml, :version => "1.0"
|
2
|
+
xml.rss :version => "2.0" do
|
3
|
+
xml.channel do
|
4
|
+
xml.title Refinery::Core.site_name
|
5
|
+
xml.description Refinery::Core.site_name + " Blog Posts"
|
6
|
+
xml.link refinery.blog_root_url
|
7
|
+
|
8
|
+
@posts.each do |post|
|
9
|
+
xml.item do
|
10
|
+
xml.title post.title
|
11
|
+
xml.description post.body
|
12
|
+
xml.pubDate post.published_at.to_s(:rfc822)
|
13
|
+
xml.link refinery.blog_post_url(post)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<div id="show_blog_post">
|
3
|
+
<%= render 'post' %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<% if Refinery::Blog::Post.comments_allowed? %>
|
7
|
+
<%= render 'comments'%>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render :partial => '/refinery/blog/shared/body_content_right' %>
|
12
|
+
|
13
|
+
<%= render :partial => "/refinery/content_page", :locals => { :remove_automatic_sections => true } %>
|
14
|
+
|
15
|
+
<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %>
|
16
|
+
<% content_for :javascripts do %>
|
17
|
+
<%# enable AJAX'd post nav at your own risk until html5 history API implemented. %>
|
18
|
+
<%#= javascript_include_tag('refinery/blog/frontend') %>
|
19
|
+
<script src="http://w.sharethis.com/button/buttons.js"></script>
|
20
|
+
<script>stLight.options({publisher:'<%= Blog::Post::ShareThis.key %>'});</script>
|
21
|
+
<% end if Refinery::Blog::Post::ShareThis.enabled? %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<% content_for :title, "#{t('.posts_tagged')} '#{@tag_name.titleize}'" %>
|
2
|
+
|
3
|
+
<% content_for :body_content_title, "#{t('.posts_tagged')} “#{@tag_name.titleize}”".html_safe -%>
|
4
|
+
|
5
|
+
<% content_for :body_content_left do %>
|
6
|
+
<% if @posts.any? %>
|
7
|
+
<section id="blog_posts">
|
8
|
+
<%= render :partial => "/refinery/blog/shared/post", :collection => @posts %>
|
9
|
+
<%= will_paginate @posts %>
|
10
|
+
</section>
|
11
|
+
<% else %>
|
12
|
+
<p><%= t('.no_blog_articles_yet') %></p>
|
13
|
+
<% end %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render :partial => '/refinery/blog/shared/body_content_right' %>
|
17
|
+
|
18
|
+
<%= render :partial => "/refinery/content_page" %>
|
19
|
+
<% content_for :stylesheets, stylesheet_link_tag('refinery/blog/frontend') %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% content_for :body_content_right do %>
|
2
|
+
<%= yield(:body_content_right_prepend) %>
|
3
|
+
<%= render :partial => "/refinery/blog/shared/rss_feed" %>
|
4
|
+
<%= render :partial => "/refinery/blog/shared/categories" %>
|
5
|
+
<%= render :partial => "/refinery/blog/shared/tags" %>
|
6
|
+
<%= render :partial => "/refinery/blog/shared/posts" %>
|
7
|
+
<%= blog_archive_widget %>
|
8
|
+
<%= yield(:body_content_right_append) %>
|
9
|
+
<% end %>
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<% if @
|
1
|
+
<% if @categories.any? %>
|
2
2
|
<h2><%= t('.title') %></h2>
|
3
3
|
<ul id='categories'>
|
4
|
-
<% @
|
4
|
+
<% @categories.each do |category| %>
|
5
5
|
<li<%= " class='selected'" if @category.present? and @category.id == category.id %>>
|
6
|
-
<%= link_to "#{category.title} (#{category.post_count})",
|
6
|
+
<%= link_to "#{category.title} (#{category.post_count})", refinery.blog_category_path(category) %>
|
7
7
|
</li>
|
8
8
|
<% end %>
|
9
9
|
</ul>
|
@@ -1,22 +1,22 @@
|
|
1
1
|
<% if post.live? %>
|
2
2
|
<article class="blog_post" id="<%= dom_id(post) %>">
|
3
3
|
<header>
|
4
|
-
<h1><%= link_to post.title,
|
4
|
+
<h1><%= link_to post.title, refinery.blog_post_path(post) %></h1>
|
5
5
|
<section class='details'>
|
6
6
|
<time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'>
|
7
|
-
<%= t('created_at', :scope => 'blog.shared.posts', :when => l(post.published_at.to_date, :format => :short)) %>
|
7
|
+
<%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(post.published_at.to_date, :format => :short)) %>
|
8
8
|
</time>
|
9
|
-
<%= "#{t('by', :scope => 'blog.posts.show')} #{post.author.username}" if post.author.present? %>.
|
9
|
+
<%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{post.author.username}" if post.author.present? %>.
|
10
10
|
<% if (categories = post.categories).any? %>
|
11
11
|
<aside class='filed_in'>
|
12
|
-
<%= t('filed_in', :scope => 'blog.posts.show') %>
|
13
|
-
<%=raw categories.collect { |category| link_to category.title,
|
12
|
+
<%= t('filed_in', :scope => 'refinery.blog.posts.show') %>
|
13
|
+
<%=raw categories.collect { |category| link_to category.title, refinery.blog_category_path(category) }.to_sentence %>
|
14
14
|
</aside>
|
15
15
|
<% end %>
|
16
16
|
<% if (tags = post.tags).any? %>
|
17
17
|
<aside class='tagged'>
|
18
|
-
<%= t('tagged', :scope => 'blog.posts.show') %>
|
19
|
-
<%=raw tags.collect { |tag| link_to tag,
|
18
|
+
<%= t('tagged', :scope => 'refinery.blog.posts.show') %>
|
19
|
+
<%=raw tags.collect { |tag| link_to tag, refinery.blog_tagged_posts_path(tag.id, tag.name.parameterize) }.to_sentence %>
|
20
20
|
</aside>
|
21
21
|
<% end %>
|
22
22
|
</section>
|
@@ -30,14 +30,14 @@
|
|
30
30
|
</section>
|
31
31
|
<footer>
|
32
32
|
<p>
|
33
|
-
<%= link_to t('read_more', :scope => 'blog.shared.posts'),
|
33
|
+
<%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), refinery.blog_post_path(post) if blog_post_teaser_enabled? %>
|
34
34
|
</p>
|
35
35
|
<aside class='comment_count'>
|
36
|
-
<% if
|
36
|
+
<% if Refinery::Blog::Post.comments_allowed? %>
|
37
37
|
<% if post.comments.any? %>
|
38
|
-
(<%= pluralize(post.comments.approved.count, t('singular', :scope => 'blog.shared.comments')) %>)
|
38
|
+
(<%= pluralize(post.comments.approved.count, t('singular', :scope => 'refinery.blog.shared.comments')) %>)
|
39
39
|
<% else %>
|
40
|
-
(<%= t('none', :scope => 'blog.shared.comments') %>)
|
40
|
+
(<%= t('none', :scope => 'refinery.blog.shared.comments') %>)
|
41
41
|
<% end %>
|
42
42
|
<% end %>
|
43
43
|
</aside>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<h2><%= t('.title') %></h2>
|
3
3
|
<nav id='tags'>
|
4
4
|
<% tag_cloud(@tags, %w(tag1 tag2 tag3 tag4)) do |tag, css_class| %>
|
5
|
-
<%= link_to tag.name,
|
5
|
+
<%= link_to tag.name, refinery.blog_tagged_posts_path(tag.id, tag.name.parameterize), :class => css_class %>
|
6
6
|
<% end %>
|
7
7
|
</nav>
|
8
8
|
<% end %>
|
data/changelog.md
CHANGED
@@ -1,29 +1,16 @@
|
|
1
|
-
## 1.
|
2
|
-
* extraneous shared/_post partial was moved directly into posts/show [nicinabox](https://github.com/nicinabox)
|
3
|
-
* blog archive list helper logic refactored (HTML exists in view template) [nicinabox](https://github.com/nicinabox)
|
4
|
-
* pretty "Draft" label added to admin list of blog posts [nicinabox](https://github.com/nicinabox)
|
5
|
-
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.7.0...1.8.0)
|
6
|
-
|
7
|
-
## 1.7.0 [05 December 2011]
|
1
|
+
## 1.6.3 [UNRELEASED]
|
8
2
|
* Bulgarian translations [mirosr](https://github.com/mirosr)
|
9
3
|
* posts/tagged... params[:tag_name] is optional [joemsak](https://github.com/joemsak)
|
10
|
-
* Bug Fix on Categorization relationship: destroying a post produced error because no primary key existed on join table [joemsak](https://github.com/joemsak)
|
11
|
-
* Bug fix on archive listing, don't include draft posts [jgrevich](https://github.com/jgrevich)
|
12
|
-
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.6.2...1.7.0)
|
13
4
|
|
14
5
|
## 1.6.2 [29 June 2011]
|
15
6
|
* Custom teaser field to overwrite the automatic truncation of the body [wikyd](https://github.com/wikyd)
|
16
7
|
* Tagging URL strategy updated again [joemsak](https://github.com/joemsak)
|
17
8
|
* Tagging bug fixed [ruprict](https://github.com/ruprict)
|
18
9
|
* Refactored specs [parndt](https://github.com/parndt)
|
19
|
-
* * [See full list](https://github.com/resolve/refinerycms-blog/compare/1.6.1...1.6.2)
|
20
|
-
|
21
10
|
|
22
11
|
## 1.6.1 [21 June 2011]
|
23
12
|
* Tagging URL strategy updated for reliability /blog/posts/tagged/ID-name-parameterized [joemsak](https://github.com/joemsak)
|
24
13
|
* Heroku/PostgreSQL support for autocomplete tags [joemsak](https://github.com/joemsak)
|
25
|
-
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.6...1.6.1)
|
26
|
-
|
27
14
|
|
28
15
|
## 1.6 [20 June 2011]
|
29
16
|
* Category bug fixes and cleanup [wikyd](https://github.com/wikyd)
|
@@ -33,14 +20,11 @@
|
|
33
20
|
* More testing [wakeless](https://github.com/wakeless)
|
34
21
|
* Tag list autocomplete baked in [joemsak](https://github.com/joemsak)
|
35
22
|
* Customize the URL of your blog post [wikyd](https://github.com/wikyd)
|
36
|
-
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.5...1.6)
|
37
|
-
|
38
23
|
|
39
24
|
## 1.5 [28 May 2011]
|
40
25
|
|
41
26
|
* Added Gravatar support. [parndt](https://github.com/parndt)
|
42
27
|
* Added support for Refinery CMS 1.0.0 and above. [parndt](https://github.com/parndt)
|
43
|
-
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.4...1.5)
|
44
28
|
|
45
29
|
## 1.4 [26 May 2011]
|
46
30
|
|
@@ -82,4 +66,4 @@
|
|
82
66
|
* Rails 3 Support
|
83
67
|
* Archives
|
84
68
|
* Categories
|
85
|
-
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.0...1.1)
|
69
|
+
* [See full list](https://github.com/resolve/refinerycms-blog/compare/1.0...1.1)
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
class UrlValidator < ActiveModel::EachValidator
|
4
|
+
|
5
|
+
def validate_each(record, attribute, value)
|
6
|
+
url = value
|
7
|
+
|
8
|
+
# Regex code by 'Arsenic' from http://snippets.dzone.com/posts/show/3654
|
9
|
+
if url =~ /^
|
10
|
+
( (https?):\/\/ )?
|
11
|
+
( [a-z\d]+([\-\.][a-z\d]+)*\.[a-z]{2,6} )
|
12
|
+
(
|
13
|
+
(:
|
14
|
+
( \d{1,5} )
|
15
|
+
)?
|
16
|
+
( \/.* )?
|
17
|
+
)?
|
18
|
+
$/ix
|
19
|
+
url = "http#{'s' if $7 == '81'}://#{url}" unless $1
|
20
|
+
else
|
21
|
+
record.errors[attribute] << 'Not a valid URL'
|
22
|
+
end
|
23
|
+
|
24
|
+
if options[:verify]
|
25
|
+
begin
|
26
|
+
url_response = RedirectFollower.new(url).resolve
|
27
|
+
url = url_response.url if options[:verify] == [:resolve_redirects]
|
28
|
+
rescue RedirectFollower::TooManyRedirects
|
29
|
+
record.errors[attribute] << 'URL is redirecting too many times'
|
30
|
+
rescue
|
31
|
+
record.errors[attribute] << 'could not be resolved'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if options[:update]
|
36
|
+
value.replace url
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Code below written by John Nunemaker
|
42
|
+
# See blog post at http://railstips.org/blog/archives/2009/03/04/following-redirects-with-nethttp/
|
43
|
+
class RedirectFollower
|
44
|
+
class TooManyRedirects < StandardError; end
|
45
|
+
|
46
|
+
attr_accessor :url, :body, :redirect_limit, :response
|
47
|
+
|
48
|
+
def initialize(url, limit=5)
|
49
|
+
@url, @redirect_limit = url, limit
|
50
|
+
end
|
51
|
+
|
52
|
+
def logger
|
53
|
+
@logger ||= Rails.logger
|
54
|
+
end
|
55
|
+
|
56
|
+
def resolve
|
57
|
+
raise TooManyRedirects if redirect_limit < 0
|
58
|
+
|
59
|
+
self.response = Net::HTTP.get_response(URI.parse(url))
|
60
|
+
|
61
|
+
logger.info "redirect limit: #{redirect_limit}"
|
62
|
+
logger.info "response code: #{response.code}"
|
63
|
+
logger.debug "response body: #{response.body}"
|
64
|
+
|
65
|
+
if response.kind_of?(Net::HTTPRedirection)
|
66
|
+
self.url = redirect_url
|
67
|
+
self.redirect_limit -= 1
|
68
|
+
|
69
|
+
logger.info "redirect found, headed to #{url}"
|
70
|
+
resolve
|
71
|
+
end
|
72
|
+
|
73
|
+
self.body = response.body
|
74
|
+
self
|
75
|
+
end
|
76
|
+
|
77
|
+
def redirect_url
|
78
|
+
if response['location'].nil?
|
79
|
+
response.body.match(/<a href=\"([^>]+)\">/i)[1]
|
80
|
+
else
|
81
|
+
response['location']
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|