Upgraded to Rails version to 1-2-pre-release branch revision 5704. Lots of stuff is deprecated in Rails 1.2, so this changeset

also removes deprecated methods. All tests pass (at least on my machine!) and raise no deprecation warnings.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@365 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-12-08 07:41:20 +00:00
parent baf649e143
commit d7bb7555a0
1140 changed files with 135108 additions and 1098 deletions

View file

@ -20,7 +20,7 @@ class ApplicationController < ActionController::Base
# By default, sets the charset to UTF-8 if it isn't already set
def set_charset
@headers["Content-Type"] ||= "text/html; charset=UTF-8"
headers["Content-Type"] ||= "text/html; charset=UTF-8"
end
# Reverses the urlize() method by substituting underscores for spaces

View file

@ -36,6 +36,10 @@ class ContextController < ApplicationController
# http://our.tracks.host/context/create
#
def create
if params[:format] == 'application/xml' && params['exception']
render_failure "Expected post format is valid xml like so: <request><context><name>context name</name></context></request>."
return
end
@context = @user.contexts.build
params_are_invalid = true
if (params['context'] || (params['request'] && params['request']['context']))
@ -49,9 +53,9 @@ class ContextController < ApplicationController
wants.js
wants.xml do
if @context.new_record? && params_are_invalid
render_failure "Expected post format is xml like so: <request><context><name>context name</name></context></request>."
render_failure "Expected post format is valid xml like so: <request><context><name>context name</name></context></request>."
elsif @context.new_record?
render_failure @context.errors.full_messages.join(', ')
render_failure @context.errors.to_xml
else
render :xml => @context.to_xml( :except => :user_id )
end

View file

@ -3,7 +3,6 @@
class FeedController < ApplicationController
helper :feed
model :todo, :context, :project
session :disabled => true, :except => 'index' # Prevents session control from interfering with feed
before_filter :check_token_against_user_word, :except => 'index'

View file

@ -1,5 +1,4 @@
class LoginController < ApplicationController
model :user, :preference
layout 'login'
skip_before_filter :set_session_expiration
open_id_consumer if Tracks::Config.auth_schemes.include?('open_id')
@ -78,7 +77,7 @@ class LoginController < ApplicationController
end
def signup
if User.find_all.empty? # the first user of the system
if User.no_users_yet?
@page_title = "Sign up as the admin user"
@user = get_new_user
else
@ -102,7 +101,7 @@ class LoginController < ApplicationController
return
end
user.is_admin = true if User.find_all.empty?
user.is_admin = true if User.no_users_yet?
if user.save
@user = User.authenticate(user.login, params['user']['password'])
@user.create_preference

View file

@ -1,10 +1,5 @@
class MobileController < ApplicationController
model :user
model :project
model :context
model :todo
layout 'mobile'
prepend_before_filter :login_required
@ -36,16 +31,10 @@ class MobileController < ApplicationController
@item.state = "active"
end
else
if params[:item][:"show_from(1i)"] == ""
@item = Todo.create(params[:item]) if params[:item]
else
@item = Todo.create(params[:item]) if params[:item]
@item.defer!
end
params[:item][:user_id] = @user.id
@item = Todo.new(params[:item]) if params[:item]
end
@item.user_id = @user.id
if @item.save
redirect_to :action => 'index'
else

View file

@ -1,6 +1,5 @@
class NoteController < ApplicationController
model :user
prepend_before_filter :login_required
layout "standard"

View file

@ -1,7 +1,5 @@
class ProjectController < ApplicationController
model :todo
helper :todo
prepend_before_filter :login_required
before_filter :init, :except => [:create, :destroy, :order, :toggle_project_done]
@ -62,6 +60,10 @@ class ProjectController < ApplicationController
# http://our.tracks.host/project/create
#
def create
if params[:format] == 'application/xml' && params['exception']
render_failure "Expected post format is valid xml like so: <request><project><name>project name</name></project></request>."
return
end
@project = @user.projects.build
params_are_invalid = true
if (params['project'] || (params['request'] && params['request']['project']))
@ -75,7 +77,7 @@ class ProjectController < ApplicationController
wants.js
wants.xml do
if @project.new_record? && params_are_invalid
render_failure "Expected post format is xml like so: <request><project><name>project name</name></project></request>."
render_failure "Expected post format is valid xml like so: <request><project><name>project name</name></project></request>."
elsif @project.new_record?
render_failure @project.errors.full_messages.join(', ')
else

View file

@ -1,9 +1,5 @@
class TodoController < ApplicationController
model :user
model :project
model :context
helper :todo
prepend_before_filter :login_required
@ -130,6 +126,7 @@ class TodoController < ApplicationController
if @saved
@remaining_undone_in_context = @user.contexts.find(@item.context_id).not_done_todo_count
determine_down_count
determine_completed_count
end
return if request.xhr?
@ -312,5 +309,21 @@ class TodoController < ApplicationController
end
end
end
def determine_completed_count
source_view do |from|
from.todo do
@completed_count = Todo.count_by_sql(['SELECT COUNT(*) FROM todos, contexts WHERE todos.context_id = contexts.id and todos.user_id = ? and todos.state = ? and contexts.hide = ?', @user.id, 'completed', false])
end
from.context do
@completed_count = @user.contexts.find(@item.context_id).todos.count_in_state(:completed)
end
from.project do
unless @item.project_id == nil
@completed_count = @user.projects.find(@item.project_id).todos.count_in_state(:completed)
end
end
end
end
end

