radiant-forum-extension 1.1.2 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/admin/forums_controller.rb +3 -4
- data/app/controllers/admin/posts_controller.rb +10 -0
- data/app/controllers/admin/topics_controller.rb +10 -0
- data/app/controllers/posts_controller.rb +3 -27
- data/app/controllers/topics_controller.rb +3 -17
- data/app/helpers/forum_helper.rb +2 -2
- data/app/models/forum.rb +2 -24
- data/app/models/post.rb +12 -9
- data/app/models/post_attachment.rb +13 -13
- data/app/models/topic.rb +28 -55
- data/app/views/admin/forums/edit.html.haml +2 -1
- data/app/views/admin/forums/index.html.haml +42 -39
- data/app/views/admin/posts/_form.html.haml +25 -0
- data/app/views/admin/posts/edit.html.haml +6 -0
- data/app/views/admin/posts/index.html.haml +49 -0
- data/app/views/admin/reader_configuration/_edit_forum.html.haml +3 -3
- data/app/views/admin/reader_configuration/_forum.html.haml +19 -14
- data/app/views/admin/topics/_form.html.haml +24 -0
- data/app/views/admin/topics/edit.html.haml +6 -0
- data/app/views/admin/topics/index.html.haml +49 -0
- data/app/views/forums/index.html.haml +0 -7
- data/app/views/forums/show.html.haml +4 -3
- data/app/views/posts/_attachment.html.haml +4 -0
- data/app/views/posts/_form.html.haml +1 -3
- data/app/views/posts/_post.html.haml +50 -51
- data/app/views/posts/_reply.html.haml +16 -17
- data/app/views/posts/_search.html.haml +13 -17
- data/app/views/posts/_upload.html.haml +2 -0
- data/app/views/posts/_uploader.html.haml +15 -15
- data/app/views/posts/edit.html.haml +5 -7
- data/app/views/posts/index.html.haml +1 -8
- data/app/views/posts/search.html.haml +54 -45
- data/app/views/posts/show.html.haml +14 -6
- data/app/views/topics/_form.html.haml +15 -11
- data/app/views/topics/_latest.html.haml +0 -2
- data/app/views/topics/_locked.html.haml +2 -2
- data/app/views/topics/_topic.html.haml +50 -31
- data/app/views/topics/comments.html.haml +2 -1
- data/app/views/topics/index.html.haml +1 -9
- data/app/views/topics/new.html.haml +29 -18
- data/app/views/topics/show.html.haml +14 -14
- data/config/initializers/radiant_config.rb +12 -0
- data/config/locales/en.yml +81 -12
- data/forum_extension.rb +11 -16
- data/lib/forum_admin_ui.rb +47 -5
- data/radiant-forum-extension.gemspec +12 -4
- metadata +14 -6
- data/app/views/readers/_extra_controls.html.haml +0 -5
- data/app/views/readers/show_with_posts.html.haml +0 -47
@@ -1,18 +1,12 @@
|
|
1
1
|
- content_for :signals do
|
2
2
|
= render :partial => 'readers/flasher'
|
3
3
|
|
4
|
-
- content_for :preamble do
|
5
|
-
%p
|
6
|
-
= t('topics_introduction')
|
7
|
-
= link_to( t('categories'), forums_url) + '.'
|
8
|
-
|
9
4
|
- content_for :messages do
|
10
5
|
- if @topics.empty?
|
11
6
|
%p
|
12
7
|
= t('no_topics')
|
13
8
|
- else
|
14
|
-
|
15
|
-
= render :partial => 'topics/topic', :collection => @topics, :locals => {:with_context => true}
|
9
|
+
= render :partial => 'topics/topic', :collection => @topics, :locals => {:with_context => true}
|
16
10
|
|
17
11
|
- content_for :sidebar do
|
18
12
|
%h2
|
@@ -48,8 +42,6 @@
|
|
48
42
|
= render :partial => 'readers/controls'
|
49
43
|
|
50
44
|
#forum
|
51
|
-
= yield :new_topic
|
52
|
-
= yield :preamble
|
53
45
|
= yield :pagination if @topics.previous_page
|
54
46
|
= yield :messages
|
55
47
|
= yield :pagination if @topics.next_page
|
@@ -2,19 +2,36 @@
|
|
2
2
|
= render :partial => 'readers/flasher'
|
3
3
|
|
4
4
|
- content_for :form do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
12
|
-
|
13
|
-
|
5
|
+
.post_wrapper
|
6
|
+
.post_header
|
7
|
+
%h2
|
8
|
+
= t('new_topic_heading')
|
9
|
+
%p.context
|
10
|
+
= t('logged_in_as', :name => current_reader.name)
|
11
|
+
= t('if_not_you')
|
12
|
+
= link_to(t('log_out'), reader_logout_url) + '.'
|
13
|
+
|
14
|
+
- form_for :topic, @topic, :url => @forum ? forum_topics_path(@forum) : topics_path, :html => {:class => 'friendly', :multipart => true} do |f|
|
15
|
+
= render :partial => "form", :object => f
|
16
|
+
%p.buttons
|
17
|
+
= submit_tag t('new_topic_button')
|
18
|
+
= t('or')
|
19
|
+
- if @forum
|
20
|
+
= link_to t('cancel'), forum_path(@forum)
|
21
|
+
- else
|
22
|
+
= link_to t('cancel'), :back
|
23
|
+
|
24
|
+
- content_for :speaker do
|
25
|
+
%div.speaker
|
26
|
+
%a{:href => reader_url(current_reader), :class => 'main'}
|
27
|
+
= gravatar_for(current_reader, {:size => 40}, {:alt => current_reader.name, :class => 'gravatar', :width => '40', :height => '40'})
|
14
28
|
|
15
29
|
- content_for :title do
|
16
30
|
= t('new_topic_heading')
|
17
31
|
|
32
|
+
- content_for :introduction do
|
33
|
+
= t('new_topic_introduction')
|
34
|
+
|
18
35
|
- content_for :breadhead do
|
19
36
|
= link_to t('forum'), forum_home_url
|
20
37
|
= t('separator')
|
@@ -24,12 +41,6 @@
|
|
24
41
|
- content_for :controls do
|
25
42
|
= render :partial => 'readers/controls'
|
26
43
|
|
27
|
-
- content_for :credits do
|
28
|
-
%p
|
29
|
-
= t('logged_in_as', :name => current_reader.name)
|
30
|
-
= t('if_not_you')
|
31
|
-
= link_to t('log_out'), reader_logout_url
|
32
|
-
|
33
44
|
- content_for :breadcrumbs do
|
34
45
|
= link_to t('forum'), topics_url
|
35
46
|
= t('separator')
|
@@ -38,8 +49,8 @@
|
|
38
49
|
= t('separator')
|
39
50
|
= t('new_topic')
|
40
51
|
|
41
|
-
|
42
52
|
#forum
|
43
|
-
|
44
|
-
|
53
|
+
.post.first
|
54
|
+
= yield :speaker
|
55
|
+
= yield :form
|
45
56
|
|
@@ -2,10 +2,8 @@
|
|
2
2
|
= render :partial => 'readers/flasher'
|
3
3
|
|
4
4
|
- content_for :messages do
|
5
|
-
= render :partial => 'posts/post', :
|
6
|
-
|
7
|
-
- content_for :sidebar do
|
8
|
-
= render :partial => "latest"
|
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 }
|
9
7
|
|
10
8
|
- content_for :new_topic do
|
11
9
|
.newmessage
|
@@ -24,16 +22,15 @@
|
|
24
22
|
- content_for :title do
|
25
23
|
= @topic.name
|
26
24
|
|
27
|
-
- content_for :
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
in
|
33
|
-
= link_to @topic.forum.name + '.', forum_url(@topic.forum), {:class => 'breadhead'}
|
25
|
+
- content_for :thing_title do
|
26
|
+
= @topic.name
|
27
|
+
|
28
|
+
- content_for :introduction do
|
29
|
+
= t('topic_show_introduction')
|
34
30
|
|
35
|
-
- content_for :
|
36
|
-
|
31
|
+
- content_for :speaker do
|
32
|
+
.speaker
|
33
|
+
= gravatar_for(@topic.reader, {:size => 40}, {:alt => @topic.reader.name, :class => 'gravatar', :width => '40', :height => '40'})
|
37
34
|
|
38
35
|
- content_for :feed do
|
39
36
|
= feed_link(topic_path(@topic, :format => :rss))
|
@@ -41,6 +38,9 @@
|
|
41
38
|
- content_for :controls do
|
42
39
|
= render :partial => 'readers/controls'
|
43
40
|
|
41
|
+
- content_for :parent do
|
42
|
+
= link_to @topic.forum.name + ':', forum_url(@topic.forum)
|
43
|
+
|
44
44
|
- content_for :breadhead do
|
45
45
|
= link_to t('forum'), forum_home_url
|
46
46
|
= t('separator')
|
@@ -57,7 +57,7 @@
|
|
57
57
|
= yield :pagination if @posts.previous_page
|
58
58
|
= yield :messages
|
59
59
|
= yield :pagination if @posts.next_page
|
60
|
-
= yield :reply_form
|
60
|
+
= yield :reply_form unless @posts.next_page
|
61
61
|
|
62
62
|
|
63
63
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Radiant.config do |config|
|
2
|
+
config.namespace('forum') do |forum|
|
3
|
+
forum.define 'allow_registration?', :default => true
|
4
|
+
forum.define 'public?', :default => true
|
5
|
+
forum.define 'editable_period', :type => :integer, :default => 15, :units => "minutes"
|
6
|
+
forum.define 'allow_page_comments?', :default => true
|
7
|
+
forum.define 'allow_attachments?', :default => true
|
8
|
+
forum.define 'attachment.content_types'
|
9
|
+
forum.define 'attachment.max_size', :type => :integer, :default => 10, :units => "MB"
|
10
|
+
forum.define 'layout', :select_from => lambda { Layout.all.map(&:name) }, :allow_blank => false
|
11
|
+
end
|
12
|
+
end
|
data/config/locales/en.yml
CHANGED
@@ -1,59 +1,128 @@
|
|
1
1
|
en:
|
2
|
+
a_reply_to: "A reply to"
|
3
|
+
add_post: "Add a %{message_type}"
|
2
4
|
all: "all"
|
5
|
+
anyone: "anyone"
|
6
|
+
anywhere: "anywhere"
|
7
|
+
attached: "attached"
|
8
|
+
attach_file: "attach a file"
|
9
|
+
author: "author"
|
10
|
+
begun_on: "begun on %{date}"
|
11
|
+
breadhead_separator: "»"
|
3
12
|
by: "by"
|
13
|
+
by_content_and_author: "by content, author or category."
|
14
|
+
comment: "comment"
|
15
|
+
comments: "comments"
|
4
16
|
config:
|
5
17
|
forum:
|
6
|
-
|
7
|
-
|
18
|
+
allow_attachments?: "Posts have file attachments?"
|
19
|
+
allow_page_comments?: "Page comments allowed?"
|
20
|
+
attachment:
|
21
|
+
content_types: "Permitted content types"
|
22
|
+
max_size: "Maximum attachment size"
|
8
23
|
editable_period: "Editable period"
|
9
24
|
layout: "Forum layout"
|
10
25
|
public?: "Forum public?"
|
11
|
-
|
26
|
+
date_recently: "%A"
|
27
|
+
date_this_year: "%B %e"
|
28
|
+
edit_forum: "edit forum"
|
29
|
+
edit_minimal: "e"
|
30
|
+
edit_post: "edit post"
|
31
|
+
edit_topic: "edit topic"
|
12
32
|
edit_your_post: "edit your post"
|
33
|
+
filed_in: "under %{name}"
|
34
|
+
for_comments: "for page comments"
|
13
35
|
forum: "Forum"
|
14
36
|
forums: "Discussion categories"
|
37
|
+
forum_configuration: "Forum settings"
|
38
|
+
forum_search: "Forum Search"
|
39
|
+
forum_show_introduction: ""
|
15
40
|
forums_introduction: "These are the broad filing areas we use to organise the forum. You can also see a list of "
|
41
|
+
from_reader: "from %{name}"
|
16
42
|
if_not_you: "If that's not you, please"
|
43
|
+
in: "in"
|
44
|
+
in_reply_to: "in reply to"
|
45
|
+
label:
|
46
|
+
topic_body: "Opening message"
|
47
|
+
topic_category: "File in category"
|
48
|
+
topic_name: "Discussion title"
|
49
|
+
latest_activity: "latest activity"
|
17
50
|
latest_discussion: "Latest topics"
|
18
51
|
latest_posts: "Latest comments"
|
19
52
|
latest_topics: "all the latest topics"
|
53
|
+
locked: "locked"
|
20
54
|
logged_in_as: "You are logged in as %{name}."
|
21
|
-
|
55
|
+
matching: "matching"
|
56
|
+
new_forum: "New forum"
|
57
|
+
new_reply_to: "New reply to"
|
58
|
+
new_topic: "New topic"
|
22
59
|
new_topic_button: "Submit topic"
|
23
60
|
new_topic_heading: "Start a new topic"
|
61
|
+
new_topic_introduction: ""
|
24
62
|
new_topic_here: "start a new<br />topic here"
|
63
|
+
no_description_provided: "No description provided."
|
64
|
+
no_file: "You must choose a file to upload!"
|
25
65
|
no_forums: "No discussion categories defined here yet."
|
66
|
+
no_messages_yet: "No messages yet"
|
26
67
|
no_posts: "The forum is empty."
|
68
|
+
no_posts_found: "No messages found."
|
27
69
|
no_topics: "No talk here yet."
|
28
70
|
of: "of"
|
29
71
|
on: "on"
|
72
|
+
on_date: "on %{date}"
|
30
73
|
post: "comment"
|
74
|
+
post_body: "Post body"
|
31
75
|
post_count_from:
|
32
76
|
zero: ""
|
33
|
-
one: "One
|
34
|
-
other: "%{count}
|
77
|
+
one: "One reply, from"
|
78
|
+
other: "%{count} replies, most recently from"
|
79
|
+
post_post: "Post %{message_type}"
|
35
80
|
post_removed: "Post removed"
|
36
|
-
posted_and_updated_on: "posted %{posted} and updated %{updated}"
|
37
|
-
posted_by: "
|
38
|
-
posted_on: "posted %{date}"
|
81
|
+
posted_and_updated_on: "posted on %{posted} and updated on %{updated}"
|
82
|
+
posted_by: "posted by"
|
83
|
+
posted_on: "posted on %{date}"
|
84
|
+
post: "message"
|
85
|
+
posts: "Messages"
|
86
|
+
posts_found:
|
87
|
+
zero: "Nothing found"
|
88
|
+
one: "One message found"
|
89
|
+
other: "%{count} messages found"
|
39
90
|
posts_introduction: "This is a list of all forum posts by date."
|
40
91
|
really_remove_post: "Are you sure you want to delete this comment?"
|
41
92
|
recent_topics: "Recent topics"
|
93
|
+
remove_minimal: "x"
|
42
94
|
remove_post: "delete comment"
|
43
95
|
replied_on: "replied on %{date}"
|
96
|
+
reply_from: "reply from"
|
44
97
|
rss_feed: "RSS feed"
|
98
|
+
save_changes: "Save changes"
|
99
|
+
search: "Search"
|
100
|
+
search_form:
|
101
|
+
forum_label: "In this discussion category"
|
102
|
+
person_label: "From this person"
|
103
|
+
query_label: "Look for this text"
|
104
|
+
search_whole_forum: "search the whole forum"
|
105
|
+
search_introduction: "Please choose a search phrase and/or a person or discussion category."
|
106
|
+
search_results: "Search Results"
|
45
107
|
separator: '»'
|
46
108
|
showing: "showing"
|
47
|
-
|
109
|
+
sorry_locked: "Sorry: this topic is locked."
|
110
|
+
standard_date: "%B %e, %Y"
|
48
111
|
started_topic_in: "started a new topic under"
|
49
112
|
started_topic_on: "started a new topic on %{date}"
|
50
|
-
|
113
|
+
started_on: "started on %{date}"
|
114
|
+
sticky: "sticky"
|
115
|
+
time_recently: "%A at %l:%M%p"
|
51
116
|
time_remaining_to_edit: "You have %{time} left to "
|
52
117
|
time_today: "today at %l:%M%p"
|
53
118
|
time_yesterday: "yesterday at %l:%M%p"
|
119
|
+
topic_show_introduction: ""
|
54
120
|
to: "to"
|
121
|
+
to_add_post: "To add a %{message_type}"
|
55
122
|
topic: "topic"
|
123
|
+
topic_body: "Opening message"
|
56
124
|
topic_empty: "Topic empty!"
|
57
|
-
|
125
|
+
topic_name: "Topic name"
|
126
|
+
topics: "Topics"
|
58
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"
|
59
128
|
unknown_date: "unknown date"
|
data/forum_extension.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_dependency 'application_controller'
|
2
2
|
|
3
3
|
class ForumExtension < Radiant::Extension
|
4
|
-
version "1.1
|
4
|
+
version "1.2.1"
|
5
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."
|
6
6
|
url "http://spanner.org/radiant/forum"
|
7
7
|
|
@@ -10,40 +10,35 @@ class ForumExtension < Radiant::Extension
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def activate
|
13
|
-
Reader.send :include, ForumReader
|
14
|
-
ReaderNotifier.send :include, ForumReaderNotifier
|
15
|
-
|
16
|
-
|
17
|
-
UserActionObserver.instance.send :add_observer!, Forum
|
13
|
+
Reader.send :include, ForumReader # has topics and posts
|
14
|
+
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
|
18
17
|
UserActionObserver.instance.send :add_observer!, Topic
|
19
18
|
UserActionObserver.instance.send :add_observer!, Post
|
20
|
-
Page.send :include, ForumTags
|
19
|
+
Page.send :include, ForumTags # radius tags for highlighting forum content on other pages
|
21
20
|
|
22
21
|
unless defined? admin.forum # UI is a singleton
|
23
22
|
Radiant::AdminUI.send :include, ForumAdminUI
|
24
|
-
|
23
|
+
Radiant::AdminUI.load_forum_extension_regions
|
25
24
|
end
|
26
25
|
|
27
26
|
# admin.pages.edit.add :parts_bottom, "edit_commentability", :after => "edit_layout_and_type"
|
28
|
-
admin.reader_configuration.show.add :settings, "forum", :after => "
|
29
|
-
admin.reader_configuration.edit.add :form, "edit_forum", :after => "
|
30
|
-
|
31
|
-
if defined? Site && admin.sites
|
32
|
-
Site.send :include, ForumSite
|
33
|
-
end
|
27
|
+
admin.reader_configuration.show.add :settings, "forum", :after => "administration"
|
28
|
+
admin.reader_configuration.edit.add :form, "edit_forum", :after => "administration"
|
34
29
|
|
35
30
|
if defined? RedCloth::DEFAULT_RULES # identifies redcloth 3
|
36
31
|
RedCloth.send :include, ForumRedCloth3
|
37
32
|
RedCloth::DEFAULT_RULES.push(:smilies)
|
38
33
|
else
|
39
|
-
RedCloth::TextileDoc.send :include, ForumRedCloth4
|
34
|
+
RedCloth::TextileDoc.send :include, ForumRedCloth4 # interpolate smily icons
|
40
35
|
end
|
41
36
|
|
42
37
|
tab("Forum") do
|
43
38
|
add_item 'Categories', '/admin/forum/forums'
|
44
39
|
add_item 'Topics', '/admin/forum/topics'
|
45
40
|
add_item 'Posts', '/admin/forum/posts'
|
46
|
-
add_item 'Settings', '/admin/
|
41
|
+
add_item 'Settings', '/admin/reader_configuration'
|
47
42
|
end
|
48
43
|
end
|
49
44
|
|
data/lib/forum_admin_ui.rb
CHANGED
@@ -3,12 +3,20 @@ module ForumAdminUI
|
|
3
3
|
def self.included(base)
|
4
4
|
base.class_eval do
|
5
5
|
|
6
|
-
attr_accessor :forum
|
6
|
+
attr_accessor :forum, :topic, :post
|
7
7
|
alias_method :forums, :forum
|
8
|
+
alias_method :topics, :topic
|
9
|
+
alias_method :posts, :post
|
10
|
+
|
11
|
+
def load_forum_extension_regions
|
12
|
+
@forum = load_default_forum_regions
|
13
|
+
@topic = load_default_topic_regions
|
14
|
+
@post = load_default_post_regions
|
15
|
+
end
|
8
16
|
|
9
17
|
def load_default_regions_with_forum
|
10
18
|
load_default_regions_without_forum
|
11
|
-
|
19
|
+
load_forum_extension_regions
|
12
20
|
end
|
13
21
|
alias_method_chain :load_default_regions, :forum
|
14
22
|
|
@@ -22,14 +30,48 @@ module ForumAdminUI
|
|
22
30
|
edit.form_bottom.concat %w{edit_timestamp edit_buttons}
|
23
31
|
end
|
24
32
|
forum.index = Radiant::AdminUI::RegionSet.new do |index|
|
25
|
-
index.thead.concat %w{title_header latest_header modify_header}
|
26
|
-
index.tbody.concat %w{title_cell latest_cell modify_cell}
|
27
|
-
index.bottom.concat %w{
|
33
|
+
index.thead.concat %w{title_header description_header latest_header modify_header}
|
34
|
+
index.tbody.concat %w{title_cell description_cell latest_cell modify_cell}
|
35
|
+
index.bottom.concat %w{buttons}
|
28
36
|
end
|
29
37
|
forum.remove = forum.index
|
30
38
|
forum.new = forum.edit
|
31
39
|
end
|
32
40
|
end
|
41
|
+
|
42
|
+
def load_default_topic_regions
|
43
|
+
returning OpenStruct.new do |topic|
|
44
|
+
topic.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
45
|
+
edit.main.concat %w{edit_header edit_form}
|
46
|
+
edit.form.concat %w{edit_name edit_body}
|
47
|
+
edit.form_bottom.concat %w{edit_timestamp edit_buttons}
|
48
|
+
end
|
49
|
+
topic.index = Radiant::AdminUI::RegionSet.new do |index|
|
50
|
+
index.thead.concat %w{title_header date_header author_header body_header modify_header}
|
51
|
+
index.tbody.concat %w{title_cell date_cell author_cell body_cell modify_cell}
|
52
|
+
index.bottom.concat %w{buttons}
|
53
|
+
end
|
54
|
+
topic.remove = topic.index
|
55
|
+
topic.new = topic.edit
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def load_default_post_regions
|
60
|
+
returning OpenStruct.new do |post|
|
61
|
+
post.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
62
|
+
edit.main.concat %w{edit_header edit_form}
|
63
|
+
edit.form.concat %w{show_name edit_body}
|
64
|
+
edit.form_bottom.concat %w{edit_timestamp edit_buttons}
|
65
|
+
end
|
66
|
+
post.index = Radiant::AdminUI::RegionSet.new do |index|
|
67
|
+
index.thead.concat %w{body_header author_header topic_header modify_header}
|
68
|
+
index.tbody.concat %w{body_cell author_cell topic_cell modify_cell}
|
69
|
+
index.bottom.concat %w{buttons}
|
70
|
+
end
|
71
|
+
post.remove = post.index
|
72
|
+
post.new = post.edit
|
73
|
+
end
|
74
|
+
end
|
33
75
|
|
34
76
|
end
|
35
77
|
end
|