radiant-forum-extension 0.6.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/Rakefile +1 -3
  2. data/VERSION +1 -1
  3. data/app/controllers/forums_controller.rb +13 -5
  4. data/app/controllers/posts_controller.rb +9 -3
  5. data/app/controllers/topics_controller.rb +10 -3
  6. data/app/helpers/forum_helper.rb +105 -0
  7. data/app/models/post_attachment.rb +20 -12
  8. data/app/models/topic.rb +1 -1
  9. data/app/views/admin/forums/index.html.haml +63 -65
  10. data/app/views/admin/reader_configuration/_edit_forum.html.haml +6 -0
  11. data/app/views/admin/reader_configuration/_forum.html.haml +6 -0
  12. data/app/views/forums/_forum.html.haml +1 -2
  13. data/app/views/forums/index.html.haml +27 -25
  14. data/app/views/forums/show.html.haml +31 -19
  15. data/app/views/posts/_attachment.html.haml +5 -2
  16. data/app/views/posts/_form.html.haml +3 -5
  17. data/app/views/posts/_post.html.haml +32 -29
  18. data/app/views/posts/_uploader.html.haml +2 -3
  19. data/app/views/posts/index.html.haml +27 -11
  20. data/app/views/topics/_form.html.haml +3 -3
  21. data/app/views/topics/_topic.html.haml +10 -11
  22. data/app/views/topics/index.html.haml +28 -22
  23. data/app/views/topics/new.html.haml +32 -27
  24. data/app/views/topics/show.html.haml +25 -10
  25. data/config/locales/en.yml +58 -0
  26. data/config/routes.rb +5 -5
  27. data/forum_extension.rb +18 -11
  28. data/lib/forum_readers_controller.rb +1 -0
  29. data/lib/tasks/radiant_forum_extension_tasks.rake +54 -31
  30. data/public/images/{forum → furniture}/attachment.png +0 -0
  31. data/public/images/{forum → furniture}/attachment_link.png +0 -0
  32. data/public/images/{forum → furniture}/attachment_over.png +0 -0
  33. data/public/images/{forum → furniture}/chk_off.png +0 -0
  34. data/public/images/{forum → furniture}/chk_on.png +0 -0
  35. data/public/images/{forum → furniture}/feed_14.png +0 -0
  36. data/public/images/{forum → furniture}/feed_28.png +0 -0
  37. data/public/images/furniture/post.png +0 -0
  38. data/public/images/furniture/post_over.png +0 -0
  39. data/public/images/{forum → furniture}/rdo_off.png +0 -0
  40. data/public/images/{forum → furniture}/rdo_on.png +0 -0
  41. data/public/images/{forum → furniture}/wait_16_grey.gif +0 -0
  42. data/public/javascripts/forum.js +198 -0
  43. data/public/stylesheets/sass/forum.sass +247 -0
  44. data/radiant-forum-extension.gemspec +21 -28
  45. metadata +26 -53
  46. data/lib/forum_helper.rb +0 -109
  47. data/public/images/forum/post_14.png +0 -0
  48. data/public/images/forum/post_14_over.png +0 -0
  49. data/public/javascripts/platform/forum.js +0 -175
  50. data/public/javascripts/platform/remotecontent.js +0 -89
  51. data/public/stylesheets/admin/forum.css +0 -87
  52. data/public/stylesheets/platform/forum.css +0 -70
@@ -6,3 +6,9 @@
6
6
  = show_config 'forum.public?'
7
7
  %p.ruled
8
8
  = show_config 'forum.allow_page_comments?'
9
+ %p.ruled
10
+ = show_config 'forum.comments_have_attachments?'
11
+ %p.ruled
12
+ = show_config 'forum.attachment_content_types'
13
+ %p.ruled
14
+ = show_config 'forum.max_attachment_size'
@@ -1,7 +1,6 @@
1
1
  %li.forum{:id => forum.dom_id}
2
2
  %span.subject
3
- %a{:href => forum_url(forum), :class => 'main'}
4
- = forum.name
3
+ = link_to forum.name, forum_url(forum), :class => 'main'
5
4
  - if topic = forum.recent_topics.first
6
5
  %span.context
7
6
  = forum.topics.count
@@ -1,44 +1,46 @@
1
- = render :partial => 'readers/flasher'
1
+ - content_for :signals do
2
+ = render :partial => 'readers/flasher'
2
3
 
3
- #forum
4
- #forum_preamble
5
- %p
6
- These are the broad filing areas we use to organise the forum.
7
- You can also see a list of
8
- = link_to "all the most recent discussion", topics_url
9
- in any category.
4
+ - content_for :title do
5
+ = t('forums')
10
6
 
