[Contributed by Nicholas Lee] Changes to the way that URLs are specified which should improve the situation for people using Tracks in a subdirectory.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@54 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-03-30 15:35:37 +00:00
parent 310b763fb5
commit ec69c71564
17 changed files with 73 additions and 29 deletions

View file

@ -4,9 +4,6 @@
require_dependency "login_system"
require 'date'
$notes_img = "<img src=\"/images/notes.png\" width=\"10\" height=\"10\" border=\"0\" />"
$done_img = "<img src=\"/images/done.png\" width=\"16\" height=\"16\" border=\"0\" />"
class ApplicationController < ActionController::Base
helper :application

View file

@ -93,7 +93,7 @@ class ContextController < ApplicationController
expire_action(:controller => "context", :action => "list")
item = Todo.new
item.attributes = @params["new_item"]
where = Context.find_by_id(item.context_id)
# where = Context.find_by_id(item.context_id)
back_to = urlize(where.name)
@ -112,7 +112,7 @@ class ContextController < ApplicationController
# If you choose to go ahead, any actions in the context will also be deleted.
def destroy
expire_action(:controller => "context", :action => "list")
context = Context.find(@params['id'])
context = Context.find( @params['id'] )
if context.destroy
flash["confirmation"] = "Succesfully deleted context \"#{context.name}\""
redirect_to( :action => "list" )

View file

@ -121,8 +121,8 @@ class TodoController < ApplicationController
item.toggle!('done')
if item.save
#flash["confirmation"] = "Next action \"#{item.description}\" marked as completed"
#redirect_to( :action => "list" )
flash["confirmation"] = "Next action \"#{item.description}\" marked as completed"
redirect_to( :action => "list" )
else
flash["warning"] = "Couldn't mark action \"#{item.description}\" as completed"
redirect_to( :action => "list" )

View file

@ -1,15 +1,24 @@
<% @item = not_done %>
<tr>
<td valign="top">
<%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
<td valign="top" width="30"><%= link_image_to( "edit", { :controller => "todo", :action => "edit", :id => @item.id }, :title => "Edit item", :size => "10x10", :border => "0" ) + " " + link_image_to( "delete", { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :size => "10x10", :border => "0", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %></td>
<%=
link = url_for( :controller => 'todo', :action => 'toggle_check', :id => "#{@item.id}" ); check_box( "item", "done", :onclick => "document.location.href='#{link}'" )
%>
</td>
<td valign="top" width="30">
<%=
link_to(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), { :controller =>"todo", :action => "edit", :id => @item.id } ) + " " + link_to(image_tag( "delete", :title => "Delete item", :width=>"10", :height=>"10", :border=>"0" ), { :controller => "todo", :action => "destroy", :id => @item.id}, :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " "
%>
</td>
<td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :id => @item.project_id }, :title => "View project: #{@item.project['name']}" ) %>
<% end %>
<% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" +
image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>"
%>
<% m_notes = markdown( @item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
<% end %>

View file

@ -18,7 +18,9 @@
shown
<% end %>
</td>
<td width="40"><%= link_image_to("edit", { :action => "edit", :id => @context.id }, :title => "Edit item", :size => "10x10", :border => "0" ) + " " + link_image_to("delete", { :action => "destroy", :id => @context.id }, :title => "Delete item", :size => "10x10", :border => "0", :confirm => "Are you sure you want to delete the context \"#{@context.name}?\" Any todos in this context will be deleted.") + " " %></td>
<td width="40">
<%= link_to(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), { :action => "edit", :id => @context.id } ) + " " + link_to(image_tag( "delete", :title => "Delete item", :width=>10, :height=>10, :border=>0 ), { :action => "destroy", :id => @context.id}, :confirm => "Are you sure you want to delete the context \"#{@context.name}?\" Any todos in this context will be deleted." ) %>
</td>
</tr>
<% row += 1 %>
<% end %>

View file

@ -6,7 +6,8 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
@not_done.each { |i|
xml.item do
xml.title(i.description)
xml.link("http://#{@request.host}:#{@request.port}/context/show/#{i.context_id}")
@link = url_for(:controller => 'context', :action => 'show', :id => "#{i.context_id}")
xml.link("http://#{@request.host}:#{@request.port}#{@link}")
xml.description(i.context['name'].capitalize)
end
}

View file

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Login</title>
<link href="/stylesheets/scaffold.css" rel="stylesheet" type="text/css" />
<%= stylesheet_link_tag "scaffold" %>
</head>
<body>
<%= @content_for_layout %>

View file

