Sha256: 700b9c1489cb7117c26de5892c6a3875874112b5623625f25a509a02c7827f5d

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

%h1 Listing all forums

- @categories.each do |category|
  %h2
    = category.name
    Category
  - if category.moderator?(mongoid_forums_user)
    %b You are a moderator of this category
  %table{:border => "1"}
    %tr
      %th
        Name
      %th
        Last post
      %th
        Topics
      %th
        Posts
      %th
        Unread topics
      %th
        Views

    - category.forums.order_by([:order, :asc]).each do |forum|
      %tr
        %td
          = link_to forum.name, forum
        %td
          - unless forum.topics.last.nil?
            - last_post = forum.topics.select {|topic| !topic.hidden }.last.posts.last
            = time_ago_in_words ( last_post.created_at )
            ago on
            = link_to last_post.topic.name, last_post.topic
            by
            = last_post.user.forum_display_name
          - else
            No posts yet
        %td
          = topics_count(forum) ? topics_count(forum) : "None"
        %td
          = posts_count(forum) ? posts_count(forum) : "None"
        %td
          = mongoid_forums_user ? forum.unread_topic_count(mongoid_forums_user) : ""
        %td
          = forum.views_count ? forum.views_count : "None"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-forums-0.0.4 app/views/mongoid_forums/forums/index.haml