resolved conflict in base.html.erb - content_for vs. yield

pull/1186/head
Philipp Tessenow 12 years ago
commit 5889179f0f
  1. 7
      app/controllers/activities_controller.rb
  2. 12
      app/controllers/boards_controller.rb
  3. 2
      app/controllers/issues/auto_completes_controller.rb
  4. 11
      app/controllers/issues/calendars_controller.rb
  5. 3
      app/controllers/issues/context_menus_controller.rb
  6. 9
      app/controllers/issues/gantts_controller.rb
  7. 8
      app/controllers/issues/moves_controller.rb
  8. 10
      app/controllers/issues_controller.rb
  9. 24
      app/controllers/journals_controller.rb
  10. 22
      app/controllers/watchers_controller.rb
  11. 36
      app/helpers/application_helper.rb
  12. 9
      app/helpers/journals_helper.rb
  13. 36
      app/helpers/watchers_helper.rb
  14. 11
      app/models/journal.rb
  15. 4
      app/views/attachments/_links.html.erb
  16. 2
      app/views/boards/edit.html.erb
  17. 2
      app/views/boards/new.html.erb
  18. 2
      app/views/common/_calendar.html.erb
  19. 131
      app/views/context_menus/issues.html.erb
  20. 2
      app/views/issue_relations/_form.html.erb
  21. 8
      app/views/issues/_action_menu.html.erb
  22. 3
      app/views/issues/_form.html.erb
  23. 4
      app/views/issues/_subissue_row.html.erb
  24. 0
      app/views/issues/auto_completes/issues.html.erb
  25. 2
      app/views/issues/bulk_edit.html.erb
  26. 5
      app/views/issues/calendars/index.html.erb
  27. 127
      app/views/issues/context_menus/issues.html.erb
  28. 13
      app/views/issues/gantts/show.html.erb
  29. 3
      app/views/issues/index.html.erb
  30. 0
      app/views/issues/moves/new.html.erb
  31. 2
      app/views/journals/_notes_form.html.erb
  32. 18
      app/views/layouts/base.html.erb
  33. 2
      app/views/projects/settings/_boards.html.erb
  34. 2
      app/views/queries/_filters.html.erb
  35. 11
      app/views/watchers/_watchers.html.erb
  36. 135
      config/routes.rb
  37. 14
      lib/redmine.rb
  38. 2
      lib/redmine/helpers/gantt.rb
  39. 4
      test/functional/attachments_controller_test.rb
  40. 8
      test/functional/boards_controller_test.rb
  41. 4
      test/functional/issues/auto_completes_controller_test.rb
  42. 14
      test/functional/issues/calendars_controller_test.rb
  43. 34
      test/functional/issues/context_menus_controller_test.rb
  44. 20
      test/functional/issues/gantts_controller_test.rb
  45. 16
      test/functional/issues/moves_controller_test.rb
  46. 36
      test/functional/issues_controller_test.rb
  47. 2
      test/functional/users_controller_test.rb
  48. 2
      test/functional/watchers_controller_test.rb
  49. 2
      test/functional/wiki_controller_test.rb
  50. 4
      test/integration/api_test/news_test.rb
  51. 18
      test/integration/api_test/projects_test.rb
  52. 16
      test/integration/api_test/time_entries_test.rb
  53. 34
      test/integration/api_test/users_test.rb
  54. 6
      test/integration/application_test.rb
  55. 9
      test/integration/issues_test.rb
  56. 2
      test/integration/lib/redmine/menu_manager_test.rb
  57. 753
      test/integration/routing_test.rb

@ -61,10 +61,11 @@ class ActivitiesController < ApplicationController
private
# TODO: refactor, duplicated in projects_controller
# TODO: this should now be functionally identical to the implementation in application_controller
# double check and remove
def find_optional_project
return true unless params[:id]
@project = Project.find(params[:id])
return true unless params[:project_id]
@project = Project.find(params[:project_id])
authorize
rescue ActiveRecord::RecordNotFound
render_404

@ -57,19 +57,23 @@ class BoardsController < ApplicationController
end
end
verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index }
def new
end
def create
@board = Board.new(params[:board])
@board.project = @project
if request.post? && @board.save
if @board.save
flash[:notice] = l(:notice_successful_create)
redirect_to_settings_in_projects
end
end
def edit
if request.post? && @board.update_attributes(params[:board])
end
def update
if @board.update_attributes(params[:board])
redirect_to_settings_in_projects
end
end

@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
class AutoCompletesController < ApplicationController
class Issues::AutoCompletesController < ApplicationController
before_filter :find_project
def issues

@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
class CalendarsController < ApplicationController
class Issues::CalendarsController < ApplicationController
menu_item :calendar
before_filter :find_optional_project
@ -21,7 +21,7 @@ class CalendarsController < ApplicationController
include QueriesHelper
include SortHelper
def show
def index
if params[:year] and params[:year].to_i > 1900
@year = params[:year].to_i
if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
@ -44,11 +44,6 @@ class CalendarsController < ApplicationController
@calendar.events = events
end
render :action => 'show', :layout => false if request.xhr?
render :layout => !request.xhr?
end
def update
show
end
end

@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
class ContextMenusController < ApplicationController
class Issues::ContextMenusController < ApplicationController
def issues
@issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
@ -53,5 +53,4 @@ class ContextMenusController < ApplicationController
render :layout => false
end
end

@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
class GanttsController < ApplicationController
class Issues::GanttsController < ApplicationController
menu_item :gantt
before_filter :find_optional_project
@ -22,7 +22,7 @@ class GanttsController < ApplicationController
include SortHelper
include Redmine::Export::PDF
def show
def index
@gantt = Redmine::Helpers::Gantt.new(params)
@gantt.project = @project
retrieve_query
@ -37,9 +37,4 @@ class GanttsController < ApplicationController
format.pdf { send_data(@gantt.to_pdf, :type => 'application/pdf', :filename => "#{basename}.pdf") }
end
end
def update
show
end
end

@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
class IssueMovesController < ApplicationController
class Issues::MovesController < ApplicationController
default_search_scope :issues
before_filter :find_issues, :check_project_uniqueness
before_filter :authorize
@ -43,12 +43,12 @@ class IssueMovesController < ApplicationController
if params[:follow]
if @issues.size == 1 && moved_issues.size == 1
redirect_to :controller => 'issues', :action => 'show', :id => moved_issues.first
redirect_to issue_path(moved_issues.first)
else
redirect_to :controller => 'issues', :action => 'index', :project_id => (@target_project || @project)
redirect_to project_issues_path(@target_project || @project)
end
else
redirect_to :controller => 'issues', :action => 'index', :project_id => @project
redirect_to project_issues_path(@project)
end
return
end

@ -46,14 +46,6 @@ class IssuesController < ApplicationController
include IssuesHelper
include Redmine::Export::PDF
verify :method => [:post, :delete],
:only => :destroy,
:render => { :nothing => true, :status => :method_not_allowed }
verify :method => :post, :only => :create, :render => {:nothing => true, :status => :method_not_allowed }
verify :method => :post, :only => :bulk_update, :render => {:nothing => true, :status => :method_not_allowed }
verify :method => :put, :only => :update, :render => {:nothing => true, :status => :method_not_allowed }
def index
sort_init(@query.sort_criteria.empty? ? [['parent', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns)
@ -101,7 +93,7 @@ class IssuesController < ApplicationController
end
def show
@journals = @issue.journals.changing.find(:all, :include => [:user], :order => "#{Journal.table_name}.created_at ASC")
@journals = @issue.journals.changing.find(:all, :include => [:user, :journaled], :order => "#{Journal.table_name}.created_at ASC")
@journals.reverse! if User.current.wants_comments_in_reverse_order?
@changesets = @issue.changesets.visible.all
@changesets.reverse! if User.current.wants_comments_in_reverse_order?

@ -13,10 +13,10 @@
#++
class JournalsController < ApplicationController
before_filter :find_journal, :only => [:edit, :diff]
before_filter :find_journal, :only => [:edit, :update]
before_filter :find_issue, :only => [:new]
before_filter :find_optional_project, :only => [:index]
before_filter :authorize, :only => [:new, :edit, :diff]
before_filter :authorize, :only => [:new, :edit, :update ]
accept_key_auth :index
menu_item :issues
@ -64,16 +64,6 @@ class JournalsController < ApplicationController
def edit
(render_403; return false) unless @journal.editable_by?(User.current)
if request.post?
@journal.update_attribute(:notes, params[:notes]) if params[:notes]
@journal.destroy if @journal.details.empty? && @journal.notes.blank?
call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params})
respond_to do |format|
format.html { redirect_to :controller => @journal.journaled.class.name.pluralize.downcase,
:action => 'show', :id => @journal.journaled_id }
format.js { render :action => 'update' }
end
else
respond_to do |format|
format.html {
# TODO: implement non-JS journal update
@ -82,6 +72,16 @@ class JournalsController < ApplicationController
format.js
end
end
def update
@journal.update_attribute(:notes, params[:notes]) if params[:notes]
@journal.destroy if @journal.details.empty? && @journal.notes.blank?
call_hook(:controller_journals_edit_post, { :journal => @journal, :params => params})
respond_to do |format|
format.html { redirect_to :controller => @journal.journaled.class.name.pluralize.downcase,
:action => 'show', :id => @journal.journaled_id }
format.js { render :action => 'update' }
end
end
private

@ -13,14 +13,12 @@
#++
class WatchersController < ApplicationController
before_filter :find_watched_by_object, :except => [:destroy]
before_filter :find_watched_by_id, :only => [:destroy]
before_filter :find_project
before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch]
before_filter :authorize, :only => [:new, :destroy]
verify :method => :post,
:only => [ :watch, :unwatch ],
:render => { :nothing => true, :status => :method_not_allowed }
def watch
if @watched.respond_to?(:visible?) && !@watched.visible?(User.current)
render_403
@ -50,7 +48,7 @@ class WatchersController < ApplicationController
end
def destroy
@watched.set_watcher(User.find(params[:user_id]), false) if request.post?
@watched.set_watcher(@watch.user, false)
respond_to do |format|
format.html { redirect_to :back }
format.js do
@ -62,15 +60,23 @@ class WatchersController < ApplicationController
end
private
def find_project
klass = params[:object_type].camelcase.constantize
def find_watched_by_object
klass = params[:object_type].singularize.camelcase.constantize
return false unless klass.respond_to?('watched_by')
@watched = klass.find(params[:object_id])
@project = @watched.project
rescue
render_404
end
def find_watched_by_id
@watch = Watcher.find(params[:id], :include => { :watchable => [:project] } )
@watched = @watch.watchable
end
def find_project
@project = @watched.project
end
def set_watcher(user, watching)
@watched.set_watcher(user, watching)

@ -123,9 +123,10 @@ module ApplicationHelper
end
end
closed = issue.closed? ? content_tag(:span, l(:label_closed_issues), :class => "hidden-for-sighted") : ""
s = link_to closed + options[:before_text].to_s + "#{h(issue.tracker)} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue},
s = link_to "#{closed}#{h(options[:before_text].to_s)}#{h(issue.tracker)} ##{issue.id}".html_safe,
issue,
:class => issue.css_classes,
:title => title
:title => h(title)
s << ": #{h subject}" if subject
s = "#{h issue.project} - " + s if options[:project]
s
@ -883,10 +884,11 @@ module ApplicationHelper
content_tag("label", label_text)
end
def labelled_tabular_form_for(name, object, options, &proc)
def labelled_tabular_form_for(record_or_name_or_array, *args, &proc)
options = args.extract_options!
options[:html] ||= {}
options[:html][:class] = 'tabular' unless options[:html].has_key?(:class)
form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc)
form_for(record_or_name_or_array, *(args << options.merge({:builder => TabularFormBuilder, :lang => current_language})), &proc)
end
def back_url_hidden_field_tag
@ -972,6 +974,32 @@ module ApplicationHelper
link_to h(name), url, options
end
# TODO: need a decorator to clean this up
def context_menu_entry(args)
db_attribute = args[:db_attribute] || "#{args[:attribute]}_id"
content_tag :li, :class => "folder #{args[:attribute]}" do
ret = link_to((args[:title] || l(:"field_#{args[:attribute]}")), "#", :class => "context_item")
ret += content_tag :ul do
args[:collection].collect do |(s, name)|
content_tag :li do
context_menu_link (name || s), bulk_update_issues_path(:ids => args[:updated_object_ids],
:issue => { db_attribute => s },
:back_url => args[:back_url]),
:method => :put,
:selected => args[:selected].call(s),
:disabled => args[:disabled].call(s)
end
end.join.html_safe
end
ret += content_tag :div, '', :class => "submenu"
ret
end
end
def calendar_for(field_id)
include_calendar_headers_tags
image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger", :alt => l(:label_calendar_show)}) +

