プロジェクト

全般

プロフィール

Vote #70103

未完了

macro backlinks

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
-
開始日:
2011/06/09
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
0
issue_org_id:
8575
author_id:
34856
assigned_to_id:
0
comments:
4
status_id:
1
tracker_id:
2
plus1:
1
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

use as !{{backlinks}} or !{{backlinks(Foo)}}. sort-a hack-it-yourself for the fearless

#XXX insert at end of Definitions in lib/redmine/wiki_formatting/macros.rb, after other macroses
#XXX svild: part from child_pages, part from SearchController.index, part from render_page_hierarchy

      desc "shows backlinks to the/a wiki page. Example:\n\n  !{{backlinks}} or !{{backlinks(Foo)}} "
      macro :backlinks do |obj, args|
        title = nil
        if args.size > 0
          page = Wiki.find_page(args.first.to_s, :project => @project)
        elsif obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)
          page = obj.page
          title = 'here'
        else
          raise 'With no argument, this macro can be called from wiki pages only.'
        end
        raise 'Page not found' if page.nil? || !User.current.allowed_to?(:view_wiki_pages, page.wiki.project)

        r,c = WikiPage.search( "[["+page.title, @project ,
          :all_words => true ,
          :titles_only => false
          #,:limit => 100,
          #,:offset => 0
          )
        title = page.pretty_title if title.nil?
        content = ''
          content << "links to " + title + ": "
          #content << "
    " r.each do |p| #content << "
  • " content << link_to( h(p.pretty_title), { :controller => 'wiki', :action => 'show', :project_id => p.project, :id => p.title }, :title => nil) content << "\n" #content << "
  • \n" end #content << "
\n" content end

journals

Would be great to have backlinks in Redmine wiki!
--------------------------------------------------------------------------------
Hi. I've put the functionality into the plugin for those interested in the backlinks feature:

https://github.com/Yrwein/redmine_backlinks

In fact it's rewritten code above (we've used a modified version of the patch in previous versions of Redmine, but it was removed after upgrade) with possibility to show backlinks on every wiki page without macro call.
--------------------------------------------------------------------------------
+1
I would also love to have the possibility to search for backlinks in a subtree of a wiki.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0