radiant-forum-extension 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/README.md +37 -56
  2. data/VERSION +1 -1
  3. data/app/controllers/forum_base_controller.rb +78 -0
  4. data/app/controllers/forums_controller.rb +5 -34
  5. data/app/controllers/posts_controller.rb +61 -153
  6. data/app/controllers/topics_controller.rb +6 -63
  7. data/app/helpers/forum_helper.rb +24 -48
  8. data/app/models/forum.rb +5 -18
  9. data/app/models/post.rb +53 -55
  10. data/app/models/post_attachment.rb +9 -6
  11. data/app/models/topic.rb +20 -113
  12. data/app/views/admin/reader_configuration/_edit_forum.html.haml +4 -2
  13. data/app/views/admin/reader_configuration/_forum.html.haml +6 -2
  14. data/app/views/forums/_forum.html.haml +14 -20
  15. data/app/views/forums/_latest.html.haml +12 -0
  16. data/app/views/forums/_standard_parts.html.haml +49 -0
  17. data/app/views/forums/index.html.haml +16 -24
  18. data/app/views/forums/show.html.haml +18 -28
  19. data/app/views/pages/_comment.html.haml +1 -1
  20. data/app/views/posts/_attachments.html.haml +13 -0
  21. data/app/views/posts/_confirm_delete.html.haml +10 -0
  22. data/app/views/posts/_context.html.haml +16 -0
  23. data/app/views/posts/_edit_links.html.haml +11 -0
  24. data/app/views/posts/_form.html.haml +40 -2
  25. data/app/views/posts/_latest.html.haml +10 -17
  26. data/app/views/posts/_new_attachment.html.haml +2 -0
  27. data/app/views/posts/_post.html.haml +25 -60
  28. data/app/views/posts/{_search.html.haml → _search_form.html.haml} +1 -1
  29. data/app/views/posts/_uploader.html.haml +2 -2
  30. data/app/views/posts/edit.html.haml +26 -13
  31. data/app/views/posts/index.html.haml +19 -27
  32. data/app/views/posts/new.html.haml +27 -7
  33. data/app/views/posts/remove.html.haml +27 -0
  34. data/app/views/posts/show.html.haml +20 -7
  35. data/app/views/readers/_forum_messages.html.haml +20 -0
  36. data/app/views/readers/_messages_summary.html.haml +3 -0
  37. data/app/views/topics/_context.html.haml +12 -0
  38. data/app/views/topics/_latest.html.haml +14 -16
  39. data/app/views/topics/_locked.html.haml +1 -1
  40. data/app/views/topics/_replies.html.haml +6 -0
  41. data/app/views/topics/_reply.html.haml +23 -0
  42. data/app/views/topics/_topic.html.haml +14 -43
  43. data/app/views/topics/_voices.html.haml +5 -0
  44. data/app/views/topics/index.html.haml +11 -24
  45. data/app/views/topics/show.html.haml +25 -38
  46. data/config/initializers/radiant_config.rb +5 -1
  47. data/config/locales/en.yml +73 -27
  48. data/config/routes.rb +3 -4
  49. data/db/migrate/20101222160900_page_posts.rb +21 -0
  50. data/db/migrate/20101222163605_no_comment_forum.rb +10 -0
  51. data/db/migrate/20110105103827_topic_merely_associative.rb +23 -0
  52. data/db/migrate/20110111080550_detach_observer.rb +11 -0
  53. data/db/migrate/20110127113852_import_attachments.rb +9 -0
  54. data/forum_extension.rb +12 -13
  55. data/lib/commentable_model.rb +98 -0
  56. data/lib/forum_page.rb +2 -22
  57. data/lib/forum_reader_sessions_controller.rb +14 -0
  58. data/lib/forum_readers_controller.rb +2 -9
  59. data/lib/forum_red_cloth3.rb +23 -4
  60. data/lib/forum_red_cloth4.rb +23 -4
  61. data/lib/forum_tags.rb +298 -194
  62. data/lib/sanitize/config/forum.rb +47 -0
  63. data/public/images/furniture/blank.png +0 -0
  64. data/public/images/furniture/emoticons.png +0 -0
  65. data/public/javascripts/forum.js +349 -93
  66. data/public/javascripts/jquery.tools.min.js +195 -0
  67. data/public/punymce/blank.htm +1 -0
  68. data/public/punymce/css/content.css +4 -0
  69. data/public/punymce/css/editor.css +58 -0
  70. data/public/punymce/i18n/sv.js +28 -0
  71. data/public/punymce/img/icons.gif +0 -0
  72. data/public/punymce/img/icons_uncompressed.png +0 -0
  73. data/public/punymce/plugins/bbcode.js +1 -0
  74. data/public/punymce/plugins/bbcode_src.js +50 -0
  75. data/public/punymce/plugins/editsource/css/editor.css +3 -0
  76. data/public/punymce/plugins/editsource/editsource.js +1 -0
  77. data/public/punymce/plugins/editsource/editsource_src.js +81 -0
  78. data/public/punymce/plugins/editsource/img/icons.gif +0 -0
  79. data/public/punymce/plugins/emoticons/css/content.css +13 -0
  80. data/public/punymce/plugins/emoticons/css/editor.css +17 -0
  81. data/public/punymce/plugins/emoticons/emoticons.js +1 -0
  82. data/public/punymce/plugins/emoticons/emoticons_src.js +303 -0
  83. data/public/punymce/plugins/emoticons/img/emoticons.gif +0 -0
  84. data/public/punymce/plugins/emoticons/img/emoticons.png +0 -0
  85. data/public/punymce/plugins/emoticons/img/trans.gif +0 -0
  86. data/public/punymce/plugins/entities.js +1 -0
  87. data/public/punymce/plugins/entities_src.js +37 -0
  88. data/public/punymce/plugins/forceblocks.js +1 -0
  89. data/public/punymce/plugins/forceblocks_src.js +465 -0
  90. data/public/punymce/plugins/forcenl.js +1 -0
  91. data/public/punymce/plugins/forcenl_src.js +26 -0
  92. data/public/punymce/plugins/image/css/editor.css +1 -0
  93. data/public/punymce/plugins/image/image.js +1 -0
  94. data/public/punymce/plugins/image/image_src.js +30 -0
  95. data/public/punymce/plugins/image/img/icons.gif +0 -0
  96. data/public/punymce/plugins/link/css/editor.css +2 -0
  97. data/public/punymce/plugins/link/img/icons.gif +0 -0
  98. data/public/punymce/plugins/link/link.js +1 -0
  99. data/public/punymce/plugins/link/link_src.js +36 -0
  100. data/public/punymce/plugins/paste.js +1 -0
  101. data/public/punymce/plugins/paste_src.js +169 -0
  102. data/public/punymce/plugins/protect.js +1 -0
  103. data/public/punymce/plugins/protect_src.js +30 -0
  104. data/public/punymce/plugins/safari2x.js +1 -0
  105. data/public/punymce/plugins/safari2x_src.js +284 -0
  106. data/public/punymce/plugins/tabfocus.js +1 -0
  107. data/public/punymce/plugins/tabfocus_src.js +45 -0
  108. data/public/punymce/plugins/textcolor/css/editor.css +7 -0
  109. data/public/punymce/plugins/textcolor/img/icons.gif +0 -0
  110. data/public/punymce/plugins/textcolor/textcolor.js +1 -0
  111. data/public/punymce/plugins/textcolor/textcolor_src.js +73 -0
  112. data/public/punymce/puny_mce.js +1 -0
  113. data/public/punymce/puny_mce_full.js +1 -0
  114. data/public/punymce/puny_mce_src.js +1460 -0
  115. data/public/stylesheets/sass/forum.sass +175 -169
  116. data/radiant-forum-extension.gemspec +81 -19
  117. data/spec/controllers/admin/forums_controller_spec.rb +2 -2
  118. data/spec/controllers/forums_controller_spec.rb +3 -6
  119. data/spec/controllers/posts_controller_spec.rb +76 -59
  120. data/spec/controllers/topics_controller_spec.rb +4 -95
  121. data/spec/datasets/forum_readers_dataset.rb +1 -0
  122. data/spec/datasets/forums_dataset.rb +91 -10
  123. data/spec/lib/commentable_model_spec.rb +88 -0
  124. data/spec/lib/forum_page_spec.rb +2 -34
  125. data/spec/lib/forum_site_spec.rb +2 -3
  126. data/spec/lib/forum_tags_spec.rb +35 -0
  127. data/spec/models/forum_spec.rb +31 -20
  128. data/spec/models/post_spec.rb +40 -39
  129. data/spec/models/topic_spec.rb +29 -71
  130. data/spec/spec_helper.rb +10 -1
  131. metadata +84 -22
  132. data/app/views/posts/_reply.html.haml +0 -35
  133. data/app/views/posts/_upload.html.haml +0 -2
  134. data/app/views/posts/preview.html.haml +0 -32
  135. data/app/views/posts/search.html.haml +0 -63
  136. data/app/views/posts/search.rss.builder +0 -14
  137. data/app/views/topics/_form.html.haml +0 -30
  138. data/app/views/topics/_help.html.haml +0 -8
  139. data/app/views/topics/comments.html.haml +0 -6
  140. data/app/views/topics/edit.html.haml +0 -26
  141. data/app/views/topics/new.html.haml +0 -56
  142. data/spec/datasets/forum_pages_dataset.rb +0 -11
  143. data/spec/datasets/posts_dataset.rb +0 -31
  144. data/spec/datasets/topics_dataset.rb +0 -37
