Author: assaf
Date: Wed May 28 16:02:23 2008
New Revision: 661137
URL: http://svn.apache.org/viewvc?rev=661137&view=rev
Log:
Switched to tabular view for tasks list (also completed, following).
Provides more concise task list, more information in less space.
Added:
ode/sandbox/singleshot/app/views/tasks/completed.html.erb
ode/sandbox/singleshot/app/views/tasks/following.html.erb
Modified:
ode/sandbox/singleshot/app/controllers/tasks_controller.rb
ode/sandbox/singleshot/app/helpers/application_helper.rb
ode/sandbox/singleshot/app/helpers/task_helper.rb
ode/sandbox/singleshot/app/models/task.rb
ode/sandbox/singleshot/app/views/activities/index.html.erb
ode/sandbox/singleshot/app/views/layouts/application.html.erb
ode/sandbox/singleshot/app/views/tasks/_task.html.erb
ode/sandbox/singleshot/app/views/tasks/index.html.erb
ode/sandbox/singleshot/lib/tasks/populate.rake
ode/sandbox/singleshot/public/stylesheets/default.css
Modified: ode/sandbox/singleshot/app/controllers/tasks_controller.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/controllers/tasks_controller.rb?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/tasks_controller.rb (original)
+++ ode/sandbox/singleshot/app/controllers/tasks_controller.rb Wed May 28
16:02:23 2008
@@ -28,7 +28,6 @@
respond_to do |format|
format.html do
@days = @tasks.group_by { |task| task.updated_at.to_date }
- render :template=>'tasks/by_day'
end
# TODO: format.xml
# TODO: format.json
@@ -45,7 +44,6 @@
respond_to do |format|
format.html do
@days = @tasks.group_by { |task| task.updated_at.to_date }
- render :template=>'tasks/by_day'
end
# TODO: format.xml
# TODO: format.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=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/helpers/application_helper.rb (original)
+++ ode/sandbox/singleshot/app/helpers/application_helper.rb Wed May 28
16:02:23 2008
@@ -5,10 +5,11 @@
# (or profile, if unspecified) as the reference.
def link_to_person(person, *args)
options = args.extract_options!
- fullname = person == authenticated ? 'you' : h(person.fullname)
- if person.url
+ if person == authenticated
+ content_tag('span', 'you')
+ elsif person.url
options.update :rel=>args.first if args.first
- link_to(fullname, person.url, options.merge(:title=>"See #{fullname}'s
profile"))
+ link_to(h(person.fullname), person.url, options.merge(:title=>"See
#{h(person.fullname)}'s profile"))
else
content_tag('span', fullname)
end
@@ -34,20 +35,32 @@
end
def relative_time(time)
- diff = Time.now - time
- if diff < 1.minute
- 'this minute'
- elsif diff < 1.hour
- "#{(diff / 1.minute).round} minutes ago"
- elsif diff < 1.day
- "#{(diff / 1.hour).round} hours ago"
- elsif diff < 1.month
- "#{(diff / 1.day).round} days ago"
+ case age = Time.now - time
+ when 0...2.minute
+ '1 minute'
+ when 2.minute...1.hour
+ '%d minutes' % (age / 1.minute)
+ when 1.hour...2.hour
+ '1 hour'
+ when 2.hour...1.day
+ '%d hours' % (age / 1.hour)
+ when 1.day...2.day
+ '1 day'
+ when 2.day...1.month
+ '%d days' % (age / 1.day)
+ when 1.month...2.month
+ 'about 1 month'
+ else
+ '%d months' % (age / 1.month) if age > 0
end
end
- def relative_date_abbr(date, options = {})
- content_tag 'abbr', relative_date(date),
options.merge(:title=>date.to_date.to_s)
+ def abbr_date(date, text, options = {})
+ content_tag 'abbr', text,
options.merge(:title=>date.to_date.strftime('%Y%m%d'))
+ end
+
+ def abbr_time(time, text, options = {})
+ content_tag 'abbr', text,
options.merge(:title=>time.strftime('%Y%m%dT%H:%M:%S'))
end
end
Modified: ode/sandbox/singleshot/app/helpers/task_helper.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/helpers/task_helper.rb?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/helpers/task_helper.rb (original)
+++ ode/sandbox/singleshot/app/helpers/task_helper.rb Wed May 28 16:02:23 2008
@@ -8,10 +8,10 @@
end
def task_vitals(task)
- vitals = ['Created ' + relative_date_abbr(task.created_at,
:class=>'published')]
+ vitals = ['Created ' + abbr_time(task.created_at,
relative_date(task.created_at), :class=>'published')]
vitals.first << ' by ' + link_to_person(task.creator, :creator) if
task.creator
vitals << (task.status == 'completed' ? "completed by " : "assigned to ")
+ link_to_person(task.owner, :owner) if task.owner
- vitals << "due #{relative_date_abbr(task.due_on)}" if task.due_on
+ vitals << "due #{relative_date(task.due_on)}" if task.due_on
vitals.to_sentence
end
@@ -19,6 +19,7 @@
if task.form_perform_url
task_uri = URI(task_perform_url(task))
task_uri.user, task_uri.password = '_token',
task.token_for(authenticated)
+ # TODO: fix to handle perform/view URLs differently and decide when to
pass perform query param.
uri = URI(task.owner?(authenticated) ? task.form_perform_url :
(task.form_view_url || task.form_perform_url))
uri.query = CGI.parse(uri.query ||
'').update('perform'=>task.owner?(authenticated), 'task_url'=>task_uri).to_query
uri.to_s
Modified: ode/sandbox/singleshot/app/models/task.rb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Wed May 28 16:02:23 2008
@@ -365,7 +365,7 @@
:order=>'tasks.updated_at DESC' } }
named_scope :following, lambda { |end_date|
- { :conditions=>["involved.role IN ('creator', 'observer', 'admin') AND
tasks.updated_at >= ?", end_date || Date.today - 7.days],
+ { :conditions=>["involved.role != 'excluded' AND tasks.updated_at >= ?",
end_date || Date.today - 7.days],
:order=>'tasks.updated_at DESC' } }
named_scope :visible, :conditions=>["tasks.status != 'reserved'"]
Modified: ode/sandbox/singleshot/app/views/activities/index.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/activities/index.html.erb?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/activities/index.html.erb (original)
+++ ode/sandbox/singleshot/app/views/activities/index.html.erb Wed May 28
16:02:23 2008
@@ -1,14 +1,16 @@
-<ol class='activities hfeed'>
- <% for day in @days %>
- <li class='day'>
- <h3 class='date'><%= relative_date(day.first).titleize %></h3>
- <% for activity in day.last %>
- <% content_tag_for 'li', activity, :class=>'hentry entry-title' do %>
- <%= link_to h(activity.person.fullname), activity.person.identity %>
- <%= activity.action %>
- the task <%= link_to h(truncate(activity.task.title, 100)),
task_url(activity.task), :rel=>'bookmark' %>
+<ol class='dates hfeed'>
+ <% for day, activities in @days %>
+ <% content_tag_for 'li', day do %>
+ <h2><%= abbr_date day, relative_date(day).capitalize %></h2>
+ <ol class='activities'>
+ <% for activity in activities %>
+ <% content_tag_for 'li', activity, :class=>'hentry entry-title' do %>
+ <%= link_to h(activity.person.fullname), activity.person.identity
%>
+ <%= activity.action %>
+ the task <%= link_to h(truncate(activity.task.title, 100)),
task_url(activity.task), :rel=>'bookmark,
:title=>truncate(strip_tags(task.description), 250)' %>
+ <% end %>
<% end %>
- <% end %>
- </li>
+ </ol>
+ <% end %>
<% end %>
</ol>
Modified: ode/sandbox/singleshot/app/views/layouts/application.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/layouts/application.html.erb?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/layouts/application.html.erb (original)
+++ ode/sandbox/singleshot/app/views/layouts/application.html.erb Wed May 28
16:02:23 2008
@@ -10,6 +10,7 @@
</head>
<body>
<div id='header'>
+ <h1><%= link_to 'Singleshot', root_url %></h1>
<ul class='links'><li><%= link_to 'Logout', session_url,
:method=>:delete %></li></ul>
<ul class='tabs'><%=
[ ['â Tasks', tasks_url, 'Pending and available tasks'],
Modified: ode/sandbox/singleshot/app/views/tasks/_task.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/_task.html.erb?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/_task.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/_task.html.erb Wed May 28 16:02:23
2008
@@ -2,6 +2,5 @@
<h3 class='entry-title priority_<%= task.priority %> <%= 'overdue' if
task.over_due? %>'>
<%= link_to h(task.title), task_url(task), :rel=>'bookmark',
:title=>'View/perform task' %></h3>
<div class='entry-content'>
- <p class='description'><%= truncate(strip_tags(task.description), 500) %></p>
<p class='vitals'><%= task_vitals(task) %></p>
</div>
Added: ode/sandbox/singleshot/app/views/tasks/completed.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/completed.html.erb?rev=661137&view=auto
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/completed.html.erb (added)
+++ ode/sandbox/singleshot/app/views/tasks/completed.html.erb Wed May 28
16:02:23 2008
@@ -0,0 +1,14 @@
+<ol class='dates'>
+ <% for day, tasks in @days %>
+ <% content_tag_for 'li', day do %>
+ <h2><%= abbr_date day, relative_date(day).capitalize %></h2>
+ <ol class='tasks'>
+ <% for task in tasks %>
+ <% content_tag_for 'li', task do %>
+ <%= link_to h(task.title), task_url(task), :rel=>'bookmark',
:title=>truncate(strip_tags(task.description), 250) %>
+ <% end %>
+ <% end %>
+ </ol>
+ <% end %>
+ <% end %>
+</ol>
Added: ode/sandbox/singleshot/app/views/tasks/following.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/following.html.erb?rev=661137&view=auto
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/following.html.erb (added)
+++ ode/sandbox/singleshot/app/views/tasks/following.html.erb Wed May 28
16:02:23 2008
@@ -0,0 +1,23 @@
+<table class='tasks hfeed'>
+ <thead>
+ <th style='width:4em'>Status</th>
+ <th>Task</th>
+ <th>Assigned to</th>
+ <th style='width:5em'>Due on</th>
+ <th style='width:4em'>Priority</th>
+ <th style='width:6em'>Age</th>
+ </thead>
+ <tbody>
+ <% for task in @tasks %>
+ <% content_tag_for 'tr', task, :class=>'hentry' + (task.over_due? ? '
overdue' : '') do %>
+ <td class='status'><%= task.status.titleize %></td>
+ <td class='entry-title'><%= 'â ' if task.over_due? %><%= link_to
h(task.title), task_url(task), :rel=>'bookmark',
:title=>truncate(strip_tags(task.description), 250) %></h3></td>
+ <td><%= link_to_person task.owner, :owner if task.owner %></td>
+ <td><%= abbr_date task.due_on, relative_date(task.due_on).titleize,
:class=>(task.over_due? ? 'overdue' : nil) if task.due_on %></td>
+ <td><%= content_tag 'span', ['High', 'Normal', 'Low'][task.priority -
1], :class=>"priority_#{task.priority}" %></td>
+ <td><%= abbr_time task.created_at, relative_time(task.created_at),
:class=>'published' %></td>
+ <% end %>
+ <% end %>
+ </tbody>
+</table>
+
Modified: ode/sandbox/singleshot/app/views/tasks/index.html.erb
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/index.html.erb?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/index.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/index.html.erb Wed May 28 16:02:23
2008
@@ -1,7 +1,22 @@
-<ol class='tasks hfeed'>
- <% @tasks.each do |task| %>
- <% content_tag_for 'li', task, :class=>'hentry' do %>
- <%= render :partial=>'task', :locals=>{ :task=>task } %>
+<table class='tasks hfeed'>
+ <thead>
+ <th style='width:4em'>Status</th>
+ <th>Task</th>
+ <th style='width:5em'>Due on</th>
+ <th style='width:4em'>Priority</th>
+ <th style='width:6em'>Age</th>
+ <th></th>
+ </thead>
+ <tbody>
+ <% for task in @tasks %>
+ <% content_tag_for 'tr', task, :class=>'hentry' + (task.over_due? ? '
overdue' : '') do %>
+ <td class='status'><%= task.status.titleize %></td>
+ <td class='entry-title'><%= 'â ' if task.over_due? %><%= link_to
h(task.title), task_url(task), :rel=>'bookmark',
:title=>truncate(strip_tags(task.description), 250) %></h3></td>
+ <td><%= abbr_date task.due_on, relative_date(task.due_on).titleize,
:class=>(task.over_due? ? 'overdue' : nil) if task.due_on %></td>
+ <td><%= content_tag 'span', ['High', 'Normal', 'Low'][task.priority -
1], :class=>"priority_#{task.priority}" %></td>
+ <td><%= abbr_time task.created_at, relative_time(task.created_at),
:class=>'published' %></td>
+ <td><%= button_to 'Claim', '' if task.can_claim?(authenticated) %></td>
+ <% end %>
<% end %>
- <% end %>
-</ol>
+ </tbody>
+</table>
Modified: ode/sandbox/singleshot/lib/tasks/populate.rake
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/populate.rake?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/populate.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/populate.rake Wed May 28 16:02:23 2008
@@ -64,10 +64,10 @@
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
- # Completed, cancelled
- task = create(:owner=>you)
- task.status = 'completed'
- task.save
+ # Completed, cancelled, suspended
+ create(:potential_owners=>[you,
other]).update_attributes(:status=>'suspended')
+ create(:owner=>you,
:status=>'active').update_attributes(:status=>'completed')
+ create(:owner=>you,
:status=>'active').update_attributes(:status=>'cancelled')
end
end
Modified: ode/sandbox/singleshot/public/stylesheets/default.css
URL:
http://svn.apache.org/viewvc/ode/sandbox/singleshot/public/stylesheets/default.css?rev=661137&r1=661136&r2=661137&view=diff
==============================================================================
--- ode/sandbox/singleshot/public/stylesheets/default.css (original)
+++ ode/sandbox/singleshot/public/stylesheets/default.css Wed May 28 16:02:23
2008
@@ -1,7 +1,7 @@
/** Main styles **/
body {
- font: 10pt "Lucida Grande", Helvetica, Sans;
+ font: 10pt "Lucida Grande", Helvetica, Verdana, Sans;
color: #000;
background-color: #fff;
margin: 0;
@@ -105,7 +105,7 @@
#header h1 {
font-size: 2.2em;
font-weight: bold;
- margin: 0 auto 1em auto;
+ margin: 0 auto 0.7em auto;
float: left;
}
#header h1 a {
@@ -114,7 +114,7 @@
}
#header ul.links {
list-style: none;
- margin: 0 0 0.5em 0;
+ margin: 0;
float: right
}
#header ul.links li {
@@ -186,65 +186,67 @@
/** Tasks list **/
-ol.tasks {
- list-style: none;
- margin: 2em 3.5em 0 3.5em;
- padding: 0;
+table.tasks {
+ width: 100%;
+ border-spacing: 0;
+ border-padding: 0;
+ border: none;
+ margin: 0;
+ padding:2em 2.5em 2em 2.5em;
+ font-size: 1.1em;
}
-ol.tasks li.task {
+table.tasks thead th {
+ text-align: left;
+ font-weight: bold;
+ padding: 0.5em;
+ margin: 0;
border-bottom: 1px solid #ccc;
- margin-bottom: 1.5em;
}
-ol.tasks li.task .entry-title {
- font-size: 1.2em;
+table.tasks tbody td {
+ text-align: left;
+ vertical-align: top;
+ padding: 0.5em;
margin: 0;
+ border-bottom: 1px solid #ddd;
}
-ol.tasks li.task .entry-title.priority_1:before {
- content: 'â
';
- color: red;
-}
-ol.tasks li.task .entry-title.priority_2:before {
-}
-ol.tasks li.task .entry-title.priority_1:before {
+table.tasks tbody td.entry-title {
}
-ol.tasks li.task .entry-title.overdue a {
+table.tasks tbody .overdue td {
color: red;
}
-ol.tasks li.task a {
- text-decoration: none;
-}
-ol.tasks li.task .description {
- color: #222;
-}
-ol.tasks li.task .actions {
- float: right;
+table.tasks tbody td .priority_1 {
+ color: red;
}
-ol.tasks li.task .actions form {
- margin-left: 0.1em;
+
+ol.dates {
+ font-size: 1.1em;
+ list-style: none;
+ margin: 2em 3em 2em 3em;
+ padding: 0;
}
-ol.tasks li.task p.vitals {
- color: #808080;
+ol.dates li.date {
+ padding-bottom: 1em;
}
-ol.tasks li.date h2 {
- font-size: 1.4em;
+ol.dates li.date h2 {
+ font-size: 1.2em;
+ border-bottom: 1px solid #ccc;
}
-ol.tasks li.date ol {
+ol.dates li.date ol.tasks {
list-style: none;
margin: 0;
padding: 0;
}
+ol.dates li.date ol.tasks li.task {
+ margin: 0 0 1.0em 0;
+}
/** Activities **/
ol.activities {
list-style: none;
- margin: 2em 3.5em 0 3.5em;
padding: 0;
}
-ol.activities li.day h3 {
- border-bottom: 1px solid #ccc;
-}
ol.activities li.activity {
margin: 0 0 1.0em 0;
}
@@ -384,3 +386,6 @@
form.login input {
width: 100%;
}
+
+
+