fixes #989
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class WikiPage < ActiveRecord::Base
|
||||
before_save :normalize_title
|
||||
before_create :initialize_creator
|
||||
before_validation :initialize_creator, :on => :create
|
||||
before_validation :initialize_updater
|
||||
after_save :create_version
|
||||
belongs_to :creator, :class_name => "User"
|
||||
validates_uniqueness_of :title, :case_sensitive => false
|
||||
@@ -125,10 +126,18 @@ class WikiPage < ActiveRecord::Base
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def updater_name
|
||||
User.id_to_name(updater_id)
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.user.id
|
||||
end
|
||||
|
||||
def initialize_updater
|
||||
self.updater_id = CurrentUser.user.id
|
||||
end
|
||||
|
||||
def post_set
|
||||
@post_set ||= PostSets::WikiPage.new(title, 1, 4)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<% @wiki_pages.each do |wiki_page| %>
|
||||
<tr>
|
||||
<td class="tag-category-<%= wiki_page.category_name %>"><%= link_to wiki_page.pretty_title, wiki_page_path(wiki_page, :noredirect => 1) %></td>
|
||||
<td><%= wiki_page.updated_at.strftime("%Y-%m-%d %I:%M") %> by <%= h link_to wiki_page.creator.name, user_path(wiki_page.creator) %></td>
|
||||
<td><%= wiki_page.updated_at.strftime("%Y-%m-%d %I:%M") %> by <%= h link_to wiki_page.updater_name, user_path(wiki_page.updater_id) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user