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,11 +1,13 @@
1
1
  %fieldset
2
2
  %h3 Forum
3
+ %p
4
+ = edit_config 'forum.public?'
3
5
  %p
4
6
  = edit_config 'forum.layout'
5
7
  %p
6
- = edit_config 'forum.editable_period'
8
+ = edit_config 'forum.toolbar?'
7
9
  %p
8
- = edit_config 'forum.public?'
10
+ = edit_config 'forum.editable_period'
9
11
  %p
10
12
  = edit_config 'forum.allow_page_comments?'
11
13
  %p
@@ -3,14 +3,18 @@
3
3
  .actions
4
4
  = button_to t("edit"), edit_admin_reader_configuration_url, :method => :get
5
5
  =t("forum_configuration")
6
+ %p.ruled
7
+ = show_config 'forum.public?'
6
8
  %p.ruled
7
9
  = show_config 'forum.layout'
8
10
  %p.ruled
9
- = show_config 'forum.editable_period'
11
+ = show_config 'forum.toolbar?'
10
12
  %p.ruled
11
- = show_config 'forum.public?'
13
+ = show_config 'forum.editable_period'
12
14
  %p.ruled
13
15
  = show_config 'forum.allow_page_comments?'
16
+ %p.ruled
17
+ = show_config 'forum.commentable_period'
14
18
  %p.ruled
15
19
  = show_config 'forum.allow_attachments?'
16
20
  %p.ruled
@@ -1,21 +1,15 @@
1
- %li.forum{:id => forum.dom_id}
2
- %span.subject
3
- = link_to forum.name, forum_url(forum), :class => 'main'
4
- - if topic = forum.recent_topics.first
5
- %span.context
6
- = forum.topics.count
7
- = pluralize forum.topics.count, "discussions"
8
- containing
9
- = forum.posts.count
10
- messages,
11
- %br
12
- most recently in
13
- = link_to topic.name, forum_topic_url(forum, topic)
14
- = time_ago_in_words(topic.replied_at || topic.created_at)
15
- ago.
16
- - else
17
- %span.context
18
- No posts yet.
19
- %div.preview
20
- = truncate_and_textilize(forum.description, 40)
1
+ - if forum.visible_to?(current_reader)
2
+ .forum
3
+ .forum_wrapper{:id => forum.dom_id}
4
+ .forum_header
5
+ %h2
6
+ = link_to forum.name, forum_url(forum), :class => 'main'
7
+ %p.context
8
+ = t("topic_count", :count => forum.topics.count)
9
+ - if topic = forum.topics.first
10
+ = link_to topic.name, forum_topic_url(forum, topic)
11
+ = time_ago_in_words(topic.replied_at || topic.created_at)
12
+ = t('ago')
13
+ .forum_description
14
+ = truncate_and_textilize(forum.description, 40)
21
15
 
@@ -0,0 +1,12 @@
1
+ %h2
2
+ = t('forums')
3
+ %ul
4
+ - Forum.all.each do |forum|
5
+ - if topic = forum.topics.bydate.first
6
+ %li
7
+ = link_to forum.name, forum_url(forum), :class => 'title'
8
+ %br
9
+ = forum.topics.count
10
+ = t('topics') + ','
11
+ = t('most_recently')
12
+ = link_to topic.name, forum_topic_url(forum, topic)
@@ -0,0 +1,49 @@
1
+ - add_reader_css '/stylesheets/reader.css'
2
+ - if current_reader
3
+ - if Radiant::Config['forum.toolbar?']
4
+ - add_reader_js '/punymce/puny_mce_src.js'
5
+ - add_reader_js '/punymce/plugins/link/link.js'
6
+ - add_reader_js '/punymce/plugins/image/image.js'
7
+ - add_reader_js '/punymce/plugins/emoticons/emoticons.js'
8
+ - add_reader_js '/punymce/plugins/editsource/editsource.js'
9
+ - add_reader_js '/punymce/plugins/paste.js'
10
+ - add_reader_js '/javascripts/forum.js'
11
+
12
+
13
+ - content_for :section_navigation do
14
+ = link_to t('navigation.forum'), topics_url, :class => 'section'
15
+ = link_to t('navigation.topics'), topics_url
16
+ = link_to t('navigation.forums'), forums_url
17
+ = link_to t('navigation.readers'), readers_url
18
+ = link_to t('navigation.new_topic'), new_post_url
19
+ - if current_reader
20
+ = link_to t('navigation.your_account'), reader_account_url
21
+ - else
22
+ = link_to t('log_in'), reader_login_url
23
+ - if Radiant::Config['forum.help_url']
24
+ = link_to t('navigation.forum_help'), Radiant::Config['forum.help_url']
25
+
26
+ - content_for :controls do
27
+ = render :partial => 'readers/controls'
28
+
29
+ - content_for :signals do
30
+ = render :partial => 'readers/flasher'
31
+
32
+ - content_for :reader_css do
33
+ - reader_css_paths.each do |path|
34
+ %link{:rel => 'stylesheet', :href => path, :type => 'text/css'}
35
+
36
+ - content_for :reader_js do
37
+ - reader_js_paths.each do |path|
38
+ %script{:src => path, :type => 'text/javascript'}
39
+
40
+ - content_for :person do
41
+ - if @reader
42
+ = standard_gravatar_for(@reader)
43
+
44
+ - content_for :search do
45
+ = render :partial => 'posts/search_form'
46
+
47
+ - content_for :newtopic do
48
+ .newmessage
49
+ = link_to t('new_topic'), new_post_url
@@ -1,42 +1,34 @@
1
- - content_for :signals do
2
- = render :partial => 'readers/flasher'
1
+ = render :partial => 'forums/standard_parts'
3
2
 
