radiant-forum-extension 3.0.0.rc4 → 3.0.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,24 +47,4 @@ module ForumHelper
47
47
  link_to t('forum_extension.delete'), topic_post_url(post.topic, post), :method => 'delete', :class => 'delete_post', :id => "delete_post_#{post.id}", :title => t("remove_post"), :confirm => t('forum_extension.really_remove_post')
48
48
  end
49
49
 
50
- def friendly_date(datetime)
51
- I18n.l(datetime, :format => friendly_date_format(datetime)) if datetime
52
- end
53
-
54
- def friendly_date_format(datetime)
55
- if datetime && date = datetime.to_date
56
- if (date.to_datetime == Date.today)
57
- :today
58
- elsif (date.to_datetime == Date.yesterday)
59
- :yesterday
60
- elsif (date.to_datetime > 6.days.ago)
61
- :recently
62
- elsif (date.year == Date.today.year)
63
- :this_year
64
- else
65
- :standard
66
- end
67
- end
68
- end
69
-
70
50
  end
data/app/models/topic.rb CHANGED
@@ -12,6 +12,13 @@ class Topic < ActiveRecord::Base
12
12
  named_scope :latest, lambda { |count|
13
13
  { :order => 'replied_at DESC', :limit => count }
14
14
  }
15
+ named_scope :busiest, lambda { |count| {
16
+ :select => "topics.*, count(posts.id) AS post_count",
17
+ :joins => "INNER JOIN posts ON posts.topic_id = topics.id",
18
+ :group => column_names.map { |n| 'topics.' + n }.join(','),
19
+ :order => "post_count DESC",
20
+ :limit => count
21
+ }}
15
22
  # adapted from the usual scope defined in has_groups, since here visibility is set at the forum level