@@ -1,20 +1,8 @@
1
- - content_for :signals do
2
- = render :partial => 'readers/flasher'
1
+ = render :partial => 'forums/standard_parts'
3
2
 
4
- - content_for :messages do
5
- = render :partial => 'posts/post', :object => @first_post, :locals => { :with_context => false, :first => true}
6
- = render :partial => 'posts/post', :collection => @posts, :locals => { :with_context => false, :first => false }
7
-
8
- - content_for :new_topic do
3
+ - content_for :newtopic do
9
4
  .newmessage
10
- = link_to t('new_topic_here'), new_forum_topic_url(@forum)
11
-
12
- - content_for :reply_form do
13
- - unless @posts.next_page
14
- - if @topic.page
15
- = link_to "Post a reply", new_topic_post_url(@topic), :class => 'inviting remote_content'
16
- - else
17
- = render :partial => 'posts/reply'
5
+ = link_to t('new_topic_here'), new_post_url(:forum_id => @forum.id)
18
6
 
19
7
  - content_for :pagination do
20
8
  = pagination_and_summary_for(@posts, t('post'))
@@ -22,42 +10,41 @@
22
10
  - content_for :title do
23
11
  = @topic.name
24
12
 
25
- - content_for :thing_title do
26
- = @topic.name
27
-
28
- - content_for :introduction do
29
- = t('topic_show_introduction')
13
+ - content_for :person do
14
+ = standard_gravatar_for(@topic.reader)
30
15
 