4
3
  - content_for :title do
5
- = t('forums')
4
+ = t('forums_heading')
6
5
 
7
- - content_for :new_topic do
8
- .newmessage
9
- = link_to t('new_topic'), new_topic_url
6
+ - content_for :introduction do
7
+ %p
8
+ = t('forums_introduction')
10
9
 
11
10
  - content_for :messages do
12
11
  - if @forums.empty?
13
12
  %p
14
13
  = t('no_forums')
15
14
  - else
16
- %ul.main
17
- = render :partial => 'forums/forum', :collection => @forums
18
-
19
- - content_for :sidebar do
20
- = render :partial => "topics/latest"
15
+ = yield :pagination if @forums.previous_page
16
+ = render :partial => 'forums/forum', :collection => @forums
17
+ = yield :pagination if @forums.next_page
21
18
 
22
19
  - content_for :pagination do
23
20
  = pagination_and_summary_for(@forums, t('forum'))
24
21
 
25
- - content_for :feed do
22
+ - content_for :feedlink do
26
23
  = feed_link(forums_path(:format => :rss))
27
24
 
28
- - content_for :controls do
29
- = render :partial => 'readers/controls'
30
-
31
- - content_for :breadhead do
32
- = link_to t("forum"), forum_home_url
33
-
34
25
  - content_for :breadcrumbs do
35
- = link_to 'Forum', topics_url
36
- \>
37
- = t('forums')
38
-
26
+ = link_to t('forum').titlecase, topics_url
27
+ = t('separator')
28
+ = yield :title
29
+
30
+
31
+
39
32
  #forum
40
- = yield :pagination if @forums.previous_page
41
33
  = yield :messages
42
- = yield :pagination if @forums.next_page
34
+ = yield :newtopic
@@ -1,27 +1,14 @@
1
- - content_for :signals do
2
- = render :partial => 'readers/flasher'
1
+ = render :partial => 'forums/standard_parts'
3
2
 
4
3
  - content_for :title do
5
4
  = @forum.name
6
5
 
7
- - content_for :thing_title do
8
- = @forum.name
9
-
10
6
  - content_for :introduction do
11
7
  = clean_textilize(@forum.description)
12
8
 
13
- - content_for :new_topic do
14
- - unless @forum.for_comments?
15
- .newmessage
16
- = link_to t('new_topic_here'), new_forum_topic_url(@forum)
17
-
18
- - content_for :messages do
19
- - if @topics.empty?
20
- %p
21
- = t('no_topics')
22
- - else
23
- %ul.main
24
- = render :partial => 'topics/topic', :collection => @topics, :locals => { :with_context => false }
9
+ - content_for :newtopic do
10
+ .newmessage
11
+ = link_to t('new_topic_here'), new_post_url(:forum_id => @forum.id)
25
12
 
26
13
  - content_for :sidebar do
27
14
  = render :partial => "topics/latest"
@@ -29,26 +16,29 @@
29
16
  - content_for :pagination do
30
17
  = pagination_and_summary_for @topics, 'topics'
31
18
 
32
- - content_for :feed do
19
+ - content_for :feedlink do
33
20
  = feed_link(forum_path(@forum, :format => :rss))
34
21
 
35
22
  - content_for :breadhead do
36
- = link_to t("forum"), forum_home_url
37
- = t('separator')
23
+ = link_to t('forum').titlecase + t('separator'), topics_url
38
24
  = link_to t('forums'), forums_url
