To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / app / controllers / previews_controller.rb @ 438:34214e593c67
History | View | Annotate | Download (957 Bytes)
| 1 |
class PreviewsController < ApplicationController |
|---|---|
| 2 |
before_filter :find_project
|
| 3 |
|
| 4 |
def issue |
| 5 |
@issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank? |
| 6 |
if @issue |
| 7 |
@attachements = @issue.attachments |
| 8 |
@description = params[:issue] && params[:issue][:description] |
| 9 |
if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n") |
| 10 |
@description = nil |
| 11 |
end
|
| 12 |
@notes = params[:notes] |
| 13 |
else
|
| 14 |
@description = (params[:issue] ? params[:issue][:description] : nil) |
| 15 |
end
|
| 16 |
render :layout => false |
| 17 |
end
|
| 18 |
|
| 19 |
def news |
| 20 |
@text = (params[:news] ? params[:news][:description] : nil) |
| 21 |
render :partial => 'common/preview' |
| 22 |
end
|
| 23 |
|
| 24 |
private |
| 25 |
|
| 26 |
def find_project |
| 27 |
project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id] |
| 28 |
@project = Project.find(project_id) |
| 29 |
rescue ActiveRecord::RecordNotFound |
| 30 |
render_404 |
| 31 |
end
|
| 32 |
|
| 33 |
end
|