##// END OF EJS Templates
route: split issue preview route to adding and editing...
Toshi MARUYAMA -
r8766:84dd4ecbd4a0
parent child
Show More
@@ -39,7 +39,7
39 <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %>
39 <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %>
40 <%= submit_tag l(:button_submit) %>
40 <%= submit_tag l(:button_submit) %>
41 <%= link_to_remote l(:label_preview),
41 <%= link_to_remote l(:label_preview),
42 { :url => preview_issue_path(:project_id => @project, :id => @issue),
42 { :url => preview_edit_issue_path(:project_id => @project, :id => @issue),
43 :method => 'post',
43 :method => 'post',
44 :update => 'preview',
44 :update => 'preview',
45 :with => 'Form.serialize("issue-form")',
45 :with => 'Form.serialize("issue-form")',
@@ -32,7 +32,7
32 <%= submit_tag l(:button_create) %>
32 <%= submit_tag l(:button_create) %>
33 <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
33 <%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
34 <%= link_to_remote l(:label_preview),
34 <%= link_to_remote l(:label_preview),
35 { :url => preview_issue_path(:project_id => @project),
35 { :url => preview_new_issue_path(:project_id => @project),
36 :method => 'post',
36 :method => 'post',
37 :update => 'preview',
37 :update => 'preview',
38 :with => "Form.serialize('issue-form')",
38 :with => "Form.serialize('issue-form')",
@@ -7,7 +7,7
7 <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %>
7 <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %>
8 <p><%= submit_tag l(:button_save) %>
8 <p><%= submit_tag l(:button_save) %>
9 <%= link_to_remote l(:label_preview),
9 <%= link_to_remote l(:label_preview),
10 { :url => preview_issue_path(:project_id => @project, :id => @journal.issue),
10 { :url => preview_edit_issue_path(:project_id => @project, :id => @journal.issue),
11 :method => 'post',
11 :method => 'post',
12 :update => "journal_#{@journal.id}_preview",
12 :update => "journal_#{@journal.id}_preview",
13 :with => "Form.serialize('journal-#{@journal.id}-form')",
13 :with => "Form.serialize('journal-#{@journal.id}-form')",
@@ -44,8 +44,10 ActionController::Routing::Routes.draw do |map|
44 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes',
44 map.auto_complete_issues '/issues/auto_complete', :controller => 'auto_completes',
45 :action => 'issues', :conditions => { :method => :get }
45 :action => 'issues', :conditions => { :method => :get }
46 # TODO: would look nicer as /issues/:id/preview
46 # TODO: would look nicer as /issues/:id/preview
47 map.preview_issue '/issues/preview/:id', :controller => 'previews',
47 map.preview_new_issue '/issues/preview/new/:project_id', :controller => 'previews',
48 :action => 'issue'
48 :action => 'issue'
49 map.preview_edit_issue '/issues/preview/edit/:id', :controller => 'previews',
50 :action => 'issue'
49 map.issues_context_menu '/issues/context_menu',
51 map.issues_context_menu '/issues/context_menu',
50 :controller => 'context_menus', :action => 'issues'
52 :controller => 'context_menus', :action => 'issues'
51
53
@@ -21,8 +21,12 class RoutingPreviewsTest < ActionController::IntegrationTest
21 def test_previews
21 def test_previews
22 ["get", "post"].each do |method|
22 ["get", "post"].each do |method|
23 assert_routing(
23 assert_routing(
24 { :method => method, :path => "/issues/preview/123" },
24 { :method => method, :path => "/issues/preview/new/123" },
25 { :controller => 'previews', :action => 'issue', :id => '123' }
25 { :controller => 'previews', :action => 'issue', :project_id => '123' }
26 )
27 assert_routing(
28 { :method => method, :path => "/issues/preview/edit/321" },
29 { :controller => 'previews', :action => 'issue', :id => '321' }
26 )
30 )
27 end
31 end
28 assert_routing(
32 assert_routing(
General Comments 0
You need to be logged in to leave comments. Login now