app/views/topics/_topic.html.haml in radiant-forum-extension-1.1.2 vs app/views/topics/_topic.html.haml in radiant-forum-extension-1.2.1

- old
+ new

@@ -1,34 +1,53 @@ - if topic.visible_to?(current_reader) - - with_context ||= false - - cssclass = ['topic'] - - cssclass << 'sticky' if topic.sticky? - - cssclass << 'locked' if topic.locked? + - post = topic.first_post + %div.post{:id => post.dom_id} + .speaker + = link_to gravatar_for(topic.reader, {:size => 40}, {:alt => topic.reader.name, :class => 'gravatar offset', :width => '40', :height => '40'}), forum_topic_url(topic.forum, topic) - %li{:id => topic.dom_id, :class => cssclass.join(' ')} - %span.context - - if with_context - = link_to topic.forum.name, forum_url(topic.forum) - %span.subject - %a{:href => forum_topic_url(topic.forum, topic), :class => 'main'} - - if topic.reader - = gravatar_for(topic.reader, {:size => 40}, {:alt => topic.reader.name, :class => 'gravatar'}) - = topic.name - %span.context - = t('posted_by') - = link_to topic.reader.name + '.', reader_url(topic.reader) - = t('post_count_from', :count => topic.posts.count - 1) - - if topic.has_posts? - = link_to topic.replied_by.name, reader_url(topic.replied_by) - = friendly_date(topic.replied_at) - - else - = friendly_date(topic.created_at) - .post_wrapper - - if topic.page - = truncate_words(topic.page.render_part(:body), 50) - - elsif topic.first_post - = truncate_and_textilize(topic.first_post.body, 50) - - else - %p - = t('topic_empty') - \ No newline at end of file + .post_header + %h2.subject + %a{:href => forum_topic_url(topic.forum, topic), :class => 'main'} + = topic.name + + %p.context + = t('begun_on', :date => friendly_date(topic.created_at)) + = t('in') + = link_to topic.forum.name, forum_url(topic.forum) + = t('by') + = link_to post.reader.name, reader_url(topic.reader), :class => 'person' + + - if post.editable_by?(current_reader) + %br + %span.still_editable + - if post.editable_interval + = t('time_remaining_to_edit', :time => distance_of_time_in_words(post.still_editable_for)) + = link_to t('edit_your_post'), edit_topic_post_url(topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}" + - elsif admin? + = link_to t("edit_minimal"), edit_topic_post_url(topic, post), :class => 'edit_post', :id => "revise_post_#{post.id}" + = link_to t("remove_minimal"), topic_post_url(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?" + + .post_body + = truncate_and_textilize(post.body, 100) + + - unless post.attachments.empty? + .post_attachments + %h4 + attached: + - post.attachments.images.each do |att| + = link_to image_tag(att.thumbnail), att.file.url, :class => :thumbnail + - if post.attachments.non_images.any? + %ul.attachments + - post.attachments.non_images.each do |att| + %li + = link_to att.filename, att.file.url, :class => "attachment #{att.extension}" + + - if topic.has_posts? + %p.voices + - topic.other_voices.each do |reader| + = gravatar_for(reader, {:size => 16}, {:alt => reader.name, :class => 'gravatar tiny', :width => '16', :height => '16'}) + %p.replies + = t('post_count_from', :count => topic.posts.count - 1) + = link_to topic.replied_by.name, reader_url(topic.replied_by) + = friendly_date(topic.replied_at) +