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.
Files changed (50) hide show
  1. data/VERSION +1 -1
  2. data/app/controllers/admin/forums_controller.rb +3 -4
  3. data/app/controllers/admin/posts_controller.rb +10 -0
  4. data/app/controllers/admin/topics_controller.rb +10 -0
  5. data/app/controllers/posts_controller.rb +3 -27
  6. data/app/controllers/topics_controller.rb +3 -17
  7. data/app/helpers/forum_helper.rb +2 -2
  8. data/app/models/forum.rb +2 -24
  9. data/app/models/post.rb +12 -9
  10. data/app/models/post_attachment.rb +13 -13
  11. data/app/models/topic.rb +28 -55
  12. data/app/views/admin/forums/edit.html.haml +2 -1
  13. data/app/views/admin/forums/index.html.haml +42 -39
  14. data/app/views/admin/posts/_form.html.haml +25 -0
  15. data/app/views/admin/posts/edit.html.haml +6 -0
  16. data/app/views/admin/posts/index.html.haml +49 -0
  17. data/app/views/admin/reader_configuration/_edit_forum.html.haml +3 -3
  18. data/app/views/admin/reader_configuration/_forum.html.haml +19 -14
  19. data/app/views/admin/topics/_form.html.haml +24 -0
  20. data/app/views/admin/topics/edit.html.haml +6 -0
  21. data/app/views/admin/topics/index.html.haml +49 -0
  22. data/app/views/forums/index.html.haml +0 -7
  23. data/app/views/forums/show.html.haml +4 -3
  24. data/app/views/posts/_attachment.html.haml +4 -0
  25. data/app/views/posts/_form.html.haml +1 -3
  26. data/app/views/posts/_post.html.haml +50 -51
  27. data/app/views/posts/_reply.html.haml +16 -17
  28. data/app/views/posts/_search.html.haml +13 -17
  29. data/app/views/posts/_upload.html.haml +2 -0
  30. data/app/views/posts/_uploader.html.haml +15 -15
  31. data/app/views/posts/edit.html.haml +5 -7
  32. data/app/views/posts/index.html.haml +1 -8
  33. data/app/views/posts/search.html.haml +54 -45
  34. data/app/views/posts/show.html.haml +14 -6
  35. data/app/views/topics/_form.html.haml +15 -11
  36. data/app/views/topics/_latest.html.haml +0 -2
  37. data/app/views/topics/_locked.html.haml +2 -2
  38. data/app/views/topics/_topic.html.haml +50 -31
  39. data/app/views/topics/comments.html.haml +2 -1
  40. data/app/views/topics/index.html.haml +1 -9
  41. data/app/views/topics/new.html.haml +29 -18
  42. data/app/views/topics/show.html.haml +14 -14
  43. data/config/initializers/radiant_config.rb +12 -0
  44. data/config/locales/en.yml +81 -12
  45. data/forum_extension.rb +11 -16
  46. data/lib/forum_admin_ui.rb +47 -5
  47. data/radiant-forum-extension.gemspec +12 -4
  48. metadata +14 -6
  49. data/app/views/readers/_extra_controls.html.haml +0 -5
  50. data/app/views/readers/show_with_posts.html.haml +0 -47
@@ -7,68 +7,71 @@
7
7
  %tr
8
8
  - render_region :thead do |thead|
9
9
  - thead.title_header do
10
- %th.forum Forum
10
+ %th.forum
11
+ =t('forum').titlecase
12
+ - thead.description_header do
13
+ %th.description
14
+ =t('description').titlecase
11
15
  - thead.latest_header do
12
- %th.forum_latest Latest activity
16
+ %th.forum_latest
17
+ =t('latest_activity').titlecase
13
18
  - thead.modify_header do
14
- %th.action Action
19
+ %th.action
15
20
  %tbody
16
21
  - @forums.each do |forum|
17
- %tr.node.level-1
22
+ %tr
18
23
  - render_region :tbody do |tbody|
19
-
20
24
  - tbody.title_cell do
21
- %td.forum
22
- %h3
23
- = link_to forum.name, edit_admin_forum_url(:id => forum)
25
+ %td.name
26
+ = link_to forum.name, edit_admin_forum_url(:id => forum)
24
27
  -if forum.for_comments
25
28
  %p.context
