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 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 def find_optional_project
return true unless params[:id] return true unless params[:project_id]
@project = Project.find(params[:id]) @project = Project.find(params[:project_id])
authorize authorize
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404

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

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

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

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

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

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

@ -46,14 +46,6 @@ class IssuesController < ApplicationController
include IssuesHelper include IssuesHelper
include Redmine::Export::PDF 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 def index
sort_init(@query.sort_criteria.empty? ? [['parent', 'desc']] : @query.sort_criteria) sort_init(@query.sort_criteria.empty? ? [['parent', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns) sort_update(@query.sortable_columns)
@ -101,7 +93,7 @@ class IssuesController < ApplicationController
end end
def show 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? @journals.reverse! if User.current.wants_comments_in_reverse_order?
@changesets = @issue.changesets.visible.all @changesets = @issue.changesets.visible.all
@changesets.reverse! if User.current.wants_comments_in_reverse_order? @changesets.reverse! if User.current.wants_comments_in_reverse_order?

@ -13,10 +13,10 @@
#++ #++
class JournalsController < ApplicationController 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_issue, :only => [:new]
before_filter :find_optional_project, :only => [:index] 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 accept_key_auth :index
menu_item :issues menu_item :issues
@ -64,16 +64,6 @@ class JournalsController < ApplicationController
def edit def edit
(render_403; return false) unless @journal.editable_by?(User.current) (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| respond_to do |format|
format.html { format.html {
# TODO: implement non-JS journal update # TODO: implement non-JS journal update
@ -82,6 +72,16 @@ class JournalsController < ApplicationController
format.js format.js
end end
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 end
private private

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

@ -123,9 +123,10 @@ module ApplicationHelper
end end
end end
closed = issue.closed? ? content_tag(:span, l(:label_closed_issues), :class => "hidden-for-sighted") : "" 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, :class => issue.css_classes,
:title => title :title => h(title)
s << ": #{h subject}" if subject s << ": #{h subject}" if subject
s = "#{h issue.project} - " + s if options[:project] s = "#{h issue.project} - " + s if options[:project]
s s
@ -883,10 +884,11 @@ module ApplicationHelper
content_tag("label", label_text) content_tag("label", label_text)
end 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] ||= {}
options[:html][:class] = 'tabular' unless options[:html].has_key?(:class) 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 end
def back_url_hidden_field_tag def back_url_hidden_field_tag
@ -972,6 +974,32 @@ module ApplicationHelper
link_to h(name), url, options link_to h(name), url, options
end 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) def calendar_for(field_id)
include_calendar_headers_tags include_calendar_headers_tags
image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger", :alt => l(:label_calendar_show)}) + 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? unless journal.notes.blank?
links = [].tap do |l| links = [].tap do |l|
if reply_links if reply_links
l << link_to_remote(image_tag('comment.png', :alt => l(:button_quote), :title => l(:button_quote)), l << link_to(image_tag('comment.png', :alt => l(:button_quote), :title => l(:button_quote)),
:url => {:controller => controller, :action => action, :id => model, :journal_id => journal}) { :controller => controller,
:action => action,
:id => model,
:journal_id => journal },
:method => :get,
:remote => true)
end end
if editable 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", 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 # 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 # * :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 options = options.with_indifferent_access
raise ArgumentError, 'Missing :replace option in options hash' if options['replace'].blank? raise ArgumentError, 'Missing :replace option in options hash' if options['replace'].blank?
return '' unless user && user.logged? && object.respond_to?('watched_by?') return '' unless user && user.logged? && object.respond_to?('watched_by?')
watched = object.watched_by?(user) watched = object.watched_by?(user)
url = {:controller => 'watchers',
:action => (watched ? 'unwatch' : 'watch'), html_options = options
:object_type => object.class.to_s.underscore, path = send(:"#{(watched ? 'unwatch' : 'watch')}_path", :object_type => object.class.to_s.underscore.pluralize,
:object_id => object.id, :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)) label = watched ?
html_options[:class] = html_options[:class].to_s + (watched ? ' icon icon-fav' : ' icon icon-fav-off') 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 end
# Returns a comma separated list of users watching the given object # Returns a comma separated list of users watching the given object
def watchers_list(object) def watchers_list(object)
remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project)
lis = object.watcher_users.collect do |user| lis = object.watchers.collect do |watch|
s = avatar(user, :size => "16").to_s + link_to_user(user, :class => 'user').to_s s = avatar(watch.user, :size => "16").to_s + link_to_user(watch.user, :class => 'user').to_s
if remove_allowed if remove_allowed
url = {:controller => 'watchers', s += ' ' + link_to(image_tag('delete.png', :alt => l(:button_delete), :title => l(:button_delete)),
:action => 'destroy', watcher_path(watch), :method => :delete, :remote => true,
: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),
:style => "vertical-align: middle", :style => "vertical-align: middle",
:class => "delete") :class => "delete")
end end

@ -48,6 +48,17 @@ class Journal < ActiveRecord::Base
# logs like the history on issue#show # logs like the history on issue#show
scope "changing", :conditions => ["version > 1"] 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 def touch_journaled_after_creation
journaled.touch journaled.touch
end end

@ -5,9 +5,9 @@
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span> <span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
<% if options[:deletable] %> <% if options[:deletable] %>
<%= link_to image_tag('delete.png', :alt => l(:button_delete), :title => l(:button_delete)), <%= 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), { :confirm => l(:text_are_you_sure),
:method => :post, :method => :delete,
:class => 'delete', :class => 'delete',
:title => l(:button_delete) } %> :title => l(:button_delete) } %>
<% end %> <% end %>

