Attachments can now be added to wiki pages (original patch by Pavol Murin). Only authorized users can add/delete attachments.
Attached images can be displayed inline, using textile image tag (for wiki pages, issue descriptions and forum messages). git-svn-id: http://redmine.rubyforge.org/svn/trunk@541 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -77,7 +77,11 @@ class Attachment < ActiveRecord::Base
|
||||
def self.most_downloaded
|
||||
find(:all, :limit => 5, :order => "downloads DESC")
|
||||
end
|
||||
|
||||
|
||||
def project
|
||||
container.is_a?(Project) ? container : container.project
|
||||
end
|
||||
|
||||
private
|
||||
def sanitize_filename(value)
|
||||
# get only the filename, not the whole path
|
||||
|
||||
@@ -34,4 +34,8 @@ class Message < ActiveRecord::Base
|
||||
board.increment! :topics_count
|
||||
end
|
||||
end
|
||||
|
||||
def project
|
||||
board.project
|
||||
end
|
||||
end
|
||||
|
||||
+2
-1
@@ -31,7 +31,8 @@ class Wiki < ActiveRecord::Base
|
||||
|
||||
# find the page with the given title
|
||||
def find_page(title)
|
||||
pages.find_by_title(Wiki.titleize(title || start_page))
|
||||
title = start_page if title.blank?
|
||||
pages.find_by_title(Wiki.titleize(title))
|
||||
end
|
||||
|
||||
# turn a string into a valid page title
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
class WikiPage < ActiveRecord::Base
|
||||
belongs_to :wiki
|
||||
has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id', :dependent => :destroy
|
||||
has_many :attachments, :as => :container, :dependent => :destroy
|
||||
|
||||
validates_presence_of :title
|
||||
validates_format_of :title, :with => /^[^,\.\/\?\;\|\s]*$/
|
||||
@@ -41,4 +42,8 @@ class WikiPage < ActiveRecord::Base
|
||||
def self.pretty_title(str)
|
||||
(str && str.is_a?(String)) ? str.tr('_', ' ') : str
|
||||
end
|
||||
|
||||
def project
|
||||
wiki.project
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user