Minor bug fixes to journalized versions
This commit is contained in:
parent
5844623031
commit
08a013da44
|
@ -122,7 +122,7 @@ class WikiController < ApplicationController
|
|||
@version_pages = Paginator.new self, @version_count, per_page_option, params['p']
|
||||
# don't load text
|
||||
@versions = @page.content.versions.find :all,
|
||||
:select => "id, user_id, notes, updated_at, version",
|
||||
:select => "id, user_id, notes, created_at, version",
|
||||
:order => 'version DESC',
|
||||
:limit => @version_pages.items_per_page + 1,
|
||||
:offset => @version_pages.current.offset
|
||||
|
|
|
@ -29,7 +29,7 @@ class Message < ActiveRecord::Base
|
|||
if o.parent_id.nil?
|
||||
{:id => o.id}
|
||||
else
|
||||
{:id => o.parent_id, :r => o.id, :anchor => "message-#{o.id}"}
|
||||
{:id => o.parent_id, :r => o.versioned.id, :anchor => "message-#{o.versioned.id}"}
|
||||
end.reverse_merge :controller => 'messages', :action => 'show', :board_id => o.board_id
|
||||
end),
|
||||
:activity_find_options => { :include => { :board => :project } }
|
||||
|
|
|
@ -57,11 +57,16 @@ class WikiContent < ActiveRecord::Base
|
|||
WikiContentJournal.class_eval do
|
||||
attr_protected :data
|
||||
after_save :compress_version_text
|
||||
after_save :move_comments_to_notes
|
||||
|
||||
# Wiki Content might be large and the data should possibly be compressed
|
||||
def compress_version_text
|
||||
self.text = changes["text"].last if changes["text"]
|
||||
end
|
||||
|
||||
def move_comments_to_notes
|
||||
self.notes = changes.delete("comments").last if changes["comments"]
|
||||
end
|
||||
|
||||
def text=(plain)
|
||||
case Setting.wiki_compression
|
||||
|
@ -99,4 +104,4 @@ class WikiContent < ActiveRecord::Base
|
|||
@previous ||= versioned.journals.at(version - 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<td class="id"><%= link_to ver.version, :action => 'index', :page => @page.title, :version => ver.version %></td>
|
||||
<td class="checkbox"><%= radio_button_tag('version', ver.version, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < @versions.size) %></td>
|
||||
<td class="checkbox"><%= radio_button_tag('version_from', ver.version, (line_num==2), :id => "cbto-#{line_num}") if show_diff && (line_num > 1) %></td>
|
||||
<td align="center"><%= format_time(ver.updated_at) %></td>
|
||||
<td align="center"><%= format_time(ver.created_at) %></td>
|
||||
<td><%= link_to_user ver.user %></td>
|
||||
<td><%=h ver.notes %></td>
|
||||
<td align="center"><%= link_to l(:button_annotate), :action => 'annotate', :page => @page.title, :version => ver.version %></td>
|
||||
|
|
Loading…
Reference in New Issue