@ -1,6 +1,6 @@
<h2><%= l(:label_board) %></h2> <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} %> <%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_save) %> <%= submit_tag l(:button_save) %>
<% end %> <% end %>

@ -1,6 +1,6 @@
<h2><%= l(:label_board_new) %></h2> <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} %> <%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create) %>
<% end %> <% end %>

@ -13,7 +13,7 @@ while day <= calendar.enddt %>
<% if i.is_a? Issue %> <% if i.is_a? Issue %>
<div class="<%= i.css_classes %> tooltip"> <div class="<%= i.css_classes %> tooltip">
<%= h("#{i.project} -") unless @project && @project == i.project %> <%= h("#{i.project} -") unless @project && @project == i.project %>
<% date_img = '' %> <%# date_img = '' %>
<% if day == i.start_date and day == i.due_date %> <% 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), <% 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") %> :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();" %> <p><%= f.select :relation_type, collection_for_relation_type_select, {}, :onchange => "setPredecessorFieldsVisibility();" %>
<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 10 %> <%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 10 %>
<div id="related_issue_candidates" class="autocomplete"></div> <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;"> <span id="predecessor_fields" style="display:none;">
<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %> <%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
</span> </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_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_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_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 %> <% end %>

@ -4,6 +4,7 @@
<p><%= f.select :tracker_id, @project.trackers.collect {|t| [t.name, t.id]}, :required => true %></p> <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 }, <%= observe_field :issue_tracker_id, :url => { :action => :new, :project_id => @project, :id => @issue },
:update => :attributes, :update => :attributes,
:method => :get,
:with => "Form.serialize('issue-form')" %> :with => "Form.serialize('issue-form')" %>
<p><%= f.text_field :subject, :size => 80, :required => true %></p> <p><%= f.text_field :subject, :size => 80, :required => true %></p>
@ -11,7 +12,7 @@
<% if User.current.allowed_to?(:manage_subtasks, @project) %> <% 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> <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> <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 %> <% end %>
<p><%= f.text_area :description, <p><%= f.text_area :description,

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

