@@ -995,6 +995,14 module ApplicationHelper | |||
|
995 | 995 | link_to l(:button_delete), url, options |
|
996 | 996 | end |
|
997 | 997 | |
|
998 | def preview_link(url, form, target='preview', options={}) | |
|
999 | content_tag 'a', l(:label_preview), { | |
|
1000 | :href => "#", | |
|
1001 | :onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|, | |
|
1002 | :accesskey => accesskey(:preview) | |
|
1003 | }.merge(options) | |
|
1004 | end | |
|
1005 | ||
|
998 | 1006 | def back_url_hidden_field_tag |
|
999 | 1007 | back_url = params[:back_url] || request.env['HTTP_REFERER'] |
|
1000 | 1008 | back_url = CGI.unescape(back_url.to_s) |
@@ -14,13 +14,7 | |||
|
14 | 14 | <%= form_for @message, :url => {:controller => 'messages', :action => 'new', :board_id => @board}, :html => {:multipart => true, :id => 'message-form'} do |f| %> |
|
15 | 15 | <%= render :partial => 'messages/form', :locals => {:f => f} %> |
|
16 | 16 | <p><%= submit_tag l(:button_create) %> |
|
17 | <%= link_to_remote l(:label_preview), | |
|
18 | { :url => { :controller => 'messages', :action => 'preview', :board_id => @board }, | |
|
19 | :method => 'post', | |
|
20 | :update => 'preview', | |
|
21 | :with => "Form.serialize('message-form')", | |
|
22 | :complete => "Element.scrollTo('preview')" | |
|
23 | }, :accesskey => accesskey(:preview) %> | | |
|
17 | <%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %> | | |
|
24 | 18 | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-message")' %></p> |
|
25 | 19 | <% end %> |
|
26 | 20 | <div id="preview" class="wiki"></div> |
@@ -38,13 +38,7 | |||
|
38 | 38 | <%= f.hidden_field :lock_version %> |
|
39 | 39 | <%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %> |
|
40 | 40 | <%= submit_tag l(:button_submit) %> |
|
41 | <%= link_to_remote l(:label_preview), | |
|
42 | { :url => preview_edit_issue_path(:project_id => @project, :id => @issue), | |
|
43 | :method => 'post', | |
|
44 | :update => 'preview', | |
|
45 | :with => 'Form.serialize("issue-form")', | |
|
46 | :complete => "Element.scrollTo('preview')" | |
|
47 | }, :accesskey => accesskey(:preview) %> | |
|
41 | <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @issue), 'issue-form' %> | |
|
48 | 42 | <% end %> |
|
49 | 43 | |
|
50 | 44 | <div id="preview" class="wiki"></div> |
@@ -36,13 +36,7 | |||
|
36 | 36 | |
|
37 | 37 | <%= submit_tag l(:button_create) %> |
|
38 | 38 | <%= submit_tag l(:button_create_and_continue), :name => 'continue' %> |
|
39 | <%= link_to_remote l(:label_preview), | |
|
40 | { :url => preview_new_issue_path(:project_id => @project), | |
|
41 | :method => 'post', | |
|
42 | :update => 'preview', | |
|
43 | :with => "Form.serialize('issue-form')", | |
|
44 | :complete => "Element.scrollTo('preview')" | |
|
45 | }, :accesskey => accesskey(:preview) %> | |
|
39 | <%= preview_link preview_new_issue_path(:project_id => @project), 'issue-form' %> | |
|
46 | 40 | |
|
47 | 41 | <%= javascript_tag "Form.Element.focus('issue_subject');" %> |
|
48 | 42 | <% end %> |
@@ -6,14 +6,9 | |||
|
6 | 6 | :rows => (@journal.notes.blank? ? 10 : [[10, @journal.notes.length / 50].max, 100].min) %> |
|
7 | 7 | <%= call_hook(:view_journals_notes_form_after_notes, { :journal => @journal}) %> |
|
8 | 8 | <p><%= submit_tag l(:button_save) %> |
|
9 | <%= link_to_remote l(:label_preview), | |
|
10 | { :url => preview_edit_issue_path(:project_id => @project, :id => @journal.issue), | |
|
11 | :method => 'post', | |
|
12 | :update => "journal_#{@journal.id}_preview", | |
|
13 | :with => "Form.serialize('journal-#{@journal.id}-form')", | |
|
14 | :complete => "Element.scrollTo('journal_#{@journal.id}_preview')" | |
|
15 | }, :accesskey => accesskey(:preview) %> | |
|
16 | | | |
|
9 | <%= preview_link preview_edit_issue_path(:project_id => @project, :id => @journal.issue), | |
|
10 | "journal-#{@journal.id}-form", | |
|
11 | "journal_#{@journal.id}_preview" %> | | |
|
17 | 12 | <%= link_to l(:button_cancel), '#', :onclick => "Element.remove('journal-#{@journal.id}-form'); " + |
|
18 | 13 | "Element.show('journal-#{@journal.id}-notes'); return false;" %></p> |
|
19 | 14 |
@@ -12,14 +12,7 | |||
|
12 | 12 | <%= render :partial => 'form', |
|
13 | 13 | :locals => {:f => f, :replying => !@message.parent.nil?} %> |
|
14 | 14 | <%= submit_tag l(:button_save) %> |
|
15 | <%= link_to_remote l(:label_preview), | |
|
16 | { :url => { :controller => 'messages', | |
|
17 | :action => 'preview', :board_id => @board, :id => @message }, | |
|
18 | :method => 'post', | |
|
19 | :update => 'preview', | |
|
20 | :with => "Form.serialize('message-form')", | |
|
21 | :complete => "Element.scrollTo('preview')" | |
|
22 | }, :accesskey => accesskey(:preview) %> | |
|
15 | <%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board, :id => @message}, 'message-form') %> | |
|
23 | 16 | <% end %> |
|
24 | 17 | <div id="preview" class="wiki"></div> |
|
25 | 18 |
@@ -3,13 +3,7 | |||
|
3 | 3 | <%= form_for @message, :url => {:action => 'new'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> |
|
4 | 4 | <%= render :partial => 'form', :locals => {:f => f} %> |
|
5 | 5 | <%= submit_tag l(:button_create) %> |
|
6 | <%= link_to_remote l(:label_preview), | |
|
7 | { :url => { :controller => 'messages', :action => 'preview', :board_id => @board }, | |
|
8 | :method => 'post', | |
|
9 | :update => 'preview', | |
|
10 | :with => "Form.serialize('message-form')", | |
|
11 | :complete => "Element.scrollTo('preview')" | |
|
12 | }, :accesskey => accesskey(:preview) %> | |
|
6 | <%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %> | |
|
13 | 7 | <% end %> |
|
14 | 8 | |
|
15 | 9 | <div id="preview" class="wiki"></div> |
@@ -75,13 +75,7 | |||
|
75 | 75 | <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message-form'} do |f| %> |
|
76 | 76 | <%= render :partial => 'form', :locals => {:f => f, :replying => true} %> |
|
77 | 77 | <%= submit_tag l(:button_submit) %> |
|
78 | <%= link_to_remote l(:label_preview), | |
|
79 | { :url => { :controller => 'messages', :action => 'preview', :board_id => @board }, | |
|
80 | :method => 'post', | |
|
81 | :update => 'preview', | |
|
82 | :with => "Form.serialize('message-form')", | |
|
83 | :complete => "Element.scrollTo('preview')" | |
|
84 | }, :accesskey => accesskey(:preview) %> | |
|
78 | <%= preview_link({:controller => 'messages', :action => 'preview', :board_id => @board}, 'message-form') %> | |
|
85 | 79 | <% end %> |
|
86 | 80 | <div id="preview" class="wiki"></div> |
|
87 | 81 | </div> |
@@ -3,12 +3,7 | |||
|
3 | 3 | <%= labelled_form_for @news, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> |
|
4 | 4 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
5 | 5 | <%= submit_tag l(:button_save) %> |
|
6 | <%= link_to_remote l(:label_preview), | |
|
7 | { :url => preview_news_path(:project_id => @project), | |
|
8 | :method => 'get', | |
|
9 | :update => 'preview', | |
|
10 | :with => "Form.serialize('news-form')" | |
|
11 | }, :accesskey => accesskey(:preview) %> | |
|
6 | <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | |
|
12 | 7 | <% end %> |
|
13 | 8 | <div id="preview" class="wiki"></div> |
|
14 | 9 |
@@ -11,12 +11,7 | |||
|
11 | 11 | :html => { :id => 'news-form', :multipart => true } do |f| %> |
|
12 | 12 | <%= render :partial => 'news/form', :locals => { :f => f } %> |
|
13 | 13 | <%= submit_tag l(:button_create) %> |
|
14 | <%= link_to_remote l(:label_preview), | |
|
15 | { :url => preview_news_path(:project_id => @project), | |
|
16 | :method => 'get', | |
|
17 | :update => 'preview', | |
|
18 | :with => "Form.serialize('news-form')" | |
|
19 | }, :accesskey => accesskey(:preview) %> | | |
|
14 | <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | | |
|
20 | 15 | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %> |
|
21 | 16 | <% end if @project %> |
|
22 | 17 | <div id="preview" class="wiki"></div> |
@@ -4,11 +4,6 | |||
|
4 | 4 | :html => { :id => 'news-form', :multipart => true } do |f| %> |
|
5 | 5 | <%= render :partial => 'news/form', :locals => { :f => f } %> |
|
6 | 6 | <%= submit_tag l(:button_create) %> |
|
7 | <%= link_to_remote l(:label_preview), | |
|
8 | { :url => preview_news_path(:project_id => @project), | |
|
9 | :method => 'get', | |
|
10 | :update => 'preview', | |
|
11 | :with => "Form.serialize('news-form')" | |
|
12 | }, :accesskey => accesskey(:preview) %> | |
|
7 | <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | |
|
13 | 8 | <% end %> |
|
14 | 9 | <div id="preview" class="wiki"></div> |
@@ -16,12 +16,7 | |||
|
16 | 16 | :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> |
|
17 | 17 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
18 | 18 | <%= submit_tag l(:button_save) %> |
|
19 | <%= link_to_remote l(:label_preview), | |
|
20 | { :url => preview_news_path(:project_id => @project), | |
|
21 | :method => 'get', | |
|
22 | :update => 'preview', | |
|
23 | :with => "Form.serialize('news-form')" | |
|
24 | }, :accesskey => accesskey(:preview) %> | | |
|
19 | <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | | |
|
25 | 20 | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news"); return false;' %> |
|
26 | 21 | <% end %> |
|
27 | 22 | <div id="preview" class="wiki"></div> |
@@ -33,14 +33,7 | |||
|
33 | 33 | </div> |
|
34 | 34 | |
|
35 | 35 | <p><%= submit_tag l(:button_save) %> |
|
36 | <%= link_to_remote l(:label_preview), | |
|
37 | { :url => { :controller => 'wiki', :action => 'preview', | |
|
38 | :project_id => @project, :id => @page.title }, | |
|
39 | :method => :post, | |
|
40 | :update => 'preview', | |
|
41 | :with => "Form.serialize('wiki_form')", | |
|
42 | :complete => "Element.scrollTo('preview')" | |
|
43 | }, :accesskey => accesskey(:preview) %></p> | |
|
36 | <%= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %></p> | |
|
44 | 37 | <%= wikitoolbar_for 'content_text' %> |
|
45 | 38 | <% end %> |
|
46 | 39 |
@@ -337,6 +337,16 function hideModal(el) { | |||
|
337 | 337 | } |
|
338 | 338 | } |
|
339 | 339 | |
|
340 | function submitPreview(url, form, target) { | |
|
341 | new Ajax.Updater(target, url, { | |
|
342 | asynchronous:true, | |
|
343 | evalScripts:true, | |
|
344 | method:'post', | |
|
345 | onComplete:function(request){Element.scrollTo(target)}, | |
|
346 | parameters:Form.serialize(form) | |
|
347 | }); | |
|
348 | } | |
|
349 | ||
|
340 | 350 | function collapseScmEntry(id) { |
|
341 | 351 | var els = document.getElementsByClassName(id, 'browser'); |
|
342 | 352 | for (var i = 0; i < els.length; i++) { |
General Comments 0
You need to be logged in to leave comments.
Login now