11
- %p
12
- = link_to "start a new discussion", new_topic_url, :class => 'newmessage'
7
+ - content_for :preamble do
8
+ %p
9
+ = t('forums_introduction')
10
+ = link_to t('latest_topics'), topics_url in any category.
13
11
 
14
- - if @forums.empty?
15
- %p No categories defined here yet.
12
+ - content_for :new_topic do
13
+ .newmessage
14
+ = link_to t('new_topic'), new_topic_url
16
15
 
16
+ - content_for :messages do
17
+ - if @forums.empty?
18
+ %p
19
+ = t('no_forums')
17
20
  - else
18
- - if @forums.previous_page
19
- = paginate_and_summarise @forums, 'forums'
20
-
21
21
  %ul.main
22
22
  = render :partial => 'forums/forum', :collection => @forums
23
23
 
24
- = paginate_and_summarise @forums, 'forums'
25
-
26
- - content_for :pagetitle do
27
- Discussion Categories
24
+ - content_for :pagination do
25
+ = pagination_and_summary_for(@forums, t('forum'))
28
26
 
29
27
  - content_for :feed do
30
- = feed_link(formatted_forums_path(:rss))
28
+ = feed_link(forums_path(:format => :rss))
31
29
 
32
30
  - content_for :controls do
33
31
  = render :partial => 'readers/controls'
34
32
 
35
33
  - content_for :breadhead do
36
- = link_to "Forum", topics_url, :class => 'breadhead'
34
+ = link_to t("forum"), forum_home_url
37
35
 
38
36
  - content_for :breadcrumbs do
39
37
  = link_to 'Forum', topics_url
40
38
  \>
41
- Categories
42
-
43
- - content_for :help do
44
- = render :partial => 'topics/help'
39
+ = t('forums')
40
+
41
+ #forum
42
+ = yield :new_topic
43
+ = yield :preamble
44
+ = yield :pagination if @forums.previous_page
45
+ = yield :messages
46
+ = yield :pagination if @forums.next_page
@@ -1,38 +1,50 @@
1
- = render :partial => 'readers/flasher'
1
+ - content_for :signals do
2
+ = render :partial => 'readers/flasher'
2
3
 
3
- #forum
4
- #forum_preamble
5
- = clean_textilize(@forum.description)
4
+ - content_for :title do
5
+ = @forum.name
6
+
7
+ - content_for :preamble do
8
+ = clean_textilize(@forum.description)
6
9
 
10
+ - content_for :new_topic do
7
11
  - unless @forum.for_comments?
8
- %p
9
- = link_to "start a new discussion here", new_forum_topic_url(@forum), :class => 'newmessage'
12
+ .newmessage
13
+ = link_to t('new_topic_here'), new_forum_topic_url(@forum)
10
14
 
15
+ - content_for :messages do
11
16
  - if @topics.empty?
12
- %p No talk here yet.
13
-
17
+ %p
18
+ = t('no_topics')
14
19
  - else
15
- - unless @topics.current_page == 1
16
- = paginate_and_summarise @topics, 'topics'
17
-
18
20
  %ul.main
19
21
  = render :partial => 'topics/topic', :collection => @topics, :locals => { :with_context => false }
20
22
 
21
- = paginate_and_summarise @topics, 'topics'
22
-
23
- - content_for :pagetitle do
24
- = @forum.name
23
+ - content_for :pagination do
24
+ = pagination_and_summary_for @topics, 'topics'
25
25
 
26
26
  - content_for :feed do
27
- = feed_link(formatted_forum_path(@forum, :rss))
27
+ = feed_link(forum_path(@forum, :format => :rss))
28
28
 
29
29
  - content_for :breadhead do
30
- = link_to 'Categories', forums_url, :class => 'breadhead'
30
+ = link_to t("forum"), forum_home_url
31
+ = t('separator')
32
+ = link_to t('forums'), forums_url
31
33
 
32
34
  - content_for :breadcrumbs do
33
- = link_to 'Discussion Categories', forums_url
34
- \>
35
+ = link_to t("forum"), forum_home_url
36
+ = t('separator')
37
+ = link_to t('categories'), forums_url
38
+ = t('separator')
35
39
  = link_to @forum.name, forum_url(@forum)
36
40
 
37
41
  - content_for :controls do
38
42
  = render :partial => 'readers/controls'