@ -64,7 +64,7 @@
<%= text_field_tag 'issue[parent_issue_id]', '', :size => 10 %> <%= text_field_tag 'issue[parent_issue_id]', '', :size => 10 %>
</p> </p>
<div id="parent_issue_candidates" class="autocomplete"></div> <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 %> <% end %>
<p> <p>
<label for='issue_start_date'><%= l(:field_start_date) %></label> <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> <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%> <%= hidden_field_tag('project_id', @project.to_param) if @project%>
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
<legend onclick="toggleFieldset(this);"><a href="javascript:"><%= l(:label_filter_plural) %></a></legend> <legend onclick="toggleFieldset(this);"><a href="javascript:"><%= l(:label_filter_plural) %></a></legend>
@ -21,13 +21,14 @@
<%= link_to_remote l(:button_apply), <%= link_to_remote l(:button_apply),
{ :url => { :set_filter => 1 }, { :url => { :set_filter => 1 },
:method => :get,
:update => "content", :update => "content",
:with => "Form.serialize('query_form')" :with => "Form.serialize('query_form')"
}, :class => 'icon icon-checked' %> }, :class => 'icon icon-checked' %>
<%= link_to_remote l(:button_clear), <%= link_to_remote l(:button_clear),
{ :url => { :project_id => @project, :set_filter => 1 }, { :url => { :project_id => @project, :set_filter => 1 },
:method => :put, :method => :get,
:update => "content", :update => "content",
}, :class => 'icon icon-reload' %> }, :class => 'icon icon-reload' %>
</p> </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 %> <% @gantt.view = self %>
<h2><%= @query.new_record? ? l(:label_gantt) : h(@query.name) %></h2> <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%> <%= hidden_field_tag('project_id', @project.to_param) if @project%>
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
<legend onclick="toggleFieldset(this);"><a href="javascript:"><%= l(:label_filter_plural) %></a></legend> <legend onclick="toggleFieldset(this);"><a href="javascript:"><%= l(:label_filter_plural) %></a></legend>
@ -24,13 +24,14 @@
<%= link_to_remote l(:button_apply), <%= link_to_remote l(:button_apply),
{ :url => { :set_filter => 1 }, { :url => { :set_filter => 1 },
:method => :get,
:update => "content", :update => "content",
:with => "Form.serialize('query_form')" :with => "Form.serialize('query_form')"
}, :class => 'icon icon-checked' %> }, :class => 'icon icon-checked' %>
<%= link_to_remote l(:button_clear), <%= link_to_remote l(:button_clear),
{ :url => { :project_id => @project, :set_filter => 1 }, { :url => { :project_id => @project, :set_filter => 1 },
:method => :put, :method => :get,
:update => "content", :update => "content",
}, :class => 'icon icon-reload' %> }, :class => 'icon icon-reload' %>
</p> </p>
@ -178,8 +179,12 @@ if Date.today >= @gantt.date_from and Date.today <= @gantt.date_to %>
<table width="100%"> <table width="100%">
<tr> <tr>
<td align="left"><%= link_to_content_update(l(:label_previous), params.merge(@gantt.params_previous), :class => 'navigate-left') %></td> <td align="left">
<td align="right"><%= link_to_content_update(l(:label_next), params.merge(@gantt.params_next), :class => 'navigate-right') %></td> <%= 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> </tr>
</table> </table>

@ -47,6 +47,7 @@
{ :url => { :set_filter => 1 }, { :url => { :set_filter => 1 },
:before => 'selectAllOptions("selected_columns");', :before => 'selectAllOptions("selected_columns");',
:update => "content", :update => "content",
:method => :get,
:complete => "apply_filters_observer()", :complete => "apply_filters_observer()",
:with => "Form.serialize('query_form')" :with => "Form.serialize('query_form')"
}, :class => 'icon icon-checked' %> }, :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 '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 'CSV', :url => { :project_id => @project } %>
<%= f.link_to 'PDF', :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 %> <% end %>
<%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %> <%= 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" %> <%= label_tag "notes", l(:description_notes), :class => "hidden-for-sighted" %>
<%= text_area_tag :notes, @journal.notes, :class => 'wiki-edit', <%= text_area_tag :notes, @journal.notes, :class => 'wiki-edit',

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