31
- - content_for :speaker do
32
- .speaker
33
- = gravatar_for(@topic.reader, {:size => 40}, {:alt => @topic.reader.name, :class => 'gravatar', :width => '40', :height => '40'})
16
+ - content_for :first_post do
17
+ = render :partial => 'posts/post', :locals => {:post => @topic.posts.first, :headless => true, :with_context => true}
34
18
 
35
- - content_for :feed do
19
+ - content_for :feedlink do
36
20
  = feed_link(topic_path(@topic, :format => :rss))
37
21
 
38
- - content_for :controls do
39
- = render :partial => 'readers/controls'
40
-
41
22
  - content_for :parent do
42
23
  = link_to @topic.forum.name + ':', forum_url(@topic.forum)
43
24
 
44
25
  - content_for :breadhead do
45
- = link_to t('forum'), forum_home_url
46
- = t('separator')
47
- = link_to @forum.name, forum_url(@forum)
26
+ = link_to t('forum').titlecase + t('separator'), topics_url
27
+ = yield :parent
48
28
 
49
29
  - content_for :breadcrumbs do
50
- = link_to 'Forum', topics_url
51
- \>
52
- = link_to @forum.name, forum_url(@forum)
53
- \>
54
- = @topic.name
30
+ = yield :breadhead
31
+ = t('separator')
32
+ = yield :title
55
33
 
56
- #forum
34
+ - content_for :messages do
57
35
  = yield :pagination if @posts.previous_page
