Class: WikiLinkHandler
- Inherits:
-
MediaWikiLinkHandler
- Object
- MediaWikiLinkHandler
- WikiLinkHandler
- Defined in:
- lib/wiki_link_handler.rb
Overview
Motiro - A project tracking tool
Copyright (C) 2006-2008 Thiago Arrais
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Instance Method Summary collapse
- #extra_link_attributes_for(page_name) ⇒ Object
-
#initialize(parent_controller) ⇒ WikiLinkHandler
constructor
A new instance of WikiLinkHandler.
- #link_attributes_for(page_name) ⇒ Object
- #url_for(page_name) ⇒ Object
Constructor Details
#initialize(parent_controller) ⇒ WikiLinkHandler
Returns a new instance of WikiLinkHandler.
19 20 21 |
# File 'lib/wiki_link_handler.rb', line 19 def initialize(parent_controller) @parent_controller = parent_controller end |
Instance Method Details
#extra_link_attributes_for(page_name) ⇒ Object
32 33 34 35 36 |
# File 'lib/wiki_link_handler.rb', line 32 def extra_link_attributes_for(page_name) atts = {} atts[:class] = 'done' if (page = Page.find_by_name(page_name)) && page.done? atts end |
#link_attributes_for(page_name) ⇒ Object
28 29 30 |
# File 'lib/wiki_link_handler.rb', line 28 def link_attributes_for(page_name) super(page_name).merge(extra_link_attributes_for(page_name)) end |
#url_for(page_name) ⇒ Object
23 24 25 26 |
# File 'lib/wiki_link_handler.rb', line 23 def url_for(page_name) @parent_controller.server_url_for :controller => 'wiki', :action => 'show', :page_name => page_name end |