@ -19,7 +19,7 @@
</td> </td>
<td class="buttons"> <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_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> </td>
</tr> </tr>
<% end %> <% 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| %> <% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %>
<% field = filter[0] <% field = filter[0]
options = filter[1] %> 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;"> <td style="width:200px;">
<%= check_box_tag 'f[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %> <%= 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> <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> <strong><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</strong>
(<%= link_to_remote(l(:button_add_watcher), (<%= link_to(l(:button_add_watcher), new_watcher_path(:object_type => watched.class.name.underscore.pluralize,
:url => {:controller => 'watchers', :object_id => watched),
:action => 'new', :method => :get,
:object_type => watched.class.name.underscore, :remote => true
:object_id => watched}, ) if User.current.allowed_to?(:add_issue_watchers, @project)
:method => :get) if User.current.allowed_to?(:add_issue_watchers, @project)
%>) %>)
<% unless @watcher.nil? %> <% unless @watcher.nil? %>
<% remote_form_for(:watcher, @watcher, <% remote_form_for(:watcher, @watcher,

@ -52,20 +52,6 @@ OpenProject::Application.routes.draw do
end end
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 :controller => 'documents' do
scope :via => :get do scope :via => :get do
match '/projects/:project_id/documents', :action => :index match '/projects/:project_id/documents', :action => :index
@ -79,6 +65,30 @@ OpenProject::Application.routes.draw do
end end
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 resources :projects do
member do member do
# this route let's you access the project specific settings (by tab) # this route let's you access the project specific settings (by tab)
@ -124,73 +134,81 @@ OpenProject::Application.routes.draw do
end end
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 # should probably belong to :member, but requires :copy_from instead
# of the default :id # of the default :id
get ':copy_from/copy', :action => "new", :on => :collection, :as => "copy" get ':copy_from/copy', :action => "new", :on => :collection, :as => "copy"
collection do collection do
get :all get :all
get :bulk_edit
post :bulk_update
# get a preview of a new issue (i.e. one without an ID) # get a preview of a new issue (i.e. one without an ID)
match '/new/preview' => 'previews#issue', :as => 'preview_new', :via => :post 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 resources :boards
# defining an extra route prevents confusion with create
match '/query' => 'issues#index', :via => :post
end 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 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 end
# TODO: nest under issues resources collection do
scope 'issues' do get :bulk_edit, :format => false
match '/move' => "issue_moves#create", :via => :post put :bulk_update, :format => false
match '/move/new' => "issue_moves#new", :via => :get, :as => "new_issue_move"
delete :destroy
end
end end
# Misc issue routes. TODO: move into resources # 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/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/quoted' => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue'
match '/issues/:id/destroy' => 'issues#destroy', :via => :post # legacy 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 scope :controller => 'reports', :via => :get do
match '/projects/:id/issues/report', :action => :issue_report match '/projects/:id/issues/report', :action => :issue_report
match '/projects/:id/issues/report/:detail', :action => :issue_report_details match '/projects/:id/issues/report/:detail', :action => :issue_report_details
end end
resources :issues do resources :activity, :activities, :only => :index, :controller => 'activities'
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
scope :controller => 'issue_relations', :via => :post do 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 match '/issues/:issue_id/relations/:id/destroy', :action => :destroy
end end
match '/projects/:id/members/new' => 'members#new' match '/projects/:id/members/new' => 'members#new'
resources :users, :member => { resources :users, :member => {
:edit_membership => :post, :edit_membership => :post,
:destroy_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 # 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' 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 scope :controller => 'issue_categories' do
match '/projects/:project_id/issue_categories/new', :action => :new match '/projects/:project_id/issue_categories/new', :action => :new
end end
@ -250,14 +262,23 @@ OpenProject::Application.routes.draw do
match '/projects/:id/repository/:action', :via => :post match '/projects/:id/repository/:action', :via => :post
end end
match '/attachments/:id' => 'attachments#show', :id => /\d+/ resources :attachments, :only => [:show], :format => false do
match '/attachments/:id/:filename' => 'attachments#show', :id => /\d+/, :filename => /.*/ member do
match '/attachments/download/:id/:filename' => 'attachments#download', :id => /\d+/, :filename => /.*/ 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 resources :groups
#left old routes at the bottom for backwards compat #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/documents/:action', :controller => 'documents'
match '/projects/:project_id/boards/:action/:id', :controller => 'boards' match '/projects/:project_id/boards/:action/:id', :controller => 'boards'
match '/boards/:board_id/topics/:action/:id', :controller => 'messages' 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_issue_relations, {:issue_relations => [:new, :destroy]}
map.permission :manage_subtasks, {} map.permission :manage_subtasks, {}
map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]} map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]}
map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin map.permission :edit_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin
map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin map.permission :edit_own_issue_notes, {:journals => [:edit, :update]}, :require => :loggedin
map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin map.permission :move_issues, {:'issues/moves' => [:new, :create]}, :require => :loggedin
map.permission :delete_issues, {:issues => :destroy}, :require => :member map.permission :delete_issues, {:issues => :destroy}, :require => :member
# Queries # Queries
map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member
@ -146,7 +146,7 @@ Redmine::AccessControl.map do |map|
end end
map.project_module :boards do |map| 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 :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true
map.permission :add_messages, {:messages => [:new, :reply, :quote]} map.permission :add_messages, {:messages => [:new, :reply, :quote]}
map.permission :edit_messages, {:messages => :edit}, :require => :member map.permission :edit_messages, {:messages => :edit}, :require => :member
@ -156,11 +156,11 @@ Redmine::AccessControl.map do |map|
end end
map.project_module :calendar do |map| map.project_module :calendar do |map|
map.permission :view_calendar, :calendars => [:show, :update] map.permission :view_calendar, :'issues/calendars' => [:index]
end end
map.project_module :gantt do |map| map.project_module :gantt do |map|
map.permission :view_gantt, :gantts => [:show, :update] map.permission :view_gantt, :'issues/gantts' => [:index]
end end
end end
@ -220,7 +220,7 @@ Redmine::MenuManager.map :project_menu do |menu|
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } :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 :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 :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 :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 :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, menu.push :new_news, { :controller => 'news', :action => 'new' }, :param => :project_id, :caption => :label_news_new, :parent => :news,

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