16
23
  named_scope :visible_to, lambda { |reader|
17
24
  conditions = "forums.id IS NULL OR pp.group_id IS NULL"
@@ -0,0 +1,12 @@
1
+ - posts ||= @reader.posts.paginate(pagination_parameters)
2
+
3
+ %h2
4
+ =t('forum_extension.count_forum_messages', :count => posts.total_entries)
5
+
6
+ - if posts.empty?
7
+ %p
8
+ = t('forum_extension.no_posts')
9
+ - else
10
+ = pagination_and_summary_for(posts, t('forum_extension.post')) if posts.previous_page
11
+ = render :partial => 'posts/summary', :collection => posts
12
+ = pagination_and_summary_for(posts, t('forum_extension.post')) if posts.next_page
@@ -1,5 +1,6 @@
1
1
  - render_region :main do |main|
2
2
  - main.edit_header do
3
- %h1 New Forum
3
+ %h1
4
+ = t('forum_extension.create_forum').titlecase
4
5
  - main.edit_form do
5
6
  = render :partial => 'form'
@@ -29,7 +29,11 @@
29
29
 
30
30
  - tbody.author_cell do
31
31
  %td.post_author
32
- = link_to post.reader.name, admin_reader_url(post.reader)
32
+ - if post.reader
33
+ = link_to post.reader.name, admin_reader_url(post.reader)
34
+ - else
35
+ %span.deleted
36
+ = t('forum_extension.reader_deleted')
33
37
 
34
38
  - tbody.date_cell do
35
39
  %td.post_date
@@ -0,0 +1,10 @@
1
+ - posts = current_reader.posts.latest(10)
2
+ - if posts.any?
3
+ .dashboard_module
4
+ %h3
5
+ =t('forum_extension.dashboard.posts_and_comments')
6
+ %ul
7
+ = render :partial => 'posts/summary', :collection => posts
8
+
9
+ %p
10
+ = link_to t('forum_extension.new_topic'), new_post_url, :class => 'post'
@@ -19,7 +19,7 @@
19
19
  = t('forum_extension.comment_on')
20
20
  -elsif post.reply?
21
21
  = t('forum_extension.reply_to')
22
- = link_to post.topic.name, paginated_post_url(post)
22
+ = link_to_post(post)
23
23
  - else
24
24
  %h2
25
25
  = post.reader.name
@@ -0,0 +1,18 @@
1
+ - post ||= summary
2
+
3
+ %li.post
4
+ %strong
5
+ = link_to_post(post, :class => 'title')
6
+ %span.context
7
+ - if post.comment?
8
+ = t('forum_extension.comment_on')
9
+ = link_to post.page.title, post.page.url
10
+ = t('forum_extension.posted')
11
+ - elsif post.first?
12
+ = t('forum_extension.new_topic_started')
13
+ - else
14
+ = t('forum_extension.reply_posted')
15
+ = friendly_date(post.created_at)
16
+ %br
17
+ %span.excerpt
18
+ = truncate_words(scrub_html(post.body), 12)
@@ -19,6 +19,12 @@
19
19
  .footer
20
20
  = yield :controls
21
21
 
22
+ - content_for :controls do
23
+ = render :partial => 'accounts/controls'
24
+
25
+ - content_for :signals do
26
+ = render :partial => 'accounts/flasher'
27
+
22
28
  - content_for :search do
23
29
  = render :partial => 'posts/search_form', :locals => {:minimal => true}
24
30
 
@@ -37,5 +43,3 @@
37
43
  = link_to t('forum_extension.new_topic_here'), new_post_url(:forum_id => @forum.id), :class => "post"
38
44
  - else
39
45
  = link_to t('forum_extension.new_topic'), new_post_url(), :class => "post"
40
-
41
- = render :partial => 'shared/standard_reader_parts'
@@ -1,7 +1,7 @@
1
1
  %h2
2
2
  = t('forum_extension.top_topics')
3
3
  %ul
4
- - Topic.visible_to(current_reader).most_commented(10).each do |topic|
4
+ - Topic.visible_to(current_reader).busiest(10).each do |topic|
5
5
  %li
6
6
  = link_to_topic(topic, :class => 'title')
7
7
  %br
@@ -26,10 +26,6 @@
26
26
  - content_for :feedlink do
27
27
  = feed_link(topics_url(:format => :rss))
28
28
 
29
- - content_for :head do
30
- %h1
31
- = yield :title
32
-
33
29
  - content_for :introduction do
34
30
  %p
35
31
  =t('forum_extension.topics_introduction')
@@ -15,6 +15,7 @@ en:
15
15
  attachment:
16
16
  content_types: "Permitted content types"
17
17
  max_size: "Maximum attachment size"
18
+ cached?: "Forum pages cached?"
18
19
  commentable_period: "Pages commentable for"
19
20
  editable_period: "Posts editable for"
20
21
  layout: "Forum layout"
@@ -64,6 +65,13 @@ en:
64
65
  confirm_remove_post: "Delete post?"
65
66
  confirm_remove_topic: "Delete topic?"
66
67
  containing: "containing the phrase"
68
+ count_forum_messages:
69
+ zero: "No forum messages"
70
+ one: "One forum message"
71
+ other: "%{count} forum messages"
72
+ dashboard:
73
+ new_topic: "Start discussion"
74
+ posts_and_comments: "Your latest forum posts and page comments"
67
75
  definitely_remove_post: "Yes: delete it"
68
76
  description: Description
69
77
  edit_forum: "Edit forum"
@@ -79,7 +87,8 @@ en:
79
87
  forum: "Forum"
80
88
  forums: "Discussion categories"
81
89
  forum_configuration: "Forum settings"
82
- forum_messages: "Forum messages from %{name}"
90
+ forum_messages: "Forum messages"
91
+ forum_messages_from: "Forum messages from %{name}"
83
92
  forum_search: "Forum Search"
84
93
  forum_show_introduction: ""
85
94
  forums_heading: "Forum categories"
@@ -114,7 +123,7 @@ en:
114
123
  new_forum: "New forum"
115
124
  new_reply_to: "New reply to"
116
125
  new_reply_from: "New reply from"
117
- new_topic: "Start a new discussion"
126
+ new_topic: "Start discussion"
118
127
  new_topic_button: "Submit topic"
119
128
  new_topic_heading: "Start a new topic"
120
129
  new_topic_introduction: ""
@@ -155,6 +164,7 @@ en:
155
164
  other: "%{count} messages found"
156
165
  posts_heading: "Search the forum"
157
166
  posts_introduction: 'This begins as a full list of all the posts in the forum. Add criteria below to cut down the list to specific subjects and speakers.'
167
+ reader_deleted: 'Reader deleted'
158
168
  really_remove_post: "Are you sure you want to delete this comment?"
159
169
  recent_topics: "Recent topics"
160
170
  remove_minimal: "x"
@@ -210,14 +220,7 @@ en:
210
220
  topic_empty: "Topic empty!"
211
221
  topic_name: "Topic name"
212
222
  topics: "Topics"
213
- topics_heading: "Latest topics"
223
+ topics_heading: "Forum"
214
224
  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 href="/forum/posts">search</a> for particular posts and people.'
215
225
  under: "under"
216
226
  unknown_date: "unknown date"
217
- time:
218
- formats:
219
- recently: "on %A at %l:%M%p"
220
- standard: "on %B %e, %Y at %l:%M%p"
221
- this_year: "on %B %e at %l:%M%p"
222
- today: "today at %l:%M%p"
223
- yesterday: "yesterday at %l:%M%p"
@@ -2,26 +2,20 @@ class TidyUp < ActiveRecord::Migration
2
2
  def self.up
3
3
  remove_column :forums, :topics_count
4
4
  remove_column :forums, :posts_count
5
- remove_column :forums, :group_id
6
5
  remove_column :forums, :site_id
7
6
  remove_column :forums, :reader_id
8
7
  remove_column :topics, :site_id
9
- remove_column :topics, :group_id
10
8
  remove_column :posts, :site_id
11
9
  remove_column :posts, :forum_id
12
- remove_column :posts, :group_id
13
10
  end
14
11
 
15
12
  def self.down
16
13
  add_column :forums, :topics_count, :integer
17
14
  add_column :forums, :posts_count, :integer
18
- add_column :forums, :group_id, :integer
19
15
  add_column :forums, :site_id, :integer
20
16
  add_column :forums, :reader_id, :integer
21
17
  add_column :topics, :site_id, :integer
22
- add_column :topics, :group_id, :integer
23
18
  add_column :posts, :site_id, :integer
24
19
  add_column :posts, :forum_id, :integer
25
- add_column :posts, :group_id, :integer
26
20
  end
27
21
  end
data/forum_extension.rb CHANGED
@@ -16,7 +16,7 @@ class ForumExtension < Radiant::Extension
16
16
  ReaderNotifier.send :include, ForumReaderNotifier # sets up post-notification email
17
17
  Page.send :include, ForumPage # makes commentable and reads some configuration
18
18
  Page.send :include, ForumTags # defines radius tags for highlighting forum content on other pages
19
- ReadersController.send :include, ForumReadersController # adds some partials and helpers to the reader pages
19
+ AccountsController.send :helper, ForumHelper # provides some linking and other helpers on reader pages
20
20
  ReaderSessionsController.send :include, ForumReaderSessionsController # changes default login destination to the forum front page
21
21
 
22
22
  unless defined? admin.forum # UI is a singleton
@@ -27,7 +27,9 @@ class ForumExtension < Radiant::Extension
27
27
  admin.page.edit.add :layout, "edit_commentability"
28
28
  admin.reader_configuration.show.add :settings, "forum", :after => "administration"
29
29
  admin.reader_configuration.edit.add :form, "edit_forum", :after => "administration"
30
-
30
+ admin.account.dashboard.add :main, 'dashboard/posts'
31
+ admin.account.show.add :main, 'accounts/posts'
32
+
31
33
  if defined? RedCloth::DEFAULT_RULES
32
34
  RedCloth.send :include, ForumRedCloth3
33
35
  RedCloth::DEFAULT_RULES.push(:smilies)
@@ -21,13 +21,6 @@ module CommentableModel # for inclusion into ActiveRecord::Base
21
21
  :order => "replied_at DESC",
22
22
  :limit => count
23
23
  }}