43
+
44
+
45
+ #forum
46
+ = yield :new_topic
47
+ = yield :preamble
48
+ = yield :pagination if @topics.previous_page
49
+ = yield :messages
50
+ = yield :pagination if @topics.next_page
@@ -1,2 +1,5 @@
1
- %li.attachment
2
- = link_to attachment.filename, attachment.file.url, :class => "attachment #{attachment.extension}"
1
+ %li
2
+ - if attachment.image?
3
+ = link_to image_tag(attachment.thumbnail), attachment.file.url
4
+ - else
5
+ = link_to attachment.filename, attachment.file.url, :class => "attachment #{attachment.extension}"
@@ -1,6 +1,4 @@
1
- .post_wrapper
2
- .post_body
3
- = form.text_area :body, :rows => 10, :class => 'post_body'
1
+ = form.text_area :body, :rows => 10
4
2
 
5
- - unless @topic.page && !Radiant::Config['forum.comments_have_attachments']
6
- = render :partial => 'posts/uploader'
3
+ - if Radiant::Config['forum.comments_have_attachments?'] && !@topic.page
4
+ = render :partial => 'posts/uploader'
@@ -1,5 +1,4 @@
1
1
  - post ||= @post
2
- - first_post ||= nil
3
2
  - with_context ||= false
4
3
  - without_author ||= false
5
4
  - preview ||= false
@@ -10,40 +9,47 @@
10
9
  - if admin?
11
10
  .post_control
12
11
  %p.post_admin
13
- = link_to "edit", edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
12
+ = link_to t("edit"), edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
14
13
  %span.separator |
15
- = link_to "delete", topic_post_url(post.topic, post), :method => 'delete', :class => 'delete_post', :id => "delete_post_#{post.id}", :title => "remove post", :confirm => "Are you sure you want to delete this message?"
16
- %h2
14
+ = link_to t("remove"), topic_post_url(post.topic, post), :method => 'delete', :class => 'delete_post', :id => "delete_post_#{post.id}", :title => "remove post", :confirm => "Are you sure you want to delete this message?"
15
+
16
+ %p.context
17
17
  - if with_context
18
18
  %a{:href => forum_topic_url(post.topic.forum, post.topic, :anchor => "post_#{post.id}"), :class => post.first? ? 'speaker begun' : 'speaker replied'}
19
- = gravatar_for(post.reader, {:size => 40}, {:alt => post.reader.name, :class => 'gravatar', :width => '40', :height => '40'})
19
+ = gravatar_for(post.reader, {:size => 40}, {:alt => post.reader.name, :class => 'gravatar offset', :width => '40', :height => '40'})
20
20
  = post.topic.name
21
21
  - else
22
22
  %a{:href => reader_url(post.reader), :class => 'speaker'}
23
- = gravatar_for(post.reader, {:size => 40}, {:alt => post.reader.name, :class => 'gravatar', :width => '40', :height => '40'})
23
+ = gravatar_for(post.reader, {:size => 40}, {:alt => post.reader.name, :class => 'gravatar offset', :width => '40', :height => '40'})
24
24
  = post.reader.name
25
- %p.context
25
+
26
26
  - if with_context
27
27
  = link_to post.reader.name, reader_url(post.reader)
28
28
  - if post.first?
29
- started a new discussion in
30
- = link_to(post.topic.forum.name, forum_url(post.topic.forum))
29
+ = t('started_topic_on', :date => friendly_date(post.created_at))
31
30
  - else
32
- replied
31
+ = t('replied_on', :date => friendly_date(post.created_at))
32
+
33
33
  - else
