Convert multiline { || ... } blocks into do || ... end for nicer style.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@338 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-11-08 06:25:18 +00:00
parent 4caca8db70
commit e957f86cd1
6 changed files with 28 additions and 28 deletions

View file

@ -93,11 +93,11 @@ class ApplicationController < ActionController::Base
end
def init_not_done_counts(parents = ['project','context'])
parents.each {|parent|
parents.each do |parent|
eval("@#{parent}_not_done_counts = Todo.count(:all,
:conditions => ['user_id = ? and type = ? and done = ?', @user.id, \"Immediate\", false],
:group => :#{parent}_id)")
}
end
end
end

View file

@ -4,7 +4,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
xml.title(@title)
xml.link("http://#{@request.host}:#{@request.port}/contexts")
xml.description(@description)
@contexts.each { |c|
@contexts.each do |c|
xml.item do
xml.title(c.name)
xml.link(url_for(:only_path => false, :controller => 'context', :action => 'show', :name => urlize(c.name)))
@ -14,6 +14,6 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
context_description += "</p>"
xml.description(context_description)
end
}
end
end
end

View file

@ -4,7 +4,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
xml.title(@title)
xml.link("http://#{@request.host}:#{@request.port}/projects")
xml.description(@description)
@projects.each { |p|
@projects.each do |p|
xml.item do
xml.title(p.name)
xml.link(url_for(:only_path => false, :controller => 'project', :action => 'show', :name => urlize(p.name)))
@ -16,6 +16,6 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
project_description += "</p>"
xml.description(project_description)
end
}
end
end
end

View file

@ -3,23 +3,23 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
xml.title(@title)
xml.link("http://#{request.host}:#{request.port}/todo/list")
xml.description(@description)
@todos.each { |i|
@todos.each do |i|
xml.item do
xml.title(i.description)
xml.link(url_for(:only_path => false, :controller => 'context', :action => 'show', :name => urlize(i.context.name)))
item_notes = sanitize(markdown( i.notes )) if i.notes?
due = "<div>Due: #{format_date(i.due)}</div>\n" if i.due?
xml.link(url_for(:only_path => false, :controller => 'context', :action => 'show', :name => urlize(i.context.name)))
item_notes = sanitize(markdown( i.notes )) if i.notes?
due = "<div>Due: #{format_date(i.due)}</div>\n" if i.due?
toggle_link = link_to( "mark as done", {:only_path => false, :controller => "todo", :action => "toggle_check", :id => i.id})
done = "<div>#{toggle_link}</div>" unless i.completed?
done = "<div>Completed: #{format_date(i.completed)}</div>\n" if i.completed?
context_link = link_to( i.context.name, { :only_path => false, :controller => "context", :action => "show", :name => urlize(i.context.name) } )
project_link = if i.project_id?
link_to (i.project.name, { :only_path => false, :controller => "project", :action => "show", :name => urlize(i.project.name)} )
else
"<em>none</em>"
end
xml.description("#{done||''}#{due||''}#{item_notes||''}\n<div>Project: #{project_link}</div>\n<div>Context: #{context_link}</div>")
end
}
done = "<div>#{toggle_link}</div>" unless i.completed?
done = "<div>Completed: #{format_date(i.completed)}</div>\n" if i.completed?
context_link = link_to( i.context.name, { :only_path => false, :controller => "context", :action => "show", :name => urlize(i.context.name) } )
if i.project_id?
project_link = link_to (i.project.name, { :only_path => false, :controller => "project", :action => "show", :name => urlize(i.project.name)} )
else
project_link = "<em>none</em>"
end
xml.description("#{done||''}#{due||''}#{item_notes||''}\n<div>Project: #{project_link}</div>\n<div>Context: #{context_link}</div>")
end
end
end
end

View file

@ -1,14 +1,14 @@
@headers["Content-Type"] = "text/xml; charset=utf-8"
xml.todos_by_context do
@contexts_to_show.each { |c|
@contexts_to_show.each do |c|
xml.context do
xml.name c.name
xml.hide c.hide, :type => :boolean
xml.id c.id, :type => :integer
xml.position c.position, :type => :integer
c.not_done_todos.each { |t|
c.not_done_todos.each do |t|
xml << t.to_xml( :skip_instruct => true, :root => 'todo', :except => [:user_id, :context_id] )
}
end
}
end
end
end
end

View file

@ -60,10 +60,10 @@ class LdapAuthTest < Test::Unit::TestCase
end
def start_ldap_server
t = Thread.new(@slapd_conf.path) { |slapd_conf_path|
t = Thread.new(@slapd_conf.path) do |slapd_conf_path|
puts "starting slapd..." if OUTPUT_DEBUG_INFO
run_cmd %Q{/usr/libexec/slapd -f #{slapd_conf_path} -h "ldap://127.0.0.1:10389/" -d0}
}
end
sleep(2)
run_cmd %Q{ldapsearch -H "ldap://127.0.0.1:10389/" -x -b '' -s base '(objectclass=*)' namingContexts}
end