diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index ad55726..4b9086a 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -67,9 +67,17 @@ class DocumentsController < ApplicationController end def write @document = Document.find(params[:id]) - if @document.is_etherpad? + if @document.is_etherpad? && params[:versionid].nil? redirect_to action: :write_etherpad else + unless params[:versionid].nil? + v=@document.versions.find(params[:versionid]) + if v.reify.nil? + v=v.next + end + @document=v.reify + + end @parent=@document.parent respond_to do |format| format.html diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 8939bf0..7cf3883 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -7,3 +7,11 @@ <%= raw(@document.text) %> +<% if can?(:edit, @document) %> + +<% end %>