refinerycms-blog 0.9.8.0.rc2 → 1.0.rc10
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.
- data/app/controllers/admin/blog/comments_controller.rb +18 -4
- data/app/controllers/admin/blog/settings_controller.rb +9 -2
- data/app/controllers/blog/categories_controller.rb +7 -0
- data/app/controllers/blog/posts_controller.rb +43 -0
- data/app/controllers/blog_controller.rb +15 -0
- data/app/models/blog_comment.rb +47 -13
- data/app/models/blog_post.rb +22 -1
- data/app/views/admin/blog/_submenu.html.erb +6 -1
- data/app/views/admin/blog/categories/_category.html.erb +4 -2
- data/app/views/admin/blog/categories/_form.html.erb +10 -2
- data/app/views/admin/blog/comments/_comment.html.erb +13 -10
- data/app/views/admin/blog/comments/index.html.erb +1 -1
- data/app/views/admin/blog/comments/show.html.erb +63 -0
- data/app/views/admin/blog/posts/_form.html.erb +9 -1
- data/app/views/admin/blog/posts/_post.html.erb +3 -1
- data/app/views/blog/categories/show.html.erb +20 -0
- data/app/views/blog/posts/_comment.html.erb +9 -0
- data/app/views/blog/posts/index.html.erb +17 -0
- data/app/views/blog/posts/index.rss.builder +17 -0
- data/app/views/blog/posts/show.html.erb +85 -0
- data/app/views/blog/shared/_categories.html.erb +8 -0
- data/app/views/blog/shared/_post.html.erb +22 -0
- data/app/views/blog/shared/_posts.html.erb +8 -0
- data/app/views/blog/shared/_rss_feed.html.erb +2 -0
- data/config/locales/en.yml +54 -18
- data/config/routes.rb +51 -5
- data/generators/refinery_blog/refinery_blog_generator.rb +15 -16
- data/generators/refinery_blog/templates/{migration.rb → db/migrate/migration.rb} +0 -0
- data/generators/refinery_blog/templates/{seed.rb → db/seeds/seed.rb} +0 -0
- data/lib/gemspec.rb +1 -1
- data/lib/generators/refinery_blog/templates/db/migrate/migration_number_create_singular_name.rb +26 -0
- data/lib/generators/refinery_blog/templates/db/seeds/seed.rb +16 -0
- data/lib/generators/refinery_blog_generator.rb +79 -0
- data/lib/refinerycms-blog.rb +23 -3
- data/public/images/refinerycms-blog/icons/down.gif +0 -0
- data/public/images/refinerycms-blog/icons/up.gif +0 -0
- data/public/images/refinerycms-blog/rss-feed.png +0 -0
- data/public/javascripts/refinery/refinerycms-blog.js +14 -4
- data/public/stylesheets/refinery/refinerycms-blog.css +18 -0
- data/public/stylesheets/refinerycms-blog.css +5 -0
- data/readme.md +24 -1
- metadata +27 -16
- data/app/controllers/blog_posts_controller.rb +0 -62
- data/app/views/blog_posts/_categories.html.erb +0 -0
- data/app/views/blog_posts/_comments.html.erb +0 -0
- data/app/views/blog_posts/_side_bar.html.erb +0 -8
- data/app/views/blog_posts/index.html.erb +0 -27
- data/app/views/blog_posts/show.html.erb +0 -76
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'rails/generators/migration'
|
2
|
+
|
3
|
+
class RefineryBlogGenerator < Rails::Generators::NamedBase
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
|
6
|
+
source_root File.expand_path('../refinery_blog/templates/', __FILE__)
|
7
|
+
argument :name, :type => :string, :default => 'blog_structure', :banner => ''
|
8
|
+
|
9
|
+
def generate
|
10
|
+
# seed file
|
11
|
+
template 'db/seeds/seed.rb', Rails.root.join('db/seeds/refinerycms_blog.rb')
|
12
|
+
|
13
|
+
# migration file
|
14
|
+
@refinerycms_blog_tables = [{
|
15
|
+
:table_name => 'blog_posts',
|
16
|
+
:attributes => [
|
17
|
+
Rails::Generators::GeneratedAttribute.new('title', 'string'),
|
18
|
+
Rails::Generators::GeneratedAttribute.new('body', 'text'),
|
19
|
+
Rails::Generators::GeneratedAttribute.new('draft', 'boolean')
|
20
|
+
], :id => true
|
21
|
+
},{
|
22
|
+
:table_name => 'blog_comments',
|
23
|
+
:attributes => [
|
24
|
+
Rails::Generators::GeneratedAttribute.new('blog_post_id', 'integer'),
|
25
|
+
Rails::Generators::GeneratedAttribute.new('spam', 'boolean'),
|
26
|
+
Rails::Generators::GeneratedAttribute.new('name', 'string'),
|
27
|
+
Rails::Generators::GeneratedAttribute.new('email', 'string'),
|
28
|
+
Rails::Generators::GeneratedAttribute.new('body', 'text'),
|
29
|
+
Rails::Generators::GeneratedAttribute.new('state', 'string'),
|
30
|
+
], :id => true
|
31
|
+
},{
|
32
|
+
:table_name => 'blog_categories',
|
33
|
+
:attributes => [
|
34
|
+
Rails::Generators::GeneratedAttribute.new('title', 'string')
|
35
|
+
], :id => true
|
36
|
+
},{
|
37
|
+
:table_name => 'blog_categories_blog_posts',
|
38
|
+
:attributes => [
|
39
|
+
Rails::Generators::GeneratedAttribute.new('blog_category_id', 'integer'),
|
40
|
+
Rails::Generators::GeneratedAttribute.new('blog_post_id', 'integer')
|
41
|
+
], :id => false
|
42
|
+
}]
|
43
|
+
next_migration_number = ActiveRecord::Generators::Base.next_migration_number(File.dirname(__FILE__))
|
44
|
+
template('db/migrate/migration_number_create_singular_name.rb',
|
45
|
+
Rails.root.join("db/migrate/#{next_migration_number}_create_#{singular_name}.rb"))
|
46
|
+
|
47
|
+
puts "------------------------"
|
48
|
+
puts "Now run:"
|
49
|
+
puts "rake db:migrate"
|
50
|
+
puts "------------------------"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Below is a hack until this issue:
|
55
|
+
# https://rails.lighthouseapp.com/projects/8994/tickets/3820-make-railsgeneratorsmigrationnext_migration_number-method-a-class-method-so-it-possible-to-use-it-in-custom-generators
|
56
|
+
# is fixed on the Rails project.
|
57
|
+
|
58
|
+
require 'rails/generators/named_base'
|
59
|
+
require 'rails/generators/migration'
|
60
|
+
require 'rails/generators/active_model'
|
61
|
+
require 'active_record'
|
62
|
+
|
63
|
+
module ActiveRecord
|
64
|
+
module Generators
|
65
|
+
class Base < Rails::Generators::NamedBase #:nodoc:
|
66
|
+
include Rails::Generators::Migration
|
67
|
+
|
68
|
+
# Implement the required interface for Rails::Generators::Migration.
|
69
|
+
def self.next_migration_number(dirname) #:nodoc:
|
70
|
+
next_migration_number = current_migration_number(dirname) + 1
|
71
|
+
if ActiveRecord::Base.timestamped_migrations
|
72
|
+
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
|
73
|
+
else
|
74
|
+
"%.3d" % next_migration_number
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/refinerycms-blog.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
|
1
|
+
if defined?(Bundler) and !defined?(FiltersSpam)
|
2
|
+
# this will tell the user what to do
|
3
|
+
load(File.expand_path('../../Gemfile', __FILE__))
|
4
|
+
require 'filters_spam'
|
5
|
+
end
|
2
6
|
|
3
7
|
module Refinery
|
4
8
|
module Blog
|
5
9
|
|
6
10
|
class Engine < Rails::Engine
|
7
|
-
initializer 'blog serves assets' do
|
11
|
+
initializer 'blog serves assets' do |app|
|
8
12
|
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
9
13
|
end
|
10
14
|
|
@@ -17,12 +21,28 @@ module Refinery
|
|
17
21
|
:class => BlogPost
|
18
22
|
}
|
19
23
|
end
|
24
|
+
|
25
|
+
# refinery 0.9.8 had a bug that we later found through using this engine.
|
26
|
+
# the bug was that the plugin urls were not :controller => '/admin/whatever'
|
27
|
+
if Refinery.version == '0.9.8'
|
28
|
+
::Refinery::Plugin.class_eval %{
|
29
|
+
alias_method :old_url, :url
|
30
|
+
|
31
|
+
def url
|
32
|
+
if (plugin_url = self.old_url).is_a?(Hash) and plugin_url[:controller] =~ %r{^admin}
|
33
|
+
plugin_url[:controller] = "/\#{plugin_url[:controller]}"
|
34
|
+
end
|
35
|
+
|
36
|
+
plugin_url
|
37
|
+
end
|
38
|
+
}
|
39
|
+
end
|
20
40
|
end
|
21
41
|
end if defined?(Rails::Engine)
|
22
42
|
|
23
43
|
class << self
|
24
44
|
def version
|
25
|
-
%q{
|
45
|
+
%q{1.0.rc10}
|
26
46
|
end
|
27
47
|
end
|
28
48
|
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,6 +1,9 @@
|
|
1
1
|
$(document).ready(function(){
|
2
2
|
$('nav#actions.multilist > ul:not(.search_list) li a[href$=' + window.location.pathname + ']')
|
3
3
|
.parent().addClass('selected');
|
4
|
+
if($('nav#actions.multilist > ul:not(.search_list) li.selected').length == 0) {
|
5
|
+
$('nav#actions.multilist > ul:not(.search_list) li a:nth(1)').parent().addClass('selected');
|
6
|
+
}
|
4
7
|
|
5
8
|
$('nav#actions.multilist > ul:not(.search_list) li > a').each(function(i,a){
|
6
9
|
if ($(this).data('dialog-title') == null) {
|
@@ -12,12 +15,19 @@ $(document).ready(function(){
|
|
12
15
|
|
13
16
|
$('ul.collapsible_menu').each(function(i, ul) {
|
14
17
|
(first_li = $(this).children('li:first')).after(div=$("<div></div>"));
|
18
|
+
|
19
|
+
$("<span class='arrow'> </span>").appendTo(first_li)
|
20
|
+
|
15
21
|
if (($(this).children('li.selected')).length == 0) {
|
16
22
|
div.hide();
|
23
|
+
first_li.addClass("closed");
|
17
24
|
}
|
18
25
|
$(this).children('li:not(:first)').appendTo(div);
|
19
|
-
|
20
|
-
first_li.find('> a').click(function(e){
|
26
|
+
|
27
|
+
first_li.find('> a, > span.arrow').click(function(e){
|
28
|
+
$(this).parent().toggleClass("closed");
|
29
|
+
$(this).parent().toggleClass("open");
|
30
|
+
|
21
31
|
$(this).parent().next('div').animate({
|
22
32
|
opacity: 'toggle'
|
23
33
|
, height: 'toggle'
|
@@ -32,8 +42,8 @@ $(document).ready(function(){
|
|
32
42
|
$('.success_icon, .failure_icon').bind('click', function(e) {
|
33
43
|
$.get($(this).attr('href'), $.proxy(function(data){
|
34
44
|
$(this).css('background-image', null)
|
35
|
-
.
|
36
|
-
.
|
45
|
+
.removeClass('failure_icon').removeClass('success_icon')
|
46
|
+
.addClass(data.enabled ? 'success_icon' : 'failure_icon');
|
37
47
|
}, $(this)));
|
38
48
|
e.preventDefault();
|
39
49
|
});
|
@@ -30,4 +30,22 @@
|
|
30
30
|
}
|
31
31
|
.page_add_icon {
|
32
32
|
background-image: url('/images/refinerycms-blog/icons/page_add.png');
|
33
|
+
}
|
34
|
+
ul.collapsible_menu li {
|
35
|
+
position: relative;
|
36
|
+
}
|
37
|
+
ul.collapsible_menu li span.arrow {
|
38
|
+
background-repeat: no-repeat;
|
39
|
+
position: absolute;
|
40
|
+
right: 10px;
|
41
|
+
top: 13px;
|
42
|
+
width: 11px;
|
43
|
+
height: 7px;
|
44
|
+
cursor: pointer;
|
45
|
+
}
|
46
|
+
ul.collapsible_menu li span.arrow {
|
47
|
+
background-image: url('/images/refinerycms-blog/icons/up.gif');
|
48
|
+
}
|
49
|
+
ul.collapsible_menu li.closed span.arrow {
|
50
|
+
background-image: url('/images/refinerycms-blog/icons/down.gif');
|
33
51
|
}
|
data/readme.md
CHANGED
@@ -1 +1,24 @@
|
|
1
|
-
|
1
|
+
# About
|
2
|
+
|
3
|
+
Simple blog engine for [Refinery CMS](http://refinerycms.com). It supports posts, categories and comments.
|
4
|
+
|
5
|
+
Options:
|
6
|
+
|
7
|
+
* Comment moderation
|
8
|
+
* [ShareThis.com](http://sharethis.com) support on posts. Set your key in Refinery's settings area to enable this.
|
9
|
+
|
10
|
+
# Install
|
11
|
+
|
12
|
+
Open up your ``Gemfile`` and add at the bottom this line
|
13
|
+
|
14
|
+
gem 'refinerycms-blog', '= 1.0.rc9'
|
15
|
+
|
16
|
+
Now run ``bundle install``
|
17
|
+
|
18
|
+
Next to install the blog plugin run:
|
19
|
+
|
20
|
+
ruby script/generate refinery_blog
|
21
|
+
|
22
|
+
Finally migrate your database and you're done.
|
23
|
+
|
24
|
+
rake db:migrate
|
metadata
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -398340057
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
|
10
|
-
- 0
|
11
|
-
- rc2
|
12
|
-
version: 0.9.8.0.rc2
|
9
|
+
- rc10
|
10
|
+
version: 1.0.rc10
|
13
11
|
platform: ruby
|
14
12
|
authors:
|
15
13
|
- Resolve Digital
|
@@ -18,7 +16,7 @@ autorequire:
|
|
18
16
|
bindir: bin
|
19
17
|
cert_chain: []
|
20
18
|
|
21
|
-
date: 2010-
|
19
|
+
date: 2010-09-14 00:00:00 +12:00
|
22
20
|
default_executable:
|
23
21
|
dependencies:
|
24
22
|
- !ruby/object:Gem::Dependency
|
@@ -27,7 +25,7 @@ dependencies:
|
|
27
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
28
26
|
none: false
|
29
27
|
requirements:
|
30
|
-
- -
|
28
|
+
- - ">="
|
31
29
|
- !ruby/object:Gem::Version
|
32
30
|
hash: 1
|
33
31
|
segments:
|
@@ -66,7 +64,9 @@ files:
|
|
66
64
|
- app/controllers/admin/blog/comments_controller.rb
|
67
65
|
- app/controllers/admin/blog/posts_controller.rb
|
68
66
|
- app/controllers/admin/blog/settings_controller.rb
|
69
|
-
- app/controllers/
|
67
|
+
- app/controllers/blog/categories_controller.rb
|
68
|
+
- app/controllers/blog/posts_controller.rb
|
69
|
+
- app/controllers/blog_controller.rb
|
70
70
|
- app/models/blog_category.rb
|
71
71
|
- app/models/blog_comment.rb
|
72
72
|
- app/models/blog_post.rb
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- app/views/admin/blog/comments/_comment.html.erb
|
81
81
|
- app/views/admin/blog/comments/_sortable_list.html.erb
|
82
82
|
- app/views/admin/blog/comments/index.html.erb
|
83
|
+
- app/views/admin/blog/comments/show.html.erb
|
83
84
|
- app/views/admin/blog/posts/_form.html.erb
|
84
85
|
- app/views/admin/blog/posts/_post.html.erb
|
85
86
|
- app/views/admin/blog/posts/_sortable_list.html.erb
|
@@ -87,11 +88,15 @@ files:
|
|
87
88
|
- app/views/admin/blog/posts/index.html.erb
|
88
89
|
- app/views/admin/blog/posts/new.html.erb
|
89
90
|
- app/views/admin/blog/settings/notification_recipients.html.erb
|
90
|
-
- app/views/
|
91
|
-
- app/views/
|
92
|
-
- app/views/
|
93
|
-
- app/views/
|
94
|
-
- app/views/
|
91
|
+
- app/views/blog/categories/show.html.erb
|
92
|
+
- app/views/blog/posts/_comment.html.erb
|
93
|
+
- app/views/blog/posts/index.html.erb
|
94
|
+
- app/views/blog/posts/index.rss.builder
|
95
|
+
- app/views/blog/posts/show.html.erb
|
96
|
+
- app/views/blog/shared/_categories.html.erb
|
97
|
+
- app/views/blog/shared/_post.html.erb
|
98
|
+
- app/views/blog/shared/_posts.html.erb
|
99
|
+
- app/views/blog/shared/_rss_feed.html.erb
|
95
100
|
- config/locales/en.yml
|
96
101
|
- config/locales/nb.yml
|
97
102
|
- config/locales/nl.yml
|
@@ -99,21 +104,27 @@ files:
|
|
99
104
|
- Gemfile
|
100
105
|
- Gemfile.lock
|
101
106
|
- generators/refinery_blog/refinery_blog_generator.rb
|
102
|
-
- generators/refinery_blog/templates/migration.rb
|
103
|
-
- generators/refinery_blog/templates/seed.rb
|
107
|
+
- generators/refinery_blog/templates/db/migrate/migration.rb
|
108
|
+
- generators/refinery_blog/templates/db/seeds/seed.rb
|
104
109
|
- lib/gemspec.rb
|
110
|
+
- lib/generators/refinery_blog/templates/db/migrate/migration_number_create_singular_name.rb
|
111
|
+
- lib/generators/refinery_blog/templates/db/seeds/seed.rb
|
112
|
+
- lib/generators/refinery_blog_generator.rb
|
105
113
|
- lib/refinerycms-blog.rb
|
106
114
|
- public/images/refinerycms-blog/icons/cog.png
|
107
115
|
- public/images/refinerycms-blog/icons/comment.png
|
108
116
|
- public/images/refinerycms-blog/icons/comment_cross.png
|
109
117
|
- public/images/refinerycms-blog/icons/comment_tick.png
|
110
118
|
- public/images/refinerycms-blog/icons/comments.png
|
119
|
+
- public/images/refinerycms-blog/icons/down.gif
|
111
120
|
- public/images/refinerycms-blog/icons/folder.png
|
112
121
|
- public/images/refinerycms-blog/icons/folder_add.png
|
113
122
|
- public/images/refinerycms-blog/icons/folder_edit.png
|
114
123
|
- public/images/refinerycms-blog/icons/page.png
|
115
124
|
- public/images/refinerycms-blog/icons/page_add.png
|
116
125
|
- public/images/refinerycms-blog/icons/page_copy.png
|
126
|
+
- public/images/refinerycms-blog/icons/up.gif
|
127
|
+
- public/images/refinerycms-blog/rss-feed.png
|
117
128
|
- public/javascripts/refinery/refinerycms-blog.js
|
118
129
|
- public/stylesheets/refinery/refinerycms-blog.css
|
119
130
|
- public/stylesheets/refinerycms-blog.css
|
@@ -1,62 +0,0 @@
|
|
1
|
-
class BlogPostsController < ApplicationController
|
2
|
-
|
3
|
-
before_filter :find_all_blog_posts, :find_all_blog_categories
|
4
|
-
before_filter :find_page
|
5
|
-
before_filter :find_blog_post, :only => [:show, :comment]
|
6
|
-
|
7
|
-
def index
|
8
|
-
# you can use meta fields from your model instead (e.g. browser_title)
|
9
|
-
# by swapping @page for @blogs in the line below:
|
10
|
-
present(@page)
|
11
|
-
end
|
12
|
-
|
13
|
-
def show
|
14
|
-
@blog_comment = BlogComment.new
|
15
|
-
|
16
|
-
# you can use meta fields from your model instead (e.g. browser_title)
|
17
|
-
# by swapping @page for @blogs in the line below:
|
18
|
-
present(@page)
|
19
|
-
end
|
20
|
-
|
21
|
-
def comment
|
22
|
-
if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
|
23
|
-
if BlogComment::Moderation.enabled?
|
24
|
-
flash[:notice] = t('.comments.thank_you_moderated')
|
25
|
-
redirect_back_or_default blog_post_url(params[:id])
|
26
|
-
else
|
27
|
-
flash[:notice] = t('.comments.thank_you')
|
28
|
-
redirect_to blog_post_url(params[:id],
|
29
|
-
:anchor => "comment-#{@blog_comment.to_param}")
|
30
|
-
end
|
31
|
-
else
|
32
|
-
render :action => 'show'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
protected
|
37
|
-
|
38
|
-
def find_blog_post
|
39
|
-
@blog_post = BlogPost.live.find(params[:id])
|
40
|
-
end
|
41
|
-
|
42
|
-
def find_all_blog_posts
|
43
|
-
unless params[:category_id].present?
|
44
|
-
@blog_posts = BlogPost.live
|
45
|
-
else
|
46
|
-
if (category = BlogCategory.find(params[:category_id])).present?
|
47
|
-
@blog_posts = category.posts
|
48
|
-
else
|
49
|
-
error_404
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def find_all_blog_categories
|
55
|
-
@blog_categories = BlogCategory.all
|
56
|
-
end
|
57
|
-
|
58
|
-
def find_page
|
59
|
-
@page = Page.find_by_link_url("/blog")
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
File without changes
|
File without changes
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<% content_for :body_content_left do %>
|
2
|
-
<%= @page[Page.default_parts.first.to_sym] %>
|
3
|
-
|
4
|
-
<ul id="blog_posts">
|
5
|
-
<% @blog_posts.each do |blog_post| %>
|
6
|
-
<li>
|
7
|
-
<h2><%= link_to blog_post.title, blog_post_url(blog_post) %></h2>
|
8
|
-
<%= blog_post.created_at.strftime('%d %B %Y') %>
|
9
|
-
<%= truncate(blog_post.body,
|
10
|
-
:length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
|
11
|
-
:preserve_html_tags => true) %>
|
12
|
-
<%= link_to t('.read_more'), blog_post_url(blog_post) %>
|
13
|
-
</li>
|
14
|
-
<% end %>
|
15
|
-
</ul>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<% content_for :body_content_right do %>
|
19
|
-
<%= @page[Page.default_parts.second.to_sym] %>
|
20
|
-
|
21
|
-
<%= render :partial => "side_bar" %>
|
22
|
-
<% end %>
|
23
|
-
|
24
|
-
<%= render :partial => "/shared/content_page" %>
|
25
|
-
<% content_for :head do %>
|
26
|
-
<%= stylesheet_link_tag 'refinerycms-blog' %>
|
27
|
-
<% end %>
|
@@ -1,76 +0,0 @@
|
|
1
|
-
<% content_for :body_content_title, @blog_post.title %>
|
2
|
-
|
3
|
-
<% content_for :body_content_left do %>
|
4
|
-
<%= @blog_post.body %>
|
5
|
-
|
6
|
-
<% if (categories = @blog_post.categories).any? %>
|
7
|
-
<hr />
|
8
|
-
<div class='post_categories'>
|
9
|
-
<span class='filed_in'><%= t('.filed_in') %></span>
|
10
|
-
<ul>
|
11
|
-
<% categories.each_with_index do |category, index| %>
|
12
|
-
<li>
|
13
|
-
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
|
14
|
-
</li>
|
15
|
-
<% end %>
|
16
|
-
</ul>
|
17
|
-
</div>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
<% if (comments = @blog_post.comments.approved).any? %>
|
21
|
-
<hr />
|
22
|
-
<h2><%= t('.comments.title') %></h2>
|
23
|
-
<% comments.each do |comment| %>
|
24
|
-
<div class='blog_comment_message'>
|
25
|
-
<p>
|
26
|
-
<%= comment.message.to_s.gsub("\r\n\r\n", "</p><p>").gsub("\r\n", "<br/>") %>
|
27
|
-
</p>
|
28
|
-
</div>
|
29
|
-
<p class='blog_comment_author'>
|
30
|
-
<%= t('.comments.by', :who => comment.name) %>
|
31
|
-
<%= t('.comments.time_ago', :time => time_ago_in_words(comment.created_at)) %>
|
32
|
-
</p>
|
33
|
-
<% end %>
|
34
|
-
<% end %>
|
35
|
-
|
36
|
-
<% if BlogPost.comments_allowed? %>
|
37
|
-
<hr />
|
38
|
-
<% form_for [:blog_post, @blog_comment] do |f| %>
|
39
|
-
<div class='field'>
|
40
|
-
<%= f.label :name %>
|
41
|
-
<%= f.text_field :name %>
|
42
|
-
</div>
|
43
|
-
<div class='field'>
|
44
|
-
<%= f.label :email %>
|
45
|
-
<%= f.text_field :email %>
|
46
|
-
</div>
|
47
|
-
<div class='field message_field'>
|
48
|
-
<%= f.label :message %>
|
49
|
-
<%= f.text_area :message, :rows => 6 %>
|
50
|
-
</div>
|
51
|
-
<div class='field form-actions'>
|
52
|
-
<%= f.submit t('.submit') %>
|
53
|
-
</div>
|
54
|
-
<% end %>
|
55
|
-
<% end %>
|
56
|
-
<% end %>
|
57
|
-
|
58
|
-
<% content_for :body_content_right do %>
|
59
|
-
<h2><%= t('.created_at_title') %></h2>
|
60
|
-
<%= t('.created_at', :when => @blog_post.created_at.strftime('%d %B %Y')) %>
|
61
|
-
<%= render :partial => "side_bar" %>
|
62
|
-
|
63
|
-
<h2><%= t('.other') %></h2>
|
64
|
-
<ul id="blog_post">
|
65
|
-
<% @blog_posts.each do |blog_post| %>
|
66
|
-
<li>
|
67
|
-
<%= link_to blog_post.title, blog_post_url(blog_post) %>
|
68
|
-
</li>
|
69
|
-
<% end %>
|
70
|
-
</ul>
|
71
|
-
<% end %>
|
72
|
-
|
73
|
-
<%= render :partial => "/shared/content_page" %>
|
74
|
-
<% content_for :head do %>
|
75
|
-
<%= stylesheet_link_tag 'refinerycms-blog' %>
|
76
|
-
<% end %>
|