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 ++++++++++++------ config/routes.rb | 9 ++--- public/stylesheets/admin.css | 62 +++++++++++++++++++++++++++++---- 6 files changed, 100 insertions(+), 29 deletions(-) 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 diff --git a/config/routes.rb b/config/routes.rb index 11ca34c..38f508a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,8 @@ ActionController::Routing::Routes.draw do |map| - map.resources :occurrences - map.resources :events + map.filter :locale + map.root( :locale => 'de', :controller => 'content', @@ -10,8 +10,9 @@ ActionController::Routing::Routes.draw do |map| :page_path => ['home'] ) - map.filter :locale - + map.resources :occurrences + map.resources :events + map.resources :revisions, :member => {:diff => :post} map.resources :pages map.resources :nodes, :member => {:publish => :put, :unlock => :put} map.logout '/logout', :controller => 'sessions', :action => 'destroy' diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index bd5c354..a23eea5 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css @@ -8,12 +8,21 @@ a { text-decoration: none; } +th { + text-transform: lowercase; +} + +#wrapper { + margin-left: 125px; + width: 899px; +} + .right { text-align: right; } #navigation { - padding-left: 125px; + margin-left: -5px; float: left; } @@ -48,6 +57,39 @@ a { background-color: #000000; } +/* Revisions */ + +table#revisions { + border-collapse: collapse; +} + +table#revisions td { + padding-right: 25px; +} + +table#revisions td.title { + width: 450px; +} + +table#revisions tr.header:hover { + background-color: #ffffff; +} + +table#revisions tr:hover { + background-color: #f1f1f1; +} + +table#revisions tr.header { + height: 20px; + text-align: left; +} + +table#revisions tr { + height: 45px +} + +/* Page Editor */ + input[type=text], textarea { font-size: 12px; font-family: Helvetica; @@ -69,8 +111,18 @@ input[type=text]#page_title { font-weight: bold; } +input[type=text]#tag_list { + width: 690px; + padding: 5px; +} + +input[type=text]#node_slug { + width: 690px; + padding: 5px; +} + input[type=submit] { - width: 65px; + min-width: 65px; border: 1px solid #989898; background-color: #ffffff; } @@ -86,12 +138,10 @@ textarea#page_abstract { width: 700px; } -select { - b +#page_editor #metadata, #page_editor #content { + margin-left: -125px; } -table {} - tr {} td { -- cgit v1.3