@ -76,8 +76,13 @@ module JournalsHelper
unless journal.notes.blank?
links = [].tap do |l|
if reply_links
l << link_to_remote(image_tag('comment.png', :alt => l(:button_quote), :title => l(:button_quote)),
:url => {:controller => controller, :action => action, :id => model, :journal_id => journal})
l << link_to(image_tag('comment.png', :alt => l(:button_quote), :title => l(:button_quote)),
{ :controller => controller,
:action => action,
:id => model,
:journal_id => journal },
:method => :get,
:remote => true)
end
if editable
l << link_to_in_place_notes_editor(image_tag('edit.png', :alt => l(:button_edit), :title => l(:button_edit)), "journal-#{journal.id}-notes",

@ -30,41 +30,39 @@ module WatchersHelper
# Create a link to watch/unwatch object
#
# * :replace - a string or array of strings with css selectors that will be updated, whenever the watcher status is changed
def watcher_link(object, user, options = {:replace => '.watcher_link', :class => 'watcher_link'})
def watcher_link(object, user, options = { :replace => '.watcher_link', :class => 'watcher_link' })
options = options.with_indifferent_access
raise ArgumentError, 'Missing :replace option in options hash' if options['replace'].blank?
return '' unless user && user.logged? && object.respond_to?('watched_by?')
watched = object.watched_by?(user)
url = {:controller => 'watchers',
:action => (watched ? 'unwatch' : 'watch'),
:object_type => object.class.to_s.underscore,
html_options = options
path = send(:"#{(watched ? 'unwatch' : 'watch')}_path", :object_type => object.class.to_s.underscore.pluralize,
:object_id => object.id,
:replace => options.delete('replace')}
:replace => options.delete('replace') )
html_options[:class] = html_options[:class].to_s + (watched ? ' icon icon-fav' : ' icon icon-fav-off')
url_options = {:url => url}
method = watched ?
:delete :
:post
html_options = options.merge(:href => url_for(url))
html_options[:class] = html_options[:class].to_s + (watched ? ' icon icon-fav' : ' icon icon-fav-off')
label = watched ?
l(:button_unwatch) :
l(:button_watch)
link_to_remote((watched ? l(:button_unwatch) : l(:button_watch)), url_options, html_options)
link_to(label, path, html_options.merge(:remote => true, :method => method))
end
# Returns a comma separated list of users watching the given object
def watchers_list(object)
remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project)
lis = object.watcher_users.collect do |user|
s = avatar(user, :size => "16").to_s + link_to_user(user, :class => 'user').to_s
lis = object.watchers.collect do |watch|
s = avatar(watch.user, :size => "16").to_s + link_to_user(watch.user, :class => 'user').to_s
if remove_allowed
url = {:controller => 'watchers',
:action => 'destroy',
:object_type => object.class.to_s.underscore,
:object_id => object.id,
:user_id => user}
s += ' ' + link_to_remote(image_tag('delete.png', :alt => l(:button_delete), :title => l(:button_delete)),
{:url => url},
:href => url_for(url),
s += ' ' + link_to(image_tag('delete.png', :alt => l(:button_delete), :title => l(:button_delete)),
watcher_path(watch), :method => :delete, :remote => true,
:style => "vertical-align: middle",
:class => "delete")
end

@ -48,6 +48,17 @@ class Journal < ActiveRecord::Base
# logs like the history on issue#show
scope "changing", :conditions => ["version > 1"]
# let all child classes have Journal as it's model name
# used to not having to create another route for every subclass of Journal
def self.inherited(child)
child.instance_eval do
def model_name
Journal.model_name
end
end
super
end
def touch_journaled_after_creation
journaled.touch
end

@ -5,9 +5,9 @@
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% if options[:deletable] %>
<%= link_to image_tag('delete.png', :alt => l(:button_delete), :title => l(:button_delete)),
{ :controller => 'attachments', :action => 'destroy', :id => attachment },
attachment_path(attachment),
{ :confirm => l(:text_are_you_sure),
:method => :post,
:method => :delete,
:class => 'delete',
:title => l(:button_delete) } %>
<% end %>

@ -1,6 +1,6 @@
<h2><%= l(:label_board) %></h2>
<% labelled_tabular_form_for :board, @board, :url => {:action => 'edit', :id => @board} do |f| %>
<% labelled_tabular_form_for [@project, @board] do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_save) %>
<% end %>

@ -1,6 +1,6 @@
<h2><%= l(:label_board_new) %></h2>
<% labelled_tabular_form_for :board, @board, :url => {:action => 'new'} do |f| %>
<% labelled_tabular_form_for [@project, Board.new] do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_create) %>
<% end %>

@ -13,7 +13,7 @@ while day <= calendar.enddt %>
<% if i.is_a? Issue %>
<div class="<%= i.css_classes %> tooltip">
<%= h("#{i.project} -") unless @project && @project == i.project %>
<% date_img = '' %>
<%# date_img = '' %>
<% if day == i.start_date and day == i.due_date %>
<% date_img = image_tag("bullet_diamond.png", :title => l(:text_tip_issue_begin_end_day), :alt => l(:text_tip_issue_begin_end_day),
:class => "imgtag-icon") %>

@ -1,131 +0,0 @@
<ul class="menu">
<%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>
<% if !@issue.nil? -%>
<li class="edit"><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue},
:class => 'icon-edit', :disabled => !@can[:edit] %></li>
<% else %>
<li class="edit"><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id)},
:class => 'icon-edit', :disabled => !@can[:edit] %></li>
<% end %>
<% if @allowed_statuses.present? %>
<li class="folder status">
<a href="#" class="context_item" onclick="return false;"><%= l(:field_status) %></a>
<ul>
<% @statuses.each do |s| -%>
<li><%= context_menu_link s.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {:status_id => s}, :back_url => @back}, :method => :post,
:selected => (@issue && s == @issue.status), :disabled => !(@can[:update] && @allowed_statuses.include?(s)) %></li>
<% end -%>
</ul>
<div class="submenu"></div>
</li>
<% end %>
<% unless @trackers.nil? %>
<li class="folder tracker">
<a href="#" class="context_item"><%= l(:field_tracker) %></a>
<ul>
<% @trackers.each do |t| -%>
<li><%= context_menu_link t.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'tracker_id' => t}, :back_url => @back}, :method => :post,
:selected => (@issue && t == @issue.tracker), :disabled => !@can[:edit] %></li>
<% end -%>
</ul>
<div class="submenu"></div>
</li>
<% end %>
<li class="folder priority">
<a href="#" class="context_item"><%= l(:field_priority) %></a>
<ul>
<% @priorities.each do |p| -%>
<li><%= context_menu_link p.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'priority_id' => p}, :back_url => @back}, :method => :post,
:selected => (@issue && p == @issue.priority), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
<% end -%>
</ul>
<div class="submenu"></div>
</li>
<% #TODO: allow editing versions when multiple projects %>
<% unless @project.nil? || @project.shared_versions.open.empty? -%>
<li class="folder fixed_version">
<a href="#" class="context_item"><%= l(:field_fixed_version) %></a>
<ul>
<% @project.shared_versions.open.sort.each do |v| -%>
<li><%= context_menu_link format_version_name(v), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => v}, :back_url => @back}, :method => :post,
:selected => (@issue && v == @issue.fixed_version), :disabled => !@can[:update] %></li>
<% end -%>
<li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'fixed_version_id' => 'none'}, :back_url => @back}, :method => :post,
:selected => (@issue && @issue.fixed_version.nil?), :disabled => !@can[:update] %></li>
</ul>
<div class="submenu"></div>
</li>
<% end %>
<% if @assignables.present? -%>
<li class="folder assigned">
<a href="#" class="context_item"><%= l(:field_assigned_to) %></a>
<ul>
<% @assignables.each do |u| -%>
<li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => u}, :back_url => @back}, :method => :post,
:selected => (@issue && u == @issue.assigned_to), :disabled => !@can[:update] %></li>
<% end -%>
<li><%= context_menu_link l(:label_nobody), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'assigned_to_id' => 'none'}, :back_url => @back}, :method => :post,
:selected => (@issue && @issue.assigned_to.nil?), :disabled => !@can[:update] %></li>
</ul>
<div class="submenu"></div>
</li>
<% end %>
<% unless @project.nil? || @project.issue_categories.empty? -%>
<li class="folder">
<a href="#" class="context_item"><%= l(:field_category) %></a>
<ul>
<% @project.issue_categories.each do |u| -%>
<li><%= context_menu_link u.name, {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => u}, :back_url => @back}, :method => :post,
:selected => (@issue && u == @issue.category), :disabled => !@can[:update] %></li>
<% end -%>
<li><%= context_menu_link l(:label_none), {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'category_id' => 'none'}, :back_url => @back}, :method => :post,
:selected => (@issue && @issue.category.nil?), :disabled => !@can[:update] %></li>
</ul>
<div class="submenu"></div>
</li>
<% end -%>
<% if Issue.use_field_for_done_ratio? %>
<li class="folder done_ratio">
<a href="#" class="context_item"><%= l(:field_done_ratio) %></a>
<ul>
<% (0..10).map{|x|x*10}.each do |p| -%>
<li><%= context_menu_link "#{p}%", {:controller => 'issues', :action => 'bulk_edit', :ids => @issues.collect(&:id), :issue => {'done_ratio' => p}, :back_url => @back}, :method => :post,
:selected => (@issue && p == @issue.done_ratio), :disabled => (!@can[:edit] || @issues.detect {|i| !i.leaf?}) %></li>
<% end -%>
</ul>
<div class="submenu"></div>
</li>
<% end %>
<% if !@issue.nil? %>
<% if @can[:log_time] -%>
<li class="log_time"><%= context_menu_link l(:button_log_time), {:controller => 'timelog', :action => 'new', :issue_id => @issue},
:class => 'context_item' %></li>
<% end %>
<% if User.current.logged? %>
<li class="watch"><%= watcher_link(@issue, User.current) %></li>
<% end %>
<% end %>
<% if @issue.present? %>
<li><%= context_menu_link l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue},
:class => 'icon-duplicate', :disabled => !@can[:copy] %></li>
<% end %>
<li class="move"><%= context_menu_link l(:button_move), new_issue_move_path(:ids => @issues.collect(&:id)),
:class => 'context_item', :disabled => !@can[:move] %></li>
<li class="copy"><%= context_menu_link l(:button_copy), new_issue_move_path(:ids => @issues.collect(&:id), :copy_options => {:copy => 't'}),
:class => 'context_item' %></li>
<li class="delete"><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :ids => @issues.collect(&:id)},
:method => :post, :confirm => l(:text_issues_destroy_confirmation), :class => 'context_item', :disabled => !@can[:delete] %></li>
<%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
</ul>

@ -3,7 +3,7 @@
<p><%= f.select :relation_type, collection_for_relation_type_select, {}, :onchange => "setPredecessorFieldsVisibility();" %>
<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 10 %>
<div id="related_issue_candidates" class="autocomplete"></div>
<%= javascript_tag "observeRelatedIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project, :escape => false) }')" %>
<%= javascript_tag "observeRelatedIssueField('#{issues_auto_complete_path(:id => @issue, :project_id => @project, :escape => false) }')" %>
<span id="predecessor_fields" style="display:none;">
<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
</span>

@ -10,5 +10,11 @@
<%= li_unless_nil(link_to_if_authorized l(:button_duplicate), {:controller => 'issues', :action => 'new', :project_id => @project, :copy_from => @issue }, :class => 'icon icon-duplicate') %>
<%= li_unless_nil(link_to_if_authorized l(:button_copy), {:controller => 'issue_moves', :action => 'new', :id => @issue, :copy_options => {:copy => 't'}}, :class => 'icon icon-copy') %>
<%= li_unless_nil(link_to_if_authorized l(:button_move), {:controller => 'issue_moves', :action => 'new', :id => @issue}, :class => 'icon icon-move') %>
<%= li_unless_nil(link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => (@issue.leaf? ? l(:text_are_you_sure) : l(:text_are_you_sure_with_children)), :method => :post, :class => 'icon icon-del') %>
<%= li_unless_nil(link_to_if_authorized l(:button_delete), { :controller => 'issues',
:action => 'destroy',
:id => @issue },
:confirm => (@issue.leaf? ? l(:text_are_you_sure) : l(:text_are_you_sure_with_children)),
:remote => true,
:method => :delete ,
:class => 'icon icon-del' ) %>
<% end %>

@ -4,6 +4,7 @@
<p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p>
<%= observe_field :issue_tracker_id, :url => { :action => :new, :project_id => @project, :id => @issue },
:update => :attributes,
:method => :get,
:with => "Form.serialize('issue-form')" %>
<p><%= f.text_field :subject, :size => 80, :required => true %></p>
@ -11,7 +12,7 @@
<% if User.current.allowed_to?(:manage_subtasks, @project) %>
<p id="parent_issue"><%= f.text_field :parent_issue_id, :size => 10, :title => l(:description_autocomplete) %></p>
<div id="parent_issue_candidates" class="autocomplete"></div>
<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:id => @issue, :project_id => @project, :escape => false) }')" %>
<%= javascript_tag "observeParentIssueField('#{issues_auto_complete_path(:id => @issue, :project_id => @project, :escape => false) }')" %>
<% end %>
<p><%= f.text_area :description,

@ -18,7 +18,7 @@
end
title << " #{h(issue.tracker.name)} ##{issue.id}"
issue_text = link_to(title, issue, :class => issue.css_classes)
issue_text = link_to(title.html_safe, issue, :class => issue.css_classes)
end
issue_text << ": "
issue_text << truncate(issue.subject, :length => 60)
@ -30,7 +30,7 @@
content_tag('td', h(issue.status)),
content_tag('td', link_to_user(issue.assigned_to)),
content_tag('td', link_to_version(issue.fixed_version))
].join,
].join.html_safe,
:class => css_classes.join(' ')
)
%>

@ -64,7 +64,7 @@
<%= text_field_tag 'issue[parent_issue_id]', '', :size => 10 %>
</p>
<div id="parent_issue_candidates" class="autocomplete"></div>
<%= javascript_tag "observeParentIssueField('#{auto_complete_issues_path(:project_id => @project) }')" %>
<%= javascript_tag "observeParentIssueField('#{issues_auto_complete_path }')" %>
<% end %>
<p>
<label for='issue_start_date'><%= l(:field_start_date) %></label>

