@@ -17,7 +17,7 | |||
|
17 | 17 | |
|
18 | 18 | class IssuesController < ApplicationController |
|
19 | 19 | layout 'base', :except => :export_pdf |
|
20 | before_filter :find_project, :authorize, :except => :index | |
|
20 | before_filter :find_project, :authorize, :except => [:index, :preview] | |
|
21 | 21 | accept_key_auth :index |
|
22 | 22 | |
|
23 | 23 | cache_sweeper :issue_sweeper, :only => [ :edit, :change_status, :destroy ] |
@@ -167,6 +167,13 class IssuesController < ApplicationController | |||
|
167 | 167 | redirect_to :action => 'show', :id => @issue |
|
168 | 168 | end |
|
169 | 169 | |
|
170 | def preview | |
|
171 | issue = Issue.find_by_id(params[:id]) | |
|
172 | @attachements = issue.attachments if issue | |
|
173 | @text = params[:issue][:description] | |
|
174 | render :partial => 'common/preview' | |
|
175 | end | |
|
176 | ||
|
170 | 177 | private |
|
171 | 178 | def find_project |
|
172 | 179 | @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) |
@@ -144,7 +144,7 class WikiController < ApplicationController | |||
|
144 | 144 | page = @wiki.find_page(params[:page]) |
|
145 | 145 | @attachements = page.attachments if page |
|
146 | 146 | @text = params[:content][:text] |
|
147 | render :partial => 'preview' | |
|
147 | render :partial => 'common/preview' | |
|
148 | 148 | end |
|
149 | 149 | |
|
150 | 150 | def add_attachment |
|
1 | NO CONTENT: file renamed from app/views/wiki/_preview.rhtml to app/views/common/_preview.rhtml |
@@ -25,7 +25,11 | |||
|
25 | 25 | </div> |
|
26 | 26 | |
|
27 | 27 | <p><%= f.text_field :subject, :size => 80, :required => true %></p> |
|
28 | <p><%= f.text_area :description, :required => true, :cols => 60, :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), :class => 'wiki-edit' %></p> | |
|
28 | <p><%= f.text_area :description, :required => true, | |
|
29 | :cols => 60, | |
|
30 | :rows => (@issue.description.blank? ? 10 : [[10, @issue.description.length / 50].max, 100].min), | |
|
31 | :accesskey => accesskey(:edit), | |
|
32 | :class => 'wiki-edit' %></p> | |
|
29 | 33 | <p><%= f.select :fixed_version_id, (@project.versions.sort.collect {|v| [v.name, v.id]}), { :include_blank => true } %></p> |
|
30 | 34 | <% for @custom_value in @custom_values %> |
|
31 | 35 | <p><%= custom_field_tag_with_label @custom_value %></p> |
@@ -1,7 +1,19 | |||
|
1 | 1 | <h2><%=h "#{@issue.tracker.name} ##{@issue.id}" %></h2> |
|
2 | 2 | |
|
3 |
<% labelled_tabular_form_for :issue, @issue, |
|
|
3 | <% labelled_tabular_form_for :issue, @issue, | |
|
4 | :url => {:action => 'edit'}, | |
|
5 | :html => {:id => 'issue-form'} do |f| %> | |
|
4 | 6 | <%= render :partial => 'form', :locals => {:f => f} %> |
|
5 | 7 | <%= f.hidden_field :lock_version %> |
|
6 | 8 | <%= submit_tag l(:button_save) %> |
|
9 | <%= link_to_remote l(:label_preview), | |
|
10 | { :url => { :controller => 'issues', :action => 'preview', :id => @issue }, | |
|
11 | :method => 'post', | |
|
12 | :update => 'preview', | |
|
13 | :with => "Form.serialize('issue-form')", | |
|
14 | :complete => "location.href='#preview-top'" | |
|
15 | }, :accesskey => accesskey(:preview) %> | |
|
7 | 16 | <% end %> |
|
17 | ||
|
18 | <a name="preview-top"></a> | |
|
19 | <div id="preview" class="wiki"></div> |
@@ -1,7 +1,19 | |||
|
1 | 1 | <h2><%=l(:label_issue_new)%>: <%= @tracker.name %></h2> |
|
2 | 2 | |
|
3 | <% labelled_tabular_form_for :issue, @issue, :url => {:action => 'add_issue'}, :html => {:multipart => true} do |f| %> | |
|
3 | <% labelled_tabular_form_for :issue, @issue, | |
|
4 | :url => {:action => 'add_issue'}, | |
|
5 | :html => {:multipart => true, :id => 'issue-form'} do |f| %> | |
|
4 | 6 | <%= hidden_field_tag 'tracker_id', @tracker.id %> |
|
5 | 7 | <%= render :partial => 'issues/form', :locals => {:f => f} %> |
|
6 | 8 | <%= submit_tag l(:button_create) %> |
|
9 | <%= link_to_remote l(:label_preview), | |
|
10 | { :url => { :controller => 'issues', :action => 'preview', :id => @issue }, | |
|
11 | :method => 'post', | |
|
12 | :update => 'preview', | |
|
13 | :with => "Form.serialize('issue-form')", | |
|
14 | :complete => "location.href='#preview-top'" | |
|
15 | }, :accesskey => accesskey(:preview) %> | |
|
7 | 16 | <% end %> |
|
17 | ||
|
18 | <a name="preview-top"></a> | |
|
19 | <div id="preview" class="wiki"></div> |
General Comments 0
You need to be logged in to leave comments.
Login now