@ -102,7 +102,7 @@ class AttachmentsControllerTest < ActionController::TestCase
def test_anonymous_on_private_private def test_anonymous_on_private_private
get :download, :id => 7 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 end
def test_destroy_issue_attachment def test_destroy_issue_attachment
@ -146,7 +146,7 @@ class AttachmentsControllerTest < ActionController::TestCase
def test_destroy_without_permission def test_destroy_without_permission
post :destroy, :id => 3 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) assert Attachment.find_by_id(3)
end end
end end

@ -49,10 +49,10 @@ class BoardsControllerTest < ActionController::TestCase
assert_not_nil assigns(:topics) assert_not_nil assigns(:topics)
end end
def test_post_new def test_create
@request.session[:user_id] = 2 @request.session[:user_id] = 2
assert_difference 'Board.count' do 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 end
assert_redirected_to '/projects/ecookbook/settings/boards' assert_redirected_to '/projects/ecookbook/settings/boards'
end end
@ -75,10 +75,10 @@ class BoardsControllerTest < ActionController::TestCase
assert_not_nil assigns(:messages) assert_not_nil assigns(:messages)
end end
def test_post_edit def test_update
@request.session[:user_id] = 2 @request.session[:user_id] = 2
assert_no_difference 'Board.count' do 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 end
assert_redirected_to '/projects/ecookbook/settings/boards' assert_redirected_to '/projects/ecookbook/settings/boards'
assert_equal 'Testing', Board.find(2).name assert_equal 'Testing', Board.find(2).name