39
25
 
40
26
  - content_for :breadcrumbs do
41
- = link_to t("forum"), forum_home_url
42
- = t('separator')
43
- = link_to t('categories'), forums_url
27
+ = yield :breadhead
44
28
  = t('separator')
45
- = link_to @forum.name, forum_url(@forum)
29
+ = yield :title
30
+
31
+ - content_for :messages do
32
+ - if @topics.empty?
33
+ %p
34
+ = t('no_topics')
35
+ - else
36
+ = yield :pagination if @topics.previous_page
37
+ = render :partial => 'topics/topic', :collection => @topics, :locals => { :with_context => false }
38
+ = yield :pagination if @topics.next_page
46
39
 
47
- - content_for :controls do
48
- = render :partial => 'readers/controls'
49
40
 
50
41
 
51
42
  #forum
52
- = yield :pagination if @topics.previous_page
53
43
  = yield :messages
54
- = yield :pagination if @topics.next_page
44
+ = yield :newtopic
@@ -2,7 +2,7 @@
2
2
  %div.post_header
3
3
  %h2
4
4
  %a{:href => "/readers/#{post.reader.id}", :class => 'main'}
5
- %img{:src => post.reader.gravatar_url(:size => 40), :class => 'gravatar'}
5
+ = gravatar_for(post.reader, {:size => 40}, {:class => 'gravatar'}}
6
6
  = post.reader.name
7
7
  %p.context
8
8
  = post.created_at
@@ -0,0 +1,13 @@
1
+ - if Radiant::Config['forum.allow_attachments?'] && !post.frozen? && post.attachments.any?
2
+ .post_attachments
3
+ %h4
4
+ = t('attached') + ':'
5
+ - post.attachments.images.each do |att|
6
+ - display_size = Radiant::Config['forum.image_zoom_size'] || :original
7
+ = link_to image_tag(att.thumbnail), att.file.url(display_size), :class => :thumbnail
8
+ - if post.attachments.non_images.any?
9
+ %ul.attachments
10
+ - post.attachments.non_images.each do |att|
11
+ %li
12
+ = link_to att.filename, att.file.url, :class => "attachment #{att.extension}"
13
+
@@ -0,0 +1,10 @@
1
+ - post ||= @post
2
+ .post_removal
3
+ %p.warning
4
+ = t('confirm_removal_of', :author => post.reader.name)
5
+ %p.buttons
6
+ - form_for post, :html => {:method => 'delete', :class => 'friendly'} do |f|
7
+ = f.submit t('definitely_remove_post')
8
+ = t('or')
9
+ = link_to t('cancel'), paginated_post_url(post), :class => 'cancel'
10
+
@@ -0,0 +1,16 @@
1
+ - post ||= @post
2
+
3
+ - if post
4
+ - if post.comment?
5
+ = t('comment_on')
6
+ = link_to post.page.title, post.page.url
7
+ = t('posted')
8
+ - elsif post.first?
9
+ = t('new_topic_started')
10
+ - else
11
+ = t('reply_posted')
12
+ - if post.reader
13
+ = t('by')
14
+ = link_to post.reader.name, reader_url(post.reader)
15
+ - else
16
+ No post!
@@ -0,0 +1,11 @@
1
+ - post ||= @post
2
+ - unless post.frozen?
3
+ - if post.editable_by?(current_reader)
4
+ %div.edit_me
5
+ - if post.editable_interval
6
+ = t('time_remaining_to_edit', :time => distance_of_time_in_words(post.still_editable_for))
7
+ = link_to t('edit_your_post'), edit_topic_post_url(post.topic, post), :class => 'edit_post remote', :id => "revise_post_#{post.id}"
8
+ - elsif admin?
9
+ %div.edit_me
10
+ = link_to t("edit_minimal"), edit_topic_post_url(post.topic, post), :class => 'edit_post remote', :id => "revise_post_#{post.id}", :title => "edit post"
11
+ = link_to t("remove_minimal"), remove_post_url(post), :class => 'delete_post remote', :id => "delete_post_#{post.id}", :title => "remove post"
@@ -1,2 +1,40 @@
1
- = form.text_area :body, :rows => 10
2
- = render :partial => 'posts/uploader', :locals => {:post => @post, :f => form}
1
+ - post ||= @post
2
+ - omit_label ||= !post.first?
3
+
4
+ - form_for post, :html => {:multipart => true, :id => "post_form_#{post.id}", :class => 'friendly'} do |f|
5
+ - if post.page
6
+ = f.hidden_field :page_id
7
+ - elsif post.first?
8
+ - f.fields_for :topic do |tf|
9
+ %p
10
+ = tf.label :name, t('label.topic.name'), :class => 'required'
11
+ %br
12
+ = tf.text_field :name, :class => 'titular'
13
+ - if admin?
14
+ %br
15
+ %span.quiet
16
+ = tf.check_box :sticky
17
+ = tf.label :sticky, t('label.topic.sticky'), :class => 'minor'
18
+ = tf.check_box :locked
19
+ = tf.label :locked, t('label.topic.locked'), :class => 'minor'
20
+ %p
21
+ = tf.label :forum_id, t('label.topic.forum'), :class => "required"
22
+ %br
23
+ = tf.select :forum_id, Forum.all.collect {|forum| [ forum.name, forum.id ] }, :class=> 'standard'
24
+ - elsif post.topic
25
+ = f.hidden_field :topic_id
26
+
27
+ %p
28
+ - unless omit_label
29
+ = f.label :body, t('label.post.body'), :class => 'required'
30
+ %br
31
+ = f.text_area :body, :rows => 12, :class => Radiant::Config['forum.toolbar?'] ? 'toolbarred' : ''
32
+
33
+ = render :partial => 'posts/uploader', :locals => {:post => post, :f => f}
34
+
35
+ %p.buttons
36
+ = f.submit t('save_post')
37
+ - unless post.new_record?
38
+ = t('or')
39
+ = link_to t("cancel"), paginated_post_url(post), :class => 'cancel'
40
+
@@ -1,17 +1,10 @@
1
- %h3
2
- Latest discussion
3
- %ul.clean
4
- - Post.visible.latest(6).each do |post|
5
- %li
6
- = gravatar_for(post.reader, {:size => '30'}, {:class => 'gravatar'})
7
- = link_to post.topic.name, forum_topic_url(post.topic.forum, post.topic)
8
- %br
9
- %span.credit
10
- - if post.topic.page
11
- commented upon by
12
- - elsif post.first?
13
- started by
14
- - else
15
- replied to by
16
- = post.reader.name
17
- = friendly_date(post.created_at)
1
+ %h2
2
+ = t('recent_posts')
3
+ %ul
4
+ - Post.latest(10).each do |post|
5
+ %li.post
6
+ %span.subject
7
+ = link_to_post(post, :class => 'title')
8
+ %span.context
9
+ = render :partial => 'posts/context', :locals => {:post => post}
10
+ = friendly_date(post.created_at)
@@ -0,0 +1,2 @@
1
+ - if naf
2
+ = naf.file_field :file, :class => 'filefield'
@@ -1,69 +1,34 @@
1
1
  - post ||= @post
