diff options
| author | hukl <contact@smyck.org> | 2009-04-13 20:37:16 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-04-13 20:37:16 +0200 |
| commit | 06dee9ab33701e40a5adfcf87767fb807621fa32 (patch) | |
| tree | 73a7fc1307dcd2f9e41a42d575511bda1b5c0296 | |
| parent | 22aa8523ef5864d736faf6595ef258adc0689703 (diff) | |
beautified the revision and diff interface. so pretty and so functional. i'm happy
| -rw-r--r-- | app/controllers/revisions_controller.rb | 8 | ||||
| -rw-r--r-- | app/views/nodes/edit.html.erb | 4 | ||||
| -rw-r--r-- | app/views/revisions/diff.html.erb | 12 | ||||
| -rw-r--r-- | app/views/revisions/show.html.erb | 34 | ||||
| -rw-r--r-- | config/routes.rb | 9 | ||||
| -rw-r--r-- | 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 | |||
| 10 | 10 | ||
| 11 | puts @node.pages.length | 11 | puts @node.pages.length |
| 12 | if @node.pages.length > 1 | 12 | if @node.pages.length > 1 |
| 13 | params[:start] ||= @node.pages.all[-2].revision | 13 | params[:start_revision] ||= @node.pages.all[-2].revision |
| 14 | params[:end] ||= @node.pages.all[-1].revision | 14 | params[:end_revision] ||= @node.pages.all[-1].revision |
| 15 | else | 15 | else |
| 16 | params[:start], params[:end] = 1, 1 | 16 | params[:start], params[:end] = 1, 1 |
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | @start = Page.find( :first, :conditions => { | 19 | @start = Page.find( :first, :conditions => { |
| 20 | :node_id => params[:id], | 20 | :node_id => params[:id], |
| 21 | :revision => params[:start] | 21 | :revision => params[:start_revision] |
| 22 | }) | 22 | }) |
| 23 | 23 | ||
| 24 | @end = Page.find( :first, :conditions => { | 24 | @end = Page.find( :first, :conditions => { |
| 25 | :node_id => params[:id], | 25 | :node_id => params[:id], |
| 26 | :revision => params[:end] | 26 | :revision => params[:end_revision] |
| 27 | }) | 27 | }) |
| 28 | 28 | ||
| 29 | end | 29 | 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 @@ | |||
| 2 | <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> | 2 | <%= link_to 'metadata', '#', :id => 'button', :class => "unselected" %> |
| 3 | <%= link_to 'Preview', @node %> | 3 | <%= link_to 'Preview', @node %> |
| 4 | <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %> | 4 | <%= link_to 'Publish', publish_node_path, :method => :put, :confirm => "Publish this draft?" %> |
| 5 | <%= link_to 'Revisions', :controller => :revisions, :action => :diff, :id => params[:id] %> | 5 | <%= link_to 'Revisions', revision_path(params[:id]) %> |
| 6 | <% end %> | 6 | <% end %> |
| 7 | 7 | ||
| 8 | <div id="page_editor"> | 8 | <div id="page_editor"> |
| @@ -30,7 +30,7 @@ | |||
| 30 | </tr> | 30 | </tr> |
| 31 | </table> | 31 | </table> |
| 32 | 32 | ||
| 33 | <table> | 33 | <table id="content"> |
| 34 | <tr> | 34 | <tr> |
| 35 | <td class="description">Title</td> | 35 | <td class="description">Title</td> |
| 36 | <td><%= d.text_field :title %></td> | 36 | <td><%= d.text_field :title %></td> |
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 @@ | |||
| 1 | <% content_for :subnavigation do %> | ||
| 2 | <%= link_to 'Diff', :action => :diff, :id => params[:id] %> | ||
| 3 | <%= link_to 'Edit', edit_node_path(@node) %> | ||
| 4 | <%= link_to 'Revisions', revision_path(params[:id]) %> | ||
| 5 | <% end %> | ||
| 6 | |||
| 1 | <h1>Revisions#diff</h1> | 7 | <h1>Revisions#diff</h1> |
| 2 | 8 | ||
| 3 | <% form_tag url_for(:action => :diff), :method => :get do %> | 9 | <% form_tag diff_revision_path do %> |
| 4 | <%= select_tag :start, options_for_select(@node.pages.map{|x| x.revision}, params[:start].to_i) %> | 10 | <%= select_tag :start_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:start_revision].to_i) %> |
| 5 | <%= select_tag :end, options_for_select(@node.pages.map{|x| x.revision}, params[:end].to_i) %> | 11 | <%= select_tag :end_revision, options_for_select(@node.pages.map{|x| x.revision}, params[:end_revision].to_i) %> |
| 6 | <%= submit_tag 'Diff' %> | 12 | <%= submit_tag 'Diff' %> |
| 7 | <% end %> | 13 | <% end %> |
| 8 | 14 | ||
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 @@ | |||
| 1 | <div id="subnavigation"> | 1 | <% content_for :subnavigation do %> |
| 2 | <%= link_to 'Diff revisions', :action => :diff, :id => params[:id] %> | ||
| 3 | <%= link_to 'Edit', edit_node_path(@node) %> | 2 | <%= link_to 'Edit', edit_node_path(@node) %> |
| 4 | </div> | 3 | <% end %> |
| 5 | 4 | ||
| 6 | <h2>Revisions for Node: <%= @node.unique_name %></h2> | 5 | <h2>Revisions for Node: <%= @node.unique_name %></h2> |
| 7 | 6 | ||
| 8 | <h3>Current title: <%= @node.head.title %></h3> | 7 | <% form_tag diff_revision_path do %> |
| 9 | <table> | 8 | <table id="revisions"> |
| 9 | <tr class="header"> | ||
| 10 | <th>First</th> | ||
| 11 | <th>Last</th> | ||
| 12 | <th>Rev.</th> | ||
| 13 | <th>Title</th> | ||
| 14 | <th>User</th> | ||
| 15 | <th>Date</th> | ||
| 16 | </tr> | ||
| 10 | <% @node.pages.reverse.each do |page| %> | 17 | <% @node.pages.reverse.each do |page| %> |
| 11 | <tr> | 18 | <tr> |
| 12 | <td><%= page.revision %></td> | 19 | <td><%= radio_button_tag :start_revision, page.revision %></td> |
| 13 | <td><%= page.title %></td> | 20 | <td><%= radio_button_tag :end_revision, page.revision %></td> |
| 14 | <td><%= page.user.try(:login) %></td> | 21 | <td class="revision"><%= page.revision %></td> |
| 15 | <td><%= page.updated_at %></td> | 22 | <td class="title"><%= page.title %></td> |
| 23 | <td class="user"><%= page.user.try(:login) %></td> | ||
| 24 | <td class="date"><%= page.updated_at %></td> | ||
| 16 | </tr> | 25 | </tr> |
| 17 | <% end %> | 26 | <% end %> |
| 18 | </table> \ No newline at end of file | 27 | <tr> |
| 28 | <td colspan="6" class="right"><%= submit_tag 'Diff revisions' %></td> | ||
| 29 | </tr> | ||
| 30 | </table> | ||
| 31 | |||
| 32 | <% 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 @@ | |||
| 1 | ActionController::Routing::Routes.draw do |map| | 1 | ActionController::Routing::Routes.draw do |map| |
| 2 | map.resources :occurrences | ||
| 3 | 2 | ||
| 4 | map.resources :events | ||
| 5 | 3 | ||
| 4 | map.filter :locale | ||
| 5 | |||
| 6 | map.root( | 6 | map.root( |
| 7 | :locale => 'de', | 7 | :locale => 'de', |
| 8 | :controller => 'content', | 8 | :controller => 'content', |
| @@ -10,8 +10,9 @@ ActionController::Routing::Routes.draw do |map| | |||
| 10 | :page_path => ['home'] | 10 | :page_path => ['home'] |
| 11 | ) | 11 | ) |
| 12 | 12 | ||
| 13 | map.filter :locale | 13 | map.resources :occurrences |
| 14 | 14 | map.resources :events | |
| 15 | map.resources :revisions, :member => {:diff => :post} | ||
| 15 | map.resources :pages | 16 | map.resources :pages |
| 16 | map.resources :nodes, :member => {:publish => :put, :unlock => :put} | 17 | map.resources :nodes, :member => {:publish => :put, :unlock => :put} |
| 17 | map.logout '/logout', :controller => 'sessions', :action => 'destroy' | 18 | 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 { | |||
| 8 | text-decoration: none; | 8 | text-decoration: none; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | th { | ||
| 12 | text-transform: lowercase; | ||
| 13 | } | ||
| 14 | |||
| 15 | #wrapper { | ||
| 16 | margin-left: 125px; | ||
| 17 | width: 899px; | ||
| 18 | } | ||
| 19 | |||
| 11 | .right { | 20 | .right { |
| 12 | text-align: right; | 21 | text-align: right; |
| 13 | } | 22 | } |
| 14 | 23 | ||
| 15 | #navigation { | 24 | #navigation { |
| 16 | padding-left: 125px; | 25 | margin-left: -5px; |
| 17 | float: left; | 26 | float: left; |
| 18 | } | 27 | } |
| 19 | 28 | ||
| @@ -48,6 +57,39 @@ a { | |||
| 48 | background-color: #000000; | 57 | background-color: #000000; |
| 49 | } | 58 | } |
| 50 | 59 | ||
| 60 | /* Revisions */ | ||
| 61 | |||
| 62 | table#revisions { | ||
| 63 | border-collapse: collapse; | ||
| 64 | } | ||
| 65 | |||
| 66 | table#revisions td { | ||
| 67 | padding-right: 25px; | ||
| 68 | } | ||
| 69 | |||
| 70 | table#revisions td.title { | ||
| 71 | width: 450px; | ||
| 72 | } | ||
| 73 | |||
| 74 | table#revisions tr.header:hover { | ||
| 75 | background-color: #ffffff; | ||
| 76 | } | ||
| 77 | |||
| 78 | table#revisions tr:hover { | ||
| 79 | background-color: #f1f1f1; | ||
| 80 | } | ||
| 81 | |||
| 82 | table#revisions tr.header { | ||
| 83 | height: 20px; | ||
| 84 | text-align: left; | ||
| 85 | } | ||
| 86 | |||
| 87 | table#revisions tr { | ||
| 88 | height: 45px | ||
| 89 | } | ||
| 90 | |||
| 91 | /* Page Editor */ | ||
| 92 | |||
| 51 | input[type=text], textarea { | 93 | input[type=text], textarea { |
| 52 | font-size: 12px; | 94 | font-size: 12px; |
| 53 | font-family: Helvetica; | 95 | font-family: Helvetica; |
| @@ -69,8 +111,18 @@ input[type=text]#page_title { | |||
| 69 | font-weight: bold; | 111 | font-weight: bold; |
| 70 | } | 112 | } |
| 71 | 113 | ||
| 114 | input[type=text]#tag_list { | ||
| 115 | width: 690px; | ||
| 116 | padding: 5px; | ||
| 117 | } | ||
| 118 | |||
| 119 | input[type=text]#node_slug { | ||
| 120 | width: 690px; | ||
| 121 | padding: 5px; | ||
| 122 | } | ||
| 123 | |||
| 72 | input[type=submit] { | 124 | input[type=submit] { |
| 73 | width: 65px; | 125 | min-width: 65px; |
| 74 | border: 1px solid #989898; | 126 | border: 1px solid #989898; |
| 75 | background-color: #ffffff; | 127 | background-color: #ffffff; |
| 76 | } | 128 | } |
| @@ -86,12 +138,10 @@ textarea#page_abstract { | |||
| 86 | width: 700px; | 138 | width: 700px; |
| 87 | } | 139 | } |
| 88 | 140 | ||
| 89 | select { | 141 | #page_editor #metadata, #page_editor #content { |
| 90 | b | 142 | margin-left: -125px; |
| 91 | } | 143 | } |
| 92 | 144 | ||
| 93 | table {} | ||
| 94 | |||
| 95 | tr {} | 145 | tr {} |
| 96 | 146 | ||
| 97 | td { | 147 | td { |
