From 49568b847db1acadb1c2186219b2488b5621f4d0 Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 12 Sep 2009 13:14:06 +0200 Subject: changed the ui click flow a bit --- app/controllers/nodes_controller.rb | 2 +- app/models/node.rb | 4 ++++ app/views/nodes/edit.html.erb | 2 +- app/views/nodes/index.html.erb | 4 ++-- app/views/nodes/show.html.erb | 35 +++++++++++++++++++++++++++++------ 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index e442bd2..20aea5a 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -90,7 +90,7 @@ class NodesController < ApplicationController flash[:notice] = "Cannot unlock" end - redirect_to nodes_path + redirect_to :back end def move_to diff --git a/app/models/node.rb b/app/models/node.rb index b23e43b..4e94efc 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -137,6 +137,10 @@ class Node < ActiveRecord::Base self.save end + def locked? + !self.lock_owner.nil? + end + def unlock! self.lock_owner = nil self.save diff --git a/app/views/nodes/edit.html.erb b/app/views/nodes/edit.html.erb index c23381f..0635dac 100644 --- a/app/views/nodes/edit.html.erb +++ b/app/views/nodes/edit.html.erb @@ -48,7 +48,7 @@ Publish at - <%= d.datetime_select :published_at %> + <%= d.datetime_select :published_at, :value => @draft.published_at %> Template diff --git a/app/views/nodes/index.html.erb b/app/views/nodes/index.html.erb index 2f6069f..0603c08 100644 --- a/app/views/nodes/index.html.erb +++ b/app/views/nodes/index.html.erb @@ -16,11 +16,11 @@ "> <%= node.id %> -

<%= link_to title_for_node(node), edit_node_path(node) %>

+

<%= link_to title_for_node(node), node_path(node) %>

<%= link_to_path(node.unique_name, node.unique_name) %>

- <%= link_to 'Preview', node_path(node) %> + <%= link_to 'show', node_path(node) %> <%= link_to 'Revisions', :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/nodes/show.html.erb b/app/views/nodes/show.html.erb index 15547f9..8d8a985 100644 --- a/app/views/nodes/show.html.erb +++ b/app/views/nodes/show.html.erb @@ -1,26 +1,49 @@ <% content_for :subnavigation do %> <%= link_to 'Edit', edit_node_path(@node), :class => "unselected" %> <%= link_to 'Preview', preview_page_path(@page) %> - <%= link_to 'Revisions', revision_path(params[:id]) %> + <%= link_to 'Revisions', revision_path(params[:id]) %> + <%= link_to 'Unlock', unlock_node_path(@node), :method => :put, :confirm => "Are you sure you want to unlock?" %> <% end %>
- - + + - + + + + <% if @page.node.locked? %> + + + + + <% end %> + + + + + + + + + + + + + + - + - + -- cgit v1.3
Path<%= @page.public_link %>
TitleAuthor<%= @page.user.try(:login) %>
Locked by<%= @page.node.lock_owner.login %>
Last updated<%= @page.updated_at %>
Published at<%= @page.published_at %>
Revision<%= @page.revision %>
Title <%= @page.title %>
AbstractAbstract <%= @page.abstract %>
BodyBody <%= @page.body %>