mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
shorten long line of app/models/wiki_content_version.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20160 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f4aa4b0f87
commit
f7fd194ed5
@ -23,27 +23,38 @@ class WikiContentVersion < ActiveRecord::Base
|
||||
belongs_to :page, :class_name => 'WikiPage'
|
||||
belongs_to :author, :class_name => 'User'
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
|
||||
:description => :comments,
|
||||
:datetime => :updated_on,
|
||||
:type => 'wiki-page',
|
||||
:group => :page,
|
||||
:url => Proc.new {|o| {:controller => 'wiki', :action => 'show', :project_id => o.page.wiki.project, :id => o.page.title, :version => o.version}}
|
||||
|
||||
acts_as_activity_provider :type => 'wiki_edits',
|
||||
:timestamp => "#{table_name}.updated_on",
|
||||
:author_key => "#{table_name}.author_id",
|
||||
:permission => :view_wiki_edits,
|
||||
:scope => proc {
|
||||
select("#{table_name}.updated_on, #{table_name}.comments, " +
|
||||
"#{table_name}.version, #{WikiPage.table_name}.title, " +
|
||||
"#{table_name}.page_id, #{table_name}.author_id, " +
|
||||
"#{table_name}.id").
|
||||
joins("LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{table_name}.page_id " +
|
||||
"LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " +
|
||||
"LEFT JOIN #{Project.table_name} ON #{Project.table_name}.id = #{Wiki.table_name}.project_id")
|
||||
}
|
||||
|
||||
acts_as_event(
|
||||
:title =>
|
||||
Proc.new do |o|
|
||||
"#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"
|
||||
end,
|
||||
:description => :comments,
|
||||
:datetime => :updated_on,
|
||||
:type => 'wiki-page',
|
||||
:group => :page,
|
||||
:url =>
|
||||
Proc.new do |o|
|
||||
{:controller => 'wiki', :action => 'show',
|
||||
:project_id => o.page.wiki.project,
|
||||
:id => o.page.title, :version => o.version}
|
||||
end
|
||||
)
|
||||
acts_as_activity_provider(
|
||||
:type => 'wiki_edits',
|
||||
:timestamp => "#{table_name}.updated_on",
|
||||
:author_key => "#{table_name}.author_id",
|
||||
:permission => :view_wiki_edits,
|
||||
:scope =>
|
||||
proc do
|
||||
select("#{table_name}.updated_on, #{table_name}.comments, " +
|
||||
"#{table_name}.version, #{WikiPage.table_name}.title, " +
|
||||
"#{table_name}.page_id, #{table_name}.author_id, " +
|
||||
"#{table_name}.id").
|
||||
joins("LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{table_name}.page_id " +
|
||||
"LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " +
|
||||
"LEFT JOIN #{Project.table_name} ON #{Project.table_name}.id = #{Wiki.table_name}.project_id")
|
||||
end
|
||||
)
|
||||
after_destroy :page_update_after_destroy
|
||||
|
||||
def text=(plain)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user