@@ -35,6 +35,8 class BoardsController < ApplicationController | |||
|
35 | 35 | end |
|
36 | 36 | |
|
37 | 37 | def show |
|
38 | respond_to do |format| | |
|
39 | format.html { | |
|
38 | 40 | sort_init 'updated_on', 'desc' |
|
39 | 41 | sort_update 'created_on' => "#{Message.table_name}.created_on", |
|
40 | 42 | 'replies' => "#{Message.table_name}.replies_count", |
@@ -48,6 +50,14 class BoardsController < ApplicationController | |||
|
48 | 50 | :offset => @topic_pages.current.offset |
|
49 | 51 | @message = Message.new |
|
50 | 52 | render :action => 'show', :layout => !request.xhr? |
|
53 | } | |
|
54 | format.atom { | |
|
55 | @messages = @board.messages.find :all, :order => 'created_on DESC', | |
|
56 | :include => [:author, :board], | |
|
57 | :limit => Setting.feeds_limit.to_i | |
|
58 | render_feed(@messages, :title => "#{@project}: #{@board}") | |
|
59 | } | |
|
60 | end | |
|
51 | 61 | end |
|
52 | 62 | |
|
53 | 63 | verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index } |
@@ -27,6 +27,10 class Board < ActiveRecord::Base | |||
|
27 | 27 | validates_length_of :name, :maximum => 30 |
|
28 | 28 | validates_length_of :description, :maximum => 255 |
|
29 | 29 | |
|
30 | def to_s | |
|
31 | name | |
|
32 | end | |
|
33 | ||
|
30 | 34 | def reset_counters! |
|
31 | 35 | self.class.reset_counters!(id) |
|
32 | 36 | end |
@@ -59,4 +59,12 | |||
|
59 | 59 | <p class="nodata"><%= l(:label_no_data) %></p> |
|
60 | 60 | <% end %> |
|
61 | 61 | |
|
62 | <% other_formats_links do |f| %> | |
|
63 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> | |
|
64 | <% end %> | |
|
65 | ||
|
62 | 66 | <% html_title h(@board.name) %> |
|
67 | ||
|
68 | <% content_for :header_tags do %> | |
|
69 | <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> | |
|
70 | <% end %> |
@@ -86,6 +86,7 ActionController::Routing::Routes.draw do |map| | |||
|
86 | 86 | board_views.connect 'projects/:project_id/boards', :action => 'index' |
|
87 | 87 | board_views.connect 'projects/:project_id/boards/new', :action => 'new' |
|
88 | 88 | board_views.connect 'projects/:project_id/boards/:id', :action => 'show' |
|
89 | board_views.connect 'projects/:project_id/boards/:id.:format', :action => 'show' | |
|
89 | 90 | board_views.connect 'projects/:project_id/boards/:id/edit', :action => 'edit' |
|
90 | 91 | end |
|
91 | 92 | board_routes.with_options :conditions => {:method => :post} do |board_actions| |
@@ -84,6 +84,10 class BoardsControllerTest < Test::Unit::TestCase | |||
|
84 | 84 | {:method => :get, :path => '/projects/world_domination/boards/44'}, |
|
85 | 85 | :controller => 'boards', :action => 'show', :id => '44', :project_id => 'world_domination' |
|
86 | 86 | ) |
|
87 | assert_routing( | |
|
88 | {:method => :get, :path => '/projects/world_domination/boards/44.atom'}, | |
|
89 | :controller => 'boards', :action => 'show', :id => '44', :project_id => 'world_domination', :format => 'atom' | |
|
90 | ) | |
|
87 | 91 | end |
|
88 | 92 | |
|
89 | 93 | def test_show |
@@ -95,6 +99,15 class BoardsControllerTest < Test::Unit::TestCase | |||
|
95 | 99 | assert_not_nil assigns(:topics) |
|
96 | 100 | end |
|
97 | 101 | |
|
102 | def test_show_atom | |
|
103 | get :show, :project_id => 1, :id => 1, :format => 'atom' | |
|
104 | assert_response :success | |
|
105 | assert_template 'common/feed.atom' | |
|
106 | assert_not_nil assigns(:board) | |
|
107 | assert_not_nil assigns(:project) | |
|
108 | assert_not_nil assigns(:messages) | |
|
109 | end | |
|
110 | ||
|
98 | 111 | def test_edit_routing |
|
99 | 112 | assert_routing( |
|
100 | 113 | {:method => :get, :path => '/projects/world_domination/boards/44/edit'}, |
General Comments 0
You need to be logged in to leave comments.
Login now