2
- - first ||= false
3
- - with_topic ||= false
2
+ - first ||= post.first?
3
+ - headless ||= first
4
4
  - with_context ||= false
5
- - without_author ||= false
6
- - with_conversation ||= false
7
- - preview ||= false
8
-
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}")
12
5
 
6
+ - cssclasses = []
7
+ - cssclasses << 'first' if post.first?
8
+ - cssclasses << 'reply' unless post.first?
9
+ - cssclasses << 'deleted' if post.frozen?
10
+
11
+ .post{:id => post.dom_id, :class => cssclasses.join(' ')}
13
12
  .post_wrapper
13
+ - unless headless
14
+ .speaker
15
+ = standard_gravatar_for(post.reader)
14
16
  .post_header
15
- %p.context
17
+ - unless headless
16
18
  - if with_context
17
- - if post.first?
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'
25
- - else
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'
19
+ %h2.reply
20
+ = link_to post.topic.name, paginated_post_url(post)
31
21
  - else
32
- - if post.first?
33
- = t('started_on', :date => friendly_date(post.created_at))
34
- - else
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
-
39
- - if post.editable_by?(current_reader)
40
- %br
41
- %span.still_editable
42
- - if post.editable_interval
43
- = t('time_remaining_to_edit', :time => distance_of_time_in_words(post.still_editable_for))
44
- = link_to t('edit_your_post'), edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
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)
22
+ %h2
23
+ = post.reader.name
57
24
 
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}"
25
+ = render :partial => 'posts/edit_links', :locals => {:post => post}
69
26
 
27
+ %p.context
28
+ - if with_context
29
+ = render :partial => 'posts/context', :locals => {:post => post}
30
+ = friendly_date(post.created_at) + '.'
31
+
32
+ .post_body
33
+ = clean_textilize(post.body)
34
+ = render :partial => 'posts/attachments', :locals => {:post => post}