socialforge/app/helpers/stores_helper.rb

31 lines
742 B
Ruby

module StoresHelper
def attachFromUrl attachment
container = attachment.container
case container.class.to_s
when 'Message'
board_message_path(container.board, container)
when 'Issue'
issue_path(container)
when 'Document'
document_path container
when 'HomeworkAttach'
bid_path(container.bid)
when 'Memo'
forum_memo_path(container.forum, container)
when 'News'
news_path(container)
when 'Project'
project_files_path(container)
when 'Version'
# version_path(container)
project_files_path(container.project)
when 'WikiPage'
project_wiki_path(container.project)
when 'Bid'
bid_path(container)
else
'#'#logger.error "StoresHelper#attachUrl unkown type ==> #{container}"
end
end
end