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