This commit is contained in:
albert
2013-03-22 10:28:32 -07:00
parent 6933cfba26
commit 364c6fd329
3 changed files with 8 additions and 3 deletions

View File

@@ -57,6 +57,7 @@ class WikiPagesController < ApplicationController
@wiki_page = WikiPage.find(params[:id])
@version = WikiPageVersion.find(params[:version_id])
@wiki_page.revert_to!(@version)
flash[:notice] = "Page was reverted"
respond_with(@wiki_page)
end

View File

@@ -11,7 +11,8 @@
<tr>
<th width="2%"></th>
<th width="2%"></th>
<th width="60%">Title</th>
<th width="55%">Title</th>
<th width="5%"></th>
<th width="10%">IP Address</th>
<th width="26%">Last edited</th>
</tr>
@@ -29,14 +30,15 @@
<%= radio_button_tag "otherpage", wiki_page_version.id %>
<% end %>
</td>
<td><%= link_to wiki_page_version.title, wiki_page_path(wiki_page_version.wiki_page_id) %></td>
<td><%= link_to wiki_page_version.title, wiki_page_version_path(wiki_page_version) %></td>
<td><%= link_to "wiki", wiki_page_path(wiki_page_version.wiki_page_id) %></td>
<td>
<% if CurrentUser.is_admin? %>
<%= wiki_page_version.updater_ip_addr %>
<% end %>
</td>
<td>
<%= link_to wiki_page_version.updated_at.strftime("%Y-%m-%d %I:%M"), wiki_page_version_path(wiki_page_version) %>
<%= compact_time(wiki_page_version.updated_at) %>
<% if wiki_page_version.updater %>
by
<%= link_to wiki_page_version.updater_name, user_path(wiki_page_version.updater) %>

View File

@@ -8,6 +8,8 @@
<div id="wiki-page-body" class="dtext prose">
<%= format_text(@wiki_page_version.body) %>
</div>
<p><%= link_to "Revert to this version", revert_wiki_page_path(@wiki_page_version.wiki_page_id, :version_id => @wiki_page_version.id), :method => :put %></p>
</section>
</div>
</div>