58
- = yield :messages
36
+ = render :partial => 'posts/post', :collection => @posts, :locals => {:with_context => false}
59
37
  = yield :pagination if @posts.next_page
60
- = yield :reply_form unless @posts.next_page
38
+
39
+ - content_for :reply_form do
40
+ = render :partial => 'topics/reply', :locals => {:topic => @topic}
41
+
42
+ - content_for :sidebar do
43
+ = render :partial => 'topics/latest'
61
44
 
62
45
 
63
46
 
47
+ #forum
48
+ = yield :first_post
49
+ = yield :messages
50
+ = yield :reply_form unless @posts.next_page
@@ -1,12 +1,16 @@
1
1
  Radiant.config do |config|
2
2
  config.namespace('forum') do |forum|
3
- forum.define 'allow_registration?', :default => true
4
3
  forum.define 'public?', :default => true
4
+ forum.define 'toolbar?', :default => true
5
5
  forum.define 'editable_period', :type => :integer, :default => 15, :units => "minutes"
6
6
  forum.define 'allow_page_comments?', :default => true
7
7
  forum.define 'allow_attachments?', :default => true
8
8
  forum.define 'attachment.content_types'
9
9
  forum.define 'attachment.max_size', :type => :integer, :default => 10, :units => "MB"
10
10
  forum.define 'layout', :select_from => lambda { Layout.all.map(&:name) }, :allow_blank => false
11
+ forum.define 'default_forum', :select_from => lambda { Forum.all.map(&:name) }, :allow_blank => false
12
+ forum.define 'paginate_posts?', :default => true
13
+ forum.define 'posts_per_page', :type => :integer, :default => 20
14
+ forum.define 'commentable_period', :type => :integer, :default => 7, :units => "days"
11
15
  end
12
16
  end
@@ -1,6 +1,8 @@
1
1
  en:
2
2
  a_reply_to: "A reply to"
3
3
  add_post: "Add a %{message_type}"
4
+ add_reply: "Add a reply"
5
+ ago: "ago"
4
6
  all: "all"
5
7
  anyone: "anyone"
6
8
  anywhere: "anywhere"
@@ -8,67 +10,99 @@ en:
8
10
  attach_file: "attach a file"
9
11
  author: "author"
10
12
  begun_on: "begun on %{date}"
11
- breadhead_separator: "»"
12
13
  by: "by"
13
14
  by_content_and_author: "by content, author or category."
14
15
  comment: "comment"
16
+ comment_on_page: "a comment added to the page"
15
17
  comments: "comments"
16
18
  config:
17
19
  forum:
18
- allow_attachments?: "Posts have file attachments?"
20
+ allow_attachments?: "Posts have attachments?"
19
21
  allow_page_comments?: "Page comments allowed?"
20
22
  attachment:
21
23
  content_types: "Permitted content types"
22
24
  max_size: "Maximum attachment size"
23
- editable_period: "Editable period"
25
+ commentable_period: "Pages commentable for"
26
+ editable_period: "Posts editable for"
24
27
  layout: "Forum layout"
25
28
  public?: "Forum public?"
26
- date_recently: "%A"
27
- date_this_year: "%B %e"
28
- edit_forum: "edit forum"
29
+ confirm_removal_of: "Are you sure you want to delete this post from %{author}? There's no way to get it back if you change your mind."
30
+ confirm_remove_forum: "Delete forum?"
31
+ confirm_remove_post: "Delete post?"
32
+ confirm_remove_topic: "Delete topic?"
33
+ time:
34
+ formats:
35
+ recently: "%A at %l:%M%p"
36
+ standard: "on %B %e, %Y at %l:%M%p"
37
+ this_year: "%B %e at %l:%M%p"
38
+ today: "today at %l:%M%p"
39
+ yesterday: "yesterday at %l:%M%p"
40
+ definitely_remove_post: "Yes: delete it"
41
+ edit_forum: "Edit forum"
29
42
  edit_minimal: "e"
30
- edit_post: "edit post"
31
- edit_topic: "edit topic"
43
+ edit_post: "Edit post"
44
+ edit_topic: "Edit topic"
32
45
  edit_your_post: "edit your post"