View file

@ -7,7 +7,7 @@ class UserController < ApplicationController
end
verify :method => :post,
:only => %w( create_user ),
:only => %w( create ),
:render => { :text => '403 Forbidden: Only POST requests on this resource are allowed.',
:status => 403 }
@ -17,30 +17,26 @@ class UserController < ApplicationController
# http://our.tracks.host/user/create
#
def create
if params['exception']
render_failure "Expected post format is valid xml like so: <request><login>username</login><password>abc123</password></request>."
return
end
admin = User.find_admin
#logger.debug "user is " + session["user_id"].to_s + " and admin is " + a.id.to_s
unless session["user_id"].to_i == admin.id.to_i
access_denied
return
end
unless request.content_type == "application/xml"
render_failure "Content Type must be application/xml."
return
end
unless check_create_user_params
render_failure "Expected post format is xml like so: <request><login>username</login><password>abc123</password></request>."
render_failure "Expected post format is valid xml like so: <request><login>username</login><password>abc123</password></request>."
return
end
user = User.new(params[:request])
user.password_confirmation = params[:request][:password]
unless user.valid?
render_failure user.errors.full_messages.join(', ')
return
end
if user.save
render :text => "User created.", :status => 200
else
render_failure "Failed to create user."
render_failure user.errors.to_xml
end
end

View file

@ -145,7 +145,7 @@ module ApplicationHelper
end
def render_flash
render :partial => 'shared/flash'
render :partial => 'shared/flash', :locals => { :flash => flash }
end
# Display a flash message in RJS templates

View file

@ -67,7 +67,7 @@ module FeedHelper
end
def rss_feed_link(options = {})
image_tag = image_tag("feed-icon", :size => "16X16", :border => 0, :class => "rss-icon")
image_tag = image_tag("feed-icon.png", :size => "16X16", :border => 0, :class => "rss-icon")
linkoptions = {:controller => 'feed', :action => 'rss', :name => "#{@user.login}", :token => "#{@user.word}"}
linkoptions.merge!(options)
link_to(image_tag, linkoptions, :title => "RSS feed")

View file

@ -7,9 +7,9 @@ module TodoHelper
count = Todo.find_all("done=0 AND context_id=#{context.id}").length
end
def form_remote_tag_edit_todo( item )
def form_remote_tag_edit_todo( item, &block )
form_remote_tag( :url => { :controller => 'todo', :action => 'update', :id => item.id },
:html => { :id => "form-action-#{item.id}", :class => "inline-form" }
:html => { :id => "form-action-#{item.id}", :class => "inline-form" }, &block
)
end
@ -27,7 +27,7 @@ module TodoHelper
{ :class => "icon" }
)
else
str << '<a class="icon">' + image_tag("blank") + "</a> "
str << '<a class="icon">' + image_tag("blank.png") + "</a> "
end
str
end
@ -89,7 +89,7 @@ module TodoHelper
str = "<a href=\"javascript:Element.toggle('"
str << item.id.to_s
str << "')\" class=\"show_notes\" title=\"Show notes\">"
str << image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "</a>"
str << image_tag( "blank.png", :width=>"16", :height=>"16", :border=>"0" ) + "</a>"
m_notes = markdown( item.notes )
str << "\n<div class=\"notes\" id=\"" + item.id.to_s + "\" style=\"display:none\">"
str << m_notes + "</div>"
@ -135,11 +135,11 @@ module TodoHelper
private
def image_tag_for_delete
image_tag("blank", :title =>"Delete action", :class=>"delete_item")
image_tag("blank.png", :title =>"Delete action", :class=>"delete_item")
end
def image_tag_for_edit(item)
image_tag("blank", :title =>"Edit action", :class=>"edit_item", :id=>"action-#{item.id}-edit-icon")
image_tag("blank.png", :title =>"Edit action", :class=>"edit_item", :id=>"action-#{item.id}-edit-icon")
end
end

View file

@ -1,6 +1,6 @@
class Project < ActiveRecord::Base
has_many :todos, :dependent => :delete_all, :include => :context
has_many :notes, :dependent => true, :order => "created_at DESC"
has_many :notes, :dependent => :delete_all, :order => "created_at DESC"
belongs_to :user
# Project name must not be empty

View file

