before_filter :find_issue, :only => [:show, :edit, :update]
before_filter :find_issues, :only => [:bulk_edit, :move, :perform_move, :destroy]
before_filter :find_project, :only => [:new, :create]
- before_filter :authorize, :except => [:index, :changes]
- before_filter :find_optional_project, :only => [:index, :changes]
+ before_filter :authorize, :except => [:index]
+ before_filter :find_optional_project, :only => [:index]
before_filter :check_for_default_issue_status, :only => [:new, :create]
before_filter :build_new_issue_from_params, :only => [:new, :create]
- accept_key_auth :index, :show, :changes
+ accept_key_auth :index, :show
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
render_404
end
- def changes
- retrieve_query
- sort_init 'id', 'desc'
- sort_update(@query.sortable_columns)
-
- if @query.valid?
- @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC",
- :limit => 25)
- end
- @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name)
- render :layout => false, :content_type => 'application/atom+xml'
- rescue ActiveRecord::RecordNotFound
- render_404
- end
-
def show
@journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC")
@journals.each_with_index {|j,i| j.indice = i+1}
format.html { render :template => 'issues/show.rhtml' }
format.xml { render :layout => false }
format.json { render :text => @issue.to_json, :layout => false }
- format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
+ format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
format.pdf { send_data(issue_to_pdf(@issue), :type => 'application/pdf', :filename => "#{@project.identifier}-#{@issue.id}.pdf") }
end
end
class JournalsController < ApplicationController
before_filter :find_journal, :only => [:edit]
before_filter :find_issue, :only => [:new]
+ before_filter :find_optional_project, :only => [:index]
+ accept_key_auth :index
+
+ helper :issues
+ helper :queries
+ include QueriesHelper
+ helper :sort
+ include SortHelper
+
+ def index
+ retrieve_query
+ sort_init 'id', 'desc'
+ sort_update(@query.sortable_columns)
+
+ if @query.valid?
+ @journals = @query.journals(:order => "#{Journal.table_name}.created_on DESC",
+ :limit => 25)
+ end
+ @title = (@project ? @project.name : Setting.app_title) + ": " + (@query.new_record? ? l(:label_changes_details) : @query.name)
+ render :layout => false, :content_type => 'application/atom+xml'
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
def new
journal = Journal.find(params[:journal_id]) if params[:journal_id]
+++ /dev/null
-xml.instruct!
-xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
- xml.title @title
- xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
- xml.link "rel" => "alternate", "href" => home_url(:only_path => false)
- xml.id url_for(:controller => 'welcome', :only_path => false)
- xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
- xml.author { xml.name "#{Setting.app_title}" }
- @journals.each do |change|
- issue = change.issue
- xml.entry do
- xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
- xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
- xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :journal_id => change, :only_path => false)
- xml.updated change.created_on.xmlschema
- xml.author do
- xml.name change.user.name
- xml.email(change.user.mail) if change.user.is_a?(User) && !change.user.mail.blank? && !change.user.pref.hide_mail
- end
- xml.content "type" => "html" do
- xml.text! '<ul>'
- change.details.each do |detail|
- xml.text! '<li>' + show_detail(detail, false) + '</li>'
- end
- xml.text! '</ul>'
- xml.text! textilizable(change, :notes, :only_path => false) unless change.notes.blank?
- end
- end
- end
-end
\ No newline at end of file
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %>
- <%= auto_discovery_link_tag(:atom, {:action => 'changes', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %>
+ <%= 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)) %>
<% end %>
<%= context_menu issues_context_menu_path %>
--- /dev/null
+xml.instruct!
+xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
+ xml.title @title
+ xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
+ xml.link "rel" => "alternate", "href" => home_url(:only_path => false)
+ xml.id url_for(:controller => 'welcome', :only_path => false)
+ xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
+ xml.author { xml.name "#{Setting.app_title}" }
+ @journals.each do |change|
+ issue = change.issue
+ xml.entry do
+ xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
+ xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
+ xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :journal_id => change, :only_path => false)
+ xml.updated change.created_on.xmlschema
+ xml.author do
+ xml.name change.user.name
+ xml.email(change.user.mail) if change.user.is_a?(User) && !change.user.mail.blank? && !change.user.pref.hide_mail
+ end
+ xml.content "type" => "html" do
+ xml.text! '<ul>'
+ change.details.each do |detail|
+ xml.text! '<li>' + show_detail(detail, false) + '</li>'
+ end
+ xml.text! '</ul>'
+ xml.text! textilizable(change, :notes, :only_path => false) unless change.notes.blank?
+ end
+ end
+ end
+end
\ No newline at end of file
# TODO: would look nicer as /issues/:id/preview
map.preview_issue '/issues/preview/:id', :controller => 'previews', :action => 'issue'
map.issues_context_menu '/issues/context_menu', :controller => 'context_menus', :action => 'issues'
+ map.issue_changes '/issues/changes', :controller => 'journals', :action => 'index'
map.with_options :controller => 'issues' do |issues_routes|
issues_routes.with_options :conditions => {:method => :get} do |issues_views|
assert_equal columns, session[:query][:column_names].map(&:to_s)
end
- def test_changes
- get :changes, :project_id => 1
- assert_response :success
- assert_not_nil assigns(:journals)
- assert_equal 'application/atom+xml', @response.content_type
- end
-
def test_show_by_anonymous
get :show, :id => 1
assert_response :success
def test_show_atom
get :show, :id => 2, :format => 'atom'
assert_response :success
- assert_template 'changes.rxml'
+ assert_template 'journals/index.rxml'
# Inline image
assert_select 'content', :text => Regexp.new(Regexp.quote('http://test.host/attachments/download/10'))
end
User.current = nil
end
+ def test_index
+ get :index, :project_id => 1
+ assert_response :success
+ assert_not_nil assigns(:journals)
+ assert_equal 'application/atom+xml', @response.content_type
+ end
+
def test_reply_to_issue
@request.session[:user_id] = 2
get :new, :id => 1
should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
+
+ should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
end
context "issue categories" do