radiant-forum-extension 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. data/README.md +155 -0
  2. data/Rakefile +139 -0
  3. data/VERSION +1 -0
  4. data/app/controllers/admin/forums_controller.rb +11 -0
  5. data/app/controllers/forums_controller.rb +34 -0
  6. data/app/controllers/posts_controller.rb +238 -0
  7. data/app/controllers/topics_controller.rb +78 -0
  8. data/app/models/forum.rb +52 -0
  9. data/app/models/moderatorship.rb +5 -0
  10. data/app/models/post.rb +122 -0
  11. data/app/models/post_attachment.rb +73 -0
  12. data/app/models/topic.rb +162 -0
  13. data/app/views/admin/forums/_form.html.haml +25 -0
  14. data/app/views/admin/forums/edit.html.haml +5 -0
  15. data/app/views/admin/forums/index.html.haml +76 -0
  16. data/app/views/admin/forums/moderate.html.haml +2 -0
  17. data/app/views/admin/forums/new.html.haml +5 -0
  18. data/app/views/admin/forums/remove.html.haml +22 -0
  19. data/app/views/admin/pages/_edit_commentability.html.haml +9 -0
  20. data/app/views/admin/reader_settings/_forum.html.haml +4 -0
  21. data/app/views/admin/sites/_choose_forum_layout.html.haml +7 -0
  22. data/app/views/forums/_forum.html.haml +22 -0
  23. data/app/views/forums/index.html.haml +44 -0
  24. data/app/views/forums/show.html.haml +38 -0
  25. data/app/views/forums/show.rss.builder +13 -0
  26. data/app/views/layouts/feed.rss.builder +5 -0
  27. data/app/views/monitorships/create.rjs.erb +1 -0
  28. data/app/views/monitorships/destroy.rjs.erb +1 -0
  29. data/app/views/monitorships/index.html.erb +35 -0
  30. data/app/views/pages/_comment.html.haml +10 -0
  31. data/app/views/pages/_comments.html.haml +15 -0
  32. data/app/views/posts/_attachment.html.haml +2 -0
  33. data/app/views/posts/_form.html.haml +6 -0
  34. data/app/views/posts/_latest.html.haml +17 -0
  35. data/app/views/posts/_post.html.haml +67 -0
  36. data/app/views/posts/_post.rss.builder +13 -0
  37. data/app/views/posts/_reply.html.haml +36 -0
  38. data/app/views/posts/_search.html.haml +28 -0
  39. data/app/views/posts/_uploader.html.haml +16 -0
  40. data/app/views/posts/edit.html.haml +20 -0
  41. data/app/views/posts/index.html.haml +33 -0
  42. data/app/views/posts/index.rss.builder +14 -0
  43. data/app/views/posts/new.html.haml +14 -0
  44. data/app/views/posts/preview.html.haml +32 -0
  45. data/app/views/posts/search.html.haml +54 -0
  46. data/app/views/posts/search.rss.builder +14 -0
  47. data/app/views/posts/show.html.haml +10 -0
  48. data/app/views/reader_notifier/post.rhtml +14 -0
  49. data/app/views/readers/_extra_controls.html.haml +5 -0
  50. data/app/views/readers/show_with_posts.html.haml +47 -0
  51. data/app/views/topics/_form.html.haml +26 -0
  52. data/app/views/topics/_help.html.haml +8 -0
  53. data/app/views/topics/_locked.html.haml +2 -0
  54. data/app/views/topics/_topic.html.haml +35 -0
  55. data/app/views/topics/_topic.rss.builder +9 -0
  56. data/app/views/topics/comments.html.haml +5 -0
  57. data/app/views/topics/edit.html.haml +26 -0
  58. data/app/views/topics/index.html.haml +41 -0
  59. data/app/views/topics/index.rss.builder +14 -0
  60. data/app/views/topics/new.html.haml +40 -0
  61. data/app/views/topics/show.html.haml +45 -0
  62. data/app/views/topics/show.rss.builder +14 -0
  63. data/config/routes.rb +16 -0
  64. data/db/migrate/001_create_forum_tables.rb +64 -0
  65. data/db/migrate/002_pages_commentable.rb +16 -0
  66. data/db/migrate/003_extend_sites.rb +13 -0
  67. data/db/migrate/004_sample_layout.rb +41 -0
  68. data/db/migrate/005_post_attachments.rb +19 -0
  69. data/db/migrate/006_user_relations.rb +20 -0
  70. data/db/migrate/007_reader_ownership.rb +35 -0
  71. data/db/migrate/008_first_posts.rb +13 -0
  72. data/db/migrate/20090824111005_import_helpers.rb +15 -0
  73. data/forum_extension.rb +44 -0
  74. data/lib/forum_admin_ui.rb +37 -0
  75. data/lib/forum_helper.rb +109 -0
  76. data/lib/forum_page.rb +45 -0
  77. data/lib/forum_reader.rb +9 -0
  78. data/lib/forum_reader_notifier.rb +9 -0
  79. data/lib/forum_readers_controller.rb +15 -0
  80. data/lib/forum_red_cloth3.rb +10 -0
  81. data/lib/forum_red_cloth4.rb +21 -0
  82. data/lib/forum_site.rb +12 -0
  83. data/lib/forum_tags.rb +285 -0
  84. data/lib/tasks/radiant_forum_extension_tasks.rake +137 -0
  85. data/pkg/radiant-forum-extension-0.5.0.gem +0 -0
  86. data/public/images/admin/forum.png +0 -0
  87. data/public/images/admin/new-forum.png +0 -0
  88. data/public/images/admin/nominus.png +0 -0
  89. data/public/images/admin/noremove.png +0 -0
  90. data/public/images/emoticons/angry.gif +0 -0
  91. data/public/images/emoticons/bigsmile.gif +0 -0
  92. data/public/images/emoticons/confused.gif +0 -0
  93. data/public/images/emoticons/cool.gif +0 -0
  94. data/public/images/emoticons/cry.gif +0 -0
  95. data/public/images/emoticons/devil.gif +0 -0
  96. data/public/images/emoticons/neutral.gif +0 -0
  97. data/public/images/emoticons/sad.gif +0 -0
  98. data/public/images/emoticons/shamed.gif +0 -0
  99. data/public/images/emoticons/shocked.gif +0 -0
  100. data/public/images/emoticons/smile.gif +0 -0
  101. data/public/images/emoticons/surprised.gif +0 -0
  102. data/public/images/emoticons/tongue.gif +0 -0
  103. data/public/images/emoticons/wink.gif +0 -0
  104. data/public/images/forum/attachment.png +0 -0
  105. data/public/images/forum/attachment_link.png +0 -0
  106. data/public/images/forum/attachment_over.png +0 -0
  107. data/public/images/forum/chk_off.png +0 -0
  108. data/public/images/forum/chk_on.png +0 -0
  109. data/public/images/forum/feed_14.png +0 -0
  110. data/public/images/forum/feed_28.png +0 -0
  111. data/public/images/forum/post_14.png +0 -0
  112. data/public/images/forum/post_14_over.png +0 -0
  113. data/public/images/forum/rdo_off.png +0 -0
  114. data/public/images/forum/rdo_on.png +0 -0
  115. data/public/images/forum/wait_16_grey.gif +0 -0
  116. data/public/javascripts/platform/forum.js +175 -0
  117. data/public/javascripts/platform/remotecontent.js +89 -0
  118. data/public/stylesheets/admin/forum.css +87 -0
  119. data/public/stylesheets/platform/forum.css +70 -0
  120. data/radiant-forum-extension.gemspec +215 -0
  121. data/spec/controllers/admin/forums_controller_spec.rb +54 -0
  122. data/spec/controllers/forums_controller_spec.rb +42 -0
  123. data/spec/controllers/posts_controller_spec.rb +310 -0
  124. data/spec/controllers/topics_controller_spec.rb +133 -0
  125. data/spec/datasets/forum_layouts_dataset.rb +15 -0
  126. data/spec/datasets/forum_pages_dataset.rb +11 -0
  127. data/spec/datasets/forum_readers_dataset.rb +55 -0
  128. data/spec/datasets/forum_sites_dataset.rb +10 -0
  129. data/spec/datasets/forums_dataset.rb +28 -0
  130. data/spec/datasets/posts_dataset.rb +31 -0
  131. data/spec/datasets/topics_dataset.rb +37 -0
  132. data/spec/lib/forum_admin_ui_spec.rb +35 -0
  133. data/spec/lib/forum_page_spec.rb +63 -0
  134. data/spec/lib/forum_reader_notification_spec.rb +9 -0
  135. data/spec/lib/forum_reader_spec.rb +13 -0
  136. data/spec/lib/forum_site_spec.rb +39 -0
  137. data/spec/models/forum_spec.rb +48 -0
  138. data/spec/models/post_spec.rb +91 -0
  139. data/spec/models/topic_spec.rb +105 -0
  140. data/spec/spec.opts +6 -0
  141. data/spec/spec_helper.rb +44 -0
  142. data/vendor/plugins/acts_as_list/README +23 -0
  143. data/vendor/plugins/acts_as_list/init.rb +3 -0
  144. data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
  145. data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
  146. metadata +287 -0
