Extract the inbound links list from page.rhtml and revision.rhtml into a partial

This commit is contained in:
Alexey Verkhovsky 2005-11-04 06:19:10 +00:00
parent 4779a4fa4e
commit c7295287a4
3 changed files with 18 additions and 31 deletions

View file

@ -0,0 +1,13 @@
<% unless @page.linked_from.empty? %>
<small>
| Linked from:
<%= @page.linked_from.collect { |referring_page| link_to_existing_page referring_page }.join(", ") %>
</small>
<% end %>
<% unless @page.included_from.empty? %>
<small>
| Included from:
<%= @page.included_from.collect { |referring_page| link_to_existing_page referring_page }.join(", ") %>
</small>
<% end %>

View file

@ -71,8 +71,8 @@
<small> <small>
| Views: | Views:
<%= link_to('Print', <%= link_to('Print',
{:web => @web.address, :action => 'print', :id => @page.name}, { :web => @web.address, :action => 'print', :id => @page.name },
{:accesskey => 'p', :name => 'view_print'}) %> { :accesskey => 'p', :name => 'view_print' }) %>
<% if defined? RedClothForTex and RedClothForTex.available? and @web.markup == :textile %> <% if defined? RedClothForTex and RedClothForTex.available? and @web.markup == :textile %>
| |
<%= link_to 'TeX', {:web => @web.address, :action => 'tex', :id => @page.name}, <%= link_to 'TeX', {:web => @web.address, :action => 'tex', :id => @page.name},
@ -83,24 +83,7 @@
<% end %> <% end %>
</small> </small>
<% unless @page.linked_from.empty? %> <%= render :partial => 'inbound_links' %>
<small>
| Linked from:
<%= @page.linked_from.collect { |referring_page|
link_to_existing_page referring_page
}.join(", ")
%>
</small>
<% end %>
<% if @page.included_from.length > 0 %>
<small>
| Included from: <%= @page.included_from.collect { |referring_page|
link_to_existing_page referring_page
}.join(", ")
%>
</small>
<% end %>
</div> </div>
<script language="Javascript" type="text/Javascript"> <script language="Javascript" type="text/Javascript">

View file

@ -72,18 +72,9 @@
{:web => @web.address, :action => 'rollback', :id => @page.name, :rev => @revision_number}, {:web => @web.address, :action => 'rollback', :id => @page.name, :rev => @revision_number},
{:class => 'navlink', :name => 'rollback'}) {:class => 'navlink', :name => 'rollback'})
%> %>
<%= render :partial => 'inbound_links' %>
<% if @page.references.length > 0 %>
<small>
| Linked from:
<%= @page.references.collect { |ref|
link_to ref.name, :web => @web.address, :action => 'show', :id => ref.name
}.join(", ")
%>
</small>
<% else %>
Orphan page
<% end %>
</div> </div>
<script language="Javascript"> <script language="Javascript">