Class: AutomaticRecentChanges
- Inherits:
-
AutomaticSummary
- Object
- AutomaticSummary
- AutomaticRecentChanges
- Defined in:
- lib/helpers/default-helpers.rb
Constant Summary
Constants inherited from AutomaticSummary
AutomaticSummary::DEFAULT_SETTINGS
Instance Attribute Summary
Attributes inherited from AutomaticSummary
#decision, #name, #settings, #summary, #wiki
Instance Method Summary collapse
-
#initialize(wiki, changes = 200, pagename = "Recent changes to this site", author = "AutomaticRecentChanges", exclude_automatic_helpers = true, merge_revisions_within = 60*60*12) ⇒ AutomaticRecentChanges
constructor
A new instance of AutomaticRecentChanges.
- #render_summary ⇒ Object
Methods inherited from AutomaticSummary
#add_existing_pages, #check_new, #confirm_old, #new_tail, #new_top, #remove_previous_revisions, #render_summary_of_page, #render_summary_page, #scan_pages_allready_in_wiki, #scan_revisions_allready_in_wiki, #start_watching, #summarise?
Constructor Details
#initialize(wiki, changes = 200, pagename = "Recent changes to this site", author = "AutomaticRecentChanges", exclude_automatic_helpers = true, merge_revisions_within = 60*60*12) ⇒ AutomaticRecentChanges
Returns a new instance of AutomaticRecentChanges.
203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/helpers/default-helpers.rb', line 203 def initialize( wiki, changes = 200, pagename = "Recent changes to this site", = "AutomaticRecentChanges", exclude_automatic_helpers = true, merge_revisions_within = 60*60*12 ) super( wiki, pagename, :summarise_revisions => true, :max_pages_to_show => changes, :author => , :sort_pages_by => :revised_on, :event => :page_revised, :reverse_sort => true, :remove_deleted_pages => false, :merge_revisions_within => merge_revisions_within ) do |revision| exclude_automatic_helpers ? revision. !~ /^Automatic/i : true end wiki.watch_for( :day ) { render_summary_page } end |
Instance Method Details
#render_summary ⇒ Object
217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/helpers/default-helpers.rb', line 217 def render_summary content = "<div class='recentchanges'>\n\nh2. Today\n\n" previous_time = Time.now @summary.each do |revision| unless revision.revised_on.same_day?( previous_time ) content << "\nh2. #{revision.revised_on.relative_day}\n\n" previous_time = revision.revised_on end content << "* #{revision.revised_on.strftime('%H:%M')} - [[#{revision.name}]] revised by #{revision.} ([[changes => /revision/#{revision.name}?time=#{revision.created_on.to_i}]])\n" end content << "\n\n</div>" end |