26
- (comments forum)
29
+ = t('for_comments')
30
+
31
+ - tbody.description_cell do
32
+ %td.forum_description
27
33
  = textilize(forum.description)
28
- %p
29
- - if forum.respond_to?(:site)
30
- = link_to "→ browse discussions", 'http://' + forum.site.base_domain + forum_path(forum)
31
- - else
32
- = link_to "→ browse discussions", forum_path(forum)
33
34
 
34
35
  - tbody.latest_cell do
35
36
  %td.forum_latest
36
37
  - if forum.posts_count > 0
37
38
  %ul.latest
38
- - forum.recent_topics.latest.each do |topic|
39
+ - forum.topics.latest(1).each do |topic|
39
40
  %li.topic
41
+ = friendly_date(topic.replied_at) + ":"
40
42
  - if topic.page
43
+ - t('comment_on')
41
44
  = link_to topic.page.title, "#{topic.page.url}", {:class => 'topic'}
42
- - else
43
- = link_to topic.name, forum_topic_url(topic.forum, topic, :page => 'last'), {:class => 'topic'}
44
- %br
45
- %span.context
46
- from
47
- - if topic.posts.count > 1
48
- = link_to topic.reader.name + '.', reader_url(topic.reader)
49
- = topic.posts.count
50
- = pluralize(topic.posts.count, 'comment') + ','
51
- most recently from
52
- = link_to topic.replied_by.name, reader_url(topic.replied_by)
53
- = friendly_date(topic.replied_at)
54
- - else
55
- = link_to topic.reader.name, reader_url(topic.reader)
56
- = friendly_date(topic.created_at)
45
+ = t('from_reader', :name => topic.replied_by.name)
46
+ - elsif topic.replied_by
47
+ = t('new_reply_to')
48
+ = link_to topic.name, forum_topic_url(topic.forum, topic), {:class => 'topic'}
49
+ = t('from_reader', :name => topic.replied_by.name)
50
+ - else
51
+ = t('new_topic')
52
+ = link_to topic.name, forum_topic_url(topic.forum, topic), {:class => 'topic'}
53
+ = t('from_reader', :name => topic.reader.name)
57
54
  -else
58
55
  %p
59
- No topics yet.
56
+ = t('no_topics')
57
+
60
58
  - tbody.modify_cell do
61
- %td.remove
59
+ %td.actions
62
60
  -if forum.for_comments
63
- = image('noremove', :alt => 'Remove Forum')
61
+ %span.action.disabled
62
+ = image('minus_disabled')
63
+ = " " + t('remove')
64
64
  -else
65
65
  - if admin?
66
- = link_to image('remove', :alt => 'Remove Forum'), remove_admin_forum_url(:id => forum)
66
+ = link_to image('minus') + ' ' + t('remove'), remove_admin_forum_url(:id => forum) , :class => 'action'
67
67
  - else
68
- = image('noremove', :alt => 'only admin can remove forums')
68
+ %span.action.disabled
69
+ = image('minus_disabled')
70
+ = " " + t('remove')
69
71
 
70
72
  - render_region :bottom do |bottom|
