You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2008/05/23 04:56:20 UTC
svn commit: r659386 - in /ode/sandbox/singleshot: app/helpers/ app/models/
app/views/activities/ app/views/tasks/ lib/tasks/
Author: assaf
Date: Thu May 22 19:56:19 2008
New Revision: 659386
URL: http://svn.apache.org/viewvc?rev=659386&view=rev
Log:
Task description now accomodates HTML and is sanitized/stripped/truncated accordingly.
Removed:
ode/sandbox/singleshot/app/views/tasks/new.html.erb
Modified:
ode/sandbox/singleshot/app/helpers/task_helper.rb
ode/sandbox/singleshot/app/models/task.rb
ode/sandbox/singleshot/app/views/activities/index.atom.builder
ode/sandbox/singleshot/app/views/activities/index.ics.ical
ode/sandbox/singleshot/app/views/tasks/index.atom.builder
ode/sandbox/singleshot/app/views/tasks/index.html.erb
ode/sandbox/singleshot/app/views/tasks/index.ics.ical
ode/sandbox/singleshot/app/views/tasks/show.html.erb
ode/sandbox/singleshot/lib/tasks/populate.rake
Modified: ode/sandbox/singleshot/app/helpers/task_helper.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/helpers/task_helper.rb?rev=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/helpers/task_helper.rb (original)
+++ ode/sandbox/singleshot/app/helpers/task_helper.rb Thu May 22 19:56:19 2008
@@ -6,7 +6,6 @@
claim = task.can_claim?(authenticated)
actions = [
manage && button_to('Manage', edit_task_url(task), :method=>:get, :title=>'Managed this task', :disabled=>!manage),
- cancel && button_to('Cancel', task_url(task), :method=>:delete, :title=>'Cancel this task', :disabled=>!cancel),
claim && button_to('Claim', task_owner_url(task, 'owner'=>authenticated.identity), :method=>:put, :title=>'Claim task', :disabled=>!claim),
].select { |action| action }.join(' ')
end
Modified: ode/sandbox/singleshot/app/models/task.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Thu May 22 19:56:19 2008
@@ -161,6 +161,10 @@
task.priority ||= (PRIORITIES.min + PRIORITIES.max) >> 1
end
+ def high_priority?
+ priority == PRIORITIES.min
+ end
+
def over_due?
due_on && due_on < Date.today
end
Modified: ode/sandbox/singleshot/app/views/activities/index.atom.builder
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/activities/index.atom.builder?rev=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/activities/index.atom.builder (original)
+++ ode/sandbox/singleshot/app/views/activities/index.atom.builder Thu May 22 19:56:19 2008
@@ -8,7 +8,7 @@
entry.title "#{activity.person.fullname} #{activity.action} #{activity.task.title}"
entry.content :type=>'html' do |content|
content.text! "<p>#{link_to h(activity.person.fullname), activity.person.identity} #{activity.action} #{link_to h(activity.task.title), task_url(activity.task)}</p>"
- content.text! "<p>#{h(activity.task.description)}</p>"
+ content.text! truncate(strip_tags(activity.task.description), 250)
end
end
end
Modified: ode/sandbox/singleshot/app/views/activities/index.ics.ical
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/activities/index.ics.ical?rev=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/activities/index.ics.ical (original)
+++ ode/sandbox/singleshot/app/views/activities/index.ics.ical Thu May 22 19:56:19 2008
@@ -5,7 +5,7 @@
calendar.event activity do |event|
event.dtstart activity.created_at
event.summary "#{activity.person.fullname} #{activity.action} #{activity.task.title}"
- event.description activity.task.description
+ event.description truncate(strip_tags(activity.task.description), 250)
event.url task_url(activity.task)
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=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/index.atom.builder (original)
+++ ode/sandbox/singleshot/app/views/tasks/index.atom.builder Thu May 22 19:56:19 2008
@@ -6,8 +6,7 @@
feed.entry task do |entry|
entry.title task.title
entry.content :type=>'html' do |content|
- priority = "<span style='color:red'>â</span> " if task.priority == Task::PRIORITIES.first
- content.text! "<p>#{priority}#{h(task.description)}</p>"
+ content.text! sanitize(simple_format(task.description))
content.text! "<p><em>#{task_vitals(task)}</em></p>"
content.text! "<div>#{task_actions(task)}</div>"
end
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=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/index.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/index.html.erb Thu May 22 19:56:19 2008
@@ -6,7 +6,7 @@
<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'><%= h(task.description) %></p>
+ <p class='description'><%= truncate(strip_tags(task.description), 500) %></p>
<p class='vitals'><%= task_vitals(task) %></p>
</div>
<% end %>
Modified: ode/sandbox/singleshot/app/views/tasks/index.ics.ical
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/views/tasks/index.ics.ical?rev=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/index.ics.ical (original)
+++ ode/sandbox/singleshot/app/views/tasks/index.ics.ical Thu May 22 19:56:19 2008
@@ -4,7 +4,7 @@
for task in @tasks
calendar.todo task do |todo|
todo.summary task.title
- todo.description task.description
+ todo.description strip_tags(task.description)
todo.url task_url(task)
todo.due task.due_on if task.due_on
todo.priority [1,5,9][task.priority - 1]
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=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/show.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/show.html.erb Thu May 22 19:56:19 2008
@@ -12,7 +12,7 @@
<%= link_to image_tag('feed.png') + ' Activity', formatted_activity_url(@task, 'atom', :access_key=>authenticated.access_key),
:rel=>'alternate', :title=>'Subscribe to see changes to this task' %>
<h2><%= h(@task.title) %></h2>
- <div class='description'><%= h(@task.description) %></div>
+ <div class='description'><%= sanitize(simple_format(@task.description)) %></div>
<dl>
<dt>Priority</dt><dd><%= ['High', 'Medium', 'Low'][@task.priority - 1] %></dd>
<%= content_tag('dt', 'Due on') + content_tag('dd', relative_date(@task.due_on)) if @task.due_on %>
Modified: ode/sandbox/singleshot/lib/tasks/populate.rake
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/tasks/populate.rake?rev=659386&r1=659385&r2=659386&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/tasks/populate.rake (original)
+++ ode/sandbox/singleshot/lib/tasks/populate.rake Thu May 22 19:56:19 2008
@@ -35,7 +35,7 @@
def create(attributes)
retract
you = Person.find_by_identity(ENV['USER'])
- defaults = { :title=>Faker::Lorem.sentence, :description=>Faker::Lorem.paragraph,
+ defaults = { :title=>Faker::Lorem.sentence, :description=>Faker::Lorem.paragraphs(3).join("\n"),
:frame_url=>'http://localhost:3001/sandwich', :potential_owners=>[you, other] }
Task.new(defaults.merge(attributes || {})).modified_by(you).save!
end