@ -1,6 +1,6 @@
<h2><%= @query.new_record? ? l(:label_calendar) : h(@query.name) %></h2>
<% form_tag(calendar_path, :method => :put, :id => 'query_form') do %>
<% form_tag(issues_calendar_index_path, :method => :get, :id => 'query_form') do %>
<%= hidden_field_tag('project_id', @project.to_param) if @project%>
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
<legend onclick="toggleFieldset(this);"><a href="javascript:"><%= l(:label_filter_plural) %></a></legend>
@ -21,13 +21,14 @@
<%= link_to_remote l(:button_apply),
{ :url => { :set_filter => 1 },
:method => :get,
:update => "content",
:with => "Form.serialize('query_form')"
}, :class => 'icon icon-checked' %>
<%= link_to_remote l(:button_clear),
{ :url => { :project_id => @project, :set_filter => 1 },
:method => :put,
:method => :get,
:update => "content",
}, :class => 'icon icon-reload' %>
</p>

@ -0,0 +1,127 @@
<ul class="menu">
<%= call_hook(:view_issues_context_menu_start, {:issues => @issues, :can => @can, :back => @back }) %>
<% if !@issue.nil? -%>
<li class="edit">
<%= context_menu_link l(:button_edit), edit_issue_path(@issue),
:class => 'icon-edit',
:disabled => !@can[:edit] %>
</li>
<% else %>
<li class="edit">
<%= context_menu_link l(:button_edit), bulk_edit_issues_path(:ids => @issues.collect(&:id)),
:class => 'icon-edit',
:disabled => !@can[:edit] %>
</li>
<% end %>
<% updated_issues = @issues.collect(&:id) %>
<% default_params = { :back_url => @back,
:updated_object_ids => updated_issues } %>
<% if @allowed_statuses.present? %>
<% params = default_params.merge(:collection => @statuses,
:attribute => 'status',
:selected => lambda { |status| (@issue && status == @issue.status) },
:disabled => lambda { |status| !(@can[:update] && @allowed_statuses.include?(status)) }) %>
<%= context_menu_entry(params) %>
<% end %>
<% unless @trackers.nil? %>
<% params = default_params.merge(:collection => @trackers,
:attribute => 'tracker',
:selected => lambda { |tracker| (@issue && tracker == @issue.tracker) },
:disabled => lambda { |tracker| !@can[:edit] }) %>
<%= context_menu_entry(params) %>
<% end %>
<% params = default_params.merge(:collection => @priorities,
:attribute => 'priority',
:selected => lambda { |priority| (@issue && priority == @issue.priority) },
:disabled => lambda { |priority| !@can[:edit] || @issues.detect { |i| !i.leaf? } }) %>
<%= context_menu_entry(params) %>
<% #TODO: allow editing versions when multiple projects %>
<% unless @project.nil? || (versions = @project.shared_versions.open.sort).empty? -%>
<% versions = versions.map{ |v| [v, format_version_name(v)] } << [nil, l(:label_none)]%>
<% params = default_params.merge(:collection => versions,
:attribute => 'fixed_version',
:selected => lambda { |version| (@issue && version == @issue.fixed_version) },
:disabled => lambda { |version| !@can[:update] }) %>
<%= context_menu_entry(params) %>
<% end %>
<% if @assignables.present? -%>
<% assignables = @assignables.dup << [nil, l(:label_none)] %>
<% params = default_params.merge(:collection => assignables,
:attribute => 'assigned_to',
:selected => lambda { |user| @issue && user == @issue.assigned_to },
:disabled => lambda { |user| !@can[:update] }) %>
<%= context_menu_entry(params) %>
<% end %>
<% unless @project.nil? || (categories = @project.issue_categories.to_a).empty? -%>
<% categories << [nil, l(:label_none)] %>
<% params = default_params.merge(:collection => categories,
:attribute => 'category',
:selected => lambda { |category| @issue && category == @issue.category },
:disabled => lambda { |category| !@can[:update] }) %>
<%= context_menu_entry(params) %>
<% end -%>
<% if Issue.use_field_for_done_ratio? %>
<% params = default_params.merge(:collection => (0..10).map{ |x| x * 10 },
:attribute => 'done_ratio',
:db_attribute => 'done_ratio',
:selected => lambda { |ratio| @issue && ratio == @issue.done_ratio },
:disabled => lambda { |ratio| !@can[:edit] || @issues.detect { |i| !i.leaf? } }) %>
<%= context_menu_entry(params) %>
<% end -%>
<% if !@issue.nil? %>
<% if @can[:log_time] -%>
<li class="log_time">
<%= context_menu_link l(:button_log_time),
new_issue_time_entry_path(@issue),
:class => 'context_item' %>
</li>
<% end %>
<% if User.current.logged? %>
<li class="watch">
<%= watcher_link(@issue, User.current) %>
</li>
<% end %>
<% end %>
<% if @issue.present? %>
<li>
<%= context_menu_link l(:button_duplicate), new_project_issue_path({ :project_id => @project,
:copy_from => @issue }),
:class => 'icon-duplicate',
:disabled => !@can[:copy] %>
</li>
<% end %>
<li class="move">
<%= context_menu_link l(:button_move), new_issues_move_path(:ids => @issues.collect(&:id)),
:class => 'context_item',
:disabled => !@can[:move] %>
</li>
<li class="copy">
<%= context_menu_link l(:button_copy), new_issues_move_path(:ids => @issues.collect(&:id),
:copy_options => { :copy => 't' }),
:class => 'context_item' %>
</li>
<li class="delete">
<%= context_menu_link l(:button_delete), issues_path(:ids => @issues.collect(&:id)),
:method => :delete,
:confirm => l(:text_issues_destroy_confirmation),
:class => 'context_item',
:disabled => !@can[:delete] %>
</li>
<%= call_hook(:view_issues_context_menu_end, {:issues => @issues, :can => @can, :back => @back }) %>
</ul>

@ -1,7 +1,7 @@
<% @gantt.view = self %>
<h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2>
<% form_tag(gantt_path(:month => params[:month], :year => params[:year], :months => params[:months]), :method => :put, :id => 'query_form') do %>
<% form_tag(issues_gantt_index_path(:month => params[:month], :year => params[:year], :months => params[:months]), :method => :get, :id => 'query_form') do %>
<%= hidden_field_tag('project_id', @project.to_param) if @project%>
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
<legend onclick="toggleFieldset(this);"><a href="javascript:"><%= l(:label_filter_plural) %></a></legend>
@ -24,13 +24,14 @@
<%= link_to_remote l(:button_apply),
{ :url => { :set_filter => 1 },
:method => :get,
:update => "content",
:with => "Form.serialize('query_form')"
}, :class => 'icon icon-checked' %>
<%= link_to_remote l(:button_clear),
{ :url => { :project_id => @project, :set_filter => 1 },
:method => :put,
:method => :get,
:update => "content",
}, :class => 'icon icon-reload' %>
</p>
@ -178,8 +179,12 @@ if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
<table width="100%">
<tr>
<td align="left"><%= link_to_content_update(l(:label_previous), params.merge(@gantt.params_previous), :class => 'navigate-left') %></td>
<td align="right"><%= link_to_content_update(l(:label_next), params.merge(@gantt.params_next), :class => 'navigate-right') %></td>
<td align="left">
<%= link_to(l(:label_previous), params.merge(@gantt.params_previous), { :class => 'navigate-left', :method => :get } ) %>
</td>
<td align="right">
<%= link_to(l(:label_next), params.merge(@gantt.params_next), :class => 'navigate-right') %>
</td>
</tr>
</table>

@ -47,6 +47,7 @@
{ :url => { :set_filter => 1 },
:before => 'selectAllOptions("selected_columns");',
:update => "content",
:method => :get,
:complete => "apply_filters_observer()",
:with => "Form.serialize('query_form')"
}, :class => 'icon icon-checked' %>
@ -79,7 +80,7 @@
<%= f.link_to 'Atom', :url => { :project_id => @project, :query_id => (@query.new_record? ? nil : @query), :key => User.current.rss_key } %>
<%= f.link_to 'CSV', :url => { :project_id => @project } %>
<%= f.link_to 'PDF', :url => { :project_id => @project } %>
<% end if User.current.allowed_to? :export_issues, @project %>
<% end if User.current.allowed_to? :export_issues, @project, :global => @project.nil? %>
<% end %>
<%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %>

@ -1,4 +1,4 @@
<% form_remote_tag(:url => {}, :html => { :id => "journal-#{@journal.id}-form" }) do %>
<% form_for(@journal, { :html => { :id => "journal-#{@journal.id}-form" } , :remote => true } ) do %>
<%= label_tag "notes", l(:description_notes), :class => "hidden-for-sighted" %>
<%= text_area_tag :notes, @journal.notes, :class => 'wiki-edit',

@ -32,10 +32,10 @@
<% heads_for_wiki_formatter %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<%= content_for :header_tags -%>
</head>
<noscript><%=l(:description_noscript)%></noscript>
<body class="<%=h body_css_classes %>">
<body class="<%= body_css_classes %>">
<div id="wrapper">
<div id="top-menu">
<div id="header">
@ -79,10 +79,10 @@
</div>
<div id="menu-sidebar">
<%= main_menu %>
<%= yield :main_menu %>
<%= content_for :main_menu %>
<!-- Sidebar -->
<div id="sidebar">
<%= yield :sidebar %>
<%= content_for :sidebar %>
<%= call_hook :view_layouts_base_sidebar %>
</div>
</div>
@ -97,12 +97,12 @@
<!-- Action menu -->
<% if content_for?(:action_menu_main) %>
<ul class="action_menu_main">
<%= yield :action_menu_main %>
<%= content_for :action_menu_main %>
<% if content_for?(:action_menu_more) %>
<li class="drop-down">
<a href="javascript:" class="icon icon-more"><%= l(:more_actions) %></a>
<ul class="action_menu_more" style="display:none;">
<%= yield :action_menu_more %>
<%= content_for :action_menu_more %>
</ul>
</li>
<% end %>
@ -116,9 +116,11 @@
</div>
<div id="footer">
<div class="bgl"><div class="bgr">
<div class="bgl">
<div class="bgr">
<%= l(:text_powered_by, :link => link_to(Redmine::Info.app_name, Redmine::Info.url)).html_safe %>
</div></div>
</div>
</div>
</div>
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>

@ -19,7 +19,7 @@
</td>
<td class="buttons">
<%= link_to_if_authorized l(:button_edit), {:controller => 'boards', :action => 'edit', :project_id => @project, :id => board}, :class => 'icon icon-edit' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'boards', :action => 'destroy', :project_id => @project, :id => board}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
<%= link_to_if_authorized l(:button_delete), {:controller => 'boards', :action => 'destroy', :project_id => @project, :id => board}, :confirm => l(:text_are_you_sure), :method => :delete, :class => 'icon icon-del' %>
</td>
</tr>
<% end %>

@ -79,7 +79,7 @@ Event.observe(document,"dom:loaded", apply_filters_observer);
<% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>
<% field = filter[0]
options = filter[1] %>
<tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter">
<tr <%= 'style="display:none;"'.html_safe unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter">
<td style="width:200px;">
<%= check_box_tag 'f[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %>
<label for="cb_<%= field %>"><%= filter[1][:name] || l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label>