@ -9,6 +9,15 @@ class User < ActiveRecord::Base
attr_protected :is_admin
validates_presence_of :login
validates_presence_of :password, :if => :password_required?
validates_length_of :password, :within => 5..40, :if => :password_required?
validates_confirmation_of :password
validates_length_of :login, :within => 3..80
validates_uniqueness_of :login, :on => :create
validates_inclusion_of :auth_type, :in => Tracks::Config.auth_schemes, :message=>"not a valid authentication type"
validates_presence_of :open_id_url, :if => Proc.new{|user| user.auth_type == 'open_id'}
def self.authenticate(login, pass)
candidate = find(:first, :conditions => ["login = ?", login])
return nil if candidate.nil?
@ -20,8 +29,12 @@ class User < ActiveRecord::Base
nil
end
def self.no_users_yet?
count == 0
end
def self.find_admin
find_first([ "is_admin = ?", true ])
find(:first, :conditions => [ "is_admin = ?", true ])
end
def display_name
@ -61,12 +74,4 @@ protected
auth_type == 'database'
end
validates_presence_of :login
validates_presence_of :password, :if => :password_required?
validates_length_of :password, :within => 5..40, :if => :password_required?
validates_confirmation_of :password
validates_length_of :login, :within => 3..80
validates_uniqueness_of :login, :on => :create
validates_inclusion_of :auth_type, :in => Tracks::Config.auth_schemes, :message=>"not a valid authentication type"
validates_presence_of :open_id_url, :if => Proc.new{|user| user.auth_type == 'open_id'}
end

View file

@ -17,26 +17,28 @@
<span class="grey">VISIBLE</span>
<% end %>
<%= link_to_remote( image_tag("blank", :title =>"Delete context", :class=>"delete_item"),
<%= link_to_remote( image_tag("blank.png", :title =>"Delete context", :class=>"delete_item"),
:loading => visual_effect(:fade, "container_#{context.id}"),
:url => { :controller => "context", :action => "destroy", :id => context.id },
:confirm => "Are you sure that you want to delete the context \'#{context.name}\'?" ) + " " +
link_to_function( image_tag( "blank", :title => "Edit context", :class=>"edit_item"), "Element.toggle('context-#{context.id}','context-#{context.id}-edit-form'); new Effect.Appear('context-#{context.id}-edit-form'); Form.focusFirstElement('form-context-#{context.id}');" ) %>
link_to_function( image_tag( "blank.png", :title => "Edit context", :class=>"edit_item"), "Element.toggle('context-#{context.id}');,Element.toggle('context-#{context.id}-edit-form'); new Effect.Appear('context-#{context.id}-edit-form'); Form.focusFirstElement('form-context-#{context.id}');" ) %>
</div>
</div><!-- [end:context-context.id] -->
<div id="context-<%= context.id %>-edit-form" class="edit-form" style="display:none;">
<%= form_remote_tag :url => { :controller => 'context', :action => 'update', :id => context.id },
:html => { :id => "form-context-#{context.id}", :class => "inline-form" },
:complete => visual_effect(:appear, 'container_#{context.id}') %>
<table style="table-layout: fixed;" width="450">
<%= render :partial => 'context_form', :object => context %>
<tr>
<td width="150">&nbsp; <input type="hidden" name="wants_render" value="false" /></td>
<td width="300"><input type="submit" value="Update" />&nbsp;<a href="javascript:void(0);" onclick="Element.toggle('context-<%= context.id %>','context-<%= context.id %>-edit-form');Form.reset('form-context-<%= context.id %>');">Cancel</a></td>
</tr>
</table>
<%= end_form_tag %>
<%
form_remote_tag_options = { :url => { :controller => 'context', :action => 'update', :id => context.id },
:html => { :id => "form-context-#{context.id}", :class => "inline-form" },
:complete => visual_effect(:appear, 'container_#{context.id}') }
form_remote_tag form_remote_tag_options do -%>
<table style="table-layout: fixed;" width="450">
<%= render :partial => 'context_form', :object => context %>
<tr>
<td width="150">&nbsp; <input type="hidden" name="wants_render" value="false" /></td>
<td width="300"><input type="submit" value="Update" />&nbsp;<a href="javascript:void(0);" onclick="Element.toggle('context-<%= context.id %>');Element.toggle('context-<%= context.id %>-edit-form');Form.reset('form-context-<%= context.id %>');">Cancel</a></td>
</tr>
</table>
<% end -%>
</div><!-- [end:context-context.id-edit-form] -->
</div><!-- [end:context_context.id] -->
<% if controller.action_name == 'create' %>

View file

@ -10,7 +10,7 @@
<a href="javascript:void(0)" onClick="Element.toggle('context_new'); Form.focusFirstElement('context-form');" accesskey="n" title="Create a new context">Create new context &#187;</a>
<div id="context_new" class="context_new" style="display:none">
<!--[form:context]-->
<%= form_remote_tag :url => { :action => "create" }, :html=> { :id=>'context-form', :name=>'context', :class => 'inline-form' } %>
<% form_remote_tag :url => { :action => "create" }, :html=> { :id=>'context-form', :name=>'context', :class => 'inline-form' } do -%>
<div id="status"><%= error_messages_for('context') %></div>
@ -23,7 +23,7 @@
<%= check_box( "context", "hide" ) %>
<br />
<input type="submit" value="Add" />
<%= end_form_tag %>
<% end -%>
<!--[eoform:context]-->
</div>
</div>

View file

@ -1,8 +1,6 @@
<div id="display_box">
<%= render :partial => "context/context", :locals => { :context => @context, :collapsible => false } %>
<% unless @done.empty? -%>
<%= render :partial => "todo/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this context (last #{@user.preference.show_number_completed})" } %>
<% end -%>
<%= render :partial => "todo/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this context (last #{@user.preference.show_number_completed})" } %>
</div><!-- [end:display_box] -->

