Sha256: fc2f82f876c82e4c4f1c19f36475b50986c91c3a5cf87016ab49a5f88d6b2484

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 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
          - if forum.topics.select {|topic| can?(:read, topic) }.last
            - last_topic = forum.topics.select {|topic| can?(:read, topic) }.last
            - last_post = last_topic.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.5 app/views/mongoid_forums/forums/index.haml