Class: ReportController
Instance Method Summary
collapse
#check_desired_login_available, #drop_top_crumbs, #set_locale, #setup_renderer
#current_locale, #current_user, #dynjs_include_tag, #pagetext, #parsing_error_box, #render_diff_table, #render_wiki, #server_url_for
Constructor Details
#initialize(chief_editor = ChiefEditor.new) ⇒ ReportController
Returns a new instance of ReportController.
34
35
36
|
# File 'app/controllers/report_controller.rb', line 34
def initialize(chief_editor=ChiefEditor.new)
@chief_editor = chief_editor
end
|
Instance Method Details
#determine_layout ⇒ Object
38
39
40
41
42
|
# File 'app/controllers/report_controller.rb', line 38
def determine_layout
return 'application' if params[:id] or
params[:action] == 'older'
return nil
end
|
#drop_crumbs ⇒ Object
44
45
46
47
48
|
# File 'app/controllers/report_controller.rb', line 44
def drop_crumbs
@crumbs << { @reporter.channel_title =>
{:controller => 'report', :action => 'older',
:reporter => @name}}
end
|
#list ⇒ Object
72
73
74
75
76
77
78
79
80
|
# File 'app/controllers/report_controller.rb', line 72
def list
@headlines = @chief_editor.latest_news_from(@name)
respond_to do |format|
format.html
format.xml { render :action => 'rss'
cache_page }
end
end
|
#older ⇒ Object
50
51
52
|
# File 'app/controllers/report_controller.rb', line 50
def older
@headlines = @chief_editor.news_from @name
end
|
#show ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'app/controllers/report_controller.rb', line 54
def show
id = params[:id]
@revision_id = id
@headline = @chief_editor.headline_with(@name, id)
unless @headline
logger.error("Tried to access invalid headline #{id} from #{@name}")
flash[:notice] = 'The article %s from the %s reporter could not be found' / id / @name.capitalize
redirect_to(:controller => 'root', :action => 'index')
return
end
@crumbs << { @headline.title(Translator.for(@locale)) =>
{:controller => 'report', :action => 'show',
:reporter => @name, :id => @headline.rid}}
end
|