@ -12,9 +12,9 @@
# See doc/COPYRIGHT.rdoc for more details. # 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 fixtures :all
def test_issues_should_not_be_case_sensitive def test_issues_should_not_be_case_sensitive

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

@ -12,9 +12,9 @@
# See doc/COPYRIGHT.rdoc for more details. # 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 fixtures :all
def test_context_menu_one_issue def test_context_menu_one_issue
@ -26,31 +26,31 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => '/issues/1/edit', :attributes => { :href => '/issues/1/edit',
:class => 'icon-edit' } :class => 'icon-edit' }
assert_tag :tag => 'a', :content => 'Closed', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Immediate', 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 => '' } :class => '' }
# Versions # Versions
assert_tag :tag => 'a', :content => '2.0', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'eCookbook Subproject 1 - 2.0', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Dave Lopper', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Duplicate', 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' } :class => 'icon-duplicate' }
assert_tag :tag => 'a', :content => 'Copy', assert_tag :tag => 'a', :content => 'Copy',
:attributes => { :href => '/issues/move/new?copy_options[copy]=t&amp;ids[]=1' } :attributes => { :href => '/issues/move/new?copy_options[copy]=t&amp;ids[]=1' }
assert_tag :tag => 'a', :content => 'Move', assert_tag :tag => 'a', :content => 'Move',
:attributes => { :href => '/issues/move/new?ids[]=1'} :attributes => { :href => '/issues/move/new?ids[]=1'}
assert_tag :tag => 'a', :content => 'Delete', assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => '/issues/destroy?ids[]=1' } :attributes => { :href => '/issues?ids[]=1' }
end end
def test_context_menu_one_issue_by_anonymous def test_context_menu_one_issue_by_anonymous
@ -73,20 +73,20 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => "/issues/bulk_edit?#{ids}", :attributes => { :href => "/issues/bulk_edit?#{ids}",
:class => 'icon-edit' } :class => 'icon-edit' }
assert_tag :tag => 'a', :content => 'Closed', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Immediate', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Dave Lopper', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Copy', assert_tag :tag => 'a', :content => 'Copy',
:attributes => { :href => "/issues/move/new?copy_options[copy]=t&amp;#{ids}"} :attributes => { :href => "/issues/move/new?copy_options[copy]=t&amp;#{ids}"}
assert_tag :tag => 'a', :content => 'Move', assert_tag :tag => 'a', :content => 'Move',
:attributes => { :href => "/issues/move/new?#{ids}"} :attributes => { :href => "/issues/move/new?#{ids}"}
assert_tag :tag => 'a', :content => 'Delete', assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => "/issues/destroy?#{ids}"} :attributes => { :href => "/issues?#{ids}"}
end end
def test_context_menu_multiple_issues_of_different_projects def test_context_menu_multiple_issues_of_different_projects
@ -102,16 +102,16 @@ class ContextMenusControllerTest < ActionController::TestCase
:attributes => { :href => "/issues/bulk_edit?#{ids}", :attributes => { :href => "/issues/bulk_edit?#{ids}",
:class => 'icon-edit' } :class => 'icon-edit' }
assert_tag :tag => 'a', :content => 'Closed', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Immediate', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'John Smith', 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 => '' } :class => '' }
assert_tag :tag => 'a', :content => 'Delete', assert_tag :tag => 'a', :content => 'Delete',
:attributes => { :href => "/issues/destroy?#{ids}"} :attributes => { :href => "/issues?#{ids}"}
end end
def test_context_menu_issue_visibility def test_context_menu_issue_visibility

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

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

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

@ -177,7 +177,7 @@ class UsersControllerTest < ActionController::TestCase
end end
user = User.first(:order => 'id DESC') 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 'John', user.firstname
assert_equal 'Doe', user.lastname assert_equal 'Doe', user.lastname

