Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
f9a0c824ca
|
@ -98,7 +98,7 @@ class WikiController < ApplicationController
|
||||||
<div class="byline">
|
<div class="byline">
|
||||||
#{page.revisions? ? "Revised" : "Created" } on #{ page.revised_at.strftime('%B %d, %Y %H:%M:%S') }
|
#{page.revisions? ? "Revised" : "Created" } on #{ page.revised_at.strftime('%B %d, %Y %H:%M:%S') }
|
||||||
by
|
by
|
||||||
#{ UrlGenerator.new(self).make_link(page.author.name, @web, nil, { :mode => :export }) }
|
#{ UrlGenerator.new(self).make_link(@web, page.author.name, @web, nil, { :mode => :export }) }
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -44,12 +44,12 @@ module ApplicationHelper
|
||||||
# Creates a hyperlink to a Wiki page, or to a "new page" form if the page doesn't exist yet
|
# Creates a hyperlink to a Wiki page, or to a "new page" form if the page doesn't exist yet
|
||||||
def link_to_page(page_name, web = @web, text = nil, options = {})
|
def link_to_page(page_name, web = @web, text = nil, options = {})
|
||||||
raise 'Web not defined' if web.nil?
|
raise 'Web not defined' if web.nil?
|
||||||
UrlGenerator.new(@controller).make_link(page_name, web, text,
|
UrlGenerator.new(@controller).make_link(@web, page_name, web, text,
|
||||||
options.merge(:base_url => "#{base_url}/#{web.address}"))
|
options.merge(:base_url => "#{base_url}/#{web.address}"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def author_link(page, options = {})
|
def author_link(page, options = {})
|
||||||
UrlGenerator.new(@controller).make_link(page.author.name, page.web, nil, options)
|
UrlGenerator.new(@controller).make_link(@web, page.author.name, page.web, nil, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create a hyperlink to a particular revision of a Wiki page
|
# Create a hyperlink to a particular revision of a Wiki page
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
<%- for page in @pages_by_day[day] -%>
|
<%- for page in @pages_by_day[day] -%>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to_existing_page page %>
|
<%= link_to_existing_page page %>
|
||||||
<%- if page.revisions.length > 1 %>
|
<%- if page.revisions.size > 1 %>
|
||||||
<span class="views">
|
<span class="views">
|
||||||
( <%= link_to_revision(page, page.revisions.length, text='diff',
|
( <%= link_to_revision(page, page.revisions.size, text='diff',
|
||||||
mode='diff') %> | <%= link_to_history(page, text='history') %> )
|
mode='diff') %> | <%= link_to_history(page, text='history') %> )
|
||||||
</span>
|
</span>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
|
|
@ -10,7 +10,8 @@ class AbstractUrlGenerator
|
||||||
# Create a link for the given page (or file) name and link text based
|
# Create a link for the given page (or file) name and link text based
|
||||||
# on the render mode in options and whether the page (file) exists
|
# on the render mode in options and whether the page (file) exists
|
||||||
# in the web.
|
# in the web.
|
||||||
def make_link(asked_name, web, text = nil, options = {})
|
def make_link(current_web, asked_name, web, text = nil, options = {})
|
||||||
|
@web = current_web
|
||||||
mode = (options[:mode] || :show).to_sym
|
mode = (options[:mode] || :show).to_sym
|
||||||
link_type = (options[:link_type] || :show).to_sym
|
link_type = (options[:link_type] || :show).to_sym
|
||||||
|
|
||||||
|
@ -105,7 +106,9 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
end
|
end
|
||||||
when :show
|
when :show
|
||||||
if known_page
|
if known_page
|
||||||
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => 'show',
|
web = Web.find_by_address(web_address)
|
||||||
|
action = web.published? && web != @web ? 'published' : 'show'
|
||||||
|
href = @controller.url_for :controller => 'wiki', :web => web_address, :action => action,
|
||||||
:id => name, :only_path => true
|
:id => name, :only_path => true
|
||||||
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
||||||
else
|
else
|
||||||
|
|
|
@ -155,7 +155,7 @@ class WikiContent < String
|
||||||
def page_link(web_name, name, text, link_type)
|
def page_link(web_name, name, text, link_type)
|
||||||
web = Web.find_by_name(web_name) || Web.find_by_address(web_name) || @web
|
web = Web.find_by_name(web_name) || Web.find_by_address(web_name) || @web
|
||||||
@options[:link_type] = (link_type || :show)
|
@options[:link_type] = (link_type || :show)
|
||||||
@url_generator.make_link(name, web, text, @options)
|
@url_generator.make_link(@web, name, web, text, @options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_chunks
|
def build_chunks
|
||||||
|
|
Loading…
Reference in a new issue