annotate app/controllers/previews_controller.rb @ 45:65d9e2cabaa3 luisf

Added tipoftheday to the config/settings in order to correct previous issues. Tip of the day is now working correctly. Added the heading strings to the locales files.
author luisf
date Tue, 23 Nov 2010 11:50:01 +0000
parents 94944d00e43c
children cbce1fd3b1b7
rev   line source
Chris@14 1 class PreviewsController < ApplicationController
Chris@14 2 before_filter :find_project
Chris@14 3
Chris@14 4 def issue
Chris@14 5 @issue = @project.issues.find_by_id(params[:id]) unless params[:id].blank?
Chris@14 6 if @issue
Chris@14 7 @attachements = @issue.attachments
Chris@14 8 @description = params[:issue] && params[:issue][:description]
Chris@14 9 if @description && @description.gsub(/(\r?\n|\n\r?)/, "\n") == @issue.description.to_s.gsub(/(\r?\n|\n\r?)/, "\n")
Chris@14 10 @description = nil
Chris@14 11 end
Chris@14 12 @notes = params[:notes]
Chris@14 13 else
Chris@14 14 @description = (params[:issue] ? params[:issue][:description] : nil)
Chris@14 15 end
Chris@14 16 render :layout => false
Chris@14 17 end
Chris@14 18
chris@37 19 def news
chris@37 20 @text = (params[:news] ? params[:news][:description] : nil)
chris@37 21 render :partial => 'common/preview'
chris@37 22 end
chris@37 23
Chris@14 24 private
Chris@14 25
Chris@14 26 def find_project
Chris@14 27 project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
Chris@14 28 @project = Project.find(project_id)
Chris@14 29 rescue ActiveRecord::RecordNotFound
Chris@14 30 render_404
Chris@14 31 end
Chris@14 32
Chris@14 33 end