71
- - bottom.new_button do
72
- - if admin?
73
- %p
74
- = link_to image('new-forum', :alt => 'New Forum'), new_admin_forum_url
73
+ - bottom.buttons do
74
+ #actions
75
+ = pagination_for @forums
76
+ %ul
77
+ %li= link_to image('plus') + " " + t("new_forum"), new_admin_forum_url
@@ -0,0 +1,25 @@
1
+ - form_for [:admin, @post] do |f|
2
+ = hidden_field 'forum', 'lock_version'
3
+ = render_region :form_top
4
+ .form-area
5
+ - render_region :form do |form|
6
+ - form.show_name do
7
+ %p.title
8
+ %label
9
+ = t('topic_name') + ":"
10
+ = @post.topic.name
11
+
12
+ - form.edit_body do
13
+ %p.content
14
+ = f.label :body, t('post_body')
15
+ = f.text_area :body, :class => "textarea", :style => "width: 100%"
16
+
17
+ - render_region :form_bottom do |form_bottom|
18
+ - form_bottom.edit_timestamp do
19
+ = updated_stamp @post
20
+ - form_bottom.edit_buttons do
21
+ %p.buttons
22
+ = save_model_button(@post)
23
+ = save_model_and_continue_editing_button(@post)
24
+ or
25
+ = link_to 'Cancel', admin_posts_url
@@ -0,0 +1,6 @@
1
+ - render_region :main do |main|
2
+ - main.edit_header do
3
+ %h1
4
+ = t('edit_post').titlecase
5
+ - main.edit_form do
6
+ = render :partial => 'form'
@@ -0,0 +1,49 @@
1
+ - include_stylesheet('admin/forum')
2
+ = render_region :top
3
+
4
+ #posts_table.outset
5
+ %table#posts.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
6
+ %thead
7
+ %tr
8
+ - render_region :thead do |thead|
9
+ - thead.body_header do
10
+ %th.body
11
+ = t('body')
12
+ - thead.author_header do
13
+ %th.author
14
+ = t('author')
15
+ - thead.date_header do
16
+ %th.date
17
+ - thead.topic_header do
18
+ %th.topic
19
+ = t('topic')
20
+ - thead.modify_header do
21
+ %th.action
22
+ %tbody
23
+ - @posts.each do |post|
24
+ %tr
25
+ - render_region :tbody do |tbody|
26
+ - tbody.body_cell do
27
+ %td.post_body
28
+ = link_to truncate(post.body, :length => 64), edit_admin_post_url(post)
29
+
30
+ - tbody.author_cell do
31
+ %td.post_author
32
+ = link_to post.reader.name, admin_reader_url(post.reader)
33
+
34
+ - tbody.date_cell do
35
+ %td.post_date
36
+ = friendly_date(post.created_at)
37
+
38
+ - tbody.topic_cell do
39
+ %td.post_topic
40
+ = link_to post.topic.name, forum_topic_url(post.topic.forum, post.topic), :class => 'external'
41
+
42
+ - tbody.modify_cell do
43
+ %td.actions
44
+ = link_to image('minus') + ' ' + t('remove'), remove_admin_post_url(:id => post) , :class => 'action'
45
+
46
+ - render_region :bottom do |bottom|
47
+ - bottom.buttons do
48
+ #actions
49
+ = pagination_for @posts
@@ -9,8 +9,8 @@
9
9
  %p
10
10
  = edit_config 'forum.allow_page_comments?'
11
11
  %p
12
- = edit_config 'forum.comments_have_attachments?'
12
+ = edit_config 'forum.allow_attachments?'
13
13
  %p
14
- = edit_config 'forum.attachment_content_types'
14
+ = edit_config 'forum.attachment.content_types'
15
15
  %p
