Renamed revised_on to revised_at everywhere (for consistency)

This commit is contained in:
Alexey Verkhovsky 2005-08-14 23:27:55 +00:00
parent c381287714
commit 5b075ca338
9 changed files with 17 additions and 21 deletions

View file

@ -57,7 +57,7 @@ class WikiController < ApplicationController
end
def export_pdf
file_name = "#{@web.address}-tex-#{@web.revised_on.strftime('%Y-%m-%d-%H-%M-%S')}"
file_name = "#{@web.address}-tex-#{@web.revised_at.strftime('%Y-%m-%d-%H-%M-%S')}"
file_path = File.join(@wiki.storage_path, file_name)
export_web_to_tex "#{file_path}.tex" unless FileTest.exists? "#{file_path}.tex"
@ -66,7 +66,7 @@ class WikiController < ApplicationController
end
def export_tex
file_name = "#{@web.address}-tex-#{@web.revised_on.strftime('%Y-%m-%d-%H-%M-%S')}.tex"
file_name = "#{@web.address}-tex-#{@web.revised_at.strftime('%Y-%m-%d-%H-%M-%S')}.tex"
file_path = File.join(@wiki.storage_path, file_name)
export_web_to_tex(file_path) unless FileTest.exists?(file_path)
send_file file_path
@ -140,7 +140,7 @@ class WikiController < ApplicationController
def pdf
page = wiki.read_page(@web_name, @page_name)
safe_page_name = @page.name.gsub(/\W/, '')
file_name = "#{safe_page_name}-#{@web.address}-#{@page.revised_on.strftime('%Y-%m-%d-%H-%M-%S')}"
file_name = "#{safe_page_name}-#{@web.address}-#{@page.revised_at.strftime('%Y-%m-%d-%H-%M-%S')}"
file_path = File.join(@wiki.storage_path, file_name)
export_page_to_tex("#{file_path}.tex") unless FileTest.exists?("#{file_path}.tex")
@ -247,7 +247,7 @@ class WikiController < ApplicationController
def export_pages_as_zip(file_type, &block)
file_prefix = "#{@web.address}-#{file_type}-"
timestamp = @web.revised_on.strftime('%Y-%m-%d-%H-%M-%S')
timestamp = @web.revised_at.strftime('%Y-%m-%d-%H-%M-%S')
file_path = File.join(@wiki.storage_path, file_prefix + timestamp + '.zip')
tmp_path = "#{file_path}.tmp"
@ -313,8 +313,8 @@ class WikiController < ApplicationController
@pages_by_revision = @web.select.by_revision.first(limit)
else
@pages_by_revision = @web.select.by_revision
@pages_by_revision.reject! { |page| page.revised_on < start_date } if start_date
@pages_by_revision.reject! { |page| page.revised_on > end_date } if end_date
@pages_by_revision.reject! { |page| page.revised_at < start_date } if start_date
@pages_by_revision.reject! { |page| page.revised_at > end_date } if end_date
end
@hide_description = hide_description

View file

@ -121,7 +121,7 @@ class Page < ActiveRecord::Base
private
def continous_revision?(time, author)
(current_revision.author == author) && (revised_on + 30.minutes > time)
(current_revision.author == author) && (revised_at + 30.minutes > time)
end
# Forward method calls to the current revision, so the page responds to all revision calls

View file

@ -17,7 +17,7 @@ class PageSet < Array
end
def most_recent_revision
self.map { |page| page.revised_on }.max || Time.at(0)
self.map { |page| page.revised_at }.max || Time.at(0)
end
def by_name
@ -27,7 +27,7 @@ class PageSet < Array
alias :sort :by_name
def by_revision
PageSet.new(@web, sort_by { |page| page.revised_on }).reverse
PageSet.new(@web, sort_by { |page| page.revised_at }).reverse
end
def pages_that_reference(page_name)

View file

@ -3,10 +3,6 @@ class Revision < ActiveRecord::Base
belongs_to :page
composed_of :author, :mapping => [ %w(author name), %w(ip ip) ]
def revised_on
revised_at
end
# TODO this method belongs in the view helpers (only views use it)
def pretty_created_on
# Must use DateTime because Time doesn't support %e on at least some platforms

View file

@ -134,7 +134,7 @@ class Web < ActiveRecord::Base
pages_to_be_removed.each { |p| p.destroy }
end
def revised_on
def revised_at
select.most_recent_revision
end

View file

@ -59,9 +59,9 @@ class Wiki
web.remove_pages(web.select.orphaned_pages)
end
def revise_page(web_address, page_name, content, revised_on, author)
def revise_page(web_address, page_name, content, revised_at, author)
page = read_page(web_address, page_name)
page.revise(content, revised_on, author)
page.revise(content, revised_at, author)
end
def rollback_page(web_address, page_name, revision_number, time, author_id = nil)

View file

@ -3,12 +3,12 @@
<%= categories_menu %>
<% unless @pages_by_revision.empty? %>
<% revision_date = @pages_by_revision.first.revised_on %>
<% revision_date = @pages_by_revision.first.revised_at %>
<h3><%= revision_date.strftime('%B %e, %Y') %></h3>
<ul>
<% for page in @pages_by_revision %>
<% if page.revised_on < revision_date %>
<% revision_date = page.revised_on %>
<% if page.revised_at < revision_date %>
<% revision_date = page.revised_at %>
</ul>
<h3><%= revision_date.strftime('%B %e, %Y') %></h3>
<ul>

View file

@ -12,7 +12,7 @@
<% unless @hide_description %>
<description><%= h page.display_content %></description>
<% end %>
<pubDate><%= page.revised_on.getgm.strftime "%a, %d %b %Y %H:%M:%S Z" %></pubDate>
<pubDate><%= page.revised_at.getgm.strftime "%a, %d %b %Y %H:%M:%S Z" %></pubDate>
<guid><%= url_for :only_path => false, :web => @web_name, :action => @link_action, :id => page.name %></guid>
<link><%= url_for :only_path => false, :web => @web_name, :action => @link_action, :id => page.name %></link>
<dc:creator><%= WikiWords.separate(page.author) %></dc:creator>

View file

@ -50,7 +50,7 @@ class PageTest < Test::Unit::TestCase
@page.reload
assert_equal 2, @page.revisions.length
assert_equal 'HisWay would be MyWay in kinda update', @page.content
assert_equal Time.local(2004, 4, 4, 16, 57), @page.revised_on
assert_equal Time.local(2004, 4, 4, 16, 57), @page.revised_at
# but consecutive revision by another author results in a new revision
@page.revise('HisWay would be MyWay in the house', Time.local(2004, 4, 4, 16, 58), 'DavidHeinemeierHansson')