From bd3c3a25e1068eb5c10976f438ff5f645432c7ec Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Fri, 6 Mar 2015 16:40:47 +0100 Subject: [PATCH] document versions --- app/controllers/documents_controller.rb | 10 +++++++++- app/views/documents/show.html.erb | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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 %>