16
- = edit_config 'forum.max_attachment_size'
16
+ = edit_config 'forum.attachment.max_size'
@@ -1,14 +1,19 @@
1
- %p.ruled
2
- = show_config 'forum.layout'
3
- %p.ruled
4
- = show_config 'forum.editable_period'
5
- %p.ruled
6
- = show_config 'forum.public?'
7
- %p.ruled
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
+ #forum_settings.box
2
+ %h3
3
+ .actions
4
+ = button_to t("edit"), edit_admin_reader_configuration_url, :method => :get
5
+ =t("forum_configuration")
6
+ %p.ruled
7
+ = show_config 'forum.layout'
8
+ %p.ruled
9
+ = show_config 'forum.editable_period'
10
+ %p.ruled
11
+ = show_config 'forum.public?'
12
+ %p.ruled
13
+ = show_config 'forum.allow_page_comments?'
14
+ %p.ruled
15
+ = show_config 'forum.allow_attachments?'
16
+ %p.ruled
17
+ = show_config 'forum.attachment.content_types'
18
+ %p.ruled
19
+ = show_config 'forum.attachment.max_size'
@@ -0,0 +1,24 @@
1
+ - form_for [:admin, @topic] do |f|
2
+ = render_region :form_top
3
+ .form-area
4
+ - render_region :form do |form|
5
+ - form.edit_name do
6
+ %p.title
7
+ = f.label :name, t('topic_name')
8
+ = f.text_field :name, :class => 'textbox', :maxlength => 100
9
+
10
+ - form.edit_body do
11
+ - f.fields_for :posts, @topic.first_post do |pf|
12
+ %p.body
13
+ = pf.label :body, t('topic_body')
14
+ = pf.text_area :body, :class => "textarea", :style => "width: 100%"
15
+
16
+ - render_region :form_bottom do |form_bottom|
17
+ - form_bottom.edit_timestamp do
18
+ = updated_stamp @topic
19
+ - form_bottom.edit_buttons do
20
+ %p.buttons
21
+ = save_model_button(@topic)
22
+ = save_model_and_continue_editing_button(@topic)
23
+ or
24
+ = link_to 'Cancel', admin_topics_url
@@ -0,0 +1,6 @@
1
+ - render_region :main do |main|
2
+ - main.edit_header do
3
+ %h1
4
+ = t('edit_topic').titlecase
5
+ - main.edit_form do
6
+ = render :partial => 'form'
@@ -0,0 +1,49 @@
1
+ - include_stylesheet('admin/forum')
2
+ = render_region :top
3
+
4
+ #topics_table.outset
5
+ %table#topics.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
6
+ %thead
7
+ %tr
8
+ - render_region :thead do |thead|
9
+ - thead.title_header do
10
+ %th.topic
11
+ = t('topic')
12
+ - thead.date_header do
13
+ %th.date
14
+ - thead.author_header do
15
+ %th.author
16
+ = t('author')
17
+ - thead.body_header do
18
+ %th.body
19
+ = t('body')
20
+ - thead.modify_header do
21
+ %th.action
22
+ %tbody
23
+ - @topics.each do |topic|
24
+ %tr
25
+ - render_region :tbody do |tbody|
26
+ - tbody.title_cell do
27
+ %td.name
28
+ = link_to topic.name, edit_admin_topic_url(:id => topic)
29
+
30
+ - tbody.date_cell do
31
+ %td.topic_date
32
+ = friendly_date(topic.created_at)
33
+
34
+ - tbody.author_cell do
35
+ %td.topic_author
36
+ = link_to topic.reader.name, admin_reader_url(topic.reader)
37
+
38
+ - tbody.body_cell do
39
+ %td.topic_body
40
+ = truncate(topic.first_post.body, :length => 64)
41
+
42
+ - tbody.modify_cell do
43
+ %td.actions
44
+ = link_to image('minus') + ' ' + t('remove'), remove_admin_topic_url(:id => topic) , :class => 'action'
45
+
46
+ - render_region :bottom do |bottom|
47
+ - bottom.buttons do
48
+ #actions
49
+ = pagination_for @topics
@@ -4,11 +4,6 @@
4
4
  - content_for :title do
5
5
  = t('forums')
6
6
 
7
- - content_for :preamble do
8
- %p
9
- = t('forums_introduction')
10
- = link_to t('latest_topics'), topics_url
11
-
12
7
  - content_for :new_topic do
13
8
  .newmessage
14
9
  = link_to t('new_topic'), new_topic_url
@@ -42,8 +37,6 @@
42
37
  = t('forums')
43
38
 
44
39
  #forum
45
- = yield :new_topic
46
- = yield :preamble
47
40
  = yield :pagination if @forums.previous_page
48
41
  = yield :messages
49
42
  = yield :pagination if @forums.next_page
@@ -4,7 +4,10 @@
4
4
  - content_for :title do
5
5
  = @forum.name
6
6
 
7
- - content_for :preamble do
7
+ - content_for :thing_title do
8
+ = @forum.name
9
+
10
+ - content_for :introduction do
8
11
  = clean_textilize(@forum.description)
9
12
 
10
13
  - content_for :new_topic do
@@ -46,8 +49,6 @@
46
49
 
47
50
 
48
51
  #forum
49
- = yield :new_topic
50
- = yield :preamble
51
52
  = yield :pagination if @topics.previous_page
52
53
  = yield :messages
53
54
  = yield :pagination if @topics.next_page
@@ -1,5 +1,9 @@
1
+ - af ||= false
1
2
  %li
2
3
  - if attachment.image?
3
4
  = link_to image_tag(attachment.thumbnail), attachment.file.url
4
5
  - else
5
6
  = link_to attachment.filename, attachment.file.url, :class => "attachment #{attachment.extension}"
7
+ - if af
8
+ = af.check_box :_destroy, :class => 'checkbox'
9
+
@@ -1,4 +1,2 @@
1
1
  = form.text_area :body, :rows => 10
