From 06dee9ab33701e40a5adfcf87767fb807621fa32 Mon Sep 17 00:00:00 2001 From: hukl Date: Mon, 13 Apr 2009 20:37:16 +0200 Subject: beautified the revision and diff interface. so pretty and so functional. i'm happy --- app/controllers/revisions_controller.rb | 8 ++++---- app/views/nodes/edit.html.erb | 4 ++-- app/views/revisions/diff.html.erb | 12 +++++++++--- app/views/revisions/show.html.erb | 34 +++++++++++++++++++++++---------- 4 files changed, 39 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb index 6914509..7ae22f8 100644 --- a/app/controllers/revisions_controller.rb +++ b/app/controllers/revisions_controller.rb @@ -10,20 +10,20 @@ class RevisionsController < ApplicationController puts @node.pages.length if @node.pages.length > 1 - params[:start] ||= @node.pages.all[-2].revision - params[:end] ||= @node.pages.all[-1].revision + params[:start_revision] ||= @node.pages.all[-2].revision + params[:end_revision] ||= @node.pages.all[-1].revision else params[:start], params[:end] = 1, 1 end @start = Page.find( :first, :conditions => { :node_id => params[:id], - :revision => params[:start] + :revision => params[:start_revision] }) @end = Page.find( :first, :conditions => { :node_id => params[:id], - :revision => params[:end] + :revision => params[:end_revision] }) end diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index 6a243a7..d8fb8b4 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb @@ -2,7 +2,7 @@ <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> <%= link_to 'Preview', @node %> <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %> - <%= link_to 'Revisions', :controller => :revisions, :action => :diff, :id => params[:id] %> + <%= link_to 'Revisions', revision_path(params[:id]) %> <% end %>
@@ -30,7 +30,7 @@ - +
diff --git a/app/views/revisions/diff.html.erb b/app/views/revisions/diff.html.erb index a8a0276..d8ba6d2 100644 --- a/app/views/revisions/diff.html.erb +++ b/app/views/revisions/diff.html.erb @@ -1,8 +1,14 @@ +<% content_for :subnavigation do %> + <%= link_to 'Diff', :action => :diff, :id => params[:id] %> + <%= link_to 'Edit', edit_node_path(@node) %> + <%= link_to 'Revisions', revision_path(params[:id]) %> +<% end %> +

Revisions#diff

-<% form_tag url_for(:action => :diff), :method => :get do %> - <%= select_tag :start, options_for_select(@node.pages.map{|x| x.revision}, params[:start].to_i) %> - <%= select_tag :end, options_for_select(@node.pages.map{|x| x.revision}, params[:end].to_i) %> +<% form_tag diff_revision_path do %> + <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %> + <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> <%= submit_tag 'Diff' %> <% end %> diff --git a/app/views/revisions/show.html.erb b/app/views/revisions/show.html.erb index 64979fc..3e7ce09 100644 --- a/app/views/revisions/show.html.erb +++ b/app/views/revisions/show.html.erb @@ -1,18 +1,32 @@ - +<% end %>

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

-

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

-
Title <%= d.text_field :title %>
+<% form_tag diff_revision_path do %> +
+ + + + + + + + <% @node.pages.reverse.each do |page| %> - - - - + + + + + + <% end %> -
FirstLastRev.TitleUserDate
<%= page.revision %><%= page.title %><%= page.user.try(:login) %><%= page.updated_at %><%= radio_button_tag :start_revision, page.revision %><%= radio_button_tag :end_revision, page.revision %><%= page.revision %><%= page.title %><%= page.user.try(:login) %><%= page.updated_at %>
\ No newline at end of file + + <%= submit_tag 'Diff revisions' %> + + + +<% end %> \ No newline at end of file -- cgit v1.3