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.



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

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

Class Method Details

.inherited(klass) ⇒ Object



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

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

Instance Method Details

#columnObject



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

def column; 'modified_at'; end

#default_optsObject



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

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

#headlinesObject



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

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

#latest_headlines(rid = '') ⇒ Object



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

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



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

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