@ -1,10 +1,9 @@
<strong><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</strong>
(<%= link_to_remote(l(:button_add_watcher),
:url => {:controller => 'watchers',
:action => 'new',
:object_type => watched.class.name.underscore,
:object_id => watched},
:method => :get) if User.current.allowed_to?(:add_issue_watchers, @project)
(<%= link_to(l(:button_add_watcher), new_watcher_path(:object_type => watched.class.name.underscore.pluralize,
:object_id => watched),
:method => :get,
:remote => true
) if User.current.allowed_to?(:add_issue_watchers, @project)
%>)
<% unless @watcher.nil? %>
<% remote_form_for(:watcher, @watcher,

@ -52,20 +52,6 @@ OpenProject::Application.routes.draw do
end
end
scope :controller => 'boards' do
scope :via => :get do
match '/projects/:project_id/boards', :action => :index
match '/projects/:project_id/boards/new', :action => :new
match '/projects/:project_id/boards/:id', :action => :show
match '/projects/:project_id/boards/:id.:format', :action => :show
match '/projects/:project_id/boards/:id/edit', :action => :edit
end
scope :via => :post do
match '/projects/:project_id/boards', :action => :new
match '/projects/:project_id/boards/:id/:action', :action => /edit|destroy/
end
end
scope :controller => 'documents' do
scope :via => :get do
match '/projects/:project_id/documents', :action => :index
@ -79,6 +65,30 @@ OpenProject::Application.routes.draw do
end
end
# only providing routes for journals when there are multiple subclasses of journals
# all subclasses will look for the journals routes
resources :journals, :only => [:edit, :update]
namespace :issues do
end
# generic route for adding/removing watchers
# looks to be ressourceful
scope ':object_type/:object_id', :constraints => { :object_type => /issues|messages|boards/,
:object_id => /\d+/ } do
resources :watchers, :only => [:new]
match '/watch' => 'watchers#watch', :via => :post
match '/unwatch' => 'watchers#unwatch', :via => :delete
end
resources :watchers, :only => [:destroy]
# TODO: remove
scope "issues" do
match 'changes' => 'journals#index', :as => 'changes'
end
resources :projects do
member do
# this route let's you access the project specific settings (by tab)
@ -124,73 +134,81 @@ OpenProject::Application.routes.draw do
end
end
resources :issues do
namespace :issues do
resources :gantt, :controller => 'gantts', :only => [:index]
resources :calendar, :controller => 'calendars', :only => [:index]
end
resources :issues, :except => [:show, :edit, :update, :destroy] do
# should probably belong to :member, but requires :copy_from instead
# of the default :id
get ':copy_from/copy', :action => "new", :on => :collection, :as => "copy"
collection do
get :all
get :bulk_edit
post :bulk_update
# get a preview of a new issue (i.e. one without an ID)
match '/new/preview' => 'previews#issue', :as => 'preview_new', :via => :post
end
end
resources :activity, :activities, :only => :index, :controller => 'activities'
# issues#index is right now used with get and post
# defining an extra route prevents confusion with create
match '/query' => 'issues#index', :via => :post
resources :boards
end
# this is to support global actions on issues and
# for backwards compatibility
namespace :issues do
resources :gantt, :controller => 'gantts', :only => [:index]
resources :calendar, :controller => 'calendars', :only => [:index]
# have a global autocompleter for issues
# TODO: make this ressourceful
match 'auto_complete' => 'auto_completes#issues', :via => [:get, :post], :format => false
# TODO: separate routes and action for get and post
match 'context_menu' => 'context_menus#issues', :via => [:get, :post], :format => false
resource :move, :controller => 'moves', :only => [:new, :create]
end
# TODO: remove create as issues should be created scoped under project
resources :issues, :only => [:create, :show, :edit, :update, :destroy] do
resources :time_entries, :controller => 'timelog'
member do
# this route is defined so that it has precedence of the one defined on the collection
delete :destroy
end
# TODO: nest under issues resources
scope 'issues' do
match '/move' => "issue_moves#create", :via => :post
match '/move/new' => "issue_moves#new", :via => :get, :as => "new_issue_move"
collection do
get :bulk_edit, :format => false
put :bulk_update, :format => false
delete :destroy
end
end
# Misc issue routes. TODO: move into resources
match '/issues/auto_complete' => 'autoCompletes#issues', :as => 'auto_complete_issues'
match '/issues/preview/:id' => 'previews#issue', :as => 'preview_issue' # TODO: would look nicer as /issues/:id/preview
match '/issues/context_menu' => 'issues#context_menu', :as => 'issues_context_menu'
match '/issues/changes' => 'journals#index', :as => 'issue_changes'
match '/issues/bulk_edit' => 'issues#bulk_edit', :via => :get, :as => 'bulk_edit_issue'
match '/issues/bulk_edit' => 'issues#bulk_udpate', :via => :post, :as => 'bulk_update_issue'
match '/issues/:id/quoted' => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
match '/issues/:id/destroy' => 'issues#destroy', :via => :post # legacy
resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update]
resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update]
resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]
resource :calendar, :path_prefix => '/projects/:project_id/issues', :controller => 'calendars', :only => [:show, :update]
scope :controller => 'reports', :via => :get do
match '/projects/:id/issues/report', :action => :issue_report
match '/projects/:id/issues/report/:detail', :action => :issue_report_details
end
resources :issues do
collection do
# issues#index is right now used with get and post
# defining an extra route prevents confusion with create
match '/query' => 'issues#index', :via => :post
end
resources :time_entries, :controller => 'timelog'
post :edit, :on => :member
end
resources :activity, :activities, :only => :index, :controller => 'activities'
scope :controller => 'issue_relations', :via => :post do
match '/issues/:issue_id/relations/:id', :action => :new
match '/issues/:issue_id/relations(/:id)', :action => :new
match '/issues/:issue_id/relations/:id/destroy', :action => :destroy
end
match '/projects/:id/members/new' => 'members#new'
resources :users, :member => {
:edit_membership => :post,
:destroy_membership => :post,
@ -219,12 +237,6 @@ OpenProject::Application.routes.draw do
# Destroy uses a get request to prompt the user before the actual DELETE request
match '/projects/:id/destroy' => 'project#destroy', :via => :get, :as => 'project_destroy_confirm'
scope :controller => 'activities', :action => 'index', :via => :get do
match '/projects/:id/activity(.:format)'
match '/activity(.:format)'
end
scope :controller => 'issue_categories' do
match '/projects/:project_id/issue_categories/new', :action => :new
end
@ -250,14 +262,23 @@ OpenProject::Application.routes.draw do
match '/projects/:id/repository/:action', :via => :post
end
match '/attachments/:id' => 'attachments#show', :id => /\d+/
match '/attachments/:id/:filename' => 'attachments#show', :id => /\d+/, :filename => /.*/
match '/attachments/download/:id/:filename' => 'attachments#download', :id => /\d+/, :filename => /.*/
resources :attachments, :only => [:show], :format => false do
member do
scope :via => :get, :constraints => { :id => /\d+/, :filename => /[^\/]*/ } do
match 'download(/:filename)' => 'attachments#download', :as => 'download'
match ':filename' => 'attachments#show'
end
end
end
# redirect for backwards compatibility
scope :constraints => { :id => /\d+/, :filename => /[^\/]*/ } do
match "/attachments/download/:id/:filename" => redirect("/attachments/%{id}/download/%{filename}"), :format => false
match "/attachments/download/:id" => redirect("/attachments/%{id}/download"), :format => false
end
resources :groups
#left old routes at the bottom for backwards compat
match '/projects/:project_id/issues(/:action)', :controller => 'issues'
match '/projects/:project_id/documents/:action', :controller => 'documents'
match '/projects/:project_id/boards/:action/:id', :controller => 'boards'
match '/boards/:board_id/topics/:action/:id', :controller => 'messages'

@ -89,9 +89,9 @@ Redmine::AccessControl.map do |map|
map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
map.permission :manage_subtasks, {}
map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]}
map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin
map.permission :edit_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin
map.permission :edit_own_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin
map.permission :move_issues, {:'issues/moves' => [:new, :create]}, :require => :loggedin
map.permission :delete_issues, {:issues => :destroy}, :require => :member
# Queries
map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member
@ -146,7 +146,7 @@ Redmine::AccessControl.map do |map|
end
map.project_module :boards do |map|
map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member
map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true
map.permission :add_messages, {:messages => [:new, :reply, :quote]}
map.permission :edit_messages, {:messages => :edit}, :require => :member
@ -156,11 +156,11 @@ Redmine::AccessControl.map do |map|
end
map.project_module :calendar do |map|
map.permission :view_calendar, :calendars => [:show, :update]
map.permission :view_calendar, :'issues/calendars' => [:index]
end
map.project_module :gantt do |map|
map.permission :view_gantt, :gantts => [:show, :update]
map.permission :view_gantt, :'issues/gantts' => [:index]
end
end
@ -220,7 +220,7 @@ Redmine::MenuManager.map :project_menu do |menu|
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
menu.push :view_all_issues, { :controller => 'issues', :action => 'all' }, :param => :project_id, :caption => :label_issue_view_all, :parent => :issues
menu.push :summary_field, {:controller => 'reports', :action => 'issue_report'}, :param => :id, :caption => :field_summary, :parent => :issues
menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
menu.push :gantt, { :controller => 'issues/gantts', :action => 'index' }, :param => :project_id, :caption => :label_gantt
menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
menu.push :new_news, { :controller => 'news', :action => 'new' }, :param => :project_id, :caption => :label_news_new, :parent => :news,

@ -80,7 +80,7 @@ module Redmine
end
def common_params
{ :controller => 'gantts', :action => 'show', :project_id => @project }
{ :controller => 'gantts', :action => 'index', :project_id => @project }
end
def params

@ -102,7 +102,7 @@ class AttachmentsControllerTest < ActionController::TestCase
def test_anonymous_on_private_private
get :download, :id => 7
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdownload%2F7'
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F7%2Fdownload'
end
def test_destroy_issue_attachment
@ -146,7 +146,7 @@ class AttachmentsControllerTest < ActionController::TestCase
def test_destroy_without_permission
post :destroy, :id => 3
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2Fdestroy%2F3'
assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fattachments%2F3'
assert Attachment.find_by_id(3)
end
end

@ -49,10 +49,10 @@ class BoardsControllerTest < ActionController::TestCase
assert_not_nil assigns(:topics)
end
def test_post_new
def test_create
@request.session[:user_id] = 2
assert_difference 'Board.count' do
post :new, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing board creation'}
post :create, :project_id => 1, :board => { :name => 'Testing', :description => 'Testing board creation'}
end
assert_redirected_to '/projects/ecookbook/settings/boards'
end
@ -75,10 +75,10 @@ class BoardsControllerTest < ActionController::TestCase
assert_not_nil assigns(:messages)
end
def test_post_edit
def test_update
@request.session[:user_id] = 2
assert_no_difference 'Board.count' do
post :edit, :project_id => 1, :id => 2, :board => { :name => 'Testing', :description => 'Testing board update'}
put :update, :project_id => 1, :id => 2, :board => { :name => 'Testing', :description => 'Testing board update'}
end
assert_redirected_to '/projects/ecookbook/settings/boards'
assert_equal 'Testing', Board.find(2).name

@ -12,9 +12,9 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../../../test_helper', __FILE__)
class AutoCompletesControllerTest < ActionController::TestCase
class Issues::AutoCompletesControllerTest < ActionController::TestCase
fixtures :all
def test_issues_should_not_be_case_sensitive

@ -12,20 +12,20 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../../../test_helper', __FILE__)
class CalendarsControllerTest < ActionController::TestCase
class Issues::CalendarsControllerTest < ActionController::TestCase
fixtures :all
def test_calendar
get :show, :project_id => 1
get :index, :project_id => 1
assert_response :success
assert_template 'calendar'
assert_not_nil assigns(:calendar)
end
def test_cross_project_calendar
get :show
get :index
assert_response :success
assert_template 'calendar'
assert_not_nil assigns(:calendar)
@ -35,7 +35,7 @@ class CalendarsControllerTest < ActionController::TestCase
should "run custom queries" do
@query = Query.generate_default!
get :show, :query_id => @query.id
get :index, :query_id => @query.id
assert_response :success
end
@ -44,7 +44,7 @@ class CalendarsControllerTest < ActionController::TestCase
def test_week_number_calculation
Setting.start_of_week = 7
get :show, :month => '1', :year => '2010'
get :index, :month => '1', :year => '2010'
assert_response :success
assert_tag :tag => 'tr',
@ -65,7 +65,7 @@ class CalendarsControllerTest < ActionController::TestCase
Setting.start_of_week = 1
get :show, :month => '1', :year => '2010'
get :index, :month => '1', :year => '2010'
assert_response :success
assert_tag :tag => 'tr',

@ -12,9 +12,9 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../../../test_helper', __FILE__)
class ContextMenusControllerTest < ActionController::TestCase
class Issues::ContextMenusControllerTest < ActionController::TestCase
fixtures :all
def test_context_menu_one_issue
@ -26,31 +26,31 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => '/issues/1/edit',
:class => 'icon-edit' }
assert_tag :tag => 'a', :content => 'Closed',
:attributes => { :href => '/issues/bulk_edit?ids[]=1&amp;issue[status_id]=5',
:attributes => { :href => '/issues/bulk_update?ids[]=1&amp;issue[status_id]=5',
:class => '' }
assert_tag :tag => 'a', :content => 'Immediate',
:attributes => { :href => '/issues/bulk_edit?ids[]=1&amp;issue[priority_id]=8',
:attributes => { :href => '/issues/bulk_update?ids[]=1&amp;issue[priority_id]=8',
:class => '' }
# Versions
assert_tag :tag => 'a', :content => '2.0',
:attributes => { :href => '/issues/bulk_edit?ids[]=1&amp;issue[fixed_version_id]=3',
:attributes => { :href => '/issues/bulk_update?ids[]=1&amp;issue[fixed_version_id]=3',
:class => '' }
assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0',
:attributes => { :href => '/issues/bulk_edit?ids[]=1&amp;issue[fixed_version_id]=4',
:attributes => { :href => '/issues/bulk_update?ids[]=1&amp;issue[fixed_version_id]=4',
:class => '' }
assert_tag :tag => 'a', :content => 'Dave Lopper',
:attributes => { :href => '/issues/bulk_edit?ids[]=1&amp;issue[assigned_to_id]=3',
:attributes => { :href => '/issues/bulk_update?ids[]=1&amp;issue[assigned_to_id]=3',
:class => '' }
assert_tag :tag => 'a', :content => 'Duplicate',
:attributes => { :href => '/projects/ecookbook/issues/1/copy',
:attributes => { :href => '/projects/ecookbook/issues/new?copy_from=1',
:class => 'icon-duplicate' }
assert_tag :tag => 'a', :content => 'Copy',
:attributes => { :href => '/issues/move/new?copy_options[copy]=t&amp;ids[]=1' }
assert_tag :tag => 'a', :content => 'Move',
:attributes => { :href => '/issues/move/new?ids[]=1'}
assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => '/issues/destroy?ids[]=1' }
:attributes => { :href => '/issues?ids[]=1' }
end
def test_context_menu_one_issue_by_anonymous
@ -73,20 +73,20 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => "/issues/bulk_edit?#{ids}",
:class => 'icon-edit' }
assert_tag :tag => 'a', :content => 'Closed',
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue[status_id]=5",
:attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue[status_id]=5",
:class => '' }
assert_tag :tag => 'a', :content => 'Immediate',
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue[priority_id]=8",
:attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue[priority_id]=8",
:class => '' }
assert_tag :tag => 'a', :content => 'Dave Lopper',
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue[assigned_to_id]=3",
:attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue[assigned_to_id]=3",
:class => '' }
assert_tag :tag => 'a', :content => 'Copy',
:attributes => { :href => "/issues/move/new?copy_options[copy]=t&amp;#{ids}"}
assert_tag :tag => 'a', :content => 'Move',
:attributes => { :href => "/issues/move/new?#{ids}"}
assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => "/issues/destroy?#{ids}"}
:attributes => { :href => "/issues?#{ids}"}
end
def test_context_menu_multiple_issues_of_different_projects
@ -102,16 +102,16 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => "/issues/bulk_edit?#{ids}",
:class => 'icon-edit' }
assert_tag :tag => 'a', :content => 'Closed',
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue[status_id]=5",
:attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue[status_id]=5",
:class => '' }
assert_tag :tag => 'a', :content => 'Immediate',
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue[priority_id]=8",
:attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue[priority_id]=8",
:class => '' }
assert_tag :tag => 'a', :content => 'John Smith',
:attributes => { :href => "/issues/bulk_edit?#{ids}&amp;issue[assigned_to_id]=2",
:attributes => { :href => "/issues/bulk_update?#{ids}&amp;issue[assigned_to_id]=2",
:class => '' }
assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => "/issues/destroy?#{ids}"}
:attributes => { :href => "/issues?#{ids}"}
end
def test_context_menu_issue_visibility

