#-- # Copyright (C) 2007 Dimitrij Denissenko # Please read LICENSE document for more information. #++ class ApplicationController < ActionController::Base include ExceptionNotifiable before_filter :set_locale before_filter :set_layout_markers before_filter :authenticate after_filter :reset_current_project def markup_reference @examples = load_markup_reference_examples render :template => 'shared/markup_reference', :layout => 'markup_reference' end protected def render_404 respond_to do |type| type.html { render :template => 'rescues/404', :layout => 'application', :status => '404 Not Found' } type.all { render :nothing => true, :status => '404 Not Found' } end end def render_500 respond_to do |type| type.html { render :template => 'rescues/500', :layout => 'application', :status => '500 Error' } type.all { render :nothing => true, :status => '500 Error' } end end def determine_author User.current.public? ? (cookies['author_name'] || 'Anonymous') : User.current.name end def determine_email User.current.public? ? (cookies['author_email'] || '') : User.current.email end def cookie_save_author(author, email = nil) cookies['author_name'] = { 'value' => author, 'expires' => 6.months.from_now } if email cookies['author_email'] = { 'value' => email, 'expires' => 6.months.from_now } end end def load_markup_reference_examples examples = WikiEngine.default.markup_examples examples[_('Links')] += [ "A solution to this problem can be found\nin changeset \[712\]", "This problem is described in Ticket [#3733]", ] examples end def self.verify_action(name, options = {}) self.verify(options.merge(:only => name)) end # Set RetroI18n locale def set_locale RetroI18n.locale = RetroCM[:general][:basic][:locale] end private # Sets layout markers for each request def set_layout_markers @additional_header_data = RetroCM[:content][:custom][:header] || '' @additional_footer_data = '' end def reset_current_project Project.current = nil end end