24
- named_scope :most_commented, lambda { |count| {
25
- :select => "#{self.table_name}.*, count(posts.id) AS post_count",
26
- :joins => "INNER JOIN posts ON posts.#{self.class.to_s.downcase}_id = #{self.table_name}.id",
27
- :group => "#{self.table_name}.id",
28
- :order => "post_count DESC",
29
- :limit => count
30
- }}
31
24
  end
32
25
  end
33
26
 
data/lib/forum_page.rb CHANGED
@@ -3,6 +3,15 @@ module ForumPage
3
3
  def self.included(base)
4
4
  base.class_eval {
5
5
  has_comments
6
+
7
+ named_scope :busiest, lambda { |count| {
8
+ :select => "pages.*, count(posts.id) AS post_count",
9
+ :joins => "INNER JOIN posts ON posts.page_id = pages.id",
10
+ :group => column_names.map { |n| 'pages.' + n }.join(','),
11
+ :order => "post_count DESC",
12
+ :limit => count
13
+ }}
14
+
6
15
  include InstanceMethods
7
16
  }
8
17
  end
@@ -2,8 +2,6 @@ module ForumReadersController
2
2
  def self.included(base)
3
3
  base.class_eval do
4
4
  helper :forum
5
- add_show_partial 'readers/forum_messages'
6
- add_index_partial 'readers/messages_summary'
7
5
  end
