refinerycms-blog 0.9.8.dev1
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/categories_controller.rb +5 -0
- data/app/controllers/admin/blog/comments_controller.rb +15 -0
- data/app/controllers/admin/blog/posts_controller.rb +10 -0
- data/app/controllers/admin/blog/settings_controller.rb +11 -0
- data/app/controllers/blog_posts_controller.rb +30 -0
- data/app/models/blog_category.rb +12 -0
- data/app/models/blog_comment.rb +12 -0
- data/app/models/blog_post.rb +17 -0
- data/app/views/admin/blog/_submenu.html.erb +84 -0
- data/app/views/admin/blog/comments/index.html.erb +29 -0
- data/app/views/admin/blog/posts/_form.html.erb +59 -0
- data/app/views/admin/blog/posts/_post.html.erb +16 -0
- data/app/views/admin/blog/posts/_sortable_list.html.erb +7 -0
- data/app/views/admin/blog/posts/edit.html.erb +1 -0
- data/app/views/admin/blog/posts/index.html.erb +30 -0
- data/app/views/admin/blog/posts/new.html.erb +1 -0
- data/app/views/blog_posts/index.html.erb +11 -0
- data/app/views/blog_posts/show.html.erb +20 -0
- data/config/locales/en.yml +39 -0
- data/config/locales/nb.yml +23 -0
- data/config/locales/nl.yml +23 -0
- data/config/routes.rb +12 -0
- data/generators/refinery_blog/refinery_blog_generator.rb +53 -0
- data/generators/refinery_blog/templates/migration.rb +26 -0
- data/generators/refinery_blog/templates/seed.rb +16 -0
- data/lib/gemspec.rb +30 -0
- data/lib/refinerycms-blog.rb +9 -0
- data/rails/init.rb +10 -0
- data/readme.md +1 -0
- metadata +99 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
class Admin::Blog::CommentsController < Admin::BaseController
|
2
|
+
|
3
|
+
crudify :blog_comment, :title_attribute => :name, :order => 'created_at DESC'
|
4
|
+
|
5
|
+
def approved
|
6
|
+
@blog_comments = BlogComment.approved
|
7
|
+
render :action => 'index'
|
8
|
+
end
|
9
|
+
|
10
|
+
def rejected
|
11
|
+
@blog_comments = BlogComment.rejected
|
12
|
+
render :action => 'index'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Admin::Blog::PostsController < Admin::BaseController
|
2
|
+
|
3
|
+
crudify :blog_post, :title_attribute => :title, :order => 'created_at DESC'
|
4
|
+
before_filter :find_all_categories, :only => [:new, :edit, :create, :update]
|
5
|
+
|
6
|
+
protected
|
7
|
+
def find_all_categories
|
8
|
+
@blog_categories = BlogCategory.find(:all)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class BlogPostsController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :find_all_blog_posts
|
4
|
+
before_filter :find_page
|
5
|
+
|
6
|
+
def index
|
7
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
8
|
+
# by swapping @page for @blogs in the line below:
|
9
|
+
present(@page)
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
@blog_post = BlogPost.live.find(params[:id])
|
14
|
+
|
15
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
16
|
+
# by swapping @page for @blogs in the line below:
|
17
|
+
present(@page)
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def find_all_blog_posts
|
23
|
+
@blog_posts = BlogPost.live
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_page
|
27
|
+
@page = Page.find_by_link_url("/blogs")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class BlogCategory < ActiveRecord::Base
|
2
|
+
|
3
|
+
has_and_belongs_to_many :posts, :class_name => 'BlogPost'
|
4
|
+
|
5
|
+
acts_as_indexed :fields => [:title]
|
6
|
+
|
7
|
+
validates_presence_of :title
|
8
|
+
validates_uniqueness_of :title
|
9
|
+
|
10
|
+
has_friendly_id :title, :use_slug => true
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class BlogComment < ActiveRecord::Base
|
2
|
+
|
3
|
+
belongs_to :post, :class_name => 'BlogPost'
|
4
|
+
|
5
|
+
acts_as_indexed :fields => [:name, :email, :body]
|
6
|
+
|
7
|
+
validates_presence_of :title
|
8
|
+
validates_uniqueness_of :title
|
9
|
+
|
10
|
+
named_scope :approved, :conditions => {:approved => true}
|
11
|
+
named_scope :rejected, :conditions => {:approved => false}
|
12
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class BlogPost < ActiveRecord::Base
|
2
|
+
|
3
|
+
has_many :comments, :class_name => 'BlogComment'
|
4
|
+
has_and_belongs_to_many :categories, :class_name => 'BlogCategory'
|
5
|
+
|
6
|
+
acts_as_indexed :fields => [:title, :body]
|
7
|
+
|
8
|
+
validates_presence_of :title
|
9
|
+
validates_uniqueness_of :title
|
10
|
+
|
11
|
+
has_friendly_id :title, :use_slug => true
|
12
|
+
|
13
|
+
default_scope :order => "created_at DESC"
|
14
|
+
|
15
|
+
named_scope :live, :conditions => {:draft => false}
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<div id='actions'>
|
2
|
+
<ul>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_blog_posts_url
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
</ul>
|
10
|
+
|
11
|
+
<ul>
|
12
|
+
<li<%= " class='selected'" if request.path == admin_blog_posts_path %>>
|
13
|
+
<%= link_to t('.posts.title'), admin_blog_posts_path %>
|
14
|
+
</li>
|
15
|
+
<li>
|
16
|
+
<%= link_to t('.posts.new'), new_admin_blog_post_url,
|
17
|
+
:class => "add_icon" %>
|
18
|
+
</li>
|
19
|
+
</ul>
|
20
|
+
|
21
|
+
<ul style='margin-top: 30px'>
|
22
|
+
<li<%= " class='selected'" if request.path == admin_blog_comments_path %>>
|
23
|
+
<%= link_to t('.comments.new'), admin_blog_comments_path,
|
24
|
+
:class => 'user_comment_icon' %>
|
25
|
+
</li>
|
26
|
+
<li<%= " class='selected'" if request.path == approved_admin_blog_comments_path %>>
|
27
|
+
<%= link_to t('.comments.approved'), approved_admin_blog_comments_path,
|
28
|
+
:class => 'user_comments_add_icon' %>
|
29
|
+
</li>
|
30
|
+
<li<%= " class='selected'" if request.path == rejected_admin_blog_comments_path %>>
|
31
|
+
<%= link_to t('.comments.rejected'), rejected_admin_blog_comments_path,
|
32
|
+
:class => 'user_comments_delete_icon' %>
|
33
|
+
</li>
|
34
|
+
</ul>
|
35
|
+
|
36
|
+
<ul class='collapsible_menu' style='margin-top: 30px'>
|
37
|
+
<li<%= " class='selected'" if request.path == admin_blog_categories_path %>>
|
38
|
+
<%= link_to t('.categories.title'), admin_blog_categories_url,
|
39
|
+
:class => 'category_icon'%>
|
40
|
+
</li>
|
41
|
+
<li>
|
42
|
+
<%= link_to t('.categories.manage'), admin_blog_categories_url,
|
43
|
+
:class => 'edit_icon' %>
|
44
|
+
</li>
|
45
|
+
<li>
|
46
|
+
<%= link_to t('.categories.new'), new_admin_blog_category_url(:dialog => true),
|
47
|
+
:class => 'add_icon' %>
|
48
|
+
</li>
|
49
|
+
</ul>
|
50
|
+
|
51
|
+
<ul class='collapsible_menu' style='margin-top: 30px'>
|
52
|
+
<li<%= " class='selected'" if request.path == admin_blog_settings_path %>>
|
53
|
+
<%= link_to t('.settings.title'), admin_blog_settings_path,
|
54
|
+
:class => 'settings_icon' %>
|
55
|
+
</li>
|
56
|
+
<li>
|
57
|
+
<%= link_to t('.settings.moderation'), moderation_admin_blog_settings_url,
|
58
|
+
:class => 'tick_icon' # TODO: update to tick or cross later
|
59
|
+
%>
|
60
|
+
</li>
|
61
|
+
<li>
|
62
|
+
<%= link_to t('.settings.update_notified'), update_notified_admin_blog_settings_url(:dialog => true),
|
63
|
+
:class => 'user_comment_icon' %>
|
64
|
+
</li>
|
65
|
+
</ul>
|
66
|
+
|
67
|
+
</div>
|
68
|
+
<% content_for :head do %>
|
69
|
+
<script type='text/javascript'>
|
70
|
+
$(document).ready(function(){
|
71
|
+
$('ul.collapsible_menu').each(function(i, ul) {
|
72
|
+
(first_li = $(this).children('li:first')).after(div=$("<div style='display: none'></div>"));
|
73
|
+
$(this).children('li:not(:first)').appendTo(div);
|
74
|
+
first_li.find('> a').click(function(e){
|
75
|
+
$(this).css('background-image', "url('/images/refinery/ajax-loader.gif') !important");
|
76
|
+
$(this).parent().next('div').animate({opacity: 'toggle', height: 'toggle'}, 250, $.proxy(function(){
|
77
|
+
$(this).css('background-image', null);
|
78
|
+
}, $(this)));
|
79
|
+
e.preventDefault();
|
80
|
+
});
|
81
|
+
});
|
82
|
+
});
|
83
|
+
</script>
|
84
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<%= render :partial => '/admin/blog/submenu' %>
|
2
|
+
<div id='records'>
|
3
|
+
<% if searching? %>
|
4
|
+
<h2><%= t('admin.search_results_for', :query => params[:search]) %></h2>
|
5
|
+
<% if @blog_comments.any? %>
|
6
|
+
<%= render :partial => "blog_comments",
|
7
|
+
:collection => @blog_comments %>
|
8
|
+
<% else %>
|
9
|
+
<p><%= t('admin.search_no_results') %></p>
|
10
|
+
<% end %>
|
11
|
+
<% else %>
|
12
|
+
<% if @blog_comments.any? %>
|
13
|
+
<%= will_paginate @blog_comments,
|
14
|
+
:previous_label => '«',
|
15
|
+
:next_label => '»' %>
|
16
|
+
|
17
|
+
<%= render :partial => "sortable_list" %>
|
18
|
+
|
19
|
+
<%= will_paginate @blog_comments,
|
20
|
+
:previous_label => '«',
|
21
|
+
:next_label => '»' %>
|
22
|
+
<% else %>
|
23
|
+
<h3>
|
24
|
+
<%= t('.no_items_yet',
|
25
|
+
:type => (t("admin.blog.submenu.comments.#{action_name}").downcase unless action_name == 'index')) %>
|
26
|
+
</h3>
|
27
|
+
<% end %>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<% form_for [:admin, @blog_post] do |f| -%>
|
2
|
+
<%= f.error_messages %>
|
3
|
+
|
4
|
+
<div class='field'>
|
5
|
+
<%= f.label :title -%>
|
6
|
+
<%= f.text_field :title, :class => 'larger widest' -%>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class='field'>
|
10
|
+
<%= f.label :body -%>
|
11
|
+
<%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%>
|
12
|
+
</div>
|
13
|
+
<div id='more_options_field'>
|
14
|
+
<p>
|
15
|
+
<%= link_to t('.advanced_options'), "#",
|
16
|
+
:id => 'toggle_advanced_options',
|
17
|
+
:title => t('.toggle_advanced_options') %>
|
18
|
+
</p>
|
19
|
+
<span id='draft_field'>
|
20
|
+
<%= f.check_box :draft %>
|
21
|
+
<%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
|
22
|
+
</span>
|
23
|
+
</div>
|
24
|
+
<div id='more_options' style="display:none;">
|
25
|
+
<div class="hemisquare">
|
26
|
+
<h3><%= t('admin.blog.submenu.categories.title') %></h3>
|
27
|
+
<ul class='categories'>
|
28
|
+
<% @blog_categories.each do |category| %>
|
29
|
+
<li>
|
30
|
+
checkboxes for category <%= category.title %>
|
31
|
+
</li>
|
32
|
+
<% end %>
|
33
|
+
</ul>
|
34
|
+
</div>
|
35
|
+
<div class='hemisquare right_side'>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<%= render :partial => "/shared/admin/form_actions",
|
39
|
+
:locals => {
|
40
|
+
:f => f,
|
41
|
+
:continue_editing => true,
|
42
|
+
:delete_title => t('admin.blogs.blogs.delete')
|
43
|
+
} %>
|
44
|
+
<% end -%>
|
45
|
+
<% content_for :head do %>
|
46
|
+
<script type='text/javascript'>
|
47
|
+
$(document).ready(function(){
|
48
|
+
$('#toggle_advanced_options').click(function(e){
|
49
|
+
e.preventDefault();
|
50
|
+
|
51
|
+
$('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);
|
52
|
+
|
53
|
+
$('html,body').animate({
|
54
|
+
scrollTop: $('#toggle_advanced_options').parent().offset().top
|
55
|
+
}, 250);
|
56
|
+
});
|
57
|
+
});
|
58
|
+
</script>
|
59
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(post) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%=h post.title %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_go.png"), blog_post_url(post),
|
8
|
+
:title => t('.view_live'),
|
9
|
+
:target => "_blank" %>
|
10
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_blog_post_path(post),
|
11
|
+
:title => t('.edit') %>
|
12
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_blog_post_path(post),
|
13
|
+
:class => "cancel confirm-delete",
|
14
|
+
:title => t('.delete') %>
|
15
|
+
</span>
|
16
|
+
</li>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%= render :partial => '/admin/blog/submenu' %>
|
2
|
+
<div id='records'>
|
3
|
+
<% if searching? %>
|
4
|
+
<h2><%= t('admin.search_results_for', :query => params[:search]) %></h2>
|
5
|
+
<% if @blog_posts.any? %>
|
6
|
+
<%= render :partial => "blog_posts",
|
7
|
+
:collection => @blog_posts %>
|
8
|
+
<% else %>
|
9
|
+
<p><%= t('admin.search_no_results') %></p>
|
10
|
+
<% end %>
|
11
|
+
<% else %>
|
12
|
+
<% if @blog_posts.any? %>
|
13
|
+
<%= will_paginate @blog_posts,
|
14
|
+
:previous_label => '«',
|
15
|
+
:next_label => '»' %>
|
16
|
+
|
17
|
+
<%= render :partial => "sortable_list" %>
|
18
|
+
|
19
|
+
<%= will_paginate @blog_posts,
|
20
|
+
:previous_label => '«',
|
21
|
+
:next_label => '»' %>
|
22
|
+
<% else %>
|
23
|
+
<p>
|
24
|
+
<strong>
|
25
|
+
<%= t('.no_items_yet') %>
|
26
|
+
</strong>
|
27
|
+
</p>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => "form" %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<ul id="blog_posts">
|
3
|
+
<% @blog_posts.each do |blog_post| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to blog_post.title, blog_post_url(blog_post) %>
|
6
|
+
</li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% content_for :body_content_title, @blog_post.title %>
|
2
|
+
|
3
|
+
<% content_for :body_content_left do %>
|
4
|
+
|
5
|
+
<%= @blog_post.body %>
|
6
|
+
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<% content_for :body_content_right do %>
|
10
|
+
<h2><%= t('.other') %></h2>
|
11
|
+
<ul id="blog_post">
|
12
|
+
<% @blog_posts.each do |blog_post| %>
|
13
|
+
<li>
|
14
|
+
<%= link_to blog_post.title, blog_post_url(blog_post) %>
|
15
|
+
</li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
en:
|
2
|
+
plugins:
|
3
|
+
refinerycms_blog:
|
4
|
+
title: Blog
|
5
|
+
admin:
|
6
|
+
blog:
|
7
|
+
posts:
|
8
|
+
form:
|
9
|
+
advanced_options: Advanced Options
|
10
|
+
toggle_advanced_options: Click to access meta tag settings and menu options
|
11
|
+
save_as_draft: Save as Draft
|
12
|
+
index:
|
13
|
+
no_items_yet: There are no Blog Posts yet. Click "Create a new Blog Posts" to add your first blog posts.
|
14
|
+
post:
|
15
|
+
view_live: View this blog post live <br/><em>(opens in a new window)</em>
|
16
|
+
edit: Edit this blog post
|
17
|
+
delete: Remove this blog post forever
|
18
|
+
comments:
|
19
|
+
index:
|
20
|
+
no_items_yet: There are no {{type}} comments yet.
|
21
|
+
submenu:
|
22
|
+
categories:
|
23
|
+
title: Categories
|
24
|
+
manage: Manage
|
25
|
+
new: Create new category
|
26
|
+
comments:
|
27
|
+
new: New
|
28
|
+
approved: Approved
|
29
|
+
rejected: Rejected
|
30
|
+
posts:
|
31
|
+
title: Posts
|
32
|
+
new: Create new post
|
33
|
+
settings:
|
34
|
+
title: Settings
|
35
|
+
moderation: Moderation
|
36
|
+
update_notified: Update who gets notified
|
37
|
+
blog_posts:
|
38
|
+
show:
|
39
|
+
other: Other Blog Posts
|
@@ -0,0 +1,23 @@
|
|
1
|
+
nb:
|
2
|
+
plugins:
|
3
|
+
refinerycms_blog:
|
4
|
+
title: Blog
|
5
|
+
admin:
|
6
|
+
blog:
|
7
|
+
posts:
|
8
|
+
index:
|
9
|
+
no_items_yet: Det er ingen Blog Posts enda. Klikk på "Lag en ny Blog Posts" for å legge til din første blog posts.
|
10
|
+
post:
|
11
|
+
view_live: Vis hvordan denne blog post ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
12
|
+
edit: Rediger denne blog post
|
13
|
+
delete: Fjern denne blog post permanent
|
14
|
+
submenu:
|
15
|
+
comments:
|
16
|
+
new: ny
|
17
|
+
posts:
|
18
|
+
new: Lag en ny post
|
19
|
+
settings:
|
20
|
+
update_notified: Oppdater hvem som blir informert
|
21
|
+
blog_posts:
|
22
|
+
show:
|
23
|
+
other: Andre Blog Posts
|
@@ -0,0 +1,23 @@
|
|
1
|
+
nl:
|
2
|
+
plugins:
|
3
|
+
refinerycms_blog:
|
4
|
+
title: Blog
|
5
|
+
admin:
|
6
|
+
blog:
|
7
|
+
posts:
|
8
|
+
index:
|
9
|
+
no_items_yet: Er zijn nog geen Blog Post. Druk op 'Maak een nieuwe Blog Post' om de eerste aan te maken.
|
10
|
+
post:
|
11
|
+
view_live: Bekijk deze blog posts op de website <br/><em>(opent een nieuw venster)</em>
|
12
|
+
edit: Bewerk deze blog post
|
13
|
+
delete: Verwijder deze blog post voor eeuwig
|
14
|
+
submenu:
|
15
|
+
comments:
|
16
|
+
new: Nieuwe
|
17
|
+
posts:
|
18
|
+
new: Maak een nieuwe post
|
19
|
+
settings:
|
20
|
+
update_notified: Wijzig wie een notificatie ontvangt
|
21
|
+
blog_posts:
|
22
|
+
show:
|
23
|
+
other: Andere Blog Post
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
map.resources :blog_posts, :as => :blog
|
3
|
+
|
4
|
+
map.namespace(:admin, :path_prefix => 'refinery') do |admin|
|
5
|
+
admin.namespace :blog do |blog|
|
6
|
+
blog.resources :posts
|
7
|
+
blog.resources :categories
|
8
|
+
blog.resources :comments, :collection => {:approved => :get, :rejected => :get}
|
9
|
+
blog.resources :settings, :collection => {:update_notified => [:get, :post], :moderation => :get}
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class RefineryBlogGenerator < Rails::Generator::NamedBase
|
2
|
+
|
3
|
+
def initialize(*runtime_args)
|
4
|
+
# set argument for the user.
|
5
|
+
runtime_args[0] = %w(refinerycms_blog)
|
6
|
+
super(*runtime_args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def banner
|
10
|
+
'Usage: script/generate refinery_blog'
|
11
|
+
end
|
12
|
+
|
13
|
+
def manifest
|
14
|
+
record do |m|
|
15
|
+
m.template('seed.rb', 'db/seeds/refinerycms_blog.rb')
|
16
|
+
|
17
|
+
m.migration_template('migration.rb', 'db/migrate',
|
18
|
+
:migration_file_name => 'create_blog_structure',
|
19
|
+
:assigns => {
|
20
|
+
:migration_name => 'CreateBlogStructure',
|
21
|
+
:tables => [{
|
22
|
+
:table_name => 'blog_posts',
|
23
|
+
:attributes => [
|
24
|
+
Rails::Generator::GeneratedAttribute.new('title', 'string'),
|
25
|
+
Rails::Generator::GeneratedAttribute.new('body', 'text'),
|
26
|
+
Rails::Generator::GeneratedAttribute.new('draft', 'boolean')
|
27
|
+
], :id => true
|
28
|
+
},{
|
29
|
+
:table_name => 'blog_comments',
|
30
|
+
:attributes => [
|
31
|
+
Rails::Generator::GeneratedAttribute.new('name', 'string'),
|
32
|
+
Rails::Generator::GeneratedAttribute.new('email', 'string'),
|
33
|
+
Rails::Generator::GeneratedAttribute.new('body', 'text'),
|
34
|
+
Rails::Generator::GeneratedAttribute.new('approved', 'boolean'),
|
35
|
+
Rails::Generator::GeneratedAttribute.new('blog_post_id', 'integer')
|
36
|
+
], :id => true
|
37
|
+
},{
|
38
|
+
:table_name => 'blog_categories',
|
39
|
+
:attributes => [
|
40
|
+
Rails::Generator::GeneratedAttribute.new('title', 'string')
|
41
|
+
], :id => true
|
42
|
+
},{
|
43
|
+
:table_name => 'blog_categories_blog_posts',
|
44
|
+
:attributes => [
|
45
|
+
Rails::Generator::GeneratedAttribute.new('blog_category_id', 'integer'),
|
46
|
+
Rails::Generator::GeneratedAttribute.new('blog_post_id', 'integer')
|
47
|
+
], :id => false
|
48
|
+
}]
|
49
|
+
})
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end if defined?(Rails::Generator::NamedBase)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class <%= migration_name %> < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up<% tables.each do |table| %>
|
4
|
+
create_table :<%= table[:table_name] %>, :id => <%= table[:id].to_s %> do |t|
|
5
|
+
<% table[:attributes].each do |attribute| -%>
|
6
|
+
t.<%= attribute.type %> :<%= attribute.name %>
|
7
|
+
<% end -%>
|
8
|
+
<%= 't.timestamps' if table[:id] %>
|
9
|
+
end
|
10
|
+
|
11
|
+
<%= "add_index :#{table[:table_name]}, :id" if table[:id] %>
|
12
|
+
<% end -%>
|
13
|
+
load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
UserPlugin.destroy_all({:name => "refinerycms_blog"})
|
18
|
+
|
19
|
+
Page.delete_all({:link_url => "/blog"})
|
20
|
+
|
21
|
+
<% tables.each do |table| -%>
|
22
|
+
drop_table :<%= table[:table_name] %>
|
23
|
+
<% end -%>
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
User.find(:all).each do |user|
|
2
|
+
user.plugins.create(:name => "<%= singular_name %>",
|
3
|
+
:position => (user.plugins.maximum(:position) || -1) +1)
|
4
|
+
end
|
5
|
+
|
6
|
+
page = Page.create(
|
7
|
+
:title => "Blog",
|
8
|
+
:link_url => "/blog",
|
9
|
+
:deletable => false,
|
10
|
+
:position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1),
|
11
|
+
:menu_match => "^/blogs?(\/|\/.+?|)$"
|
12
|
+
)
|
13
|
+
|
14
|
+
RefinerySetting.find_or_set(:default_page_parts, %w(Body Side\ Body)).each do |default_page_part|
|
15
|
+
page.parts.create(:title => default_page_part, :body => nil)
|
16
|
+
end
|
data/lib/gemspec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.expand_path('../refinerycms-blog.rb', __FILE__)
|
3
|
+
version = ::Refinery::Blog.version
|
4
|
+
raise "Could not get version so gemspec can not be built" if version.nil?
|
5
|
+
files = Dir.glob("**/*").flatten.reject do |file|
|
6
|
+
file =~ /\.gem(spec)?$/
|
7
|
+
end
|
8
|
+
|
9
|
+
gemspec = <<EOF
|
10
|
+
Gem::Specification.new do |s|
|
11
|
+
s.name = %q{refinerycms-blog}
|
12
|
+
s.version = %q{#{version}}
|
13
|
+
s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.}
|
14
|
+
s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
|
15
|
+
s.summary = %q{Ruby on Rails blogging engine for RefineryCMS.}
|
16
|
+
s.email = %q{info@refinerycms.com}
|
17
|
+
s.homepage = %q{http://refinerycms.com}
|
18
|
+
s.authors = %w(Resolve\\ Digital Neoteric\\ Design)
|
19
|
+
s.require_paths = %w(lib)
|
20
|
+
|
21
|
+
s.files = %w(
|
22
|
+
#{files.join("\n ")}
|
23
|
+
)
|
24
|
+
#{"s.test_files = %w(
|
25
|
+
#{Dir.glob("test/**/*.rb").join("\n ")}
|
26
|
+
)" if File.directory?("test")}
|
27
|
+
end
|
28
|
+
EOF
|
29
|
+
|
30
|
+
File.open(File.expand_path("../../refinerycms-blog.gemspec", __FILE__), 'w').puts(gemspec)
|
data/rails/init.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Refinery::Plugin.register do |plugin|
|
2
|
+
plugin.name = "refinerycms_blog"
|
3
|
+
plugin.url = {:controller => '/admin/blog/posts', :action => 'index'}
|
4
|
+
plugin.menu_match = /^\/?(admin|refinery)\/blog\/?(posts|comments|categories)?/
|
5
|
+
plugin.activity = {
|
6
|
+
:class => BlogPost
|
7
|
+
}
|
8
|
+
|
9
|
+
plugin.directory = directory # tell refinery where this plugin is located
|
10
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Blog plugin redux
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refinerycms-blog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1641194447
|
5
|
+
prerelease: true
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 8
|
10
|
+
- dev1
|
11
|
+
version: 0.9.8.dev1
|
12
|
+
platform: ruby
|
13
|
+
authors:
|
14
|
+
- Resolve Digital
|
15
|
+
- Neoteric Design
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2010-08-09 00:00:00 +12:00
|
21
|
+
default_executable:
|
22
|
+
dependencies: []
|
23
|
+
|
24
|
+
description: A really straightforward open source Ruby on Rails blog engine designed for integration with RefineryCMS.
|
25
|
+
email: info@refinerycms.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- app/controllers/admin/blog/categories_controller.rb
|
34
|
+
- app/controllers/admin/blog/comments_controller.rb
|
35
|
+
- app/controllers/admin/blog/posts_controller.rb
|
36
|
+
- app/controllers/admin/blog/settings_controller.rb
|
37
|
+
- app/controllers/blog_posts_controller.rb
|
38
|
+
- app/models/blog_category.rb
|
39
|
+
- app/models/blog_comment.rb
|
40
|
+
- app/models/blog_post.rb
|
41
|
+
- app/views/admin/blog/_submenu.html.erb
|
42
|
+
- app/views/admin/blog/comments/index.html.erb
|
43
|
+
- app/views/admin/blog/posts/_form.html.erb
|
44
|
+
- app/views/admin/blog/posts/_post.html.erb
|
45
|
+
- app/views/admin/blog/posts/_sortable_list.html.erb
|
46
|
+
- app/views/admin/blog/posts/edit.html.erb
|
47
|
+
- app/views/admin/blog/posts/index.html.erb
|
48
|
+
- app/views/admin/blog/posts/new.html.erb
|
49
|
+
- app/views/blog_posts/index.html.erb
|
50
|
+
- app/views/blog_posts/show.html.erb
|
51
|
+
- config/locales/en.yml
|
52
|
+
- config/locales/nb.yml
|
53
|
+
- config/locales/nl.yml
|
54
|
+
- config/routes.rb
|
55
|
+
- generators/refinery_blog/refinery_blog_generator.rb
|
56
|
+
- generators/refinery_blog/templates/migration.rb
|
57
|
+
- generators/refinery_blog/templates/seed.rb
|
58
|
+
- lib/gemspec.rb
|
59
|
+
- lib/refinerycms-blog.rb
|
60
|
+
- rails/init.rb
|
61
|
+
- readme.md
|
62
|
+
has_rdoc: true
|
63
|
+
homepage: http://refinerycms.com
|
64
|
+
licenses: []
|
65
|
+
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ">"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 25
|
86
|
+
segments:
|
87
|
+
- 1
|
88
|
+
- 3
|
89
|
+
- 1
|
90
|
+
version: 1.3.1
|
91
|
+
requirements: []
|
92
|
+
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 1.3.7
|
95
|
+
signing_key:
|
96
|
+
specification_version: 3
|
97
|
+
summary: Ruby on Rails blogging engine for RefineryCMS.
|
98
|
+
test_files: []
|
99
|
+
|