@ -12,9 +12,9 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../../../test_helper', __FILE__)
class GanttsControllerTest < ActionController::TestCase
class Issues::GanttsControllerTest < ActionController::TestCase
fixtures :all
context "#gantt" do
@ -22,7 +22,7 @@ class GanttsControllerTest < ActionController::TestCase
i2 = Issue.find(2)
i2.update_attribute(:due_date, 1.month.from_now)
get :show, :project_id => 1
get :index, :project_id => 1
assert_response :success
assert_template 'show'
assert_not_nil assigns(:gantt)
@ -38,7 +38,7 @@ class GanttsControllerTest < ActionController::TestCase
should "work without issue due dates" do
Issue.update_all("due_date = NULL")
get :show, :project_id => 1
get :index, :project_id => 1
assert_response :success
assert_template 'show'
assert_not_nil assigns(:gantt)
@ -48,14 +48,14 @@ class GanttsControllerTest < ActionController::TestCase
Issue.update_all("due_date = NULL")
Version.update_all("effective_date = NULL")
get :show, :project_id => 1
get :index, :project_id => 1
assert_response :success
assert_template 'show'
assert_not_nil assigns(:gantt)
end
should "work cross project" do
get :show
get :index
assert_response :success
assert_template 'show'
assert_not_nil assigns(:gantt)
@ -64,7 +64,7 @@ class GanttsControllerTest < ActionController::TestCase
end
should "not disclose private projects" do
get :show
get :index
assert_response :success
assert_template 'show'
@ -76,7 +76,7 @@ class GanttsControllerTest < ActionController::TestCase
end
should "export to pdf" do
get :show, :project_id => 1, :format => 'pdf'
get :index, :project_id => 1, :format => 'pdf'
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@ -84,7 +84,7 @@ class GanttsControllerTest < ActionController::TestCase
end
should "export to pdf cross project" do
get :show, :format => 'pdf'
get :index, :format => 'pdf'
assert_response :success
assert_equal 'application/pdf', @response.content_type
assert @response.body.starts_with?('%PDF')
@ -92,7 +92,7 @@ class GanttsControllerTest < ActionController::TestCase
end
should "export to png" do
get :show, :project_id => 1, :format => 'png'
get :index, :project_id => 1, :format => 'png'
assert_response :success
assert_equal 'image/png', @response.content_type
end if Object.const_defined?(:Magick)

@ -12,9 +12,9 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../test_helper', __FILE__)
require File.expand_path('../../../test_helper', __FILE__)
class IssueMovesControllerTest < ActionController::TestCase
class Issues::MovesControllerTest < ActionController::TestCase
fixtures :all
def setup
@ -24,7 +24,7 @@ class IssueMovesControllerTest < ActionController::TestCase
def test_create_one_issue_to_another_project
@request.session[:user_id] = 2
post :create, :id => 1, :new_project_id => 2, :tracker_id => '', :assigned_to_id => '', :status_id => '', :start_date => '', :due_date => ''
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_redirected_to project_issues_path(:project_id => 'ecookbook')
assert_equal 2, Issue.find(1).project_id
end
@ -37,7 +37,7 @@ class IssueMovesControllerTest < ActionController::TestCase
def test_bulk_create_to_another_project
@request.session[:user_id] = 2
post :create, :ids => [1, 2], :new_project_id => 2
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_redirected_to project_issues_path(:project_id => 'ecookbook')
# Issues moved to project 2
assert_equal 2, Issue.find(1).project_id
assert_equal 2, Issue.find(2).project_id
@ -49,7 +49,7 @@ class IssueMovesControllerTest < ActionController::TestCase
def test_bulk_create_to_another_tracker
@request.session[:user_id] = 2
post :create, :ids => [1, 2], :new_tracker_id => 2
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_redirected_to project_issues_path(:project_id => 'ecookbook')
assert_equal 2, Issue.find(1).tracker_id
assert_equal 2, Issue.find(2).tracker_id
end
@ -62,7 +62,7 @@ class IssueMovesControllerTest < ActionController::TestCase
should "allow changing the issue priority" do
post :create, :ids => [1, 2], :priority_id => 6
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_redirected_to project_issues_path(:project_id => 'ecookbook')
assert_equal 6, Issue.find(1).priority_id
assert_equal 6, Issue.find(2).priority_id
@ -71,7 +71,7 @@ class IssueMovesControllerTest < ActionController::TestCase
should "allow adding a note when moving" do
post :create, :ids => [1, 2], :notes => 'Moving two issues'
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook'
assert_redirected_to project_issues_path(:project_id => 'ecookbook')
assert_equal 'Moving two issues', Issue.find(1).journals.sort_by(&:id).last.notes
assert_equal 'Moving two issues', Issue.find(2).journals.sort_by(&:id).last.notes
@ -132,7 +132,7 @@ class IssueMovesControllerTest < ActionController::TestCase
@request.session[:user_id] = 2
post :create, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1'
issue = Issue.first(:order => 'id DESC')
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
assert_redirected_to issue_path(issue)
end
end

