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 /app | |
| parent | 22aa8523ef5864d736faf6595ef258adc0689703 (diff) | |
beautified the revision and diff interface. so pretty and so functional. i'm happy
Diffstat (limited to 'app')
| -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 |
4 files changed, 39 insertions, 19 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 | ||
