@@ -22,11 +22,11 class IssuesController < ApplicationController | |||
|
22 | 22 | before_filter :find_issue, :only => [:show, :edit, :update] |
|
23 | 23 | before_filter :find_issues, :only => [:bulk_edit, :move, :perform_move, :destroy] |
|
24 | 24 | before_filter :find_project, :only => [:new, :create] |
|
25 |
before_filter :authorize, :except => [:index |
|
|
26 |
before_filter :find_optional_project, :only => [:index |
|
|
25 | before_filter :authorize, :except => [:index] | |
|
26 | before_filter :find_optional_project, :only => [:index] | |
|
27 | 27 | before_filter :check_for_default_issue_status, :only => [:new, :create] |
|
28 | 28 | before_filter :build_new_issue_from_params, :only => [:new, :create] |
|
29 |
accept_key_auth :index, :show |
|
|
29 | accept_key_auth :index, :show | |
|
30 | 30 | |
|
31 | 31 | rescue_from Query::StatementInvalid, :with => :query_statement_invalid |
|
32 | 32 | |
@@ -95,21 +95,6 class IssuesController < ApplicationController | |||
|
95 | 95 | render_404 |
|
96 | 96 | end |
|
97 | 97 | |
|
98 | def changes | |
|
99 | retrieve_query | |
|
100 | sort_init 'id', 'desc' | |
|
101 | sort_update(@query.sortable_columns) | |
|
102 | ||
|
103 | if @query.valid? | |
|
104 | @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", | |
|
105 | :limit => 25) | |
|
106 | end | |
|
107 | @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name) | |
|
108 | render :layout => false, :content_type => 'application/atom+xml' | |
|
109 | rescue ActiveRecord::RecordNotFound | |
|
110 | render_404 | |
|
111 | end | |
|
112 | ||
|
113 | 98 | def show |
|
114 | 99 | @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC") |
|
115 | 100 | @journals.each_with_index {|j,i| j.indice = i+1} |
@@ -124,7 +109,7 class IssuesController < ApplicationController | |||
|
124 | 109 | format.html { render :template => 'issues/show.rhtml' } |
|
125 | 110 | format.xml { render :layout => false } |
|
126 | 111 | format.json { render :text => @issue.to_json, :layout => false } |
|
127 |
format.atom { render : |
|
|
112 | format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' } | |
|
128 | 113 | format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") } |
|
129 | 114 | end |
|
130 | 115 | end |
@@ -18,6 +18,29 | |||
|
18 | 18 | class JournalsController < ApplicationController |
|
19 | 19 | before_filter :find_journal, :only => [:edit] |
|
20 | 20 | before_filter :find_issue, :only => [:new] |
|
21 | before_filter :find_optional_project, :only => [:index] | |
|
22 | accept_key_auth :index | |
|
23 | ||
|
24 | helper :issues | |
|
25 | helper :queries | |
|
26 | include QueriesHelper | |
|
27 | helper :sort | |
|
28 | include SortHelper | |
|
29 | ||
|
30 | def index | |
|
31 | retrieve_query | |
|
32 | sort_init 'id', 'desc' | |
|
33 | sort_update(@query.sortable_columns) | |
|
34 | ||
|
35 | if @query.valid? | |
|
36 | @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC", | |
|
37 | :limit => 25) | |
|
38 | end | |
|
39 | @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name) | |
|
40 | render :layout => false, :content_type => 'application/atom+xml' | |
|
41 | rescue ActiveRecord::RecordNotFound | |
|
42 | render_404 | |
|
43 | end | |
|
21 | 44 | |
|
22 | 45 | def new |
|
23 | 46 | journal = Journal.find(params[:journal_id]) if params[:journal_id] |
@@ -78,7 +78,7 | |||
|
78 | 78 | |
|
79 | 79 | <% content_for :header_tags do %> |
|
80 | 80 | <%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %> |
|
81 |
<%= auto_discovery_link_tag(:atom, {:action => ' |
|
|
81 | <%= auto_discovery_link_tag(:atom, {:controller => 'journals', :action => 'index', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %> | |
|
82 | 82 | <% end %> |
|
83 | 83 | |
|
84 | 84 | <%= context_menu issues_context_menu_path %> |
|
1 | NO CONTENT: file renamed from app/views/issues/changes.rxml to app/views/journals/index.rxml |
@@ -108,6 +108,7 ActionController::Routing::Routes.draw do |map| | |||
|
108 | 108 | # TODO: would look nicer as /issues/:id/preview |
|
109 | 109 | map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue' |
|
110 | 110 | map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues' |
|
111 | map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index' | |
|
111 | 112 | |
|
112 | 113 | map.with_options :controller => 'issues' do |issues_routes| |
|
113 | 114 | issues_routes.with_options :conditions => {:method => :get} do |issues_views| |
@@ -231,13 +231,6 class IssuesControllerTest < ActionController::TestCase | |||
|
231 | 231 | assert_equal columns, session[:query][:column_names].map(&:to_s) |
|
232 | 232 | end |
|
233 | 233 | |
|
234 | def test_changes | |
|
235 | get :changes, :project_id => 1 | |
|
236 | assert_response :success | |
|
237 | assert_not_nil assigns(:journals) | |
|
238 | assert_equal 'application/atom+xml', @response.content_type | |
|
239 | end | |
|
240 | ||
|
241 | 234 | def test_show_by_anonymous |
|
242 | 235 | get :show, :id => 1 |
|
243 | 236 | assert_response :success |
@@ -307,7 +300,7 class IssuesControllerTest < ActionController::TestCase | |||
|
307 | 300 | def test_show_atom |
|
308 | 301 | get :show, :id => 2, :format => 'atom' |
|
309 | 302 | assert_response :success |
|
310 |
assert_template ' |
|
|
303 | assert_template 'journals/index.rxml' | |
|
311 | 304 | # Inline image |
|
312 | 305 | assert_select 'content', :text => Regexp.new(Regexp.quote('http://test.host/attachments/download/10')) |
|
313 | 306 | end |
@@ -31,6 +31,13 class JournalsControllerTest < ActionController::TestCase | |||
|
31 | 31 | User.current = nil |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | def test_index | |
|
35 | get :index, :project_id => 1 | |
|
36 | assert_response :success | |
|
37 | assert_not_nil assigns(:journals) | |
|
38 | assert_equal 'application/atom+xml', @response.content_type | |
|
39 | end | |
|
40 | ||
|
34 | 41 | def test_reply_to_issue |
|
35 | 42 | @request.session[:user_id] = 2 |
|
36 | 43 | get :new, :id => 1 |
@@ -106,6 +106,8 class RoutingTest < ActionController::IntegrationTest | |||
|
106 | 106 | should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123' |
|
107 | 107 | should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
108 | 108 | should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues' |
|
109 | ||
|
110 | should_route :get, "/issues/changes", :controller => 'journals', :action => 'index' | |
|
109 | 111 | end |
|
110 | 112 | |
|
111 | 113 | context "issue categories" do |
General Comments 0
You need to be logged in to leave comments.
Login now