@ -195,13 +195,13 @@ class IssuesControllerTest < ActionController::TestCase
get :index, :format => 'csv'
assert_response :success
assert_not_nil assigns(:issues)
assert_equal 'text/csv', @response.content_type
assert_equal 'text/csv; header=present', @response.content_type
assert @response.body.starts_with?("#,")
get :index, :project_id => 1, :format => 'csv'
assert_response :success
assert_not_nil assigns(:issues)
assert_equal 'text/csv', @response.content_type
assert_equal 'text/csv; header=present', @response.content_type
end
def test_index_pdf
@ -1145,17 +1145,17 @@ class IssuesControllerTest < ActionController::TestCase
def test_bulk_update
@request.session[:user_id] = 2
# update issues priority
post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing',
:issue => {:priority_id => 7,
put :bulk_update, :ids => [1, 2], :notes => 'Bulk editing',
:issue => { :priority_id => 7,
:assigned_to_id => '',
:custom_field_values => {'2' => ''}}
:custom_field_values => {'2' => ''} }
assert_response 302
# check that the issues were updated
assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
issue = Issue.find(1)
journal = issue.journals.find(:first, :order => 'created_at DESC')
journal = issue.journals.reorder('created_at DESC').first
assert_equal '125', issue.custom_value_for(2).value
assert_equal 'Bulk editing', journal.notes
assert_equal 1, journal.details.size
@ -1164,7 +1164,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_bullk_update_should_not_send_a_notification_if_send_notification_is_off
@request.session[:user_id] = 2
ActionMailer::Base.deliveries.clear
post(:bulk_update,
put(:bulk_update,
{
:ids => [1, 2],
:issue => {
@ -1183,7 +1183,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_bulk_update_on_different_projects
@request.session[:user_id] = 2
# update issues priority
post :bulk_update, :ids => [1, 2, 6], :notes => 'Bulk editing',
put :bulk_update, :ids => [1, 2, 6], :notes => 'Bulk editing',
:issue => {:priority_id => 7,
:assigned_to_id => '',
:custom_field_values => {'2' => ''}}
@ -1193,7 +1193,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal [7, 7, 7], Issue.find([1,2,6]).map(&:priority_id)
issue = Issue.find(1)
journal = issue.journals.find(:first, :order => 'created_at DESC')
journal = issue.journals.reorder('created_at DESC').first
assert_equal '125', issue.custom_value_for(2).value
assert_equal 'Bulk editing', journal.notes
assert_equal 1, journal.details.size
@ -1205,7 +1205,7 @@ class IssuesControllerTest < ActionController::TestCase
action = { :controller => "issues", :action => "bulk_update" }
assert user.allowed_to?(action, Issue.find(1).project)
assert ! user.allowed_to?(action, Issue.find(6).project)
post :bulk_update, :ids => [1, 6], :notes => 'Bulk should fail',
put :bulk_update, :ids => [1, 6], :notes => 'Bulk should fail',
:issue => {:priority_id => 7,
:assigned_to_id => '',
:custom_field_values => {'2' => ''}}
@ -1216,7 +1216,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_bullk_update_should_send_a_notification
@request.session[:user_id] = 2
ActionMailer::Base.deliveries.clear
post(:bulk_update,
put(:bulk_update,
{
:ids => [1, 2],
:notes => 'Bulk editing',
@ -1234,7 +1234,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_bulk_update_status
@request.session[:user_id] = 2
# update issues priority
post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing status',
put :bulk_update, :ids => [1, 2], :notes => 'Bulk editing status',
:issue => {:priority_id => '',
:assigned_to_id => '',
:status_id => '5'}
@ -1246,7 +1246,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_bulk_update_parent_id
@request.session[:user_id] = 2
post :bulk_update, :ids => [1, 3],
put :bulk_update, :ids => [1, 3],
:notes => 'Bulk editing parent',
:issue => {:priority_id => '', :assigned_to_id => '', :status_id => '', :parent_issue_id => '2'}
@ -1260,7 +1260,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_bulk_update_custom_field
@request.session[:user_id] = 2
# update issues priority
post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing custom field',
put :bulk_update, :ids => [1, 2], :notes => 'Bulk editing custom field',
:issue => {:priority_id => '',
:assigned_to_id => '',
:custom_field_values => {'2' => '777'}}
@ -1279,7 +1279,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_not_nil Issue.find(2).assigned_to
@request.session[:user_id] = 2
# unassign issues
post :bulk_update, :ids => [1, 2], :notes => 'Bulk unassigning', :issue => {:assigned_to_id => 'none'}
put :bulk_update, :ids => [1, 2], :notes => 'Bulk unassigning', :issue => {:assigned_to_id => 'none'}
assert_response 302
# check that the issues were updated
assert_nil Issue.find(2).assigned_to
@ -1288,7 +1288,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_post_bulk_update_should_allow_fixed_version_to_be_set_to_a_subproject
@request.session[:user_id] = 2
post :bulk_update, :ids => [1,2], :issue => {:fixed_version_id => 4}
put :bulk_update, :ids => [1,2], :issue => {:fixed_version_id => 4}
assert_response :redirect
issues = Issue.find([1,2])
@ -1300,7 +1300,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_post_bulk_update_should_redirect_back_using_the_back_url_parameter
@request.session[:user_id] = 2
post :bulk_update, :ids => [1,2], :back_url => '/issues'
put :bulk_update, :ids => [1,2], :back_url => '/issues'
assert_response :redirect
assert_redirected_to '/issues'
@ -1308,7 +1308,7 @@ class IssuesControllerTest < ActionController::TestCase
def test_post_bulk_update_should_not_redirect_back_using_the_back_url_parameter_off_the_host
@request.session[:user_id] = 2
post :bulk_update, :ids => [1,2], :back_url => 'http://google.com'
put :bulk_update, :ids => [1,2], :back_url => 'http://google.com'
assert_response :redirect
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => Project.find(1).identifier

@ -177,7 +177,7 @@ class UsersControllerTest < ActionController::TestCase
end
user = User.first(:order => 'id DESC')
assert_redirected_to :controller => 'users', :action => 'edit', :id => user.id
assert_redirected_to edit_user_path(user)
assert_equal 'John', user.firstname
assert_equal 'Doe', user.lastname

@ -125,7 +125,7 @@ class WatchersControllerTest < ActionController::TestCase
def test_remove_watcher
@request.session[:user_id] = 2
assert_difference('Watcher.count', -1) do
xhr :post, :destroy, :object_type => 'issue', :object_id => '2', :user_id => '3'
xhr :delete, :destroy, :id => Watcher.find_by_user_id_and_watchable_id(3, 2).id
assert_response :success
assert_select_rjs :replace_html, 'watchers'
end

@ -47,7 +47,7 @@ class WikiControllerTest < ActionController::TestCase
assert_tag :tag => 'h1', :content => /Another page/
# Included page with an inline image
assert_tag :tag => 'p', :content => /This is an inline image/
assert_tag :tag => 'img', :attributes => { :src => '/attachments/download/3',
assert_tag :tag => 'img', :attributes => { :src => '/attachments/3/download',
:alt => 'This is a logo' }
end

@ -12,8 +12,8 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../../test_helper', __FILE__)
require 'pp'
class ApiTest::NewsTest < ActionController::IntegrationTest
class ApiTest::NewsTest < ActionDispatch::IntegrationTest
fixtures :all
def setup

@ -129,7 +129,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
should "create a project with the attributes" do
assert_difference('Project.count') do
post '/projects.xml', @parameters, :authorization => credentials('admin')
post '/projects.xml', @parameters, credentials('admin')
end
project = Project.first(:order => 'id DESC')
@ -147,7 +147,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
@parameters[:project].merge!({:enabled_module_names => ['issue_tracking', 'news', 'time_tracking']})
assert_difference('Project.count') do
post '/projects.xml', @parameters, :authorization => credentials('admin')
post '/projects.xml', @parameters, credentials('admin')
end
project = Project.first(:order => 'id DESC')
@ -158,7 +158,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
@parameters[:project].merge!({:tracker_ids => [1, 3]})
assert_difference('Project.count') do
post '/projects.xml', @parameters, :authorization => credentials('admin')
post '/projects.xml', @parameters, credentials('admin')
end
project = Project.first(:order => 'id DESC')
@ -175,7 +175,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
context ".xml" do
should "return errors" do
assert_no_difference('Project.count') do
post '/projects.xml', @parameters, :authorization => credentials('admin')
post '/projects.xml', @parameters, credentials('admin')
end
assert_response :unprocessable_entity
@ -200,7 +200,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
should "update the project" do
assert_no_difference 'Project.count' do
put '/projects/2.xml', @parameters, :authorization => credentials('jsmith')
put '/projects/2.xml', @parameters, credentials('jsmith')
end
assert_response :ok
assert_equal 'application/xml', @response.content_type
@ -212,7 +212,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
@parameters[:project].merge!({:enabled_module_names => ['issue_tracking', 'news', 'time_tracking']})
assert_no_difference 'Project.count' do
put '/projects/2.xml', @parameters, :authorization => credentials('admin')
put '/projects/2.xml', @parameters, credentials('admin')
end
assert_response :ok
project = Project.find(2)
@ -223,7 +223,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
@parameters[:project].merge!({:tracker_ids => [1, 3]})
assert_no_difference 'Project.count' do
put '/projects/2.xml', @parameters, :authorization => credentials('admin')
put '/projects/2.xml', @parameters, credentials('admin')
end
assert_response :ok
project = Project.find(2)
@ -240,7 +240,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
context ".xml" do
should "return errors" do
assert_no_difference('Project.count') do
put '/projects/2.xml', @parameters, :authorization => credentials('admin')
put '/projects/2.xml', @parameters, credentials('admin')
end
assert_response :unprocessable_entity
@ -260,7 +260,7 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
should "delete the project" do
assert_difference('Project.count',-1) do
delete '/projects/2.xml', {}, :authorization => credentials('admin')
delete '/projects/2.xml', {}, credentials('admin')
end
assert_response :ok
assert_nil Project.find_by_id(2)

@ -22,7 +22,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "GET /time_entries.xml" do
should "return time entries" do
get '/time_entries.xml', {}, :authorization => credentials('jsmith')
get '/time_entries.xml', {}, credentials('jsmith')
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_tag :tag => 'time_entries',
@ -32,7 +32,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "GET /time_entries/2.xml" do
should "return requested time entry" do
get '/time_entries/2.xml', {}, :authorization => credentials('jsmith')
get '/time_entries/2.xml', {}, credentials('jsmith')
assert_response :success
assert_equal 'application/xml', @response.content_type
assert_tag :tag => 'time_entry',
@ -44,7 +44,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with issue_id" do
should "return create time entry" do
assert_difference 'TimeEntry.count' do
post '/time_entries.xml', {:time_entry => {:issue_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, :authorization => credentials('jsmith')
post '/time_entries.xml', {:time_entry => {:issue_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith')
end
assert_response :created
assert_equal 'application/xml', @response.content_type
@ -62,7 +62,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with project_id" do
should "return create time entry" do
assert_difference 'TimeEntry.count' do
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, :authorization => credentials('jsmith')
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :hours => '3.5', :activity_id => '11'}}, credentials('jsmith')
end
assert_response :created
assert_equal 'application/xml', @response.content_type
@ -80,7 +80,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with invalid parameters" do
should "return errors" do
assert_no_difference 'TimeEntry.count' do
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :activity_id => '11'}}, :authorization => credentials('jsmith')
post '/time_entries.xml', {:time_entry => {:project_id => '1', :spent_on => '2010-12-02', :activity_id => '11'}}, credentials('jsmith')
end
assert_response :unprocessable_entity
assert_equal 'application/xml', @response.content_type
@ -94,7 +94,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with valid parameters" do
should "update time entry" do
assert_no_difference 'TimeEntry.count' do
put '/time_entries/2.xml', {:time_entry => {:comments => 'API Update'}}, :authorization => credentials('jsmith')
put '/time_entries/2.xml', {:time_entry => {:comments => 'API Update'}}, credentials('jsmith')
end
assert_response :ok
assert_equal 'API Update', TimeEntry.find(2).comments
@ -104,7 +104,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "with invalid parameters" do
should "return errors" do
assert_no_difference 'TimeEntry.count' do
put '/time_entries/2.xml', {:time_entry => {:hours => '', :comments => 'API Update'}}, :authorization => credentials('jsmith')
put '/time_entries/2.xml', {:time_entry => {:hours => '', :comments => 'API Update'}}, credentials('jsmith')
end
assert_response :unprocessable_entity
assert_equal 'application/xml', @response.content_type
@ -117,7 +117,7 @@ class ApiTest::TimeEntriesTest < ActionController::IntegrationTest
context "DELETE /time_entries/2.xml" do
should "destroy time entry" do
assert_difference 'TimeEntry.count', -1 do
delete '/time_entries/2.xml', {}, :authorization => credentials('jsmith')
delete '/time_entries/2.xml', {}, credentials('jsmith')
end
assert_response :ok
assert_nil TimeEntry.find_by_id(2)

@ -12,7 +12,7 @@
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../../test_helper', __FILE__)
require 'pp'
class ApiTest::UsersTest < ActionController::IntegrationTest
fixtures :users
@ -28,7 +28,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
context "GET /users/2" do
context ".xml" do
should "return requested user" do
get '/users/2.xml'
get '/users/2.xml', {}, credentials('admin')
assert_tag :tag => 'user',
:child => {:tag => 'id', :content => '2'}
@ -37,9 +37,9 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
context ".json" do
should "return requested user" do
get '/users/2.json'
get '/users/2.json', {}, credentials('admin')
json = ActiveSupport::JSON.decode(response.body)
json = ActiveSupport::JSON.decode(@response.body)
assert_kind_of Hash, json
assert_kind_of Hash, json['user']
assert_equal 2, json['user']['id']
@ -56,7 +56,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
end
should "return current user" do
get '/users/current.xml', {}, :authorization => credentials('jsmith')
get '/users/current.xml', {}, credentials('jsmith')
assert_tag :tag => 'user',
:child => {:tag => 'id', :content => '2'}
@ -78,7 +78,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
should "create a user with the attributes" do
assert_difference('User.count') do
post '/users.xml', @parameters, :authorization => credentials('admin')
post '/users.xml', @parameters, credentials('admin')
end
user = User.first(:order => 'id DESC')
@ -104,7 +104,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
should "create a user with the attributes" do
assert_difference('User.count') do
post '/users.json', @parameters, :authorization => credentials('admin')
post '/users.json', @parameters, credentials('admin')
end
user = User.first(:order => 'id DESC')
@ -132,7 +132,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
context ".xml" do
should "return errors" do
assert_no_difference('User.count') do
post '/users.xml', @parameters, :authorization => credentials('admin')
post '/users.xml', @parameters, credentials('admin')
end
assert_response :unprocessable_entity
@ -144,7 +144,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
context ".json" do
should "return errors" do
assert_no_difference('User.count') do
post '/users.json', @parameters, :authorization => credentials('admin')
post '/users.json', @parameters, credentials('admin')
end
assert_response :unprocessable_entity
@ -152,7 +152,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Hash, json
assert json.has_key?('errors')
assert_kind_of Array, json['errors']
assert_equal({ "firstname" => ["can't be blank"], "mail" => ["is invalid"] }, json['errors'])
end
end
end
@ -172,7 +172,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
should "update user with the attributes" do
assert_no_difference('User.count') do
put '/users/2.xml', @parameters, :authorization => credentials('admin')
put '/users/2.xml', @parameters, credentials('admin')
end
user = User.find(2)
@ -194,7 +194,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
should "update user with the attributes" do
assert_no_difference('User.count') do
put '/users/2.json', @parameters, :authorization => credentials('admin')
put '/users/2.json', @parameters, credentials('admin')
end
user = User.find(2)
@ -217,7 +217,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
context ".xml" do
should "return errors" do
assert_no_difference('User.count') do
put '/users/2.xml', @parameters, :authorization => credentials('admin')
put '/users/2.xml', @parameters, credentials('admin')
end
assert_response :unprocessable_entity
@ -229,7 +229,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
context ".json" do
should "return errors" do
assert_no_difference('User.count') do
put '/users/2.json', @parameters, :authorization => credentials('admin')
put '/users/2.json', @parameters, credentials('admin')
end
assert_response :unprocessable_entity
@ -237,7 +237,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
json = ActiveSupport::JSON.decode(response.body)
assert_kind_of Hash, json
assert json.has_key?('errors')
assert_kind_of Array, json['errors']
assert_equal({ "firstname" => ["can't be blank"], "mail" => ["is invalid"] }, json['errors'])
end
end
end
@ -261,7 +261,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
should "delete user" do
assert_difference('User.count', -1) do
delete '/users/2.xml', {}, :authorization => credentials('admin')
delete '/users/2.xml', {}, credentials('admin')
end
assert_response :ok
@ -278,7 +278,7 @@ class ApiTest::UsersTest < ActionController::IntegrationTest
should "delete user" do
assert_difference('User.count', -1) do
delete '/users/2.json', {}, :authorization => credentials('admin')
delete '/users/2.json', {}, credentials('admin')
end
assert_response :ok

@ -23,19 +23,19 @@ class ApplicationTest < ActionController::IntegrationTest
Setting.default_language = 'en'
# a french user
get 'projects', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
get 'projects', { }, { 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'}
assert_response :success
assert_tag :tag => 'h2', :content => 'Projets'
assert_equal :fr, current_language
# then an italien user
get 'projects', { }, 'Accept-Language' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'it;q=0.8,en-us;q=0.5,en;q=0.3'
assert_response :success
assert_tag :tag => 'h2', :content => 'Progetti'
assert_equal :it, current_language
# not a supported language: default language should be used
get 'projects', { }, 'Accept-Language' => 'zz'
get 'projects', { }, 'HTTP_ACCEPT_LANGUAGE' => 'zz'
assert_response :success
assert_tag :tag => 'h2', :content => 'Projects'
end

@ -106,13 +106,14 @@ class IssuesTest < ActionController::IntegrationTest
end
end
def test_other_formats_links_on_post_index_without_project_id_in_url
def test_other_formats_links_on_get_index_without_project_id_in_url
Role.anonymous.add_permission!(:export_issues)
post '/issues', :project_id => 'ecookbook'
get '/issues', :project_id => 'ecookbook'
%w(Atom PDF CSV).each do |format|
assert_tag :a, :content => format,
:attributes => { :href => "/projects/ecookbook/issues.#{format.downcase}",
:class => format.downcase,
:rel => 'nofollow' }
end
end
@ -126,9 +127,9 @@ class IssuesTest < ActionController::IntegrationTest
end
def test_pagination_links_on_post_index_without_project_id_in_url
def test_pagination_links_on_get_index_without_project_id_in_url
Setting.per_page_options = '2'
post '/issues', :project_id => 'ecookbook'
get '/issues', :project_id => 'ecookbook'
assert_tag :a, :content => '2',
:attributes => { :href => '/projects/ecookbook/issues?page=2' }

@ -20,7 +20,7 @@ class MenuManagerTest < ActionController::IntegrationTest
def test_project_menu_with_specific_locale
Setting.available_languages = [:fr, :en]
get 'projects/ecookbook/issues', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
get 'projects/ecookbook/issues', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
assert_tag :div, :attributes => { :id => 'main-menu' },
:descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_activity),

@ -15,335 +15,476 @@ require File.expand_path('../../test_helper', __FILE__)
class RoutingTest < ActionController::IntegrationTest
context "activities" do
should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil
should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom'
should route(:get, "/activity").to(:controller => 'activities', :action => 'index')
should route(:get, "/activity.atom").to(:controller => 'activities', :action => 'index', :format => 'atom')
should "route /activities to activities#index" do
assert_recognizes({ :controller => 'activities', :action => 'index' }, "/activities")
end
context "attachments" do
should_route :get, "/attachments/1", :controller => 'attachments', :action => 'show', :id => '1'
should_route :get, "/attachments/1/filename.ext", :controller => 'attachments', :action => 'show', :id => '1', :filename => 'filename.ext'
should_route :get, "/attachments/download/1", :controller => 'attachments', :action => 'download', :id => '1'
should_route :get, "/attachments/download/1/filename.ext", :controller => 'attachments', :action => 'download', :id => '1', :filename => 'filename.ext'
end
context "boards" do
should_route :get, "/projects/world_domination/boards", :controller => 'boards', :action => 'index', :project_id => 'world_domination'
should_route :get, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
should_route :get, "/projects/world_domination/boards/44", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44'
should_route :get, "/projects/world_domination/boards/44.atom", :controller => 'boards', :action => 'show', :project_id => 'world_domination', :id => '44', :format => 'atom'
should_route :get, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
should_route :post, "/projects/world_domination/boards/new", :controller => 'boards', :action => 'new', :project_id => 'world_domination'
should_route :post, "/projects/world_domination/boards/44/edit", :controller => 'boards', :action => 'edit', :project_id => 'world_domination', :id => '44'
should_route :post, "/projects/world_domination/boards/44/destroy", :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44'
end
context "documents" do
should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
should_route :post, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
should_route :post, "/documents/567/edit", :controller => 'documents', :action => 'edit', :id => '567'
should_route :post, "/documents/567/destroy", :controller => 'documents', :action => 'destroy', :id => '567'
end
context "issues" do
# REST actions
should_route :get, "/issues", :controller => 'issues', :action => 'index'
should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
# TODO: Should use PUT
should_route :post, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
# TODO: Should use DELETE
should_route :post, "/issues/64/destroy", :controller => 'issues', :action => 'destroy', :id => '64'
should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
# Extra actions
should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
should_route :put, "/issues/calendar", :controller => 'calendars', :action => 'update'
should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
should_route :put, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'update', :project_id => 'project-name'
should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
should_route :put, "/issues/gantt", :controller => 'gantts', :action => 'update'
should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
should_route :put, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'update', :project_id => 'project-name'
should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
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'
should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
should_route :post, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_update'
should "route /activites.atom to activities#index" do
assert_recognizes({ :controller => 'activities', :action => 'index', :format => 'atom' }, "/activities.atom")
end
context "issue categories" do
should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
should route(:get, "projects/eCookbook/activity").to(:controller => 'activities', :action => 'index', :project_id => "eCookbook")
should route(:get, "projects/eCookbook/activity.atom").to(:controller => 'activities', :action => 'index', :project_id => "eCookbook", :format => 'atom')
should_route :post, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
should "route project/eCookbook/activities to activities#index" do
assert_recognizes({ :controller => 'activities', :action => 'index', :project_id => "eCookbook" }, "/projects/eCookbook/activities")
end
context "issue relations" do
should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'new', :issue_id => '1'
should_route :post, "/issues/1/relations/23/destroy", :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23'
end
context "issue reports" do
should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
should "route project/eCookbook/activites.atom to activities#index" do
assert_recognizes({ :controller => 'activities', :action => 'index', :format => 'atom', :project_id => "eCookbook" }, "/projects/eCookbook/activities.atom")
end
context "members" do
should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
end
context "messages" do
should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
end
context "news" do
should_route :get, "/news", :controller => 'news', :action => 'index'
should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
end
context "projects" do
should_route :get, "/projects", :controller => 'projects', :action => 'index'
should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
should_route :post, "/projects", :controller => 'projects', :action => 'create'
should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
end
context "repositories" do
should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw'
should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw'
should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
end
context "timelogs (global)" do
should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
context "attachments" do
should route(:get, "/attachments/1").to( :controller => 'attachments',
:action => 'show',
:id => '1')
should route(:get, "/attachments/1/filename.ext").to( :controller => 'attachments',
:action => 'show',
:id => '1',
:filename => 'filename.ext' )
should route(:get, "/attachments/1/download").to( :controller => 'attachments',
:action => 'download',
:id => '1' )
should route(:get, "/attachments/1/download/filename.ext").to( :controller => 'attachments',
:action => 'download',
:id => '1',
:filename => 'filename.ext' )
should "redirect /atttachments/download/1 to /attachments/1/download" do
get '/attachments/download/1'
assert_redirected_to '/attachments/1/download'
end
context "timelogs (scoped under project)" do
should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
should "redirect /atttachments/download/1/filename.ext to /attachments/1/download/filename.ext" do
get '/attachments/download/1/filename.ext'
assert_redirected_to '/attachments/1/download/filename.ext'
end
context "timelogs (scoped under issues)" do
should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
end
context "timelogs (scoped under project and issues)" do
should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
end
context "time_entry_reports" do
should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report'
should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567'
should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv'
end
context "users" do
should_route :get, "/users", :controller => 'users', :action => 'index'
should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
should_route :get, "/users/new", :controller => 'users', :action => 'new'
should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership'
should_route :post, "/users", :controller => 'users', :action => 'create'
should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
should_route :post, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
should_route :post, "/users/567/memberships/12/destroy", :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12'
context "boards" do
should route(:get, "/projects/world_domination/boards").to( :controller => 'boards',
:action => 'index',
:project_id => 'world_domination')
should route(:get, "/projects/world_domination/boards/new").to( :controller => 'boards',
:action => 'new',
:project_id => 'world_domination')
should route(:post, "/projects/world_domination/boards").to( :controller => 'boards',
:action => 'create',
:project_id => 'world_domination')
should route(:get, "/projects/world_domination/boards/44").to( :controller => 'boards',
:action => 'show',
:project_id => 'world_domination',
:id => '44')
should route(:get, "/projects/world_domination/boards/44.atom").to( :controller => 'boards',
:action => 'show',
:project_id => 'world_domination',
:id => '44',
:format => 'atom')
should route(:get, "/projects/world_domination/boards/44/edit").to( :controller => 'boards',
:action => 'edit',
:project_id => 'world_domination',
:id => '44')
should route(:put, "/projects/world_domination/boards/44").to( :controller => 'boards',
:action => 'update',
:project_id => 'world_domination',
:id => '44')
should route(:delete, "/projects/world_domination/boards/44").to( :controller => 'boards',
:action => 'destroy',
:project_id => 'world_domination',
:id => '44')
should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
end
# TODO: should they all be scoped under /projects/:project_id ?
context "versions" do
should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1'
should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1'
should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1'
should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1'
context "documents" do
should route(:get, "/projects/567/documents").to( :controller => 'documents', :action => 'index', :project_id => '567')
should route(:get, "/projects/567/documents/new").to( :controller => 'documents', :action => 'new', :project_id => '567')
should route(:get, "/documents/22").to( :controller => 'documents', :action => 'show', :id => '22')
should route(:get, "/documents/22/edit").to( :controller => 'documents', :action => 'edit', :id => '22')
should route(:post, "/projects/567/documents/new").to( :controller => 'documents', :action => 'new', :project_id => '567')
should route(:post, "/documents/567/edit").to( :controller => 'documents', :action => 'edit', :id => '567')
should route(:post, "/documents/567/destroy").to( :controller => 'documents', :action => 'destroy', :id => '567')
end
context "wiki (singular, project's pages)" do
should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1'
should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
context "issues" do
# REST actions
should route(:get, "/issues").to( :controller => 'issues',
:action => 'index')
should route(:get, "/issues.pdf").to( :controller => 'issues',
:action => 'index',
:format => 'pdf')
should route(:get, "/issues.atom").to( :controller => 'issues',
:action => 'index',
:format => 'atom')
should route(:get, "/issues.xml").to( :controller => 'issues',
:action => 'index',
:format => 'xml')
should route(:get, "/projects/23/issues").to( :controller => 'issues',
:action => 'index',
:project_id => '23')
should route(:get, "/projects/23/issues.pdf").to( :controller => 'issues',
:action => 'index',
:project_id => '23',
:format => 'pdf')
should route(:get, "/projects/23/issues.atom").to( :controller => 'issues',
:action => 'index',
:project_id => '23',
:format => 'atom')
should route(:get, "/projects/23/issues.xml").to( :controller => 'issues',
:action => 'index',
:project_id => '23',
:format => 'xml')
should route(:get, "/issues/64").to( :controller => 'issues',
:action => 'show',
:id => '64')
should route(:get, "/issues/64.pdf").to( :controller => 'issues',
:action => 'show',
:id => '64',
:format => 'pdf')
should route(:get, "/issues/64.atom").to( :controller => 'issues',
:action => 'show',
:id => '64',
:format => 'atom')
should route(:get, "/issues/64.xml").to( :controller => 'issues',
:action => 'show',
:id => '64',
:format => 'xml')
should route(:get, "/projects/23/issues/new").to( :controller => 'issues',
:action => 'new',
:project_id => '23')
should route(:post, "/projects/23/issues").to( :controller => 'issues',
:action => 'create',
:project_id => '23')
# TODO: remove as issues should be created scoped under project
should route(:post, "/issues.xml").to( :controller => 'issues',
:action => 'create',
:format => 'xml')
should route(:get, "/issues/64/edit").to( :controller => 'issues',
:action => 'edit',
:id => '64')
should route(:put, "/issues/1.xml").to( :controller => 'issues',
:action => 'update',
:id => '1',
:format => 'xml')
should route(:delete, "/issues/1.xml").to( :controller => 'issues',
:action => 'destroy',
:id => '1',
:format => 'xml')
should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
# Extra actions
should route(:get, "/projects/23/issues/64/copy").to( :controller => 'issues',
:action => 'new',
:project_id => '23',
:copy_from => '64')
should route(:get, "/issues/move/new").to( :controller => 'issues/moves',
:action => 'new')
should route(:post, "/issues/move").to( :controller => 'issues/moves',
:action => 'create')
should route(:post, "/issues/1/quoted").to( :controller => 'journals',
:action => 'new',
:id => '1')
should route(:get, "/issues/calendar").to( :controller => 'issues/calendars',
:action => 'index')
should route(:get, "/projects/project-name/issues/calendar").to( :controller => 'issues/calendars',
:action => 'index',
:project_id => 'project-name' )
should route(:get, "/issues/gantt").to( :controller => 'issues/gantts',
:action => 'index')
should route(:get, "/projects/project-name/issues/gantt").to( :controller => 'issues/gantts',
:action => 'index',
:project_id => 'project-name')
should route(:get, "/issues/auto_complete").to( :controller => 'issues/auto_completes',
:action => 'issues')
should route(:post, "/issues/auto_complete").to( :controller => 'issues/auto_completes',
:action => 'issues')
should route(:get, "/issues/preview/123").to( :controller => 'previews',
:action => 'issue',
:id => '123')
should route(:post, "/issues/preview/123").to( :controller => 'previews',
:action => 'issue',
:id => '123')
should route(:get, "/issues/context_menu").to( :controller => 'issues/context_menus',
:action => 'issues')
should route(:post, "/issues/context_menu").to( :controller => 'issues/context_menus',
:action => 'issues')
should route(:get, "/issues/changes").to( :controller => 'journals',
:action => 'index')
should route(:get, "/issues/bulk_edit").to( :controller => 'issues',
:action => 'bulk_edit')
should route(:put, "/issues/bulk_update").to( :controller => 'issues',
:action => 'bulk_update')
should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
end
context "wikis (plural, admin setup)" do
should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
context "watches" do
['issues', 'messages, boards'].each do |type|
should route(:post, "/#{type}/1/watch").to( :controller => 'watchers',
:action => 'watch',
:object_type => type,
:object_id => '1' )
should route(:delete, "/#{type}/1/unwatch").to( :controller => 'watchers',
:action => 'unwatch',
:object_type => type,
:object_id => '1' )
should route(:get, "/#{type}/1/watchers/new").to( :controller => 'watchers',
:action => 'new',
:object_type => type,
:object_id => '1' )
end
context "administration panel" do
should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects'
should route(:delete, "/watchers/1").to( :controller => 'watchers',
:action => 'destroy',
:id => '1' )
end
end
# context "issue categories" do
# should route(:get, "/projects/test/issue_categories/new").to( :controller => 'issue_categories', :action => 'new', :project_id => 'test')
#
# should route(:post, "/projects/test/issue_categories/new").to( :controller => 'issue_categories', :action => 'new', :project_id => 'test')
# end
#
# context "issue relations" do
# should route(:post, "/issues/1/relations").to( :controller => 'issue_relations', :action => 'new', :issue_id => '1')
# should route(:post, "/issues/1/relations/23/destroy").to( :controller => 'issue_relations', :action => 'destroy', :issue_id => '1', :id => '23')
# end
#
# context "issue reports" do
# should route(:get, "/projects/567/issues/report").to( :controller => 'reports', :action => 'issue_report', :id => '567')
# should route(:get, "/projects/567/issues/report/assigned_to").to( :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to')
# end
#
# context "members" do
# should route(:post, "/projects/5234/members/new").to( :controller => 'members', :action => 'new', :id => '5234')
# end
#
# context "messages" do
# should route(:get, "/boards/22/topics/2").to( :controller => 'messages', :action => 'show', :id => '2', :board_id => '22')
# should route(:get, "/boards/lala/topics/new").to( :controller => 'messages', :action => 'new', :board_id => 'lala')
# should route(:get, "/boards/lala/topics/22/edit").to( :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala')
#
# should route(:post, "/boards/lala/topics/new").to( :controller => 'messages', :action => 'new', :board_id => 'lala')
# should route(:post, "/boards/lala/topics/22/edit").to( :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala')
# should route(:post, "/boards/22/topics/555/replies").to( :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22')
# should route(:post, "/boards/22/topics/555/destroy").to( :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22')
# end
#
# context "news" do
# should route(:get, "/news").to( :controller => 'news', :action => 'index')
# should route(:get, "/news.atom").to( :controller => 'news', :action => 'index', :format => 'atom')
# should route(:get, "/news.xml").to( :controller => 'news', :action => 'index', :format => 'xml')
# should route(:get, "/news.json").to( :controller => 'news', :action => 'index', :format => 'json')
# should route(:get, "/projects/567/news").to( :controller => 'news', :action => 'index', :project_id => '567')
# should route(:get, "/projects/567/news.atom").to( :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567')
# should route(:get, "/projects/567/news.xml").to( :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567')
# should route(:get, "/projects/567/news.json").to( :controller => 'news', :action => 'index', :format => 'json', :project_id => '567')
# should route(:get, "/news/2").to( :controller => 'news', :action => 'show', :id => '2')
# should route(:get, "/projects/567/news/new").to( :controller => 'news', :action => 'new', :project_id => '567')
# should route(:get, "/news/234").to( :controller => 'news', :action => 'show', :id => '234')
# should route(:get, "/news/567/edit").to( :controller => 'news', :action => 'edit', :id => '567')
# should route(:get, "/news/preview").to( :controller => 'previews', :action => 'news')
#
# should route(:post, "/projects/567/news").to( :controller => 'news', :action => 'create', :project_id => '567')
# should route(:post, "/news/567/comments").to( :controller => 'comments', :action => 'create', :id => '567')
#
# should route(:put, "/news/567").to( :controller => 'news', :action => 'update', :id => '567')
#
# should route(:delete, "/news/567").to( :controller => 'news', :action => 'destroy', :id => '567')
# should route(:delete, "/news/567/comments/15").to( :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15')
# end
#
# context "projects" do
# should route(:get, "/projects").to( :controller => 'projects', :action => 'index')
# should route(:get, "/projects.atom").to( :controller => 'projects', :action => 'index', :format => 'atom')
# should route(:get, "/projects.xml").to( :controller => 'projects', :action => 'index', :format => 'xml')
# should route(:get, "/projects/new").to( :controller => 'projects', :action => 'new')
# should route(:get, "/projects/test").to( :controller => 'projects', :action => 'show', :id => 'test')
# should route(:get, "/projects/1.xml").to( :controller => 'projects', :action => 'show', :id => '1', :format => 'xml')
# should route(:get, "/projects/4223/settings").to( :controller => 'projects', :action => 'settings', :id => '4223')
# should route(:get, "/projects/4223/settings/members").to( :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members')
# should route(:get, "/projects/33/files").to( :controller => 'files', :action => 'index', :project_id => '33')
# should route(:get, "/projects/33/files/new").to( :controller => 'files', :action => 'new', :project_id => '33')
# should route(:get, "/projects/33/roadmap").to( :controller => 'versions', :action => 'index', :project_id => '33')
# should route(:get, "/projects/33/activity").to( :controller => 'activities', :action => 'index', :id => '33')
# should route(:get, "/projects/33/activity.atom").to( :controller => 'activities', :action => 'index', :id => '33', :format => 'atom')
#
# should route(:post, "/projects").to( :controller => 'projects', :action => 'create')
# should route(:post, "/projects.xml").to( :controller => 'projects', :action => 'create', :format => 'xml')
# should route(:post, "/projects/33/files").to( :controller => 'files', :action => 'create', :project_id => '33')
# should route(:post, "/projects/64/archive").to( :controller => 'projects', :action => 'archive', :id => '64')
# should route(:post, "/projects/64/unarchive").to( :controller => 'projects', :action => 'unarchive', :id => '64')
#
# should route(:put, "/projects/64/enumerations").to( :controller => 'project_enumerations', :action => 'update', :project_id => '64')
# should route(:put, "/projects/4223").to( :controller => 'projects', :action => 'update', :id => '4223')
# should route(:put, "/projects/1.xml").to( :controller => 'projects', :action => 'update', :id => '1', :format => 'xml')
#
# should route(:delete, "/projects/64").to( :controller => 'projects', :action => 'destroy', :id => '64')
# should route(:delete, "/projects/1.xml").to( :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml')
# should route(:delete, "/projects/64/enumerations").to( :controller => 'project_enumerations', :action => 'destroy', :project_id => '64')
# end
#
# context "repositories" do
# should route(:get, "/projects/redmine/repository").to( :controller => 'repositories', :action => 'show', :id => 'redmine')
# should route(:get, "/projects/redmine/repository/edit").to( :controller => 'repositories', :action => 'edit', :id => 'redmine')
# should route(:get, "/projects/redmine/repository/revisions").to( :controller => 'repositories', :action => 'revisions', :id => 'redmine')
# should route(:get, "/projects/redmine/repository/revisions.atom").to( :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom')
# should route(:get, "/projects/redmine/repository/revisions/2457").to( :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457')
# should route(:get, "/projects/redmine/repository/revisions/2457/diff").to( :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457')
# should route(:get, "/projects/redmine/repository/revisions/2457/diff.diff").to( :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff')
# should route(:get, "/projects/redmine/repository/diff/path/to/file.c").to( :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c])
# should route(:get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c").to( :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2')
# should route(:get, "/projects/redmine/repository/browse/path/to/file.c").to( :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c])
# should route(:get, "/projects/redmine/repository/entry/path/to/file.c").to( :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c])
# should route(:get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c").to( :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2')
# should route(:get, "/projects/redmine/repository/raw/path/to/file.c").to( :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw')
# should route(:get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c").to( :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw')
# should route(:get, "/projects/redmine/repository/annotate/path/to/file.c").to( :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c])
# should route(:get, "/projects/redmine/repository/changes/path/to/file.c").to( :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c])
# should route(:get, "/projects/redmine/repository/statistics").to( :controller => 'repositories', :action => 'stats', :id => 'redmine')
#
#
# should route(:post, "/projects/redmine/repository/edit").to( :controller => 'repositories', :action => 'edit', :id => 'redmine')
# end
#
# context "timelogs (global)" do
# should route(:get, "/time_entries").to( :controller => 'timelog', :action => 'index')
# should route(:get, "/time_entries.csv").to( :controller => 'timelog', :action => 'index', :format => 'csv')
# should route(:get, "/time_entries.atom").to( :controller => 'timelog', :action => 'index', :format => 'atom')
# should route(:get, "/time_entries/new").to( :controller => 'timelog', :action => 'new')
# should route(:get, "/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22')
#
# should route(:post, "/time_entries").to( :controller => 'timelog', :action => 'create')
#
# should route(:put, "/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22')
#
# should route(:delete, "/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55')
# end
#
# context "timelogs (scoped under project)" do
# should route(:get, "/projects/567/time_entries").to( :controller => 'timelog', :action => 'index', :project_id => '567')
# should route(:get, "/projects/567/time_entries.csv").to( :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv')
# should route(:get, "/projects/567/time_entries.atom").to( :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom')
# should route(:get, "/projects/567/time_entries/new").to( :controller => 'timelog', :action => 'new', :project_id => '567')
# should route(:get, "/projects/567/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567')
#
# should route(:post, "/projects/567/time_entries").to( :controller => 'timelog', :action => 'create', :project_id => '567')
#
# should route(:put, "/projects/567/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567')
#
# should route(:delete, "/projects/567/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567')
# end
#
# context "timelogs (scoped under issues)" do
# should route(:get, "/issues/234/time_entries").to( :controller => 'timelog', :action => 'index', :issue_id => '234')
# should route(:get, "/issues/234/time_entries.csv").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv')
# should route(:get, "/issues/234/time_entries.atom").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom')
# should route(:get, "/issues/234/time_entries/new").to( :controller => 'timelog', :action => 'new', :issue_id => '234')
# should route(:get, "/issues/234/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234')
#
# should route(:post, "/issues/234/time_entries").to( :controller => 'timelog', :action => 'create', :issue_id => '234')
#
# should route(:put, "/issues/234/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234')
#
# should route(:delete, "/issues/234/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234')
# end
#
# context "timelogs (scoped under project and issues)" do
# should route(:get, "/projects/ecookbook/issues/234/time_entries").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook')
# should route(:get, "/projects/ecookbook/issues/234/time_entries.csv").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv')
# should route(:get, "/projects/ecookbook/issues/234/time_entries.atom").to( :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom')
# should route(:get, "/projects/ecookbook/issues/234/time_entries/new").to( :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook')
# should route(:get, "/projects/ecookbook/issues/234/time_entries/22/edit").to( :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook')
#
# should route(:post, "/projects/ecookbook/issues/234/time_entries").to( :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook')
#
# should route(:put, "/projects/ecookbook/issues/234/time_entries/22").to( :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook')
#
# should route(:delete, "/projects/ecookbook/issues/234/time_entries/55").to( :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook')
# end
#
# context "time_entry_reports" do
# should route(:get, "/time_entries/report").to( :controller => 'time_entry_reports', :action => 'report')
# should route(:get, "/projects/567/time_entries/report").to( :controller => 'time_entry_reports', :action => 'report', :project_id => '567')
# should route(:get, "/projects/567/time_entries/report.csv").to( :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv')
# end
#
# context "users" do
# should route(:get, "/users").to( :controller => 'users', :action => 'index')
# should route(:get, "/users.xml").to( :controller => 'users', :action => 'index', :format => 'xml')
# should route(:get, "/users/44").to( :controller => 'users', :action => 'show', :id => '44')
# should route(:get, "/users/44.xml").to( :controller => 'users', :action => 'show', :id => '44', :format => 'xml')
# should route(:get, "/users/current").to( :controller => 'users', :action => 'show', :id => 'current')
# should route(:get, "/users/current.xml").to( :controller => 'users', :action => 'show', :id => 'current', :format => 'xml')
# should route(:get, "/users/new").to( :controller => 'users', :action => 'new')
# should route(:get, "/users/444/edit").to( :controller => 'users', :action => 'edit', :id => '444')
# should route(:get, "/users/222/edit/membership").to( :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership')
#
# should route(:post, "/users").to( :controller => 'users', :action => 'create')
# should route(:post, "/users.xml").to( :controller => 'users', :action => 'create', :format => 'xml')
# should route(:post, "/users/123/memberships").to( :controller => 'users', :action => 'edit_membership', :id => '123')
# should route(:post, "/users/123/memberships/55").to( :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55')
# should route(:post, "/users/567/memberships/12/destroy").to( :controller => 'users', :action => 'destroy_membership', :id => '567', :membership_id => '12')
#
# should route(:put, "/users/444").to( :controller => 'users', :action => 'update', :id => '444')
# should route(:put, "/users/444.xml").to( :controller => 'users', :action => 'update', :id => '444', :format => 'xml')
# end
#
# # TODO: should they all be scoped under /projects/:project_id ?
# context "versions" do
# should route(:get, "/projects/foo/versions/new").to( :controller => 'versions', :action => 'new', :project_id => 'foo')
# should route(:get, "/versions/show/1").to( :controller => 'versions', :action => 'show', :id => '1')
# should route(:get, "/versions/edit/1").to( :controller => 'versions', :action => 'edit', :id => '1')
#
# should route(:post, "/projects/foo/versions").to( :controller => 'versions', :action => 'create', :project_id => 'foo')
# should route(:post, "/versions/update/1").to( :controller => 'versions', :action => 'update', :id => '1')
#
# should route(:delete, "/versions/destroy/1").to( :controller => 'versions', :action => 'destroy', :id => '1')
# end
#
# context "wiki (singular, project's pages)" do
# should route(:get, "/projects/567/wiki").to( :controller => 'wiki', :action => 'show', :project_id => '567')
# should route(:get, "/projects/567/wiki/lalala").to( :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala')
# should route(:get, "/projects/567/wiki/my_page/edit").to( :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page')
# should route(:get, "/projects/1/wiki/CookBook_documentation/history").to( :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation')
# should route(:get, "/projects/1/wiki/CookBook_documentation/diff").to( :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation')
# should route(:get, "/projects/1/wiki/CookBook_documentation/diff/2").to( :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2')
# should route(:get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1").to( :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1')
# should route(:get, "/projects/1/wiki/CookBook_documentation/annotate/2").to( :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2')
# should route(:get, "/projects/22/wiki/ladida/rename").to( :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida')
# should route(:get, "/projects/567/wiki/index").to( :controller => 'wiki', :action => 'index', :project_id => '567')
# should route(:get, "/projects/567/wiki/date_index").to( :controller => 'wiki', :action => 'date_index', :project_id => '567')
# should route(:get, "/projects/567/wiki/export").to( :controller => 'wiki', :action => 'export', :project_id => '567')
#
# should route(:post, "/projects/567/wiki/CookBook_documentation/preview").to( :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation')
# should route(:post, "/projects/22/wiki/ladida/rename").to( :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida')
# should route(:post, "/projects/22/wiki/ladida/protect").to( :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida')
# should route(:post, "/projects/22/wiki/ladida/add_attachment").to( :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida')
#
# should route(:put, "/projects/567/wiki/my_page").to( :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page')
#
# should route(:delete, "/projects/22/wiki/ladida").to( :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida')
# end
#
# context "wikis (plural, admin setup)" do
# should route(:get, "/projects/ladida/wiki/destroy").to( :controller => 'wikis', :action => 'destroy', :id => 'ladida')
#
# should route(:post, "/projects/ladida/wiki").to( :controller => 'wikis', :action => 'edit', :id => 'ladida')
# should route(:post, "/projects/ladida/wiki/destroy").to( :controller => 'wikis', :action => 'destroy', :id => 'ladida')
# end
#
# context "administration panel" do
# should route(:get, "/admin/projects").to( :controller => 'admin', :action => 'projects')
# end
#end

Loading…
Cancel
Save