@@ -0,0 +1,25 @@
1
+ - form_for [:admin, @forum] do |f|
2
+ = hidden_field 'forum', 'lock_version'
3
+ = render_region :form_top
4
+ .form-area
5
+ - render_region :form do |form|
6
+ - form.edit_name do
7
+ %p.title
8
+ %label{:for=>"forum_name"} Name
9
+ = text_field "forum", "name", :class => 'textbox', :maxlength => 100
10
+ - form.edit_description do
11
+ %p.content
12
+ %label{:for=>"forum_description"} Description
13
+ ~ text_area "forum", "description", :class => "textarea", :style => "width: 100%"
14
+
15
+ = javascript_tag "$('forum_name').activate()"
16
+
17
+ - render_region :form_bottom do |form_bottom|
18
+ - form_bottom.edit_timestamp do
19
+ = updated_stamp @forum
20
+ - form_bottom.edit_buttons do
21
+ %p.buttons
22
+ = save_model_button(@forum)
23
+ = save_model_and_continue_editing_button(@forum)
24
+ or
25
+ = link_to 'Cancel', admin_forums_url
@@ -0,0 +1,5 @@
1
+ - render_region :main do |main|
2
+ - main.edit_header do
3
+ %h1 Edit Forum
4
+ - main.edit_form do
5
+ = render :partial => 'form'
@@ -0,0 +1,76 @@
1
+ - include_stylesheet('admin/forum')
2
+ = render_region :top
3
+
4
+ %h1 Discussion Categories
5
+ %p This is where you sort out the discussion filing. To edit or remove messages or whole discussions, use the links on forum pages.
6
+
7
+ %table#forums.index{:cellspacing=>"0", :border=>"0", :cellpadding=>"0"}
8
+ %thead
9
+ %tr
10
+ - render_region :thead do |thead|
11
+ - thead.title_header do
12
+ %th.forum Forum
13
+ - thead.latest_header do
14
+ %th.forum_latest Latest activity
15
+ - thead.modify_header do
16
+ %th.action Action
17
+ %tbody
18
+ - @forums.each do |forum|
19
+ %tr.node.level-1
20
+ - render_region :tbody do |tbody|
21
+
22
+ - tbody.title_cell do
23
+ %td.forum
24
+ %h3
25
+ = link_to forum.name, edit_admin_forum_url(:id => forum)
26
+ -if forum.for_comments
27
+ %p.context
28
+ (comments forum)
29
+ = textilize(forum.description)
30
+ %p
31
+ - if forum.respond_to?(:site)
32
+ = link_to "→ browse discussions", 'http://' + forum.site.base_domain + forum_path(forum)
33
+ - else
34
+ = link_to "→ browse discussions", forum_path(forum)
35
+
36
+ - tbody.latest_cell do
37
+ %td.forum_latest
38
+ - if forum.posts_count > 0
39
+ %ul.latest
40
+ - forum.recent_topics.latest.each do |topic|
41
+ %li.topic
42
+ - if topic.page
43
+ = link_to topic.page.title, "#{topic.page.url}", {:class => 'topic'}
44
+ - else
45
+ = link_to topic.name, forum_topic_url(topic.forum, topic, :page => 'last'), {:class => 'topic'}
46
+ %br
47
+ %span.context
48
+ from
49
+ - if topic.posts.count > 1
50
+ = link_to topic.reader.name + '.', reader_url(topic.reader)
51
+ = topic.posts.count
52
+ = pluralize(topic.posts.count, 'comment') + ','
53
+ most recently from
54
+ = link_to topic.replied_by.name, reader_url(topic.replied_by)
55
+ = friendly_date(topic.replied_at)
56
+ - else
57
+ = link_to topic.reader.name, reader_url(topic.reader)
58
+ = friendly_date(topic.created_at)
59
+ -else
60
+ %p
61
+ No topics yet.
62
+ - tbody.modify_cell do
63
+ %td.remove
64
+ -if forum.for_comments
65
+ = image('noremove', :alt => 'Remove Forum')
66
+ -else
67
+ - if admin?
68
+ = link_to image('remove', :alt => 'Remove Forum'), remove_admin_forum_url(:id => forum)
69
+ - else
70
+ = image('noremove', :alt => 'only admin can remove forums')
71
+
72
+ - render_region :bottom do |bottom|
73
+ - bottom.new_button do
74
+ - if admin?
75
+ %p
76
+ = link_to image('new-forum', :alt => 'New Forum'), new_admin_forum_url
@@ -0,0 +1,2 @@
1
+ %h1 Moderate Forum
2
+ %p Really really soon you will see a list of topics and postings here and an easy way to remove those that offend
@@ -0,0 +1,5 @@
1
+ - render_region :main do |main|
2
+ - main.edit_header do
3
+ %h1 New Forum
4
+ - main.edit_form do
5
+ = render :partial => 'form'
@@ -0,0 +1,22 @@
1
+ %h1 Remove Discussion Category
2
+
3
+ %p
4
+ Are you sure you want to
5
+ %strong.warning permanently remove
6
+ the
7
+ = link_to @forum.name, forum_url(@forum)
8
+ discussion category?
9
+ - if @forum.topics_count > 0
10
+ It contains
11
+ = @forum.topics_count
12
+ discussions and
13
+ = @forum.posts_count
14
+ messages,
15
+ %strong.warning all of which will also be deleted
16
+ - else
17
+ It contains no discussions.
18
+
19
+ %p.buttons
20
+ = button_to("Delete Forum", admin_forum_url(@forum), {:method => 'delete', :confirm => 'Really delete forum?', :class => 'button'})
21
+ or
22
+ = link_to 'Cancel', admin_forums_url
@@ -0,0 +1,9 @@
1
+ - include_stylesheet 'admin/forum'
2
+
3
+ - fields_for :page do |f|
4
+ .commentability
5
+ = f.check_box :commentable, {:onclick => "if (this.checked) { $('page_comments_closed').enable(); $('comments_closed_label').removeClassName('disabled'); } else { $('page_comments_closed').disable(); $('comments_closed_label').addClassName('disabled'); }"}
6
+ = f.label :commentable, "Show comments"
7
+ %br
8
+ = f.check_box :comments_closed, :disabled => !@page.commentable?
9
+ = f.label :comments_closed, 'Comments closed', :id => 'comments_closed_label', :class => !@page.commentable? ? 'disabled' : ''
@@ -0,0 +1,4 @@
1
+ = render :partial => 'setting', :locals => {:key => 'forum.layout', :label => "Forum layout", :notes => "The radiant layout that will be used to present forum topics and posts"}
2
+ = render :partial => 'setting', :locals => {:key => 'forum.editable_period', :label => "Editable interval", :notes => "The period (in minutes) for which forum messages remain editable by their author"}
3
+ = render :partial => 'setting', :locals => {:key => 'forum.public?', :label => "Forum visible to the public"}
4
+ = render :partial => 'setting', :locals => {:key => 'forum.allow_page_comments?', :label => "Page comments enabled", :notes => "Has no effect unless the comment mechanism is invoked by the layout."}
@@ -0,0 +1,7 @@
1
+ - layouts = @site.respond_to?(:layouts) ? @site.layouts : Layout.find(:all)
2
+ %p.subtitle
3
+ %label{:for=>"site_forum_layout_id", :class => "admin_only"}
4
+ Layout for forum pages (defaults to reader layout)
5
+ = select :site, :forum_layout_id, layouts.map { |l| [l.name, l.id] }
6
+ %br
7
+ %span.formnote currently you have to be logged into a site to see its layouts here. will fix.
@@ -0,0 +1,22 @@
1
+ %li.forum{:id => forum.dom_id}
2
+ %span.subject
3
+ %a{:href => forum_url(forum), :class => 'main'}
4
+ = forum.name
5
+ - if topic = forum.recent_topics.first
6
+ %span.context
7
+ = forum.topics.count
8
+ = pluralize forum.topics.count, "discussions"
9
+ containing
10
+ = forum.posts.count
11
+ messages,
12
+ %br
13
+ most recently in
14
+ = link_to topic.name, forum_topic_url(forum, topic)
15
+ = time_ago_in_words(topic.replied_at || topic.created_at)
16
+ ago.
17
+ - else
18
+ %span.context
19
+ No posts yet.
20
+ %div.preview
21
+ = truncate_and_textilize(forum.description, 40)
22
+
@@ -0,0 +1,44 @@
1
+ = render :partial => 'readers/flasher'
2
+
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.
10
+
11
+ %p
12
+ = link_to "start a new discussion", new_topic_url, :class => 'newmessage'
13
+
14
+ - if @forums.empty?
15
+ %p No categories defined here yet.
16
+
17
+ - else
18
+ - if @forums.previous_page
19
+ = paginate_and_summarise @forums, 'forums'
20
+
21
+ %ul.main
22
+ = render :partial => 'forums/forum', :collection => @forums
23
+
24
+ = paginate_and_summarise @forums, 'forums'
25
+
26
+ - content_for :pagetitle do
27
+ Discussion Categories
28
+
29
+ - content_for :feed do
30
+ = feed_link(formatted_forums_path(:rss))
31
+
32
+ - content_for :controls do
33
+ = render :partial => 'readers/controls'
34
+
35
+ - content_for :breadhead do
36
+ = link_to "Forum", topics_url, :class => 'breadhead'
37
+
38
+ - content_for :breadcrumbs do
39
+ = link_to 'Forum', topics_url
40
+ \>
41
+ Categories
42
+
43
+ - content_for :help do
44
+ = render :partial => 'topics/help'
@@ -0,0 +1,38 @@
1
+ = render :partial => 'readers/flasher'
2
+
3
+ #forum
4
+ #forum_preamble
5
+ = clean_textilize(@forum.description)
6
+
7
+ - unless @forum.for_comments?
8
+ %p
9
+ = link_to "start a new discussion here", new_forum_topic_url(@forum), :class => 'newmessage'
10
+
11
+ - if @topics.empty?
12
+ %p No talk here yet.
13
+
14
+ - else
15
+ - unless @topics.current_page == 1
16
+ = paginate_and_summarise @topics, 'topics'
17
+
18
+ %ul.main
19
+ = render :partial => 'topics/topic', :collection => @topics, :locals => { :with_context => false }
20
+
21
+ = paginate_and_summarise @topics, 'topics'
22
+
23
+ - content_for :pagetitle do
24
+ = @forum.name
25
+
26
+ - content_for :feed do
27
+ = feed_link(formatted_forum_path(@forum, :rss))
28
+
29
+ - content_for :breadhead do
30
+ = link_to 'Categories', forums_url, :class => 'breadhead'
31
+
32
+ - content_for :breadcrumbs do
33
+ = link_to 'Discussion Categories', forums_url
34
+ \>
35
+ = link_to @forum.name, forum_url(@forum)
36
+
37
+ - content_for :controls do
38
+ = render :partial => 'readers/controls'
@@ -0,0 +1,13 @@
1
+ xml.channel do
2
+ xml.atom :link, nil, {
3
+ :href => posts_url(:format => 'rss'),
4
+ :rel => 'self', :type => 'application/rss+xml'
5
+ }
6
+
7
+ xml.title "#{@site_title} : #{@forum.name}"
8
+ xml.link forum_url(@forum)
9
+ xml.language "en-us"
10
+ xml.ttl "60"
11
+
12
+ render :partial => "topics/topic", :collection => @topics, :locals => {:xm => xml}
13
+ end
@@ -0,0 +1,5 @@
1
+ # app/views/layouts/application.rss.builder
2
+ xml.instruct! :xml, :version => '1.0'
3
+ xml.rss :version => '2.0', 'xmlns:atom' => 'http://www.w3.org/2005/Atom' do
4
+ xml << yield
5
+ end
@@ -0,0 +1 @@
1
+ page[:monitor_label].innerHTML = "Watching topic"
@@ -0,0 +1 @@
1
+ page[:monitor_label].innerHTML = "Watch topic"
@@ -0,0 +1,35 @@
1
+ <%= render :partial => 'forums/controls' %>
2
+ <%= render :partial => 'forums/notification' %>
3
+
4
+ <div id="forum_preamble" class="contentblock">
5
+ <h2>Watch list</h2>
6
+
7
+ <p>
8
+ New posts in any these topics will show up in your personal feed, which you can see as a <%= link_to "web page", monitored_posts_url %> or an <%= link_to "rss feed", formatted_monitored_posts_url(current_user, :rss), :class => 'feedlink' %>.
9
+ To add a topic to this list, click on the 'watch this' link at the top of the topic page.
10
+ </p>
11
+
12
+ <% @topics.group_by(&:forum).each do |forum, topics| %>
13
+ <h3 class="section""><%= forum.name %></h3>
14
+
15
+ <% topics.each do |topic| %>
16
+ <%= watch_tag(topic, topic.title) %>
17
+ <% end %>
18
+ <% end%>
19
+
20
+ <p>
21
+ You can remove any of these topics from your feed by clicking it in the list above (or on the topic page). It will remain in this list so you can easily reactivate the subscription.
22
+ </p>
23
+
24
+ </div>
25
+
26
+ <% content_for :breadcrumbs do %>
27
+ <%= link_to 'Home', '/' %> &gt;
28
+ <%= link_to 'Forum', '/forums' %> &gt;
29
+ <%= link_to 'You', '/users/me' %> &gt;
30
+ Subscriptions
31
+ <% end %>
32
+
33
+ <% content_for :title do %>
34
+ Your subscriptions
35
+ <% end %>
@@ -0,0 +1,10 @@
1
+ %div.post{:id => post.dom_id}
2
+ %div.post_header
3
+ %h2
4
+ %a{:href => "/readers/#{post.reader.id}", :class => 'main'}
5
+ %img{:src => post.reader.gravatar_url(:size => 40), :class => 'gravatar'}
6
+ = post.reader.name
7
+ %p.context
8
+ = post.created_at
9
+ %div.post_body
10
+ = post.body
@@ -0,0 +1,15 @@
1
+ #forum
2
+ %h2
3
+ Comments on
4
+ = page.title
5
+
6
+ - if posts.nil?
7
+ %p None yet
8
+ %pre
9
+ = posts.inspect
10
+
11
+ - else
12
+ %pre
13
+ = posts.inspect
14
+ %p
15
+ = current_reader.inspect
@@ -0,0 +1,2 @@
1
+ %li.attachment
2
+ = link_to attachment.filename, attachment.file.url, :class => "attachment #{attachment.extension}"
@@ -0,0 +1,6 @@
1
+ .post_wrapper
2
+ .post_body
3
+ = form.text_area :body, :rows => 10, :class => 'post_body'
4
+
5
+ - unless @topic.page && !Radiant::Config['forum.comments_have_attachments']
6
+ = render :partial => 'posts/uploader'
@@ -0,0 +1,17 @@
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)
@@ -0,0 +1,67 @@
1
+ - post ||= @post
2
+ - first_post ||= nil
3
+ - with_context ||= false
4
+ - without_author ||= false
5
+ - preview ||= false
6
+
7
+ %div.post{:id => post.dom_id}
8
+ %div{:class => post.first? ? 'first_post' : 'reply'}
9
+ .post_header
10
+ - if admin?
11
+ .post_control
12
+ %p.post_admin
13
+ = link_to "edit", edit_topic_post_url(post.topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}"
14
+ %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
17
+ - 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', :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', :width => '40', :height => '40'})
24
+ = post.reader.name
25
+ %p.context
26
+ - if with_context
27
+ = link_to post.reader.name, reader_url(post.reader)
28
+ - if post.first?
29
+ started a new discussion in
30
+ = link_to(post.topic.forum.name, forum_url(post.topic.forum))
31
+ - else
32
+ replied
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)
42
+
43
+ .post_wrapper
44
+ .post_body
45
+ - if post.frozen?
46
+ %p Post removed
47
+ - elsif preview
48
+ = truncate_and_textilize(post.body, 100)
49
+ - else
50
+ = clean_textilize(post.body)
51
+
52
+ - unless post.attachments.empty?
53
+ .post_attachments
54
+ %h4
55
+ attached:
56
+ %ul
57
+ = render :partial => 'posts/attachment', :collection => post.attachments, :locals => {:removable => false}
58
+
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
+