Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
de97daa048
|
@ -26,7 +26,7 @@ module CacheSweepingHelper
|
|||
end
|
||||
|
||||
def expire_cached_revisions(page)
|
||||
page.revisions.length.times do |i|
|
||||
page.revisions.count.times do |i|
|
||||
revno = i+1
|
||||
expire_action :controller => 'wiki', :web => page.web.address,
|
||||
:action => 'revision', :id => page.name, :rev => revno
|
||||
|
|
|
@ -19,7 +19,7 @@ class WikiController < ApplicationController
|
|||
redirect_home
|
||||
elsif not @wiki.setup?
|
||||
redirect_to :controller => 'admin', :action => 'create_system'
|
||||
elsif @wiki.webs.length == 1
|
||||
elsif @wiki.webs.size == 1
|
||||
redirect_home @wiki.webs.values.first.address
|
||||
else
|
||||
redirect_to :action => 'web_list'
|
||||
|
@ -345,7 +345,7 @@ class WikiController < ApplicationController
|
|||
if @page
|
||||
@revisions_by_day = Hash.new { |h, day| h[day] = [] }
|
||||
@revision_numbers = Hash.new { |h, id| h[id] = [] }
|
||||
revision_number = @page.revisions.length
|
||||
revision_number = @page.revisions.size
|
||||
@page.revisions.reverse.each do |rev|
|
||||
day = Date.new(rev.revised_at.year, rev.revised_at.month, rev.revised_at.day)
|
||||
@revisions_by_day[day] << rev
|
||||
|
@ -462,7 +462,7 @@ class WikiController < ApplicationController
|
|||
if params['rev']
|
||||
@revision_number = params['rev'].to_i
|
||||
else
|
||||
@revision_number = @page.revisions.length
|
||||
@revision_number = @page.revisions.size
|
||||
end
|
||||
@revision = @page.revisions[@revision_number - 1]
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ module ApplicationHelper
|
|||
|
||||
# Create a hyperlink to a particular revision of a Wiki page
|
||||
def link_to_revision(page, revision_number, text = nil, mode = nil, html_options = {})
|
||||
revision_number == page.revisions.length ?
|
||||
revision_number == page.revisions.size ?
|
||||
link_to(
|
||||
text || page.plain_name,
|
||||
{:web => @web.address, :action => 'show', :id => page.name,
|
||||
|
|
|
@ -6,7 +6,7 @@ module WikiHelper
|
|||
menu << back_for_revision if @revision_number > 1
|
||||
menu << current_revision
|
||||
menu << see_or_hide_changes_for_revision if @revision_number > 1
|
||||
menu << history if @page.revisions.length > 1
|
||||
menu << history if @page.revisions.size > 1
|
||||
menu << rollback
|
||||
menu
|
||||
end
|
||||
|
@ -15,11 +15,11 @@ module WikiHelper
|
|||
menu = []
|
||||
menu << edit_page
|
||||
menu << edit_web if @page.name == "HomePage"
|
||||
if @page.revisions.length > 1
|
||||
if @page.revisions.size > 1
|
||||
menu << back_for_page
|
||||
menu << see_or_hide_changes_for_page
|
||||
end
|
||||
menu << history if @page.revisions.length > 1
|
||||
menu << history if @page.revisions.size > 1
|
||||
menu
|
||||
end
|
||||
|
||||
|
@ -40,11 +40,11 @@ module WikiHelper
|
|||
end
|
||||
|
||||
def forward
|
||||
if @revision_number < @page.revisions.length - 1
|
||||
if @revision_number < @page.revisions.size - 1
|
||||
link_to('Forward in time',
|
||||
{:web => @web.address, :action => 'revision', :id => @page.name, :rev => @revision_number + 1},
|
||||
{:class => 'navlink', :accesskey => 'F', :id => 'to_next_revision', :rel => 'nofollow'}) +
|
||||
" <span class='revisions'>(#{@revision.page.revisions.length - @revision_number} more)</span> "
|
||||
" <span class='revisions'>(#{@revision.page.revisions.size - @revision_number} more)</span> "
|
||||
else
|
||||
link_to('Forward in time', {:web => @web.address, :action => 'show', :id => @page.name},
|
||||
{:class => 'navlink', :accesskey => 'F', :id => 'to_next_revision', :rel => 'nofollow'}) +
|
||||
|
@ -62,9 +62,9 @@ module WikiHelper
|
|||
def back_for_page
|
||||
link_to('Back in time',
|
||||
{:web => @web.address, :action => 'revision', :id => @page.name,
|
||||
:rev => @page.revisions.length - 1},
|
||||
:rev => @page.revisions.size - 1},
|
||||
{:class => 'navlink', :accesskey => 'B', :id => 'to_previous_revision', :rel => 'nofollow'}) +
|
||||
" <span class='revisions'>(#{@page.revisions.length - 1} #{@page.revisions.length - 1 == 1 ? 'revision' : 'revisions'})</span>"
|
||||
" <span class='revisions'>(#{@page.revisions.size - 1} #{@page.revisions.size - 1 == 1 ? 'revision' : 'revisions'})</span>"
|
||||
end
|
||||
|
||||
def current_revision
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<%- for rev in @revisions_by_day[day] -%>
|
||||
<li>
|
||||
<%= link_to_revision(rev.page, @revision_numbers[rev.id],
|
||||
text= (rev.page.revisions.length == @revision_numbers[rev.id] ?
|
||||
text= (rev.page.revisions.size == @revision_numbers[rev.id] ?
|
||||
"Current" :
|
||||
"Revision #{@revision_numbers[rev.id]}" )
|
||||
) %>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<%- end -%>
|
||||
|
||||
<div class="byline" style="margin-bottom: 0px">
|
||||
<%= web.pages.length %> page<% if web.pages.length != 1 %>s<% end %> by <%= web.authors.length %> author<% if web.authors.length != 1 %>s<% end %>
|
||||
<%= web.pages.size %> page<% if web.pages.size != 1 %>s<% end %> by <%= web.authors.size %> author<% if web.authors.size != 1 %>s<% end %>
|
||||
- Last Update: <%= web.last_page.nil? ? format_date(web.created_at) : format_date(web.last_page.revised_at) %><br/>
|
||||
<%- if ! web.last_page.nil? -%>
|
||||
Last Document: <%= link_to_page(web.last_page.name,web) %>
|
||||
|
|
Loading…
Reference in a new issue