@ -125,7 +125,7 @@ class WatchersControllerTest < ActionController::TestCase
def test_remove_watcher def test_remove_watcher
@request.session[:user_id] = 2 @request.session[:user_id] = 2
assert_difference('Watcher.count', -1) do 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_response :success
assert_select_rjs :replace_html, 'watchers' assert_select_rjs :replace_html, 'watchers'
end end

@ -47,7 +47,7 @@ class WikiControllerTest < ActionController::TestCase
assert_tag :tag => 'h1', :content => /Another page/ assert_tag :tag => 'h1', :content => /Another page/
# Included page with an inline image # Included page with an inline image
assert_tag :tag => 'p', :content => /This is 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' } :alt => 'This is a logo' }
end end

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

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

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

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

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

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

@ -20,7 +20,7 @@ class MenuManagerTest < ActionController::IntegrationTest
def test_project_menu_with_specific_locale def test_project_menu_with_specific_locale
Setting.available_languages = [:fr, :en] 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' }, assert_tag :div, :attributes => { :id => 'main-menu' },
:descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_activity), :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 class RoutingTest < ActionController::IntegrationTest
context "activities" do context "activities" do
should_route :get, "/activity", :controller => 'activities', :action => 'index', :id => nil should route(:get, "/activity").to(:controller => 'activities', :action => 'index')
should_route :get, "/activity.atom", :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' 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 end
should "route /activites.atom to activities#index" do
context "attachments" do assert_recognizes({ :controller => 'activities', :action => 'index', :format => 'atom' }, "/activities.atom")
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'
end end
context "issue categories" do should route(:get, "projects/eCookbook/activity").to(:controller => 'activities', :action => 'index', :project_id => "eCookbook")
should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test' 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 end
should "route project/eCookbook/activites.atom to activities#index" do
context "issue relations" do assert_recognizes({ :controller => 'activities', :action => 'index', :format => 'atom', :project_id => "eCookbook" }, "/projects/eCookbook/activities.atom")
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'
end end
context "members" do
should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
end end
context "messages" do context "attachments" do
should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22' should route(:get, "/attachments/1").to( :controller => 'attachments',
should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' :action => 'show',
should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' :id => '1')
should route(:get, "/attachments/1/filename.ext").to( :controller => 'attachments',
should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala' :action => 'show',
should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala' :id => '1',
should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22' :filename => 'filename.ext' )
should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22' should route(:get, "/attachments/1/download").to( :controller => 'attachments',
end :action => 'download',
:id => '1' )
context "news" do should route(:get, "/attachments/1/download/filename.ext").to( :controller => 'attachments',
should_route :get, "/news", :controller => 'news', :action => 'index' :action => 'download',
should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom' :id => '1',
should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml' :filename => 'filename.ext' )
should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json' should "redirect /atttachments/download/1 to /attachments/1/download" do
should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567' get '/attachments/download/1'
should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567' assert_redirected_to '/attachments/1/download'
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'
end end
context "timelogs (scoped under project)" do should "redirect /atttachments/download/1/filename.ext to /attachments/1/download/filename.ext" do
should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567' get '/attachments/download/1/filename.ext'
should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv' assert_redirected_to '/attachments/1/download/filename.ext'
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'
end 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 end
context "timelogs (scoped under project and issues)" do context "boards" do
should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook' should route(:get, "/projects/world_domination/boards").to( :controller => 'boards',
should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' :action => 'index',
should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' :project_id => 'world_domination')
should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook' should route(:get, "/projects/world_domination/boards/new").to( :controller => 'boards',
should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook' :action => 'new',
:project_id => 'world_domination')
should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook' should route(:post, "/projects/world_domination/boards").to( :controller => 'boards',
:action => 'create',
should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook' :project_id => 'world_domination')
should route(:get, "/projects/world_domination/boards/44").to( :controller => 'boards',
should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook' :action => 'show',
end :project_id => 'world_domination',
:id => '44')
context "time_entry_reports" do should route(:get, "/projects/world_domination/boards/44.atom").to( :controller => 'boards',
should_route :get, "/time_entries/report", :controller => 'time_entry_reports', :action => 'report' :action => 'show',
should_route :get, "/projects/567/time_entries/report", :controller => 'time_entry_reports', :action => 'report', :project_id => '567' :project_id => 'world_domination',
should_route :get, "/projects/567/time_entries/report.csv", :controller => 'time_entry_reports', :action => 'report', :project_id => '567', :format => 'csv' :id => '44',
end :format => 'atom')
should route(:get, "/projects/world_domination/boards/44/edit").to( :controller => 'boards',
context "users" do :action => 'edit',
should_route :get, "/users", :controller => 'users', :action => 'index' :project_id => 'world_domination',
should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml' :id => '44')
should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44' should route(:put, "/projects/world_domination/boards/44").to( :controller => 'boards',
should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml' :action => 'update',
should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current' :project_id => 'world_domination',
should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml' :id => '44')
should_route :get, "/users/new", :controller => 'users', :action => 'new' should route(:delete, "/projects/world_domination/boards/44").to( :controller => 'boards',
should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444' :action => 'destroy',
should_route :get, "/users/222/edit/membership", :controller => 'users', :action => 'edit', :id => '222', :tab => 'membership' :project_id => 'world_domination',
:id => '44')
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'
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 end
# TODO: should they all be scoped under /projects/:project_id ? context "documents" do
context "versions" do should route(:get, "/projects/567/documents").to( :controller => 'documents', :action => 'index', :project_id => '567')
should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo' should route(:get, "/projects/567/documents/new").to( :controller => 'documents', :action => 'new', :project_id => '567')
should_route :get, "/versions/show/1", :controller => 'versions', :action => 'show', :id => '1' should route(:get, "/documents/22").to( :controller => 'documents', :action => 'show', :id => '22')
should_route :get, "/versions/edit/1", :controller => 'versions', :action => 'edit', :id => '1' should route(:get, "/documents/22/edit").to( :controller => 'documents', :action => 'edit', :id => '22')
should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo' should route(:post, "/projects/567/documents/new").to( :controller => 'documents', :action => 'new', :project_id => '567')
should_route :post, "/versions/update/1", :controller => 'versions', :action => 'update', :id => '1' 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')
should_route :delete, "/versions/destroy/1", :controller => 'versions', :action => 'destroy', :id => '1'
end end
context "wiki (singular, project's pages)" do context "issues" do
should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567' # REST actions
should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala' should route(:get, "/issues").to( :controller => 'issues',
should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page' :action => 'index')
should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation' should route(:get, "/issues.pdf").to( :controller => 'issues',
should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation' :action => 'index',
should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2' :format => 'pdf')
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, "/issues.atom").to( :controller => 'issues',
should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2' :action => 'index',
should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' :format => 'atom')
should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567' should route(:get, "/issues.xml").to( :controller => 'issues',
should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567' :action => 'index',
should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567' :format => 'xml')
should route(:get, "/projects/23/issues").to( :controller => 'issues',
should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation' :action => 'index',
should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida' :project_id => '23')
should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida' should route(:get, "/projects/23/issues.pdf").to( :controller => 'issues',
should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida' :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 end
context "wikis (plural, admin setup)" do context "watches" do
should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' ['issues', 'messages, boards'].each do |type|
should route(:post, "/#{type}/1/watch").to( :controller => 'watchers',
should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida' :action => 'watch',
should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida' :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 end
context "administration panel" do should route(:delete, "/watchers/1").to( :controller => 'watchers',
should_route :get, "/admin/projects", :controller => 'admin', :action => 'projects' :action => 'destroy',
:id => '1' )
end end
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