Class: WikiReporter

Inherits:
MotiroReporter show all
Defined in:
app/core/wiki_reporter.rb

Direct Known Subclasses

EventsReporter, FeaturesReporter

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MotiroReporter

add, button, #buttons, #cache?, caching, #channel_title, #latest_headline, #name, reporter_name, title

Constructor Details

#initialize(opts = {}) ⇒ WikiReporter

Returns a new instance of WikiReporter.



28
29
30
31
# File 'app/core/wiki_reporter.rb', line 28

def initialize(opts={})
  opts = default_opts.merge(opts)
  @settings, @page_provider = opts[:settings], opts[:page_provider]
end

Class Method Details

.inherited(klass) ⇒ Object



33
34
35
36
# File 'app/core/wiki_reporter.rb', line 33

def self.inherited(klass)
  klass.add(button[:older])
  klass.add(button_for_creating(klass.reporter_name.chop))
end

Instance Method Details

#columnObject



52
# File 'app/core/wiki_reporter.rb', line 52

def column; 'modified_at'; end

#default_optsObject



24
25
26
# File 'app/core/wiki_reporter.rb', line 24

def default_opts
  { :settings => SettingsProvider.new, :page_provider => Page }
end

#headlinesObject



44
45
46
# File 'app/core/wiki_reporter.rb', line 44

def headlines
  @page_provider.find(:all, find_opts).map {|p| p.to_headline}
end

#latest_headlines(rid = '') ⇒ Object



38
39
40
41
42
# File 'app/core/wiki_reporter.rb', line 38

def latest_headlines(rid='')
  @page_provider.find(:all, find_opts.merge(
                              :limit => @settings.package_size)).
    map {|p| p.to_headline}
end

#params_for(page_name) ⇒ Object



48
49
50
# File 'app/core/wiki_reporter.rb', line 48

def params_for(page_name)
  { :controller => 'wiki', :action => 'show', :page_name => page_name }
end