46
+ error:
47
+ message_empty: "Sorry: message can't be empty"
48
+ no_file: "You must choose a file to upload!"
33
49
  filed_in: "under %{name}"
34
50
  for_comments: "for page comments"
35
51
  forum: "Forum"
36
52
  forums: "Discussion categories"
37
53
  forum_configuration: "Forum settings"
54
+ forum_messages: "Forum messages"
38
55
  forum_search: "Forum Search"
39
56
  forum_show_introduction: ""
40
- forums_introduction: "These are the broad filing areas we use to organise the forum. You can also see a list of "
57
+ forums_heading: "Forum categories"
58
+ forums_introduction: 'These are the broad filing areas we use to organise the forum. You can also see lists of <a href="/forum/topics">all the latest topics</a> or <a href="/forum/posts">posts</a> across all these categories.'
41
59
  from_reader: "from %{name}"
42
- if_not_you: "If that's not you, please"
60
+ if_you_not: "If you're not %{name}, please"
43
61
  in: "in"
44
62
  in_reply_to: "in reply to"
45
63
  label:
46
- topic_body: "Opening message"
47
- topic_category: "File in category"
48
- topic_name: "Discussion title"
64
+ post:
65
+ body: "Your message"
66
+ topic:
67
+ forum: "File in category"
68
+ name: "Discussion title"
69
+ sticky: "Sticky"
70
+ locked: "Locked"
49
71
  latest_activity: "latest activity"
50
72
  latest_discussion: "Latest topics"
51
73
  latest_posts: "Latest comments"
52
74
  latest_topics: "all the latest topics"
53
75
  locked: "locked"
54
- logged_in_as: "You are logged in as %{name}."
55
76
  matching: "matching"
77
+ messages_from_reader: "Messages from %{name}"
78
+ most_recently: "most recently"
79
+ navigation:
80
+ forum: "Forum"
81
+ forum_help: "Help"
82
+ forums: "Categories"
83
+ readers: "People"
84
+ new_topic: "New topic"
85
+ topics: "Latest"
86
+ your_account: "Your account"
56
87
  new_forum: "New forum"
57
- new_reply_to: "New reply to"
58
- new_topic: "New topic"
88
+ new_reply_to: "new reply to"
89
+ new_reply_from: "new reply from"
90
+ new_topic: "Start a new discussion"
59
91
  new_topic_button: "Submit topic"
60
92
  new_topic_heading: "Start a new topic"
61
93
  new_topic_introduction: ""
62
94
  new_topic_here: "start a new<br />topic here"
95
+ new_topic_started: "New topic started"
63
96
  no_description_provided: "No description provided."
64
- no_file: "You must choose a file to upload!"
65
97
  no_forums: "No discussion categories defined here yet."
66
98
  no_messages_yet: "No messages yet"
67
99
  no_posts: "The forum is empty."
68
100
  no_posts_found: "No messages found."
69
101
  no_topics: "No talk here yet."
102
+ notice:
103
+ topic_deleted: "Topic '%{name}' was deleted."
104
+ post_deleted: "Post deleted."
70
105
  of: "of"
71
- on: "on"
72
106
  on_date: "on %{date}"
73
107
  post: "comment"
74
108
  post_body: "Post body"
@@ -78,24 +112,30 @@ en:
78
112
  other: "%{count} replies, most recently from"
79
113
  post_post: "Post %{message_type}"
80
114
  post_removed: "Post removed"
115
+ posted: "posted"
81
116
  posted_and_updated_on: "posted on %{posted} and updated on %{updated}"
117
+ posted_on: "posted"
82
118
  posted_by: "posted by"
83
- posted_on: "posted on %{date}"
84
119
  post: "message"
85
120
  posts: "Messages"
86
121
  posts_found:
87
122
  zero: "Nothing found"
88
123
  one: "One message found"
89
124
  other: "%{count} messages found"
90
- posts_introduction: "This is a list of all forum posts by date."
125
+ posts_heading: "Latest messages"
126
+ posts_introduction: 'This is a list of all forum posts by date, with the most recent first. You can get a similar list of recent messages <a href="/forum/topics">organised by topic</a>.'
91
127
  really_remove_post: "Are you sure you want to delete this comment?"
92
128
  recent_topics: "Recent topics"
93
129
  remove_minimal: "x"