34
- posted
35
- = friendly_date(post.created_at)
36
- - if post.updated_at && post.updated_at > post.created_at
37
- and updated
38
- - if post.updated_by && post.updated_by != post.created_by
39
- (by
40
- = post.updated_by.name + ')'
41
- = friendly_date(post.updated_at)
34
+ - if post.updated_at && post.updated_at > post.created_at
35
+ = t('posted_and_updated_on', :posted => friendly_date(post.created_at), :updated => friendly_date(post.updated_at))
36
+ - if post.updated_by != post.created_by
37
+ = t('by')
38
+ = post.updated_by.name
39
+ - else
40
+ = t('posted_on', :date => friendly_date(post.created_at))
41
+ - if post.editable_by?(current_reader)
42
+ %br
43
+ %span.still_editable
44
+ - if post.editable_interval
45
+ = t('time_remaining_to_edit', :time => distance_of_time_in_words(post.still_editable_for))
46
+ = link_to t('edit_your_post'), edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
42
47
 
43
48
  .post_wrapper
44
49
  .post_body
45
50
  - if post.frozen?
46
- %p Post removed
51
+ %p
52
+ = t('post_removed')
47
53
  - elsif preview
48
54
  = truncate_and_textilize(post.body, 100)
49
55
  - else
@@ -53,15 +59,12 @@
53
59
  .post_attachments
54
60
  %h4
55
61
  attached:
56
- %ul
57
- = render :partial => 'posts/attachment', :collection => post.attachments, :locals => {:removable => false}
62
+ - post.attachments.images.each do |att|
63
+ = link_to image_tag(att.thumbnail), att.file.url, :class => :thumbnail
64
+ - if post.attachments.non_images.any?
65
+ %ul.attachments
66
+ - post.attachments.non_images.each do |att|
67
+ %li
68
+ = link_to att.filename, att.file.url, :class => "attachment #{att.extension}"
58
69
 
59
- - if post.editable_by?(current_reader)
60
- .post_control
61
- %p
62
- - if post.editable_interval
63
- You have
64
- = distance_of_time_in_words(post.still_editable_for)
65
- to
66
- = link_to "edit your post", edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
67
70
 
@@ -1,14 +1,13 @@
1
1
  - post ||= @post
2
2
 
3
- .upload_handler
3
+ .upload_stack
4
4
  %ul.attachments
5
5
  = hidden_field_tag "post[attachment_ids][]", ""
6
6
  - post.attachments.each do |attachment|
7
7
  %li.attachment
8
8
  = check_box_tag "post[attachment_ids][]", attachment.id, true, {:id => "post_attachment_#{attachment.id}", :class => 'choose_attachment'}
9
9
  = link_to attachment.filename, attachment.file.url, :class => "attachment #{attachment.extension}"
10
- = link_to 'remove', '#', :class => 'remove', :id => "remove_attachment_#{attachment.id}"
11
- .uploads
10
+ %ul.uploads
12
11
  .selector
13
12
  = file_field_tag "files[]", :class => "filefield"
14
13
  .addfile
@@ -1,25 +1,33 @@
1
- = render :partial => 'readers/flasher'
1
+ - content_for :signals do
2
+ = render :partial => 'readers/flasher'
2
3
 
3
- #forum
4
+ - content_for :title do
5
+ = t('latest_posts')
6
+
7
+ - content_for :preamble do
8
+ %p
9
+ = t('posts_introduction')
10
+
11
+ - content_for :messages do
4
12
  - if @posts.empty?
5
- %p No talk here yet.
13
+ %p
14
+ = t('no_posts')
6
15
  - else
7
- - if @posts.previous_page
8
- = paginate_and_summarise @posts, 'posts'
9
-
10
16
  %ul.main
11
17
  = render :partial => 'posts/post', :collection => @posts, :locals => {:with_context => true}
12
18
 
13
- = paginate_and_summarise @posts, 'posts'
19
+ - content_for :new_topic do
20
+ .newmessage
21
+ = link_to t('new_topic'), new_topic_url
22
+
23
+ - content_for :pagination do
24
+ = pagination_and_summary_for(@posts, t('post'))
14
25
 
15
26
  - content_for :breadcrumbs do
16
27
  = link_to 'Forum', topics_url
17
28
  \>
18
29
  = @title
19
30
 
20
- - content_for :pagetitle do
21
- Posts
22
-
23
31
  - content_for :breadhead do
24
32
  = link_to "Forum", topics_url, :class => 'breadhead'
25
33
 
@@ -30,4 +38,12 @@
30
38
  = render :partial => 'readers/controls'
31
39
 
32
40
  - content_for :help do
33
- = render :partial => 'topics/help'
41
+ = render :partial => 'topics/help'
42
+
43
+
44
+ #forum
45
+ = yield :new_topic
46
+ = yield :preamble
47
+ = yield :pagination if @posts.previous_page
48
+ = yield :messages
49
+ = yield :pagination if @posts.next_page
@@ -1,4 +1,4 @@
1
- - with_error_report(@topic.errors.on(:name)) do
1
+ %p.title
2
2
  = form.label :name, 'Discussion title', :class => 'required'
3
3
  %br
4
4
  = form.text_field :name, :class => 'titular'
@@ -10,7 +10,7 @@
10
10
  = form.check_box :locked
11
11
  %label{:for => 'topic_locked', :class => 'admin'} Locked
12
12
 
13
- - with_error_report(@topic.errors.on(:body)) do
13
+ %p.body
14
14
  = form.label :name, 'Opening message'
15
15
  %br
16
16
  = form.text_area :body, :class=> 'standard', :rows => 12
@@ -19,7 +19,7 @@
19
19
  = render :partial => 'posts/uploader', :locals => {:post => @topic.first_post}
20
20
 
21
21
  - if @topic.new_record? || admin?
22
- - with_error_report(@topic.errors.on(:forum)) do
22
+ %p.forum
23
23
  = form.label :forum_id, 'File in category:'
24
24
  %br
25
25
  = form.select :forum_id, Forum.visible.collect {|f| [ f.name, f.id ] }, :class=> 'standard'
@@ -7,29 +7,28 @@
7
7
  %li{:id => topic.dom_id, :class => cssclass.join(' ')}
8
8
  %span.context
9
9
  - if with_context
10
- = link_to(topic.forum.name, forum_url(topic.forum)) + ':'
10
+ = link_to topic.forum.name, forum_url(topic.forum)
11
11
  %span.subject
12
12
  %a{:href => forum_topic_url(topic.forum, topic), :class => 'main'}
13
- = gravatar_for(topic.reader, {:size => 40}, {:alt => topic.reader.name, :class => 'gravatar'})
13
+ - if topic.reader
14
+ = gravatar_for(topic.reader, {:size => 40}, {:alt => topic.reader.name, :class => 'gravatar'})
14
15
  = topic.name
15
16
  %span.context
16
- from
17
- - if topic.posts.count > 1
18
- = link_to topic.reader.name + '.', reader_url(topic.reader)
19
- = topic.posts.count
20
- = pluralize(topic.posts.count, 'comment') + ','
21
- most recently from
17
+ = t('posted_by')
18
+ = link_to topic.reader.name + '.', reader_url(topic.reader)
19
+ = t('post_count_from', :count => topic.posts.count - 1)
20
+ - if topic.has_posts?
22
21
  = link_to topic.replied_by.name, reader_url(topic.replied_by)
23
22
  = friendly_date(topic.replied_at)
24
23
  - else
25
- = link_to topic.reader.name, reader_url(topic.reader)
26
24
  = friendly_date(topic.created_at)
27
25
 
28
- %div.preview
26
+ .post_wrapper
29
27
  - if topic.page
30
28
  = truncate_words(topic.page.render_part(:body), 50)
31
29
  - elsif topic.first_post
32
30
  = truncate_and_textilize(topic.first_post.body, 50)
33
31
  - else
34
- %p Topic empty!
32
+ %p
33
+ = t('topic_empty')
35
34
 
@@ -1,35 +1,34 @@
1
- = render :partial => 'readers/flasher'
1
+ - content_for :signals do
2
+ = render :partial => 'readers/flasher'
2
3
 
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'
4
+ - content_for :preamble do
5
+ %p
6
+ = t('topics_introduction')
7
+ = link_to( t('categories'), forums_url) + '.'
12
8
 
9
+ - content_for :messages do
13
10
  - if @topics.empty?
14
- %p No talk here yet.
15
-
11
+ %p
12
+ = t('no_topics')
16
13
  - else
17
- - if @topics.previous_page
18
- = paginate_and_summarise @topics, 'topics'
19
-
20
14
  %ul.main
21
15
  = render :partial => 'topics/topic', :collection => @topics, :locals => {:with_context => true}
22
16
 
23
- = paginate_and_summarise @topics, 'topics'
17
+ - content_for :new_topic do
18
+ .newmessage
19
+ = link_to t('new_topic'), new_topic_url
20
+
21
+ - content_for :pagination do
22
+ = pagination_and_summary_for(@topics, t('topics'))
24
23
 
25
24
  - content_for :breadhead do
26
- = home_page_link(:class => 'breadhead')
25
+ = home_page_link
27
26
 
28
27
  - content_for :breadcrumbs do
29
- Forum
28
+ = t('forum').titlecase
30
29
 
31
- - content_for :pagetitle do
32
- Latest discussion
30
+ - content_for :title do
31
+ = t('latest_discussion')
33
32
 
34
33
  - content_for :feed do
35
34
  = feed_link(topics_path(:format => :rss))
@@ -37,5 +36,12 @@
37
36
  - content_for :controls do
38
37
  = render :partial => 'readers/controls'
39
38
 
40
- - content_for :help do
41
- = render :partial => 'topics/help'
39
+ #forum
40
+ = yield :new_topic
41
+ = yield :preamble
42
+ = yield :pagination if @topics.previous_page
43
+ = yield :messages
44
+ = yield :pagination if @topics.next_page
45
+
46
+
47
+