@ -4,7 +4,7 @@
<%= stylesheet_link_tag "standard" %>
<%= javascript_include_tag "toggle_notes" %>
<%= javascript_include_tag "calendar" %>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="shortcut icon" href="<%= url_for(:controller => 'favicon.ico') %>" />
<title><%= @page_title %></title>
@ -35,10 +35,8 @@ var moty = ["January","February","March","April","May","June","July","August","S
<li><%= link_to( "Completed", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed AccessKey: Alt+D"} ) %></li>
<li><a href="javascript:toggleAll('notes','block')" accesskey="S" title="Show all notes AccessKey: Alt+S">Show</a></li>
<li><a href="javascript:toggleAll('notes','none')" accesskey="H" title="Show all notes AccessKey: Alt+H">Hide</a></li>
<li><%= link_to("<span style=\"font-family: verdana, sans-serif; font-size: 10px; font-weight:bold; text-decoration:none; color: white; background-color: #F60; border:1px solid;
border-color: #FC9 #630 #330 #F96; padding:0px 3px 0px 3px; margin:0px;\">RSS</span>", {:controller => "feed", :action => "na_feed", :params => {"name", "#{@session['user']['login']}", "token", "#{@session['user']['word']}"}}, :title => "Subscribe to an RSS feed of your next actions" ) %></li>
<li><%= link_to("<span style=\"font-family: verdana, sans-serif; font-size: 10px; font-weight:bold; text-decoration:none; color: white; background-color: #F60; border:1px solid;
border-color: #FC9 #630 #330 #F96; padding:0px 3px 0px 3px; margin:0px;\">TXT</span>", {:controller => "feed", :action => "na_text", :params => {"name", "#{@session['user']['login']}", "token", "#{@session['user']['word']}"}}, :title => "View a plain text feed of your next actions" ) %></li>
<li><%= link_to("<span class=\"feed\">RSS</span>", {:controller => "feed", :action => "na_feed", :name => "#{@session['user']['login']}", :token => "#{@session['user']['word']}"}, :title => "Subscribe to an RSS feed of your next actions" ) %></li>
<li><%= link_to("<span class=\"feed\">TXT</span>", {:controller => "feed", :action => "na_text", :name => "#{@session['user']['login']}", :token => "#{@session['user']['word']}"}, :title => "View a plain text feed of your next actions" ) %></li>
<li><%= link_to "Logout (#{@session['user']['login']}) &#187;", :controller => "login", :action=>"logout"%></li>
</ul>
</div>

View file

@ -1,14 +1,24 @@
<% @item = not_done %>
<tr>
<td valign="top"><%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
<td valign="top" width="30"><%= link_image_to( "edit", { :controller => "todo", :action => "edit", :id => @item.id }, :title => "Edit item", :size => "10x10", :border => "0" ) + " " + link_image_to( "delete", { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :size => "10x10", :border => "0", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %></td>
<td valign="top">
<%=
link = url_for(:controller => 'todo', :action => 'toggle_check', :id => "#{@item.id}")
check_box( "item", "done", :onclick => "document.location.href='#{link}'" )
%>
</td>
<td valign="top" width="30">
<%=
link_to(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), { :controller => "todo", :action => "edit", :id => @item.id } ) + " " +
link_to(image_tag( "delete", :title => "Delete item", :width=>"10", :height=>"10", :border=>"0"), { :controller => "todo", :action => "destroy", :id => @item.id}, :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " "
%>
</td>
<td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>
<%= link_to( "[C]", { :controller => "context", :action => "show", :id => @item.context_id }, :title => "View context: #{@item.context['name'].capitalize}" ) %>
<% end %>
<% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
<% m_notes = markdown( @item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
<% end %>

View file

@ -1,6 +1,6 @@
<div id="display_box">
<h2>Edit project</h2>
<form action="/project/update" method="post">
<form action="<%= url_for(:controller => 'project', :action => 'update') %>" method="post">
<%= render_partial "edit_project", "@project" %>
<input type="submit" value="Update" />
</form>

View file

@ -10,7 +10,11 @@
<% end %>
<td align="right" width="20"><%= @project.id.to_s %></td>
<td width="390"><%= link_to ( "#{@project.name}", :action => "show", :name => urlize(@project.name) ) %></td>
<td width="40"><%= link_image_to( "edit", { :action => "edit", :id => @project.id }, :title => "Edit item", :size => "10x10", :border => "0" ) + " " + link_image_to( "delete", { :action => "destroy", :id => @project.id }, :title => "Delete item", :size => "10x10", :border => "0", :confirm => "Are you sure you want to delete the project \"#{@project.name}?\" Any todos in this project will be deleted." ) + " " %></td>
<td width="40">
<%= link_to(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), { :action => "edit", :id => @project.id } ) + " " +
link_to(image_tag( "delete", :title => "Delete item", :width=>"10", :height=>"10", :border=>"0"), { :action => "destroy", :id => @project.id}, :confirm => "Are you sure you want to delete this entry: #{@project.name}" ) + " "
%>
</td>
</tr>
<% row += 1 %>
<% end %>

View file

@ -1,7 +1,7 @@
<% @done_item = done %>
<tr>
<% if @done_item.completed %>
<td valign="top"><%= $done_img %></td>
<td valign="top"><%= image_tag( "done", :width=>"16", :height=>"16", :border=>"0") %></td>
<td valign="top"><span class="grey"><%= format_date( @done_item.completed ) %></span></td>
<td valign="top"><%= " " + @done_item.description + " "%>
@ -16,7 +16,7 @@
<% end %>
<% if @done_item.notes? %>
<%= "<a href=\"javascript:toggle('" + @done_item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>
<%= "<a href=\"javascript:toggle('" + @done_item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
<% m_notes = markdown( @done_item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @done_item.id.to_s + "\">" + m_notes + "</div>" %>
<% end %>

View file

@ -1,14 +1,19 @@
<% @notdone_item = not_done %>
<tr id="action-<%= @notdone_item.id.to_s %>">
<td valign="top"><%= check_box( "item", "done", "onclick" => "markItemDone('action-#{@notdone_item.id}', '/todo/toggle_check/#{@notdone_item.id}', '#{@notdone_item.id}')" ) %></td>
<td valign="top" width="30"><%= link_image_to( "edit", { :action => "edit", :id => @notdone_item.id }, :title => "Edit item", :size => "10x10", :border => "0" ) + " " + link_image_to( "delete", { :controller => "todo", :action => "destroy", :id => @notdone_item.id }, :title => "Delete item", :size => "10x10", :border => "0", :confirm => "Are you sure you want to delete this entry: #{@notdone_item.description}" ) + " " %></td>
<td valign="top" width="30">
<%= link_to(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), { :action => "edit", :id => @notdone_item.id } ) + " " +
link_to(image_tag( "delete", :title => "Delete item", :width=>"10", :height=>"10", :border=>"0"), { :action => "destroy", :id => @notdone_item.id }, :confirm => "Are you sure you want to delete this entry: #{@notdone_item.description}" ) + " " %>
</td>
<td valign="top"><%= due_date( @notdone_item.due ) %>
<%= @notdone_item.description %>
<% if @notdone_item.project_id %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(@notdone_item.project.name) }, :title => "View project: #{@notdone_item.project.name}" ) %>
<% end %>
<% if @notdone_item.notes? %>
<%= "<a href=\"javascript:toggle('" + @notdone_item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>
<%= "<a href=\"javascript:toggle('" + @notdone_item.id.to_s + "')\" title=\"Show notes\">" +
image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>"
%>
<% m_notes = markdown( @notdone_item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @notdone_item.id.to_s + "\">" + m_notes + "</div>" %>
<% end %>

View file

@ -1,6 +1,6 @@
<div id="display_box">
<h2>Edit task</h2>
<form action="/todo/update" method="post">
<form action="<%= url_for(:controller => 'todo', :action => 'update') %>" method="post">
<%= render_partial "todo/item", "@item" %>
<input type="submit" value="Update" />
</form>

View file

@ -8,7 +8,7 @@ ActionController::Routing::Routes.draw do |map|
# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named 'wsdl'
map.connect ':controller/service.wsdl', :action => 'wsdl'
#map.connect ':controller/service.wsdl', :action => 'wsdl'
# Index Route
map.connect '', :controller => 'todo', :action => 'list'
@ -35,10 +35,14 @@ ActionController::Routing::Routes.draw do |map|
map.connect 'project/:name', :controller => 'project', :action => 'show'
map.connect 'project/:id', :controller => 'project', :action => 'show'
map.connect 'delete/project/:id', :controller => 'project', :action => 'destroy'
# Feed Routes
map.connect 'feed/:action/:name/:user', :controller => 'feed'
map.connect 'add_item', :controller => 'todo', :action => 'add_item'
# Install the default route as the lowest priority.
map.connect ':controller/:action'
map.connect ':controller/:action/:id'
end

View file

@ -21,6 +21,7 @@ Project wiki: <http://www.rousette.org.uk/projects/wiki/>
6. [Contributed by Andrew Williams] Toggling of contexts in /todo/list to collapse or expand their display via a small '+' or '-' graphic. This is independent of the shown/hidden setting for contexts, and is ideal for just hiding things on the fly to focus your view.
7. [Contributed by Jim Ray] Jim added a host of fixes and bits of cleaning up, including a position column for contexts and projects to allow custom sorting, and changes to the links for pages to make them more human-readable.
8. I added a pop-up calendar to set the due date. This is entirely lifted from Michele's excellent tutorial on pxl8.com <http://www.pxl8.com/calendar_date_picker.html>. It works well, but I need to make sure it doesn't break in postgresql or sqlite.
9. [Contributed by Nicholas Lee] Changes to the way that URLs are specified which should improve the situation for people using Tracks in a subdirectory.
## Version 1.02

View file

@ -276,6 +276,19 @@ input {
margin-bottom: 5px;
}
.feed {
font-family: verdana, sans-serif;
font-size: 10px;
font-weight:bold;
text-decoration:none;
color: white;
background-color: #F60;
border:1px solid;
border-color: #FC9 #630 #330 #F96;
padding:0px 3px 0px 3px;
margin:0px;
}
/* Popup calendar styles */
#calNavPY, #calNavPM {border:1px #999 solid}