94
130
  remove_post: "delete comment"
95
131
  replied_on: "replied on %{date}"
96
132
  reply_from: "reply from"
133
+ reply_posted: "reply posted"
134
+ reply_to: "Reply to"
135
+ reply: "reply"
97
136
  rss_feed: "RSS feed"
98
137
  save_changes: "Save changes"
138
+ save_post: "Save post"
99
139
  search: "Search"
100
140
  search_form:
101
141
  forum_label: "In this discussion category"
@@ -104,19 +144,23 @@ en:
104
144
  search_whole_forum: "search the whole forum"
105
145
  search_introduction: "Please choose a search phrase and/or a person or discussion category."
106
146
  search_results: "Search Results"
107
- separator: '&raquo;'
147
+ separator: ':'
108
148
  showing: "showing"
109
149
  sorry_locked: "Sorry: this topic is locked."
110
- standard_date: "%B %e, %Y"
150
+ start_topic: "Start a new conversation"
151
+ started: "started"
152
+ started_by: "Started by"
111
153
  started_topic_in: "started a new topic under"
112
154
  started_topic_on: "started a new topic on %{date}"
113
- started_on: "started on %{date}"
114
155
  sticky: "sticky"
115
- time_recently: "%A at %l:%M%p"
116
156
  time_remaining_to_edit: "You have %{time} left to "
117
- time_today: "today at %l:%M%p"
118
- time_yesterday: "yesterday at %l:%M%p"
157
+ topic_count:
158
+ zero: "No discussion."
159
+ one: "One topic: "
160
+ other: "%{count} topics, most recently "
119
161
  topic_show_introduction: ""
162
+ topic_removed: "Topic removed"
163
+ post_removed: "Post removed"
120
164
  to: "to"
121
165
  to_add_post: "To add a %{message_type}"
122
166
  topic: "topic"
@@ -124,5 +168,7 @@ en:
124
168
  topic_empty: "Topic empty!"
125
169
  topic_name: "Topic name"
126
170
  topics: "Topics"
127
- topics_introduction: "This is a list of all the discussions going on here, with the most recently updated first. You can also see a more organised list of"
171
+ topics_heading: "Latest topics"
172
+ topics_introduction: 'This is a list of all the discussions going on here, with the most recently updated first. You can also see a more organised list of <a href="/forum/forums">discussion categories</a> or a purely chronological list of <a href="/forum/posts">recent posts.</a>'
173
+ under: "under"
128
174
  unknown_date: "unknown date"
data/config/routes.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
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]
3
+ forum.resources :forums, :only => [:index, :show], :has_many => [:topics]
4
+ forum.resources :topics, :only => [:index, :show], :has_many => [:posts]
5
+ forum.resources :posts, :member => { :remove => :get }
7
6
  end
8
7
 
9
8
  map.namespace :admin, :member => { :remove => :get }, :path_prefix => 'admin/forum' do |admin|
@@ -0,0 +1,21 @@
1
+ class PagePosts < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :posts, :page_id, :integer
4
+ Post.reset_column_information
5
+ Post.all.each do |post|
6
+ if topic = Topic.find_by_id(post.topic_id)
7
+ if (topic.page_id)
8
+ post.page_id = topic.page_id
9
+ post.topic_id = nil
10
+ post.save!
11
+ end
12
+ end
13
+ end
14
+ remove_column :topics, :page_id
15
+ end
16
+
17
+ def self.down
18
+ remove_column :posts, :page_id
19
+ add_column :topics, :page_id, :integer
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ class NoCommentForum < ActiveRecord::Migration
2
+ def self.up
3
+ Forum.find(:all, :conditions => "for_comments = 1").each {|forum| forum.destroy }
4
+ remove_column :forums, :for_comments
5
+ end
6
+
7
+ def self.down
8
+ add_column :forums, :for_comments, :boolean
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ class TopicMerelyAssociative < ActiveRecord::Migration
2
+ def self.up
3
+ remove_column :topics, :reader_id
4
+ remove_column :topics, :first_post_id
5
+ remove_column :topics, :last_post_id
6
+ remove_column :topics, :posts_count
7
+ remove_column :topics, :updated_by_id
8
+ remove_column :topics, :created_by_id
9
+ remove_column :topics, :updated_at
10
+ remove_column :topics, :created_at
11
+ end
12
+
13
+ def self.down
14
+ add_column :topics, :reader_id, :integer
15
+ add_column :topics, :first_post_id, :integer
16
+ add_column :topics, :last_post_id, :integer
17
+ add_column :topics, :posts_count, :integer
18
+ add_column :topics, :updated_at, :datetime
19
+ add_column :topics, :created_at, :datetime
20
+ add_column :topics, :updated_by_id, :integer
21
+ add_column :topics, :created_by_id, :integer
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ class DetachObserver < ActiveRecord::Migration
2
+ def self.up
3
+ remove_column :posts, :updated_by
4
+ remove_column :posts, :created_by
5
+ end
6
+
7
+ def self.down
8
+ add_column :posts, :updated_by, :integer
9
+ add_column :posts, :created_by, :integer
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ class ImportAttachments < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :post_attachments, :old_id, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :post_attachments, :old_id
8
+ end
9
+ end
data/forum_extension.rb CHANGED
@@ -1,37 +1,37 @@
1
1
  require_dependency 'application_controller'
