From a936993a5a7bbe7bb4f679d3adc059929cd0d7c5 Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 15 Mar 2009 14:07:04 +0100 Subject: first revision and diff interface --- app/views/revisions/show.html.erb | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/views/revisions/show.html.erb (limited to 'app/views/revisions/show.html.erb') diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb new file mode 100644 index 00000000..20fc39c3 --- /dev/null +++ b/app/views/revisions/show.html.erb @@ -0,0 +1,2 @@ +

Revisions#show

+

Find me in app/views/revisions/show.html.erb

-- cgit v1.3 From 7f82b8e23ec9b76d0b8a417b2d2b577aeaf7a55f Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 15 Mar 2009 19:27:37 +0100 Subject: adding revision links to the interface. disabling destroy for now --- app/controllers/revisions_controller.rb | 9 +++++++-- app/views/nodes/index.html.erb | 3 ++- app/views/revisions/show.html.erb | 19 +++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) (limited to 'app/views/revisions/show.html.erb') diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb index 20991efb..565a25f8 100644 --- a/app/controllers/revisions_controller.rb +++ b/app/controllers/revisions_controller.rb @@ -8,8 +8,12 @@ class RevisionsController < ApplicationController def diff @node = Node.find(params[:id]) - params[:start] ||= @node.pages.all[-1].revision - params[:end] ||= @node.pages.all[-2].revision + if @node.pages.length > 1 + params[:start] ||= @node.pages.all[-1].revision + params[:end] ||= @node.pages.all[-2].revision + else + params[:start], params[:end] = 1, 1 + end @start = Page.find( :first, :conditions => { :node_id => params[:id], @@ -24,6 +28,7 @@ class RevisionsController < ApplicationController end def show + @node = Node.find(params[:id]) end end diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb index a2a42b1a..31cd53ce 100644 --- a/app/views/nodes/index.html.erb +++ b/app/views/nodes/index.html.erb @@ -24,7 +24,8 @@ <%= link_to 'Show', node_path(node) %> <%= link_to 'Edit', edit_node_path(node) %> - <%= link_to 'Destroy', node, :method => :delete, :confirm => "Are you sure you want to delete this node?" %> + <%= link_to 'Revision', :controller => :revisions, :action => :show, :id => node.id %> + <%# link_to 'Destroy', node, :method => :delete, :confirm => "Are you sure you want to delete this node?" %> <%= link_to 'Unlock', unlock_node_path(node), :method => :put, :confirm => "Are you sure you want to unlock?" %> diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb index 20fc39c3..c63e7e8e 100644 --- a/app/views/revisions/show.html.erb +++ b/app/views/revisions/show.html.erb @@ -1,2 +1,17 @@ -

Revisions#show

-

Find me in app/views/revisions/show.html.erb

+ + +

Revisions for Node: <%= @node.unique_name %>

+ +

Current title: <%= @node.head.title %>

+ +<% @node.pages.reverse.each do |page| %> + + + + + + +<% end %> +
<%= page.revision %><%= page.title %><%= page.user.try(:login) %><%= page.updated_at %>
\ No newline at end of file -- cgit v1.3 From b7f67dc8527c6b404fa9682f07c7a1068bb83c7f Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 15 Mar 2009 19:45:46 +0100 Subject: interface interlinks --- app/views/nodes/edit.html.erb | 2 ++ app/views/revisions/index.html.erb | 1 - app/views/revisions/show.html.erb | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'app/views/revisions/show.html.erb') diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 2dade0fe..577a0754 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb @@ -2,6 +2,8 @@ <%= link_to 'Show', @node %> <%= link_to 'Back', nodes_path %> <%= link_to 'Publish', publish_node_path, :method => :put %> + <%= link_to 'Diff revisions', :controller => :revisions, :action => :diff, :id => params[:id] %> +

Editing page

diff --git a/app/views/revisions/index.html.erb b/app/views/revisions/index.html.erb index b41a77c9..e3134d76 100644 --- a/app/views/revisions/index.html.erb +++ b/app/views/revisions/index.html.erb @@ -1,2 +1 @@

Revisions#index

-

Find me in app/views/revisions/index.html.erb

diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb index c63e7e8e..64979fc1 100644 --- a/app/views/revisions/show.html.erb +++ b/app/views/revisions/show.html.erb @@ -1,5 +1,6 @@

Revisions for Node: <%= @node.unique_name %>

-- cgit v1.3