View file

@ -1,4 +1,4 @@
@headers["Content-Type"] = "text/xml; charset=utf-8"
headers["Content-Type"] = "text/xml; charset=utf-8"
xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
xml.channel do
xml.title(@title)

View file

@ -1,2 +1,2 @@
<% @headers["Content-Type"] = "text/plain; charset=utf-8" -%>
<% headers["Content-Type"] = "text/plain; charset=utf-8" -%>
<%= build_contexts_text_page( @contexts ) -%>

View file

@ -3,7 +3,7 @@
<div id="feedlegend">
<h3>Legend:</h3>
<dl>
<dt><%= image_tag("feed-icon", :size => "16X16", :border => 0)%></dt><dd>RSS Feed</dd>
<dt><%= image_tag("feed-icon.png", :size => "16X16", :border => 0)%></dt><dd>RSS Feed</dd>
<dt><span class="feed">TXT</span></dt><dd>Plain Text Feed</dd>
<dt><span class="feed">iCal</span></dt><dd>iCal feed</dd>
</dl>

View file

@ -14,8 +14,6 @@
<%= javascript_include_tag 'calendar', 'calendar-en', 'calendar-setup' %>
<%= javascript_include_tag "accesskey-hints" %>
<%= javascript_include_tag "todo-items" %>
<%= javascript_include_tag "lightbox" %>
<%= stylesheet_link_tag "lightbox" %>
<link rel="shortcut icon" href="<%= url_for(:controller => 'favicon.ico') %>" />
<%= auto_discovery_link_tag(:rss,{:controller => "feed", :action => "na_feed", :name => "#{@user.login}", :token => "#{@user.word}"}, {:title => "RSS feed of next actions"}) %>
@ -50,7 +48,7 @@
<li><%= navigation_link( "Done", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %></li>
<li><%= navigation_link( "Notes", {:controller => "note", :action => "index"}, {:accesskey => "o", :title => "Show all notes"} ) %></li>
<li><%= navigation_link( "Preferences", {:controller => "user", :action => "preferences"}, {:accesskey => "u", :title => "Show my preferences"} ) %></li>
<li><%= navigation_link(image_tag("feed-icon", :size => "16X16", :border => 0), {:controller => "feed", :action => "index"}, :title => "See a list of available feeds" ) %></li>
<li><%= navigation_link(image_tag("feed-icon.png", :size => "16X16", :border => 0), {:controller => "feed", :action => "index"}, :title => "See a list of available feeds" ) %></li>
</ul>
</div>

View file

@ -6,45 +6,45 @@
<h3>Please log in to use Tracks:</h3>
<% if auth_schemes.include?('database') || auth_schemes.include?('open_id') %>
<%= start_form_tag :action=> 'login' %>
<table>
<tr>
<td width="100px"><label for="user_login">Login:</label></td>
<td width="100px"><input type="text" name="user_login" id="user_login" value="" class="login_text" /></td>
</tr>
<tr>
<td width="100px"><label for="user_password">Password:</label></td>
<td width="100px"><input type="password" name="user_password" id="user_password" class="login_text" /></td>
</tr>
<tr>
<td width="100px"><label for="user_noexpiry">Stay logged in:</label></td>
<td width="100px"><input type="checkbox" name="user_noexpiry" id="user_noexpiry" checked /></td>
</tr>
<tr>
<td width="100px"></td>
<td><input type="submit" name="login" value="Login &#187;" class="primary" /></td>
</tr>
</table>
<%= end_form_tag %>
<% form_tag :action=> 'login' do %>
<table>
<tr>
<td width="100px"><label for="user_login">Login:</label></td>
<td width="100px"><input type="text" name="user_login" id="user_login" value="" class="login_text" /></td>
</tr>
<tr>
<td width="100px"><label for="user_password">Password:</label></td>
<td width="100px"><input type="password" name="user_password" id="user_password" class="login_text" /></td>
</tr>
<tr>
<td width="100px"><label for="user_noexpiry">Stay logged in:</label></td>
<td width="100px"><input type="checkbox" name="user_noexpiry" id="user_noexpiry" checked /></td>
</tr>
<tr>
<td width="100px"></td>
<td><input type="submit" name="login" value="Login &#187;" class="primary" /></td>
</tr>
</table>
<% end %>
<% end %>
<% if auth_schemes.include?('open_id') %>
<%= start_form_tag :action=> 'login', :action => 'begin' %>
<table>
<tr>
<td width="100px"><label for="openid_url">Identity URL:</label></td>
<td width="100px"><input type="text" name="openid_url" id="openid_url" value="" class="login_text open_id" /></td>
</tr>
<tr>
<td width="100px"><label for="user_noexpiry">Stay logged in:</label></td>
<td width="100px"><input type="checkbox" name="user_noexpiry" id="user_noexpiry" checked /></td>
</tr>
<tr>
<td width="100px"></td>
<td><input type="submit" name="login" value="Verify &#187;" class="primary" /></td>
</tr>
</table>
<%= end_form_tag %>
<% form_tag :action=> 'login', :action => 'begin' do %>
<table>
<tr>
<td width="100px"><label for="openid_url">Identity URL:</label></td>
<td width="100px"><input type="text" name="openid_url" id="openid_url" value="" class="login_text open_id" /></td>
</tr>
<tr>
<td width="100px"><label for="user_noexpiry">Stay logged in:</label></td>
<td width="100px"><input type="checkbox" name="user_noexpiry" id="user_noexpiry" checked /></td>
</tr>
<tr>
<td width="100px"></td>
<td><input type="submit" name="login" value="Verify &#187;" class="primary" /></td>
</tr>
</table>
<% end %>
<% end %>
</div>

View file

@ -1,5 +1,5 @@
<div title="Account signup" id="signupform" class="form">
<%= start_form_tag :action=> "create" %>
<% form_tag :action=> "create" do %>
<%= error_messages_for 'user' %><br/>
@ -26,7 +26,7 @@
</tr>
</table>
<%= end_form_tag %>
<% end %>
</div>

View file

@ -22,14 +22,14 @@
<% end -%>
<% end -%>
<hr />
<%= form_tag( { :action => "filter", :type => "context" } ) %>
<% form_tag( { :action => "filter", :type => "context" } ) do -%>
<%= collection_select( "context", "id", @contexts, "id", "name",
{ :include_blank => true } ) %>
<%= submit_tag( value = "Go" ) %>
<%= end_form_tag %>
<% end -%>
<%= form_tag( {:action => "filter", :type => "project" }) %>
<% form_tag( {:action => "filter", :type => "project" }) do -%>
<%= collection_select( "project", "id", @projects, "id", "name",
{ :include_blank => true } ) %>
<%= submit_tag( value = "Go" ) %>
<%= end_form_tag %>
<% end -%>

View file

@ -1,4 +1,4 @@
<%= form_tag :action => 'update', :id => @item.id %>
<% form_tag :action => 'update', :id => @item.id do -%>
<%= render :partial => 'mobile_edit' %>
<%= end_form_tag %>
<% end -%>
<%= button_to "Back", :controller => 'mobile', :action => 'index' %>

View file

@ -1,4 +1,4 @@
<%= form_tag :action => 'update' %>
<% form_tag :action => 'update' do %>
<%= render :partial => 'mobile_edit' %>
<%= end_form_tag %>
<% end -%>
<%= button_to "Back", :controller => 'mobile', :action => 'index' %>

View file

@ -6,13 +6,13 @@
<%= sanitize(textilize(note.body)) %>
<div class="note_footer">
<%= link_to_remote( image_tag("blank", :title =>"Delete this note", :class=>"delete_item"),
<%= link_to_remote( image_tag("blank.png", :title =>"Delete this note", :class=>"delete_item"),
:update => "note-#{note.id}",
:loading => visual_effect(:fade, "note-#{note.id}-container"),
:complete => "Element.remove('note-#{note.id}-wrapper');",
:url => { :controller => "note", :action => "delete", :id => note.id },
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?" ) + "&nbsp;"%><%= link_to_function(image_tag( "blank", :title => "Edit item", :class=>"edit_item"),
"Element.toggle('note-#{note.id}','note-#{note.id}-edit-form'); Effect.Appear('note-#{note.id}-edit-form'); Form.focusFirstElement('form-note-#{note.id}');" ) + " | " %>
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?" ) + "&nbsp;"%><%= link_to_function(image_tag( "blank.png", :title => "Edit item", :class=>"edit_item"),
"Element.toggle('note-#{note.id}'); Element.toggle('note-#{note.id}-edit-form'); Effect.Appear('note-#{note.id}-edit-form'); Form.focusFirstElement('form-note-#{note.id}');" ) + " | " %>
<%= link_to("In: " + note.project.name, {:controller => "project", :action => "show", :name => urlize(note.project.name)}, :class=>"footer_link" ) %>&nbsp;|&nbsp;
Created: <%= format_date(note.created_at) %>
<% if note.updated_at? -%>
@ -22,12 +22,12 @@
</div><!-- [end.note.id] -->
<div id="note-<%= note.id %>-edit-form" class="edit-form" style="display:none;">
<%= form_remote_tag :url => { :action => 'update', :id => note.id },
<% form_remote_tag :url => { :action => 'update', :id => note.id },
:html => { :id => "form-note-#{note.id}", :class => "inline-form" },
:update => "note-#{note.id}-container",
:complete => visual_effect(:appear, "note-#{note.id}-container") %>
:complete => visual_effect(:appear, "note-#{note.id}-container") do -%>
<%= render :partial => "note_edit_form", :object => note %>
<%= end_form_tag %>
<% end -%>
</div><!-- [end:action-item.id-edit-form] -->
</div><!-- [end.note-note.id-container] -->

View file

@ -1,6 +1,6 @@
<% note = notes_summary -%>
<div class="note_wrapper">
<%= link_to( image_tag("blank", :border => 0), { :controller => "note", :action => "show",
<%= link_to( image_tag("blank.png", :border => 0), { :controller => "note", :action => "show",
:id => note.id}, :title => "Show note", :class => "show_notes icon") %>&nbsp;
<%= sanitize(textilize(truncate(note.body, 50, "..."))) %>
</div>

View file

@ -17,27 +17,27 @@
<span class="grey">ACTIVE</span>
<% end -%>
<%= link_to_remote( image_tag("blank", :title =>"Delete project", :class=>"delete_item"),
<%= link_to_remote( image_tag("blank.png", :title =>"Delete project", :class=>"delete_item"),
:update => "container_#{project.id}",
:loading => visual_effect(:fade, "container_#{project.id}"),
:url => { :controller => "project", :action => "destroy", :id => project.id },
:confirm => "Are you sure that you want to delete the project \'#{project.name}\'?" ) + " " +
link_to_function(image_tag( "blank", :title => "Edit item", :class=>"edit_item"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focusFirstElement('form-project-#{project.id}');" ) %>
link_to_function(image_tag( "blank.png", :title => "Edit item", :class=>"edit_item"), "Element.toggle('project-#{project.id}'); Element.toggle('project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focusFirstElement('form-project-#{project.id}');" ) %>
</div>
</div><!-- [end:project-project.id] -->
<div id="project-<%= project.id %>-edit-form" class="edit-form" style="display:none;">
<%= form_remote_tag :url => { :controller => 'project', :action => 'update', :id => project.id },
<% form_remote_tag :url => { :controller => 'project', :action => 'update', :id => project.id },
:html => { :id => "form-project-#{project.id}", :class => "form" },
:complete => visual_effect(:appear, 'container_#{project.id}') %>
:complete => visual_effect(:appear, 'container_#{project.id}') do -%>
<table style="table-layout: fixed;" width="450">
<%= render :partial => 'project_form', :object => project %>
<tr>
<td width="150">&nbsp; <input type="hidden" name="wants_render" value="false" /></td>
<td width="300"><input type="submit" value="Update" />&nbsp;<a href="javascript:void(0);" onclick="Element.toggle('project-<%= project.id %>','project-<%= project.id %>-edit-form');Form.reset('form-project-<%= project.id %>');">Cancel</a></td>
<td width="300"><input type="submit" value="Update" />&nbsp;<a href="javascript:void(0);" onclick="Element.toggle('project-<%= project.id %>'); Element.toggle('project-<%= project.id %>-edit-form');Form.reset('form-project-<%= project.id %>');">Cancel</a></td>
</tr>
</table>
<%= end_form_tag %>
<% end -%>
</div><!-- [end:project-project.id-edit-form] -->
</div><!-- [end:container_project.id] -->
<% if controller.action_name == 'create' %>

View file

@ -9,8 +9,8 @@
<a href="#" onClick="Element.toggle('project_new'); Form.focusFirstElement('project-form');return false" accesskey="n" title="Create a new project">Create new project &#187;</a>
<div id="project_new" class="project_new" style="display:none">
<!--[form:project]-->
<%= form_remote_tag :url => { :action => "create" },
:html=> { :id=>'project-form', :name=>'project', :class => 'inline-form' } %>
<% form_remote_tag :url => { :action => "create" },
:html=> { :id=>'project-form', :name=>'project', :class => 'inline-form' } do -%>
<div id="status"><%= error_messages_for('project') %></div>
@ -23,7 +23,7 @@
<%= text_area 'project', 'description', "cols" => 30, "rows" => 4 %>
<br />
<input type="submit" value="Add" />
<%= end_form_tag %>
<% end -%>
<!--[eoform:project]-->
</div>
</div>

View file

@ -1,9 +1,7 @@
<div id="display_box">
<%= render :partial => "project/project", :locals => { :project => @project, :collapsible => false } %>
<% unless @done.empty? -%>
<%= render :partial => "todo/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this project" } %>
<% end -%>
<%= render :partial => "todo/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this project" } %>
<div class="container">
<div id="notes">
@ -19,16 +17,16 @@
<div>
<div id="new-note" style="display:none;">
<%= form_remote_tag :url => { :controller => "note", :action => "add" },
<% form_remote_tag :url => { :controller => "note", :action => "add" },
:update => "notes",
:position => "bottom",
:complete => "new Effect.Highlight('notes');$('empty-n').hide();",
:html => {:id=>'form-new-note', :class => 'inline-form'} %>
:html => {:id=>'form-new-note', :class => 'inline-form'} do %>
<%= hidden_field( "new_note", "project_id", "value" => "#{@project.id}" ) %>
<%= text_area( "new_note", "body", "cols" => 50, "rows" => 3, "tabindex" => 1 ) %>
<br /><br />
<input type="submit" value="Add note" tabindex="2" />
<%= end_form_tag %>
<% end -%>
</div>
<div class="container">

View file

@ -11,9 +11,9 @@
<div id="todo_new_action" class="context_new" style="display:block">
<!--[form:todo]-->
<%= form_remote_tag(
<% form_remote_tag(
:url => { :controller => "todo", :action => "create" },
:html=> { :id=>'todo-form-new-action', :name=>'todo', :class => 'inline-form' }) %>
:html=> { :id=>'todo-form-new-action', :name=>'todo', :class => 'inline-form' }) do -%>
<div id="status"><%= error_messages_for("item") %></div>
@ -55,7 +55,7 @@ Event.observe($('todo_project_name'), "click", projectAutoCompleter.activate.bin
<%= source_view_tag( @source_view ) %>
<input type="submit" value="Add item" tabindex="7">
<%= end_form_tag %><!--[eoform:todo]-->
<% end -%><!--[eoform:todo]-->
<%= observe_field "todo_due",
:frequency => 2,

View file

@ -1,7 +1,7 @@
<div id="message_holder">
<% if flash.empty? %>
<h4 id="flash" class="alert" style="display:none"></h4>
<% else %>
<% else %>
<% flash.each do |key,value| -%>
<h4 id="flash" class='alert <%= key %>'>
<%= value %>

View file

@ -1,6 +1,6 @@
<tr>
<% if done.completed_at %>
<td valign="top"><%= image_tag( "done", :width=>"16", :height=>"16", :border=>"0") %></td>
<td valign="top"><%= image_tag( "done.png", :width=>"16", :height=>"16", :border=>"0") %></td>
<td valign="top"><span class="grey"><%= format_date( done.completed_at ) %></span></td>
<td valign="top"><%= " " + sanitize(done.description) + " "%>

View file

@ -47,7 +47,7 @@
<% end -%>
<tr>
<td colspan="2"><input type="submit" value="Update" tabindex="6" />
<a href="javascript:void(0);" onclick="Element.toggle('item-<%= @item.id %>','action-<%= @item.id %>-edit-form');Form.reset('form-action-<%= @item.id %>');">Cancel</a></td>
<a href="javascript:void(0);" onclick="Element.toggle('item-<%= @item.id %>');Element.toggle('action-<%= @item.id %>-edit-form');">Cancel</a></td>
</tr>
</table>

View file

@ -40,8 +40,8 @@
</div>
</div><!-- [end:item-item.id] -->
<div id="action-<%= item.id %>-edit-form" class="edit-form" style="display:none;">
<%= form_remote_tag_edit_todo( item ) -%>
<% form_remote_tag_edit_todo( item ) do -%>
<% #note: edit form will load here remotely -%>
<%= end_form_tag -%>
<% end -%>
</div><!-- [end:action-item.id-edit-form] -->
</div><!-- [end:item-item.id-container] -->

View file

@ -5,7 +5,7 @@ if @saved
unless @user.preference.hide_completed_actions?
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "completed" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
page[empty_container_msg_div_id].show if @down_count == '0' && !empty_container_msg_div_id.nil?
page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil?
page.hide "empty-d" # If we've checked something as done, completed items can't be empty
end
if @remaining_undone_in_context == 0 && source_view_is(:todo)
@ -15,7 +15,7 @@ if @saved
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id
page.insert_html :bottom, item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
page.show "empty-d" if @done_count == '0'
page.show "empty-d" if @completed_count == 0
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? # If we've checked something as undone, uncompleted items can't be empty
end
page.hide "status"

View file

@ -6,13 +6,13 @@
<p>Select your new authentication type and click 'Change Authentication Type' to replace your current settings.</p>
<%= start_form_tag :action => 'update_auth_type' %>
<div><label for="user_auth_type">Authentication type:</label> <%= select('user', 'auth_type', Tracks::Config.auth_schemes.collect {|p| [ p, p ] }) %></div>
<div id="open_id" style="display:<%= @user.auth_type == 'open_id' ? 'block' : 'none' %>"><label for="user_open_id_url">Identity URL:</label> <input type="text" name="openid_url" value="<%= @user.open_id_url %>" class="open_id" /></div>
<div class="actions"><%= submit_tag 'Change Authentication Type' %> <%= link_to 'Cancel', :action => 'preferences' %></div>
<% form_tag :action => 'update_auth_type' do %>
<div><label for="user_auth_type">Authentication type:</label> <%= select('user', 'auth_type', Tracks::Config.auth_schemes.collect {|p| [ p, p ] }) %></div>
<div id="open_id" style="display:<%= @user.auth_type == 'open_id' ? 'block' : 'none' %>"><label for="user_open_id_url">Identity URL:</label> <input type="text" name="openid_url" value="<%= @user.open_id_url %>" class="open_id" /></div>
<div class="actions"><%= submit_tag 'Change Authentication Type' %> <%= link_to 'Cancel', :action => 'preferences' %></div>
<%= observe_field( :user_auth_type, :function => "$('open_id').style.display = value == 'open_id' ? 'block' : 'none'") %>
<%= observe_field( :user_auth_type, :function => "$('open_id').style.display = value == 'open_id' ? 'block' : 'none'") %>
<%= end_form_tag %>
<% end %>
</div>

View file

@ -6,7 +6,7 @@
<p>Enter your new password in the fields below and click 'Change Password' to replace your current password with your new one.</p>
<%= start_form_tag :action => 'update_password' %>
<% form_tag :action => 'update_password' do %>
<table width="440px">
<tr>
<td><label for="updateuser_password">New password:</label></td>
@ -21,6 +21,6 @@
<td><%= submit_tag 'Change password' %></td>
</tr>
</table>
<%= end_form_tag %>
<% end %>
</div>

View file

@ -19,51 +19,51 @@
</div>
<div id="input_box" class="container context">
<%= start_form_tag :action => 'update_preferences' %>
<table>
<tr>
<td><label>first name:</label></td>
<td><%= text_field 'user', 'first_name' %></td>
</tr>
<tr>
<td><label>last name:</label></td>
<td><%= text_field 'user', 'last_name' %></td>
</tr>
<%
def table_row(pref_name, nowrap_label = false, &block)
nowrap_attribute = nowrap_label ? ' nowrap="nowrap"' : ''
s = %Q|<tr>\n<td#{nowrap_attribute}><label>#{pref_name.gsub(/_/,' ')}:</label></td>\n<td>\n|
s << yield
s << "\n</td></tr>"
s
end
<% form_tag :action => 'update_preferences' do %>
<table>
<tr>
<td><label>first name:</label></td>
<td><%= text_field 'user', 'first_name' %></td>
</tr>
<tr>
<td><label>last name:</label></td>
<td><%= text_field 'user', 'last_name' %></td>
</tr>
<%
def table_row(pref_name, nowrap_label = false, &block)
nowrap_attribute = nowrap_label ? ' nowrap="nowrap"' : ''
s = %Q|<tr>\n<td#{nowrap_attribute}><label>#{pref_name.gsub(/_/,' ')}:</label></td>\n<td>\n|
s << yield
s << "\n</td></tr>"
s
end
def row_with_select_field(pref_name, collection = [true,false], nowrap_label = false)
table_row(pref_name, nowrap_label) { select('prefs', pref_name, collection) }
end
def row_with_select_field(pref_name, collection = [true,false], nowrap_label = false)
table_row(pref_name, nowrap_label) { select('prefs', pref_name, collection) }
end
def row_with_text_field(pref_name, nowrap_label = false)
table_row(pref_name, nowrap_label) { text_field('prefs', pref_name) }
end
%>
def row_with_text_field(pref_name, nowrap_label = false)
table_row(pref_name, nowrap_label) { text_field('prefs', pref_name) }
end
%>
<%= row_with_select_field("week_starts", Preference.day_number_to_name_map.invert.sort{|a,b| a[1]<=>b[1]})%>
<%= row_with_select_field("due_style", [['Due in ___ days',0],['Due on _______',1]]) %>
<%= row_with_select_field("show_completed_projects_in_sidebar") %>
<%= row_with_select_field("show_hidden_projects_in_sidebar") %>
<%= row_with_select_field("show_hidden_contexts_in_sidebar") %>
<%= row_with_select_field("week_starts", Preference.day_number_to_name_map.invert.sort{|a,b| a[1]<=>b[1]})%>
<%= row_with_select_field("due_style", [['Due in ___ days',0],['Due on _______',1]]) %>
<%= row_with_select_field("show_completed_projects_in_sidebar") %>
<%= row_with_select_field("show_hidden_projects_in_sidebar") %>
<%= row_with_select_field("show_hidden_contexts_in_sidebar") %>
<% if @user.is_admin? %> <%= row_with_text_field('admin_email') %> <% end %>
<%= row_with_text_field('staleness_starts', true) %>
<%= row_with_text_field('date_format') %>
<%= row_with_text_field('show_number_completed') %>
<%= row_with_text_field('refresh') %>
<%= row_with_select_field("verbose_action_descriptors") %>
<% if @user.is_admin? %> <%= row_with_text_field('admin_email') %> <% end %>
<%= row_with_text_field('staleness_starts', true) %>
<%= row_with_text_field('date_format') %>
<%= row_with_text_field('show_number_completed') %>
<%= row_with_text_field('refresh') %>
<%= row_with_select_field("verbose_action_descriptors") %>
<tr><td><%= submit_tag "Update" %></td>
<td><%= link_to "Cancel", :controller => 'user', :action => 'preferences' %></td>
</tr>
</table>
<%= end_form_tag %>
</div>
<tr><td><%= submit_tag "Update" %></td>
<td><%= link_to "Cancel", :controller => 'user', :action => 'preferences' %></td>
</tr>
</table>
<% end %>
</div>