8
6
  end
9
7
  end
data/lib/forum_tags.rb CHANGED
@@ -7,20 +7,19 @@ module ForumTags
7
7
  class TagError < StandardError; end
8
8
 
9
9
  tag 'forum_css' do |tag|
10
- styles = []
10
+ styles = tag.render("reader_css")
11
11
  styles << %{<link rel="stylesheet" href="/cleditor/jquery.cleditor.css" media="all" />} if Radiant.config['forum.toolbar?']
12
12
  styles << %{<link rel="stylesheet" href="/stylesheets/forum.css" media="all" />}
13
13
  end
14
14
 
15
15
  tag 'forum_js' do |tag|
16
- scripts = []
16
+ scripts = tag.render("reader_js")
17
17
  scripts << %{
18
18
  <script type="text/javascript" src="/cleditor/jquery.cleditor.js"></script>
19
19
  <script type="text/javascript" src="/cleditor/jquery.cleditor.icon.js"></script>
20
20
  <script type="text/javascript" src="/cleditor/jquery.cleditor.xhtml.js"></script>
21
21
  } if Radiant.config['forum.toolbar?']
22
22
  scripts << %{<script type="text/javascript" src="/javascripts/forum.js"></script>}
23
- scripts.join
24
23
  end
25
24
 
26
25
  tag 'forum' do |tag|
@@ -1,5 +1,5 @@
1
1
  module RadiantForumExtension
2
- VERSION = '3.0.0.rc4'
2
+ VERSION = '3.0.0.rc6'
3
3
  SUMMARY = %q{Forum and Comment Extension for Radiant CMS}
4
4
  DESCRIPTION = %q{Nice clean forums and page comments for inclusion in your radiant site.}
5
5
  URL = "http://radiant.spanner.org/forum"
@@ -1,5 +1,7 @@
1
1
  td
2
2
  padding: 3px
3
+ span.deleted
4
+ color: #999
3
5
  td.actions
4
6
  white-space: nowrap
5
7
  min-width: 75px
@@ -238,10 +238,6 @@ p.add_comment, p.add_reply
238
238
  span.formnote
239
239
  +small
240
240
 
241
- // dashboard module
242
-
243
-
244
-
245
241
  // emoticons in message display are interpolated by our redcloth extension as <img class="emoticon something" />
246
242
 
247
243
  img.emoticon
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.summary = RadiantForumExtension::SUMMARY
13
13
  s.description = RadiantForumExtension::DESCRIPTION
14
14
 
15
- s.add_dependency 'radiant-reader-extension', "~> 2.0.0.rc3"
15
+ s.add_dependency 'radiant-reader-extension', "~> 3.0.0.rc1"
16
16
  s.add_dependency 'acts_as_list', "~> 0.1.2"
17
17
 
18
18
  ignores = if File.exist?('.gitignore')
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-forum-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424125
4
+ hash: 15424121
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
10
  - rc
11
- - 4
12
- version: 3.0.0.rc4
11
+ - 6
12
+ version: 3.0.0.rc6
13
13
  platform: ruby
14
14
  authors:
15
15
  - William Ross
@@ -17,7 +17,8 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-07-05 00:00:00 Z
20
+ date: 2011-07-28 00:00:00 +01:00
21
+ default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
23
24
  name: radiant-reader-extension
@@ -27,14 +28,14 @@ dependencies:
27
28
  requirements:
28
29
  - - ~>
29
30
  - !ruby/object:Gem::Version
30
- hash: 15424083
31
+ hash: 15424119
31
32
  segments:
32
- - 2
33
+ - 3
33
34
  - 0
34
35
  - 0
35
36
  - rc
36
- - 3
37
- version: 2.0.0.rc3
37
+ - 1
38
+ version: 3.0.0.rc1
38
39
  type: :runtime