2
2
 
3
3
  class ForumExtension < Radiant::Extension
4
- version "1.2.1"
5
- description "Nice clean forums and page comments for inclusion in your radiant site. Derived long ago from beast. Requires the reader extension and share_layouts."
4
+ version "2.0.0"
5
+ description "Nice clean forums and page comments for inclusion in your radiant site. Requires the reader extension and share_layouts."
6
6
  url "http://spanner.org/radiant/forum"
7
7
 
8
8
  extension_config do |config|
9
- config.gem "paperclip"
9
+ config.gem "paperclip", "~> 2.3"
10
10
  end
11
11
 
12
12
  def activate
13
+ ActiveRecord::Base.send :include, CommentableModel # provides has_comments class method that is used here by topics and pages but can be called from any model
13
14
  Reader.send :include, ForumReader # has topics and posts
14
15
  ReaderNotifier.send :include, ForumReaderNotifier # sets up post-notification email
15
- Page.send :include, ForumPage # topic association and comment support
16
- UserActionObserver.instance.send :add_observer!, Forum # hook up the usual ownership and datestamp mechanism
17
- UserActionObserver.instance.send :add_observer!, Topic
18
- UserActionObserver.instance.send :add_observer!, Post
19
- Page.send :include, ForumTags # radius tags for highlighting forum content on other pages
16
+ Page.send :include, ForumPage # makes commentable and reads some configuration
17
+ Page.send :include, ForumTags # defines radius tags for highlighting forum content on other pages
18
+ ReadersController.send :include, ForumReadersController # adds some partials and helpers to the reader pages
19
+ ReaderSessionsController.send :include, ForumReaderSessionsController # changes default login destination to the forum front page
20
20
 
21
21
  unless defined? admin.forum # UI is a singleton
22
22
  Radiant::AdminUI.send :include, ForumAdminUI
23
23
  Radiant::AdminUI.load_forum_extension_regions
24
24
  end
25
25
 
26
- # admin.pages.edit.add :parts_bottom, "edit_commentability", :after => "edit_layout_and_type"
26
+ admin.pages.edit.add :parts_bottom, "edit_commentability", :after => "edit_layout_and_type"
27
27
  admin.reader_configuration.show.add :settings, "forum", :after => "administration"
28
28
  admin.reader_configuration.edit.add :form, "edit_forum", :after => "administration"
29
29
 
30
- if defined? RedCloth::DEFAULT_RULES # identifies redcloth 3
30
+ if defined? RedCloth::DEFAULT_RULES
31
31
  RedCloth.send :include, ForumRedCloth3
32
32
  RedCloth::DEFAULT_RULES.push(:smilies)
33
33
  else
34
- RedCloth::TextileDoc.send :include, ForumRedCloth4 # interpolate smily icons
34
+ RedCloth::TextileDoc.send :include, ForumRedCloth4
35
35
  end
36
36
 
37
37
  tab("Forum") do
@@ -42,5 +42,4 @@ class ForumExtension < Radiant::Extension
42
42
  end
43
43
  end
44
44
 
45
- end
46
-
45
+ end