Author: assaf
Date: Sat Jun 14 21:11:59 2008
New Revision: 667925
URL: http://svn.apache.org/viewvc?rev=667925&view=rev
Log:
Minor change to take advantage of new time zone support in Rails 2.1.
Smaller buttons on task list.
Modified:
ode/sandbox/singleshot/.gitignore
ode/sandbox/singleshot/app/controllers/activity_controller.rb
ode/sandbox/singleshot/app/controllers/tasks_controller.rb
ode/sandbox/singleshot/app/helpers/application_helper.rb
ode/sandbox/singleshot/app/models/task.rb
ode/sandbox/singleshot/app/views/activity/index.atom.builder
ode/sandbox/singleshot/app/views/tasks/index.atom.builder
ode/sandbox/singleshot/app/views/tasks/show.html.erb
ode/sandbox/singleshot/lib/tasks/populate.rake
ode/sandbox/singleshot/public/javascripts/application.js
ode/sandbox/singleshot/public/stylesheets/default.css
Modified: ode/sandbox/singleshot/.gitignore
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/.gitignore?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/.gitignore (original)
+++ ode/sandbox/singleshot/.gitignore Sat Jun 14 21:11:59 2008
@@ -1,3 +1,4 @@
tmp
log
db/*.sqlite3
+vendor/rails
Modified: ode/sandbox/singleshot/app/controllers/activity_controller.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/activity_controller.rb?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/activity_controller.rb (original)
+++ ode/sandbox/singleshot/app/controllers/activity_controller.rb Sat Jun 14
21:11:59 2008
@@ -9,7 +9,7 @@
Mime::ICS=>formatted_activity_url(:format=>:ics,
:access_key=>authenticated.access_key) }
@activities = Activity.for_stakeholder(authenticated)
day = Date.new(params[:year].to_i, params[:month].to_i, params[:day].to_i)
rescue nil if params[:year]
- dates = day ? day..day + 1.day : Date.today - 3.day..Date.today + 1.day
+ dates = day ? day..day + 1.day : Date.current - 3.day..Date.current + 1.day
@activities = @activities.for_dates(dates)
respond_to do |want|
want.html
Modified: ode/sandbox/singleshot/app/controllers/tasks_controller.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/tasks_controller.rb?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/tasks_controller.rb (original)
+++ ode/sandbox/singleshot/app/controllers/tasks_controller.rb Sat Jun 14
21:11:59 2008
@@ -27,7 +27,7 @@
@tasks = Task.completed.for_stakeholder(authenticated).with_stakeholders
respond_to do |wants|
wants.html do
- @graph = Task.connection.select_values("SELECT tasks.updated_at FROM
tasks JOIN stakeholders ON stakeholders.task_id = tasks.id WHERE
person_id=#{authenticated.id} AND role='owner' AND status='completed' AND
tasks.updated_at >= '#{Date.today - 1.month}'").group_by { |date| date.to_date
}.map { |date, entries| entries.size }
+ @graph = Task.connection.select_values("SELECT tasks.updated_at FROM
tasks JOIN stakeholders ON stakeholders.task_id = tasks.id WHERE
person_id=#{authenticated.id} AND role='owner' AND status='completed' AND
tasks.updated_at >= '#{Date.current - 1.month}'").group_by { |date|
date.to_date }.map { |date, entries| entries.size }
end
# TODO: wants.xml
# TODO: wants.json
Modified: ode/sandbox/singleshot/app/helpers/application_helper.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/helpers/application_helper.rb?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/helpers/application_helper.rb (original)
+++ ode/sandbox/singleshot/app/helpers/application_helper.rb Sat Jun 14
21:11:59 2008
@@ -16,7 +16,7 @@
def relative_date(date)
date = date.to_date
- today = Date.today
+ today = Date.current
if date == today
'today'
elsif date == today - 1.day
@@ -31,7 +31,7 @@
end
def age(time, ago = true)
- text = case age = Time.now - time
+ text = case age = Time.current - time
when 0...2.minute
'1 minute'
when 2.minute...1.hour
@@ -53,7 +53,7 @@
end
def relative_time(time)
- case age = Time.now - time
+ case age = Time.current - time
when 0...2.minute
'this minute'
when 2.minute...1.hour
@@ -83,7 +83,7 @@
def group_by_dates(activities, attr = :updated_at)
activities.inject([]) do |groups, activity|
- date, today = activity.send(attr).to_date, Date.today
+ date, today = activity.send(attr).to_date, Date.current
group = if date == today
'today'
elsif date == today.yesterday
Modified: ode/sandbox/singleshot/app/models/task.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Sat Jun 14 21:11:59 2008
@@ -308,7 +308,7 @@
end
def over_due?
- due_on ? (ready? || active?) && due_on < Date.today : false
+ due_on ? (ready? || active?) && due_on < Date.current : false
end
# Scopes can use this to add ranking methods on returned records.
@@ -322,7 +322,7 @@
# - High priority tasks always rank higher than lower priority tasks
# - Older tasks rank higher than more recently created tasks
def rank_for(person)
- today = Date.today
+ today = Date.current
# Calculating an absolute rank value is tricky if not impossible, so
instead we construct
# an array of values and compare these arrays against each other. To
create an array we
# need a person's name, so we can ranked their owned tasks higher.
@@ -516,11 +516,11 @@
:extend=>RankingMethods
named_scope :completed, lambda { |end_date|
- { :conditions=>["tasks.status == 'completed' AND tasks.updated_at >= ?",
end_date || Date.today - 7.days],
+ { :conditions=>["tasks.status == 'completed' AND tasks.updated_at >= ?",
end_date || Date.current - 7.days],
:order=>'tasks.updated_at DESC' } }
named_scope :following, lambda { |end_date|
- { :conditions=>["tasks.updated_at >= ?", end_date || Date.today - 7.days],
+ { :conditions=>["tasks.updated_at >= ?", end_date || Date.current -
7.days],
:order=>'tasks.updated_at DESC' } }
named_scope :visible, :conditions=>["tasks.status != 'reserved'"]
Modified: ode/sandbox/singleshot/app/views/activity/index.atom.builder
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/activity/index.atom.builder?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/activity/index.atom.builder (original)
+++ ode/sandbox/singleshot/app/views/activity/index.atom.builder Sat Jun 14
21:11:59 2008
@@ -11,6 +11,9 @@
content.text! "<p>#{activity_to_html(activity)}</p>"
content.text! truncate(strip_tags(task.description), 250)
end
+ entry.author do |author|
+ author.name activity.person.fullname if activity.person
+ end
end
end
end
Modified: ode/sandbox/singleshot/app/views/tasks/index.atom.builder
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/index.atom.builder?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/index.atom.builder (original)
+++ ode/sandbox/singleshot/app/views/tasks/index.atom.builder Sat Jun 14
21:11:59 2008
@@ -9,6 +9,9 @@
content.text! sanitize(simple_format(task.description))
content.text! "<p><em>#{task_vitals(task)}</em></p>"
end
+ entry.author do |author|
+ author.name task.creator.fullname if task.creator
+ end
end
end
end
Modified: ode/sandbox/singleshot/app/views/tasks/show.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/show.html.erb?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/show.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/show.html.erb Sat Jun 14 21:11:59
2008
@@ -22,7 +22,7 @@
<dt>Recent activity</dt>
<dd>
<ul class='alternate'><%= content_tag 'li',
link_to(image_tag('feed.png') + ' Feed', @alternate[Mime::ATOM],
:rel=>'alternate', :title=>'Subscribe to see changes to this task') %><%=
content_tag 'li', link_to(image_tag('calendar.png') + ' Calendar',
@alternate[Mime::ICS], :rel=>'alternate', :title=>'Add this task to your
calendar') %></ul>
- <%= render :file=>'activity/_activities', :locals=>{
:today=>Date.today, :activities=>@task.activities } %>
+ <%= render :file=>'activity/_activities', :locals=>{
:today=>Date.current, :activities=>@task.activities } %>
</dd>
</dl>
<div class='actions'><%= task_actions(@task) %></div>
Modified: ode/sandbox/singleshot/lib/tasks/populate.rake
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/populate.rake?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/populate.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/populate.rake Sat Jun 14 21:11:59 2008
@@ -35,13 +35,13 @@
you = Person.identify(ENV['USER'])
defaults = { :title=>Faker::Lorem.sentence,
:description=>Faker::Lorem.paragraphs(3).join("\n\n"),
:rendering=>{
:perform_url=>'http://localhost:3001/sandwich', :integrated_ui=>true },
:potential_owners=>[you, other] }
- returning Task.new(defaults.merge(attributes || {})) do |task|
- task.modify_by(you).save!
- def task.delay(duration = 2.hours)
- Task.delay(duration)
- self
- end
+ task = Task.new(defaults.merge(attributes || {}))
+ task.modify_by(you).save!
+ def task.delay(duration = 2.hours)
+ Task.delay(duration)
+ self
end
+ task
end
@@ -63,9 +63,9 @@
# High priority should show first.
create :owner=>you, :priority=>Task::PRIORITIES.first
# Over-due before due today before anything else.
- create :owner=>you, :due_on=>Time.today - 1.day
- create :owner=>you, :due_on=>Time.today
- create :owner=>you, :due_on=>Time.today + 1.day
+ create :owner=>you, :due_on=>Date.current - 1.day
+ create :owner=>you, :due_on=>Date.current
+ create :owner=>you, :due_on=>Date.current + 1.day
# Completed, cancelled, suspended
create(:potential_owners=>[you,
other]).delay(30.minutes).modify_by(other).update_attributes(:status=>'suspended')
create(:owner=>you,
:status=>'active').delay(2.hours).modify_by(you).update_attributes(:status=>'completed')
Modified: ode/sandbox/singleshot/public/javascripts/application.js
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/public/javascripts/application.js?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/public/javascripts/application.js (original)
+++ ode/sandbox/singleshot/public/javascripts/application.js Sat Jun 14
21:11:59 2008
@@ -32,5 +32,11 @@
target.show();
}
Event.stop(event);
+ },
+
+ makeTopFrame: function() {
+ var to = window.location.href;
+ if (top.location != to)
+ top.location = to;
}
}
Modified: ode/sandbox/singleshot/public/stylesheets/default.css
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/public/stylesheets/default.css?rev=667925&r1=667924&r2=667925&view=diff
==============================================================================
--- ode/sandbox/singleshot/public/stylesheets/default.css (original)
+++ ode/sandbox/singleshot/public/stylesheets/default.css Sat Jun 14 21:11:59
2008
@@ -250,6 +250,9 @@
table.tasks tbody td .priority_1 {
color: #f04040;
}
+table.tasks td .button-to {
+ font-size: 0.7em;
+}
/** Chronological list **/