2
-
3
- - if Radiant::Config['forum.comments_have_attachments?'] && !@topic.page
4
- = render :partial => 'posts/uploader'
2
+ = render :partial => 'posts/uploader', :locals => {:post => @post, :f => form}
@@ -1,70 +1,69 @@
1
1
  - post ||= @post
2
+ - first ||= false
3
+ - with_topic ||= false
2
4
  - with_context ||= false
3
5
  - without_author ||= false
6
+ - with_conversation ||= false
4
7
  - preview ||= false
5
8
 
6
- %div.post{:id => post.dom_id}
7
- %div{:class => post.first? ? 'first_post' : 'reply'}
8
- .post_header
9
- - if admin?
10
- .post_control
11
- %p.post_admin
12
- = link_to t("edit"), edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
13
- %span.separator |
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?"
9
+ %div{:id => post.dom_id, :class => first ? 'post first' : 'post reply'}
10
+ .speaker
11
+ = link_to gravatar_for(post.reader, {:size => 40}, {:alt => post.reader.name, :class => 'gravatar offset', :width => '40', :height => '40'}), forum_topic_url(post.topic.forum, post.topic, :anchor => "post_#{post.id}")
15
12
 
13
+ .post_wrapper
14
+ .post_header
16
15
  %p.context
17
16
  - if with_context
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 offset', :width => '40', :height => '40'})
20
- = post.topic.name
21
- - else
22
- %a{:href => reader_url(post.reader), :class => 'speaker'}
23
- = gravatar_for(post.reader, {:size => 40}, {:alt => post.reader.name, :class => 'gravatar offset', :width => '40', :height => '40'})
24
- = post.reader.name
25
-
26
- - if with_context
27
- = link_to post.reader.name, reader_url(post.reader)
28
17
  - if post.first?
29
- = t('started_topic_on', :date => friendly_date(post.created_at))
18
+ = t('new_topic')
19
+ = link_to post.topic.name, forum_topic_url(post.topic.forum, post.topic)
20
+ = t('started_on', :date => friendly_date(post.created_at))
21
+ = t('in')
22
+ = link_to post.topic.forum.name, forum_url(post.topic.forum)
23
+ = t('by')
24
+ = link_to post.reader.name, search_posts_url(:reader_id => post.reader.id), :class => 'person'
30
25
  - else
31
- = t('replied_on', :date => friendly_date(post.created_at))
32
-
26
+ = t('a_reply_to')
27
+ = link_to post.topic.name, forum_topic_url(post.topic.forum, post.topic)
28
+ = t('posted_on', :date => friendly_date(post.created_at))
29
+ = t('by')
30
+ = link_to post.reader.name, search_posts_url(:reader_id => post.reader.id), :class => 'person'
33
31
  - else
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
32
+ - if post.first?
33
+ = t('started_on', :date => friendly_date(post.created_at))
34
+ - else
40
35
  = t('posted_on', :date => friendly_date(post.created_at))
36
+ = t('by')
37
+ = link_to post.reader.name, search_posts_url(:reader_id => post.reader.id), :class => 'person'
38
+
41
39
  - if post.editable_by?(current_reader)
42
40
  %br
43
41
  %span.still_editable
44
42
  - if post.editable_interval
45
43
  = t('time_remaining_to_edit', :time => distance_of_time_in_words(post.still_editable_for))
46
44
  = link_to t('edit_your_post'), edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
47
-
48
- .post_wrapper
49
- .post_body
50
- - if post.frozen?
51
- %p
52
- = t('post_removed')
53
- - elsif preview
54
- = truncate_and_textilize(post.body, 100)
55
- - else
56
- = clean_textilize(post.body)
57
-
58
- - unless post.attachments.empty?
59
- .post_attachments
60
- %h4
61
- attached:
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}"
45
+ - elsif admin?
46
+ = link_to t("edit_minimal"), edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
47
+ = link_to t("remove_minimal"), 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?"
48
+
49
+ .post_body
50
+ - if post.frozen?
51
+ %p
52
+ = t('post_removed')
53
+ - elsif preview
54
+ = truncate_and_textilize(post.body, 100)
55
+ - else
56
+ = clean_textilize(post.body)
57
+
58
+ - if Radiant::Config['forum.allow_attachments?'] && post.attachments.any?
59
+ .post_attachments
60
+ %h4
61
+ = t('attached') + ':'
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}"
69
69
 
70
-