radiant-forum-extension 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +155 -0
- data/Rakefile +139 -0
- data/VERSION +1 -0
- data/app/controllers/admin/forums_controller.rb +11 -0
- data/app/controllers/forums_controller.rb +34 -0
- data/app/controllers/posts_controller.rb +238 -0
- data/app/controllers/topics_controller.rb +78 -0
- data/app/models/forum.rb +52 -0
- data/app/models/moderatorship.rb +5 -0
- data/app/models/post.rb +122 -0
- data/app/models/post_attachment.rb +73 -0
- data/app/models/topic.rb +162 -0
- data/app/views/admin/forums/_form.html.haml +25 -0
- data/app/views/admin/forums/edit.html.haml +5 -0
- data/app/views/admin/forums/index.html.haml +76 -0
- data/app/views/admin/forums/moderate.html.haml +2 -0
- data/app/views/admin/forums/new.html.haml +5 -0
- data/app/views/admin/forums/remove.html.haml +22 -0
- data/app/views/admin/pages/_edit_commentability.html.haml +9 -0
- data/app/views/admin/reader_settings/_forum.html.haml +4 -0
- data/app/views/admin/sites/_choose_forum_layout.html.haml +7 -0
- data/app/views/forums/_forum.html.haml +22 -0
- data/app/views/forums/index.html.haml +44 -0
- data/app/views/forums/show.html.haml +38 -0
- data/app/views/forums/show.rss.builder +13 -0
- data/app/views/layouts/feed.rss.builder +5 -0
- data/app/views/monitorships/create.rjs.erb +1 -0
- data/app/views/monitorships/destroy.rjs.erb +1 -0
- data/app/views/monitorships/index.html.erb +35 -0
- data/app/views/pages/_comment.html.haml +10 -0
- data/app/views/pages/_comments.html.haml +15 -0
- data/app/views/posts/_attachment.html.haml +2 -0
- data/app/views/posts/_form.html.haml +6 -0
- data/app/views/posts/_latest.html.haml +17 -0
- data/app/views/posts/_post.html.haml +67 -0
- data/app/views/posts/_post.rss.builder +13 -0
- data/app/views/posts/_reply.html.haml +36 -0
- data/app/views/posts/_search.html.haml +28 -0
- data/app/views/posts/_uploader.html.haml +16 -0
- data/app/views/posts/edit.html.haml +20 -0
- data/app/views/posts/index.html.haml +33 -0
- data/app/views/posts/index.rss.builder +14 -0
- data/app/views/posts/new.html.haml +14 -0
- data/app/views/posts/preview.html.haml +32 -0
- data/app/views/posts/search.html.haml +54 -0
- data/app/views/posts/search.rss.builder +14 -0
- data/app/views/posts/show.html.haml +10 -0
- data/app/views/reader_notifier/post.rhtml +14 -0
- data/app/views/readers/_extra_controls.html.haml +5 -0
- data/app/views/readers/show_with_posts.html.haml +47 -0
- data/app/views/topics/_form.html.haml +26 -0
- data/app/views/topics/_help.html.haml +8 -0
- data/app/views/topics/_locked.html.haml +2 -0
- data/app/views/topics/_topic.html.haml +35 -0
- data/app/views/topics/_topic.rss.builder +9 -0
- data/app/views/topics/comments.html.haml +5 -0
- data/app/views/topics/edit.html.haml +26 -0
- data/app/views/topics/index.html.haml +41 -0
- data/app/views/topics/index.rss.builder +14 -0
- data/app/views/topics/new.html.haml +40 -0
- data/app/views/topics/show.html.haml +45 -0
- data/app/views/topics/show.rss.builder +14 -0
- data/config/routes.rb +16 -0
- data/db/migrate/001_create_forum_tables.rb +64 -0
- data/db/migrate/002_pages_commentable.rb +16 -0
- data/db/migrate/003_extend_sites.rb +13 -0
- data/db/migrate/004_sample_layout.rb +41 -0
- data/db/migrate/005_post_attachments.rb +19 -0
- data/db/migrate/006_user_relations.rb +20 -0
- data/db/migrate/007_reader_ownership.rb +35 -0
- data/db/migrate/008_first_posts.rb +13 -0
- data/db/migrate/20090824111005_import_helpers.rb +15 -0
- data/forum_extension.rb +44 -0
- data/lib/forum_admin_ui.rb +37 -0
- data/lib/forum_helper.rb +109 -0
- data/lib/forum_page.rb +45 -0
- data/lib/forum_reader.rb +9 -0
- data/lib/forum_reader_notifier.rb +9 -0
- data/lib/forum_readers_controller.rb +15 -0
- data/lib/forum_red_cloth3.rb +10 -0
- data/lib/forum_red_cloth4.rb +21 -0
- data/lib/forum_site.rb +12 -0
- data/lib/forum_tags.rb +285 -0
- data/lib/tasks/radiant_forum_extension_tasks.rake +137 -0
- data/pkg/radiant-forum-extension-0.5.0.gem +0 -0
- data/public/images/admin/forum.png +0 -0
- data/public/images/admin/new-forum.png +0 -0
- data/public/images/admin/nominus.png +0 -0
- data/public/images/admin/noremove.png +0 -0
- data/public/images/emoticons/angry.gif +0 -0
- data/public/images/emoticons/bigsmile.gif +0 -0
- data/public/images/emoticons/confused.gif +0 -0
- data/public/images/emoticons/cool.gif +0 -0
- data/public/images/emoticons/cry.gif +0 -0
- data/public/images/emoticons/devil.gif +0 -0
- data/public/images/emoticons/neutral.gif +0 -0
- data/public/images/emoticons/sad.gif +0 -0
- data/public/images/emoticons/shamed.gif +0 -0
- data/public/images/emoticons/shocked.gif +0 -0
- data/public/images/emoticons/smile.gif +0 -0
- data/public/images/emoticons/surprised.gif +0 -0
- data/public/images/emoticons/tongue.gif +0 -0
- data/public/images/emoticons/wink.gif +0 -0
- data/public/images/forum/attachment.png +0 -0
- data/public/images/forum/attachment_link.png +0 -0
- data/public/images/forum/attachment_over.png +0 -0
- data/public/images/forum/chk_off.png +0 -0
- data/public/images/forum/chk_on.png +0 -0
- data/public/images/forum/feed_14.png +0 -0
- data/public/images/forum/feed_28.png +0 -0
- data/public/images/forum/post_14.png +0 -0
- data/public/images/forum/post_14_over.png +0 -0
- data/public/images/forum/rdo_off.png +0 -0
- data/public/images/forum/rdo_on.png +0 -0
- data/public/images/forum/wait_16_grey.gif +0 -0
- data/public/javascripts/platform/forum.js +175 -0
- data/public/javascripts/platform/remotecontent.js +89 -0
- data/public/stylesheets/admin/forum.css +87 -0
- data/public/stylesheets/platform/forum.css +70 -0
- data/radiant-forum-extension.gemspec +215 -0
- data/spec/controllers/admin/forums_controller_spec.rb +54 -0
- data/spec/controllers/forums_controller_spec.rb +42 -0
- data/spec/controllers/posts_controller_spec.rb +310 -0
- data/spec/controllers/topics_controller_spec.rb +133 -0
- data/spec/datasets/forum_layouts_dataset.rb +15 -0
- data/spec/datasets/forum_pages_dataset.rb +11 -0
- data/spec/datasets/forum_readers_dataset.rb +55 -0
- data/spec/datasets/forum_sites_dataset.rb +10 -0
- data/spec/datasets/forums_dataset.rb +28 -0
- data/spec/datasets/posts_dataset.rb +31 -0
- data/spec/datasets/topics_dataset.rb +37 -0
- data/spec/lib/forum_admin_ui_spec.rb +35 -0
- data/spec/lib/forum_page_spec.rb +63 -0
- data/spec/lib/forum_reader_notification_spec.rb +9 -0
- data/spec/lib/forum_reader_spec.rb +13 -0
- data/spec/lib/forum_site_spec.rb +39 -0
- data/spec/models/forum_spec.rb +48 -0
- data/spec/models/post_spec.rb +91 -0
- data/spec/models/topic_spec.rb +105 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +44 -0
- data/vendor/plugins/acts_as_list/README +23 -0
- data/vendor/plugins/acts_as_list/init.rb +3 -0
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- metadata +287 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
xm.item do
|
2
|
+
suffix =
|
3
|
+
xm.title h("#{topic.name} (started by #{topic.reader.name})")
|
4
|
+
xm.description truncate_words(topic.posts.first.body, 64)
|
5
|
+
xm.pubDate topic.created_at.to_s(:rfc822)
|
6
|
+
xm.guid [ActionController::Base.session_options[:session_key], topic.forum_id.to_s, topic.id.to_s].join(":"), "isPermaLink" => "false"
|
7
|
+
xm.author h(topic.reader.name)
|
8
|
+
xm.link forum_topic_url(topic.forum, topic)
|
9
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
= render :partial => 'readers/flasher'
|
2
|
+
|
3
|
+
#forum
|
4
|
+
%h1
|
5
|
+
= link_to "#{@forum.name} »", forum_url(@forum), {:class => 'breadhead'}
|
6
|
+
%br
|
7
|
+
Edit discussion
|
8
|
+
|
9
|
+
#new_topic
|
10
|
+
= form_for :topic, :url => forum_topic_path(@forum, @topic), :html => {:method => :put, :class => 'friendly'} do |f|
|
11
|
+
= render :partial => "form", :object => f
|
12
|
+
= submit_tag 'Save Changes'
|
13
|
+
or
|
14
|
+
= link_to('cancel', forum_topic_path(@forum, @topic))
|
15
|
+
|
16
|
+
= render :partial => 'readers/controls'
|
17
|
+
|
18
|
+
- content_for :breadcrumbs do
|
19
|
+
= link_to 'Forum', topics_url
|
20
|
+
\>
|
21
|
+
= link_to @forum.name, forum_url(@forum)
|
22
|
+
\>
|
23
|
+
Edit Discussion
|
24
|
+
|
25
|
+
- content_for :pagetitle do
|
26
|
+
Edit Discussion
|
@@ -0,0 +1,41 @@
|
|
1
|
+
= render :partial => 'readers/flasher'
|
2
|
+
|
3
|
+
#forum
|
4
|
+
#forum_preamble
|
5
|
+
%p
|
6
|
+
This is a list of all the discussions going on here, with the most recently updated first.
|
7
|
+
You can also see a more organised list of
|
8
|
+
= link_to("discussions by category", forums_url) + '.'
|
9
|
+
|
10
|
+
%p
|
11
|
+
= link_to "Start a new discussion", new_topic_url, :class => 'newmessage'
|
12
|
+
|
13
|
+
- if @topics.empty?
|
14
|
+
%p No talk here yet.
|
15
|
+
|
16
|
+
- else
|
17
|
+
- if @topics.previous_page
|
18
|
+
= paginate_and_summarise @topics, 'topics'
|
19
|
+
|
20
|
+
%ul.main
|
21
|
+
= render :partial => 'topics/topic', :collection => @topics, :locals => {:with_context => true}
|
22
|
+
|
23
|
+
= paginate_and_summarise @topics, 'topics'
|
24
|
+
|
25
|
+
- content_for :breadhead do
|
26
|
+
= home_page_link(:class => 'breadhead')
|
27
|
+
|
28
|
+
- content_for :breadcrumbs do
|
29
|
+
Forum
|
30
|
+
|
31
|
+
- content_for :pagetitle do
|
32
|
+
Latest discussion
|
33
|
+
|
34
|
+
- content_for :feed do
|
35
|
+
= feed_link(topics_path(:format => :rss))
|
36
|
+
|
37
|
+
- content_for :controls do
|
38
|
+
= render :partial => 'readers/controls'
|
39
|
+
|
40
|
+
- content_for :help do
|
41
|
+
= render :partial => 'topics/help'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
xml.channel do
|
2
|
+
xml.atom :link, nil, {
|
3
|
+
:href => formatted_topics_url(:rss),
|
4
|
+
:rel => 'self', :type => 'application/rss+xml'
|
5
|
+
}
|
6
|
+
|
7
|
+
xml.title "#{@site_title} : Discussions most recently updated"
|
8
|
+
xml.description "The latest new and updated topics"
|
9
|
+
xml.link topics_url
|
10
|
+
xml.language "en-us"
|
11
|
+
xml.ttl "60"
|
12
|
+
|
13
|
+
render :partial => "topic", :collection => @topics, :locals => {:xm => xml}
|
14
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
= render :partial => 'readers/flasher'
|
2
|
+
|
3
|
+
#forum
|
4
|
+
#new_topic
|
5
|
+
- form_for :topic, :url => @forum ? forum_topics_path(@forum) : topics_path, :html => {:class => 'friendly', :multipart => true} do |f|
|
6
|
+
= render :partial => "form", :object => f
|
7
|
+
%p.buttons
|
8
|
+
= submit_tag 'Start Discussion'
|
9
|
+
or
|
10
|
+
- if @forum
|
11
|
+
= link_to('cancel', forum_path(@forum))
|
12
|
+
- else
|
13
|
+
= link_to('cancel', :back)
|
14
|
+
|
15
|
+
- content_for :pagetitle do
|
16
|
+
Start a new discussion
|
17
|
+
|
18
|
+
- content_for :breadhead do
|
19
|
+
- if @forum
|
20
|
+
= link_to @forum.name, forum_url(@forum), :class => 'breadhead'
|
21
|
+
- else
|
22
|
+
= link_to "Forum", topics_url, :class => 'breadhead'
|
23
|
+
|
24
|
+
- content_for :controls do
|
25
|
+
= render :partial => 'readers/controls'
|
26
|
+
|
27
|
+
- content_for :credits do
|
28
|
+
%p.context
|
29
|
+
You are logged in as
|
30
|
+
= link_to "#{current_reader.name}.", reader_url(current_reader)
|
31
|
+
If that's not you, please
|
32
|
+
= link_to "log out.", reader_logout_url
|
33
|
+
|
34
|
+
- content_for :breadcrumbs do
|
35
|
+
= link_to 'Forum', topics_url
|
36
|
+
\>
|
37
|
+
- if @forum
|
38
|
+
= link_to @forum.name, forum_url(@forum)
|
39
|
+
\>
|
40
|
+
New Discussion
|
@@ -0,0 +1,45 @@
|
|
1
|
+
= render :partial => 'readers/flasher'
|
2
|
+
|
3
|
+
#forum
|
4
|
+
- if @posts.previous_page
|
5
|
+
= paginate_and_summarise @posts, 'comments'
|
6
|
+
|
7
|
+
= render :partial => 'posts/post', :collection => @posts, :locals => { :with_context => false, :first_post => @topic.posts.first }
|
8
|
+
|
9
|
+
- if @posts.next_page
|
10
|
+
= paginate_and_summarise @posts, 'comments'
|
11
|
+
- else
|
12
|
+
- if @topic.page
|
13
|
+
= link_to "Post a reply", new_topic_post_url(@topic), :class => 'inviting remote_content'
|
14
|
+
- else
|
15
|
+
= render :partial => 'posts/reply'
|
16
|
+
|
17
|
+
- content_for :pagetitle do
|
18
|
+
= @topic.name
|
19
|
+
|
20
|
+
- content_for :credits do
|
21
|
+
%p.context
|
22
|
+
posted by
|
23
|
+
= link_to @topic.reader.name, reader_url(@topic.reader)
|
24
|
+
= friendly_date(@topic.created_at)
|
25
|
+
in
|
26
|
+
= link_to @topic.forum.name + '.', forum_url(@topic.forum), {:class => 'breadhead'}
|
27
|
+
|
28
|
+
- content_for :mugshot do
|
29
|
+
= gravatar_for(@topic.reader, {:size => 42}, {:alt => @topic.reader.name, :class => 'gravatar'})
|
30
|
+
|
31
|
+
- content_for :feed do
|
32
|
+
= feed_link(topic_path(@topic, :format => :rss))
|
33
|
+
|
34
|
+
- content_for :controls do
|
35
|
+
= render :partial => 'readers/controls'
|
36
|
+
|
37
|
+
- content_for :breadhead do
|
38
|
+
= link_to @forum.name, forum_url(@forum), :class => 'breadhead'
|
39
|
+
|
40
|
+
- content_for :breadcrumbs do
|
41
|
+
= link_to 'Forum', topics_url
|
42
|
+
\>
|
43
|
+
= link_to @forum.name, forum_url(@forum)
|
44
|
+
\>
|
45
|
+
= @topic.name
|
@@ -0,0 +1,14 @@
|
|
1
|
+
xml.channel do
|
2
|
+
xml.atom :link, nil, {
|
3
|
+
:href => forum_topic_url(@topic.forum, @topic, :format => 'rss'),
|
4
|
+
:rel => 'self', :type => 'application/rss+xml'
|
5
|
+
}
|
6
|
+
|
7
|
+
xml.title "#{@site_title} : #{@topic.name}"
|
8
|
+
xml.description "#{@posts.length} posts, most recently from #{@posts.last.reader.name} on #{@posts.last.created_at.to_s(:informal)}"
|
9
|
+
xml.link forum_topic_url(@topic.forum, @topic)
|
10
|
+
xml.language "en-us"
|
11
|
+
xml.ttl "60"
|
12
|
+
|
13
|
+
render :partial => "posts/post", :collection => @posts, :locals => {:xm => xml}
|
14
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
map.with_options :path_prefix => '/forum' do |forum|
|
3
|
+
forum.resources :forums, :only => [:index, :show], :has_many => [:topics, :posts]
|
4
|
+
forum.resources :topics, :has_many => [:posts]
|
5
|
+
forum.resources :posts, :collection => {:search => :get}
|
6
|
+
forum.resources :pages, :has_many => [:posts], :has_one => [:topic]
|
7
|
+
end
|
8
|
+
|
9
|
+
# forum admin is nested under readers to save interface clutter
|
10
|
+
# some time soon I'll add proper moderation of topics and posts
|
11
|
+
map.namespace :admin, :member => { :remove => :get }, :path_prefix => 'admin/readers' do |admin|
|
12
|
+
admin.resources :forums
|
13
|
+
# admin.resources :topics
|
14
|
+
# admin.resources :posts
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
class CreateForumTables < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
|
4
|
+
create_table "forums", :force => true do |t|
|
5
|
+
t.column "name", :string
|
6
|
+
t.column "description", :text
|
7
|
+
t.column "site_id", :integer
|
8
|
+
t.column "topics_count", :integer, :default => 0
|
9
|
+
t.column "posts_count", :integer, :default => 0
|
10
|
+
t.column "position", :integer
|
11
|
+
t.column "lock_version", :integer, :default => 0
|
12
|
+
t.column "created_at", :datetime
|
13
|
+
t.column "updated_at", :datetime
|
14
|
+
t.column "created_by_id", :integer
|
15
|
+
t.column "updated_by_id", :integer
|
16
|
+
t.column "reader_id", :integer
|
17
|
+
t.column "for_comments", :boolean
|
18
|
+
end
|
19
|
+
add_index "forums", ["site_id"], :name => "index_forums_on_site_id"
|
20
|
+
|
21
|
+
create_table "posts", :force => true do |t|
|
22
|
+
t.column "reader_id", :integer
|
23
|
+
t.column "topic_id", :integer
|
24
|
+
t.column "forum_id", :integer
|
25
|
+
t.column "site_id", :integer
|
26
|
+
t.column "body", :text
|
27
|
+
t.column "created_at", :datetime
|
28
|
+
t.column "updated_at", :datetime
|
29
|
+
end
|
30
|
+
add_index "posts", ["site_id"], :name => "index_posts_on_site_id"
|
31
|
+
add_index "posts", ["forum_id", "created_at"], :name => "index_posts_on_forum_id"
|
32
|
+
add_index "posts", ["reader_id", "created_at"], :name => "index_posts_on_reader_id"
|
33
|
+
|
34
|
+
create_table "topics", :force => true do |t|
|
35
|
+
t.column "forum_id", :integer
|
36
|
+
t.column "site_id", :integer
|
37
|
+
t.column "reader_id", :integer
|
38
|
+
t.column "name", :string
|
39
|
+
t.column "created_at", :datetime
|
40
|
+
t.column "updated_at", :datetime
|
41
|
+
t.column "replied_at", :datetime
|
42
|
+
t.column "hits", :integer, :default => 0
|
43
|
+
t.column "sticky", :boolean, :default => false
|
44
|
+
t.column "posts_count", :integer, :default => 0
|
45
|
+
t.column "first_post_id", :integer
|
46
|
+
t.column "last_post_id", :integer
|
47
|
+
t.column "locked", :boolean, :default => false
|
48
|
+
t.column "replied_by_id", :integer
|
49
|
+
end
|
50
|
+
add_index "topics", ["site_id"], :name => "index_topics_on_site_id"
|
51
|
+
add_index "topics", ["forum_id"], :name => "index_topics_on_forum_id"
|
52
|
+
add_index "topics", ["forum_id", "sticky", "replied_at"], :name => "index_topics_on_sticky_and_replied_at"
|
53
|
+
add_index "topics", ["forum_id", "replied_at"], :name => "index_topics_on_forum_id_and_replied_at"
|
54
|
+
|
55
|
+
add_column :readers, :posts_count, :integer, :default => 0
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.down
|
59
|
+
drop_table :forums
|
60
|
+
drop_table :posts
|
61
|
+
drop_table :topics
|
62
|
+
remove_column :readers, :posts_count
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class PagesCommentable < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :pages, :commentable, :boolean, :default => true
|
4
|
+
add_column :pages, :comments_closed, :boolean, :default => false
|
5
|
+
add_column :topics, :page_id, :integer
|
6
|
+
add_index :topics, :page_id
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
remove_column :pages, :commentable
|
12
|
+
remove_column :pages, :comments_closed
|
13
|
+
remove_column :topics, :page_id
|
14
|
+
remove_index :topics, :page_id
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class SampleLayout < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
Layout.reset_column_information
|
4
|
+
Layout.create :name => 'forum_example', :content => <<-EO
|
5
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
6
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
7
|
+
<html>
|
8
|
+
<head>
|
9
|
+
<title>Forum : <r:content part="pagetitle" /></title>
|
10
|
+
<link rel="stylesheet" href="/stylesheets/platform/reader.css" type="text/css" media="all" />
|
11
|
+
<link rel="stylesheet" href="/stylesheets/platform/forum.css" type="text/css" media="all" />
|
12
|
+
<script type="text/javascript" charset="utf-8" src="/javascripts/platform/mootools.js"></script>
|
13
|
+
<script type="text/javascript" charset="utf-8" src="/javascripts/platform/core.js"></script>
|
14
|
+
<script type="text/javascript" charset="utf-8" src="/javascripts/platform/forum.js"></script>
|
15
|
+
<script type="text/javascript" charset="utf-8" src="/javascripts/platform/remotecontent.js"></script>
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<div id="container">
|
19
|
+
<div id="header">
|
20
|
+
<h1>
|
21
|
+
<r:content part="breadhead" />
|
22
|
+
<r:content part="pagetitle" />
|
23
|
+
<r:content part="feed" />
|
24
|
+
</h1>
|
25
|
+
</div>
|
26
|
+
<div id="page">
|
27
|
+
<r:content />
|
28
|
+
</div>
|
29
|
+
<div id="footer">
|
30
|
+
<r:content part="controls" />
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</body>
|
34
|
+
</html>
|
35
|
+
EO
|
36
|
+
Radiant::Config['forum.layout'] = 'forum_example'
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.down
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class PostAttachments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table "post_attachments" do |t|
|
4
|
+
t.column :post_id, :integer
|
5
|
+
t.column :reader_id, :integer
|
6
|
+
t.column :position, :integer
|
7
|
+
t.column :file_file_name, :string
|
8
|
+
t.column :file_content_type, :string
|
9
|
+
t.column :file_file_size, :integer
|
10
|
+
t.column :file_updated_at, :datetime
|
11
|
+
t.column :created_at, :datetime
|
12
|
+
t.column :updated_at, :datetime
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :post_attachments
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class UserRelations < ActiveRecord::Migration
|
2
|
+
|
3
|
+
# mostly for migrating old sites where users were talking
|
4
|
+
# but also useful for admin moderation, probably
|
5
|
+
# they already have created_at and updated_at
|
6
|
+
|
7
|
+
def self.up
|
8
|
+
add_column :posts, :created_by_id, :integer unless Post.column_names.include?("created_by_id")
|
9
|
+
add_column :posts, :updated_by_id, :integer unless Post.column_names.include?("updated_by_id")
|
10
|
+
add_column :topics, :created_by_id, :integer unless Topic.column_names.include?("created_by_id")
|
11
|
+
add_column :topics, :updated_by_id, :integer unless Topic.column_names.include?("updated_by_id")
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
remove_column :posts, :created_by_id
|
16
|
+
remove_column :posts, :updated_by_id
|
17
|
+
remove_column :topics, :created_by_id
|
18
|
+
remove_column :topics, :updated_by_id
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class ReaderOwnership < ActiveRecord::Migration
|
2
|
+
|
3
|
+
# mostly for migrating old sites where users were talking
|
4
|
+
# but also useful for admin moderation, probably
|
5
|
+
# they already have created_at and updated_at
|
6
|
+
|
7
|
+
def self.up
|
8
|
+
Post.find(:all).each do |post|
|
9
|
+
if Post.column_names.include?("user_id")
|
10
|
+
post.created_by = User.find(post.user_id) rescue nil
|
11
|
+
end
|
12
|
+
unless post.reader
|
13
|
+
post.reader = Reader.find_or_create_for_user(post.created_by)
|
14
|
+
end
|
15
|
+
post.save
|
16
|
+
end
|
17
|
+
Topic.find(:all).each do |topic|
|
18
|
+
if Topic.column_names.include?("user_id")
|
19
|
+
topic.created_by = User.find(topic.user_id) rescue nil
|
20
|
+
end
|
21
|
+
unless topic.reader
|
22
|
+
reader = Reader.find_or_create_for_user(topic.created_by)
|
23
|
+
topic.reader = reader
|
24
|
+
end
|
25
|
+
unless topic.replied_by
|
26
|
+
topic.replied_by = Reader.find_or_create_for_user(User.find(topic.replied_by_id)) rescue nil
|
27
|
+
end
|
28
|
+
topic.save
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.down
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|