39
40
  version_requirements: *id001
40
41
  - !ruby/object:Gem::Dependency
@@ -77,6 +78,8 @@ files:
77
78
  - app/models/post.rb
78
79
  - app/models/post_attachment.rb
79
80
  - app/models/topic.rb
81
+ - app/views/accounts/_messages_summary.html.haml
82
+ - app/views/accounts/_posts.html.haml
80
83
  - app/views/admin/dashboard/_forum_dashboard.html.haml
81
84
  - app/views/admin/forums/_form.html.haml
82
85
  - app/views/admin/forums/edit.html.haml
@@ -94,6 +97,7 @@ files:
94
97
  - app/views/admin/topics/_form.html.haml
95
98
  - app/views/admin/topics/edit.html.haml
96
99
  - app/views/admin/topics/index.html.haml
100
+ - app/views/dashboard/_posts.html.haml
97
101
  - app/views/forums/_forum.html.haml
98
102
  - app/views/forums/_forum.rss.builder
99
103
  - app/views/forums/_latest.html.haml
@@ -120,6 +124,7 @@ files:
120
124
  - app/views/posts/_search_form.html.haml
121
125
  - app/views/posts/_search_results.html.haml
122
126
  - app/views/posts/_search_summary.html.haml
127
+ - app/views/posts/_summary.html.haml
123
128
  - app/views/posts/_uploader.html.haml
124
129
  - app/views/posts/edit.html.haml
125
130
  - app/views/posts/index.html.haml
@@ -128,8 +133,6 @@ files:
128
133
  - app/views/posts/remove.html.haml
129
134
  - app/views/posts/show.html.haml
130
135
  - app/views/reader_notifier/post.rhtml
131
- - app/views/readers/_forum_messages.html.haml
132
- - app/views/readers/_messages_summary.html.haml
133
136
  - app/views/shared/_standard_forum_parts.html.haml
134
137
  - app/views/topics/_busiest.html.haml
135
138
  - app/views/topics/_context.html.haml
@@ -235,7 +238,6 @@ files:
235
238
  - public/stylesheets/sass/admin/forum_dashboard.sass
236
239
  - public/stylesheets/sass/forum.sass
237
240
  - public/stylesheets/sass/gallery.sass
238
- - radiant-forum-extension-3.0.0.rc4.gem
239
241
  - radiant-forum-extension.gemspec
240
242
  - Rakefile
241
243
  - README.md
@@ -259,10 +261,11 @@ files:
259
261
  - spec/models/topic_spec.rb
260
262
  - spec/spec.opts
261
263
  - spec/spec_helper.rb
264
+ has_rdoc: true
262
265
  homepage: http://radiant.spanner.org/forum
263
266
  licenses: []
264
267
 
265
- post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-forum-extension', :version => '~> 3.0.0.rc4'\n\n "
268
+ post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-forum-extension', :version => '~> 3.0.0.rc6'\n\n "
266
269
  rdoc_options: []
267
270
 
268
271
  require_paths:
@@ -290,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
293
  requirements: []
291
294
 
292
295
  rubyforge_project:
293
- rubygems_version: 1.7.2
296
+ rubygems_version: 1.5.3
294
297
  signing_key:
295
298
  specification_version: 3
296
299
  summary: Forum and Comment Extension for Radiant CMS
@@ -1,23 +0,0 @@
1
- - add_reader_css '/stylesheets/forum.css'
2
- - add_reader_js '/javascripts/forum.js'
3
-
4
- - reader ||= @reader
5
- - posts ||= reader.posts.paginate(pagination_parameters)
6
-
7
- .forum
8
- %h3
9
- =t('forum_extension.forum_messages', :name => reader.name)
10
-
11
- - if posts.empty?
12
- %p
13
- = t('forum_extension.no_posts')
14
- - else
15
- = pagination_and_summary_for(posts, t('forum_extension.post')) if posts.previous_page
16
- - posts.each do |post|
17
- - if post.comment?
18
- = render :partial => 'posts/post', :object => post, :locals => {:with_context => true}
19
- - elsif post.first?
20
- = render :partial => 'topics/topic', :object => post.topic
21
- - else
22
- = render :partial => 'posts/post', :object => post, :locals => {:with_context => true}
23
- = pagination_and_summary_for(posts, t('forum_extension.post')) if posts.next_page