@@ -17,7 +17,7 | |||||
17 |
|
17 | |||
18 | class IssuesController < ApplicationController |
|
18 | class IssuesController < ApplicationController | |
19 | layout 'base', :except => :export_pdf |
|
19 | layout 'base', :except => :export_pdf | |
20 | before_filter :find_project, :authorize, :except => :index |
|
20 | before_filter :find_project, :authorize, :except => [:index, :preview] | |
21 | accept_key_auth :index |
|
21 | accept_key_auth :index | |
22 |
|
22 | |||
23 | cache_sweeper :issue_sweeper, :only => [ :edit, :change_status, :destroy ] |
|
23 | cache_sweeper :issue_sweeper, :only => [ :edit, :change_status, :destroy ] | |
@@ -167,6 +167,13 class IssuesController < ApplicationController | |||||
167 | redirect_to :action => 'show', :id => @issue |
|
167 | redirect_to :action => 'show', :id => @issue | |
168 | end |
|
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 | private |
|
177 | private | |
171 | def find_project |
|
178 | def find_project | |
172 | @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) |
|
179 | @issue = Issue.find(params[:id], :include => [:project, :tracker, :status, :author, :priority, :category]) |
@@ -144,7 +144,7 class WikiController < ApplicationController | |||||
144 | page = @wiki.find_page(params[:page]) |
|
144 | page = @wiki.find_page(params[:page]) | |
145 | @attachements = page.attachments if page |
|
145 | @attachements = page.attachments if page | |
146 | @text = params[:content][:text] |
|
146 | @text = params[:content][:text] | |
147 | render :partial => 'preview' |
|
147 | render :partial => 'common/preview' | |
148 | end |
|
148 | end | |
149 |
|
149 | |||
150 | def add_attachment |
|
150 | def add_attachment |
1 | NO CONTENT: file renamed from app/views/wiki/_preview.rhtml to app/views/common/_preview.rhtml |
|
NO CONTENT: file renamed from app/views/wiki/_preview.rhtml to app/views/common/_preview.rhtml |
@@ -25,7 +25,11 | |||||
25 | </div> |
|
25 | </div> | |
26 |
|
26 | |||
27 | <p><%= f.text_field :subject, :size => 80, :required => true %></p> |
|
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 | <p><%= f.select :fixed_version_id, (@project.versions.sort.collect {|v| [v.name, v.id]}), { :include_blank => true } %></p> |
|
33 | <p><%= f.select :fixed_version_id, (@project.versions.sort.collect {|v| [v.name, v.id]}), { :include_blank => true } %></p> | |
30 | <% for @custom_value in @custom_values %> |
|
34 | <% for @custom_value in @custom_values %> | |
31 | <p><%= custom_field_tag_with_label @custom_value %></p> |
|
35 | <p><%= custom_field_tag_with_label @custom_value %></p> |
@@ -1,7 +1,19 | |||||
1 | <h2><%=h "#{@issue.tracker.name} ##{@issue.id}" %></h2> |
|
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 | <%= render :partial => 'form', :locals => {:f => f} %> |
|
6 | <%= render :partial => 'form', :locals => {:f => f} %> | |
5 | <%= f.hidden_field :lock_version %> |
|
7 | <%= f.hidden_field :lock_version %> | |
6 | <%= submit_tag l(:button_save) %> |
|
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 | <% end %> |
|
16 | <% end %> | |
|
17 | ||||
|
18 | <a name="preview-top"></a> | |||
|
19 | <div id="preview" class="wiki"></div> |
@@ -1,7 +1,19 | |||||
1 | <h2><%=l(:label_issue_new)%>: <%= @tracker.name %></h2> |
|
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 | <%= hidden_field_tag 'tracker_id', @tracker.id %> |
|
6 | <%= hidden_field_tag 'tracker_id', @tracker.id %> | |
5 | <%= render :partial => 'issues/form', :locals => {:f => f} %> |
|
7 | <%= render :partial => 'issues/form', :locals => {:f => f} %> | |
6 | <%= submit_tag l(:button_create) %> |
|
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 | <% end %> |
|
16 | <% end %> | |
|
17 | ||||
|
18 | <a name="preview-top"></a> | |||
|
19 | <div id="preview" class="wiki"></div> |
@@ -139,6 +139,8 text-align: left; | |||||
139 | width: 200px; |
|
139 | width: 200px; | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
|
142 | #preview fieldset {margin-top: 1em; background: url(../images/draft.png)} | |||
|
143 | ||||
142 | #settings .tabular p{ padding-left: 300px; } |
|
144 | #settings .tabular p{ padding-left: 300px; } | |
143 | #settings .tabular label{ margin-left: -300px; width: 295px; } |
|
145 | #settings .tabular label{ margin-left: -300px; width: 295px; } | |
144 |
|
146 |
General Comments 0
You need to be logged in to leave comments.
Login now