Author: assaf
Date: Tue May 20 17:31:43 2008
New Revision: 658511

URL: http://svn.apache.org/viewvc?rev=658511&view=rev
Log:
A few more UI tweaks.
Now creating method=publish vtodo entries.
Fixed new task priority defaulting to 1.

Modified:
    ode/sandbox/singleshot/app/models/activity.rb
    ode/sandbox/singleshot/app/models/task.rb
    ode/sandbox/singleshot/app/views/layouts/application.html.erb
    ode/sandbox/singleshot/app/views/tasks/index.ics.ical
    ode/sandbox/singleshot/app/views/tasks/show.html.erb
    ode/sandbox/singleshot/db/migrate/20080506015046_tasks.rb
    ode/sandbox/singleshot/db/schema.rb
    ode/sandbox/singleshot/lib/extensions/ical_template.rb
    ode/sandbox/singleshot/public/stylesheets/default.css

Modified: ode/sandbox/singleshot/app/models/activity.rb
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/activity.rb?rev=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/activity.rb (original)
+++ ode/sandbox/singleshot/app/models/activity.rb Tue May 20 17:31:43 2008
@@ -1,3 +1,15 @@
+# == Schema Information
+# Schema version: 20080506015153
+#
+# Table name: activities
+#
+#  id         :integer         not null, primary key
+#  person_id  :integer         not null
+#  task_id    :integer         not null
+#  action     :string(255)     not null
+#  created_at :datetime        not null
+#
+
 class Activity < ActiveRecord::Base
 
   belongs_to :person

Modified: ode/sandbox/singleshot/app/models/task.rb
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Tue May 20 17:31:43 2008
@@ -6,7 +6,7 @@
 #  id           :integer         not null, primary key
 #  title        :string(255)     not null
 #  description  :string(255)     not null
-#  priority     :integer(1)      default(1), not null
+#  priority     :integer(1)      not null
 #  due_on       :date
 #  state        :string(255)     not null
 #  frame_url    :string(255)

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=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/layouts/application.html.erb (original)
+++ ode/sandbox/singleshot/app/views/layouts/application.html.erb Tue May 20 
17:31:43 2008
@@ -11,12 +11,10 @@
   <body>
     <div id='header'>
       <h1><%= link_to 'Singleshot', root_url %></h1>
-      <ul id='personal'>
-        <li><a href='#'>Help</a></li>
-        <li><a href='#'>Settings</a></li>
+      <ul class='links'>
         <li><%= link_to 'Logout', session_url(:method=>:delete) %></li>
       </ul>
-      <ul id='navigation'>
+      <ul class='tabs'>
         <li><%= link_to '➠ Tasks', tasks_url %></li>
         <li><%= link_to 'Following', following_tasks_url %></a></li>
         <li><%= link_to 'Completed', completed_tasks_url %></a></li>

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=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/index.ics.ical (original)
+++ ode/sandbox/singleshot/app/views/tasks/index.ics.ical Tue May 20 17:31:43 
2008
@@ -1,4 +1,4 @@
-calendar.prodid = 'Apache Singleshot'
+calendar.prodid 'Apache Singleshot'
 for task in @tasks
   calendar.todo task do |todo|
     todo.summary task.title

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=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/show.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/show.html.erb Tue May 20 17:31:43 
2008
@@ -1,12 +1,12 @@
 <% # TODO: trim
 @title = @task.title %>
 <div id='task_bar'>
-  <div id='summary'>
+  <div class='summary'>
     <h1><%= link_to 'Singleshot', root_url %></h1>
     <div class='vitals'><%= task_vitals(@task) %></div>
-    <div class='actions'><%= task_actions(@task) %> <%= link_to_function 'More 
Options', "Singleshot.expand(event, 'expanded')", :class=>'button-to' %></div>
+    <div class='actions'><%= task_actions(@task) %> <%= link_to_function 'More 
Options', "Singleshot.expand(event, 'expanded', 'Less options')", 
:class=>'button-to' %></div>
   </div>
-  <div id='expanded' style='display:none'>
+  <div id='expanded' class='expanded' style='display:none'>
     <%= link_to image_tag('calendar.png') + ' Calendar', 
formatted_task_url(@task, 'ics', :access_key=>authenticated.access_key),
                 :rel=>'alternate', :title=>'Add this task to your calendar' %>
     <%= link_to image_tag('feed.png') + ' Activities', 
formatted_activity_url(@task, 'atom', :access_key=>authenticated.access_key),
@@ -27,6 +27,10 @@
           <% end %>
         </ol>
       </dd>
+      <%= admins = @task.admins.map { |admin| link_to_person(admin) }
+          content_tag('dt', 'Admins') + content_tag('dd', admins.to_sentence) 
unless admins.empty? %>
+      <%= observers = @task.observers.map { |admin| link_to_person(admin) }
+          content_tag('dt', 'Observers') + content_tag('dd', 
observers.to_sentence) unless observers.empty? %>
     </dl>
     <div class='actions' style='text-align:right'>
       <%= task_actions(@task) %>

Modified: ode/sandbox/singleshot/db/migrate/20080506015046_tasks.rb
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/db/migrate/20080506015046_tasks.rb?rev=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/db/migrate/20080506015046_tasks.rb (original)
+++ ode/sandbox/singleshot/db/migrate/20080506015046_tasks.rb Tue May 20 
17:31:43 2008
@@ -3,7 +3,7 @@
     create_table :tasks do |t|
       t.string    :title,        :null=>false
       t.string    :description,  :null=>false
-      t.integer   :priority,     :null=>false, :default=>1, :limit=>1
+      t.integer   :priority,     :null=>false, :limit=>1
       t.date      :due_on,       :null=>true
       t.string    :state,        :null=>false
       t.string    :frame_url,    :null=>true

Modified: ode/sandbox/singleshot/db/schema.rb
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/db/schema.rb?rev=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/db/schema.rb (original)
+++ ode/sandbox/singleshot/db/schema.rb Tue May 20 17:31:43 2008
@@ -30,10 +30,10 @@
     t.datetime "updated_at"
   end
 
-  add_index "people", ["identity"], :name => "index_people_on_identity", 
:unique => true
-  add_index "people", ["fullname"], :name => "index_people_on_fullname"
-  add_index "people", ["email"], :name => "index_people_on_email", :unique => 
true
   add_index "people", ["access_key"], :name => "index_people_on_access_key", 
:unique => true
+  add_index "people", ["email"], :name => "index_people_on_email", :unique => 
true
+  add_index "people", ["fullname"], :name => "index_people_on_fullname"
+  add_index "people", ["identity"], :name => "index_people_on_identity", 
:unique => true
 
   create_table "stakeholders", :force => true do |t|
     t.integer  "task_id",    :null => false
@@ -43,14 +43,14 @@
     t.datetime "updated_at"
   end
 
-  add_index "stakeholders", ["task_id", "person_id", "role"], :name => 
"index_stakeholders_on_task_id_and_person_id_and_role", :unique => true
-  add_index "stakeholders", ["task_id", "role"], :name => 
"index_stakeholders_on_task_id_and_role"
   add_index "stakeholders", ["person_id", "role"], :name => 
"index_stakeholders_on_person_id_and_role"
+  add_index "stakeholders", ["task_id", "role"], :name => 
"index_stakeholders_on_task_id_and_role"
+  add_index "stakeholders", ["task_id", "person_id", "role"], :name => 
"index_stakeholders_on_task_id_and_person_id_and_role", :unique => true
 
   create_table "tasks", :force => true do |t|
     t.string   "title",                                     :null => false
     t.string   "description",                               :null => false
-    t.integer  "priority",     :limit => 1,  :default => 1, :null => false
+    t.integer  "priority",     :limit => 1,                 :null => false
     t.date     "due_on"
     t.string   "state",                                     :null => false
     t.string   "frame_url"

Modified: ode/sandbox/singleshot/lib/extensions/ical_template.rb
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/lib/extensions/ical_template.rb?rev=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/lib/extensions/ical_template.rb (original)
+++ ode/sandbox/singleshot/lib/extensions/ical_template.rb Tue May 20 17:31:43 
2008
@@ -1,28 +1,9 @@
 module ActionView
   class ICalBuilder
 
-    class Component
-
-      def initialize(request, record = nil)
-        @properties = {}
-        if record
-          uid "#{request.host}:#{record.class}/#{record.id}"
-          dtstamp record.created_at.utc.strftime('%Y%m%dT%H%M%SZ') if 
record.respond_to?(:created_at)
-          last_modified record.updated_at.utc.strftime('%Y%m%dT%H%M%SZ') if 
record.respond_to?(:updated_at)
-          sequence record.send(record.class.locking_column) if 
record.locking_enabled?
-        end
-      end
-
+    module Properties
       attr_accessor :properties
 
-      def to_ical
-        # TODO: escaping for values
-        # TODO: break up long lines
-        # TODO: all other conformance requirements
-        properties = @properties.map { |name, value| property(name, value) }
-        "BEGIN:#{self.class.const_get 
:NAME}\n#{properties.join("\n")}\nEND:#{self.class.const_get :NAME}"
-      end
-
     private
 
       def property(name, value)
@@ -46,6 +27,29 @@
         options[:value] = args.first
         @properties[name] = options
       end
+    end
+
+    class Component
+
+      include Properties
+
+      def initialize(request, record = nil)
+        @properties = {}
+        if record
+          uid "#{request.host}:#{record.class}/#{record.id}"
+          dtstamp record.created_at.utc.strftime('%Y%m%dT%H%M%SZ') if 
record.respond_to?(:created_at)
+          last_modified record.updated_at.utc.strftime('%Y%m%dT%H%M%SZ') if 
record.respond_to?(:updated_at)
+          sequence record.send(record.class.locking_column) if 
record.locking_enabled?
+        end
+      end
+
+      def to_ical
+        # TODO: escaping for values
+        # TODO: break up long lines
+        # TODO: all other conformance requirements
+        properties = @properties.map { |name, value| property(name, value) }
+        ["BEGIN:#{self.class.const_get :NAME}", properties, 
"END:#{self.class.const_get :NAME}"].flatten.join("\n")
+      end
 
     end
 
@@ -62,12 +66,14 @@
 
     end
 
+    include Properties
+
     def initialize(request)
       @request =request
+      @properties = { :method=>'PUBLISH' }
       @components = []
     end
 
-    attr_accessor :prodid
     attr_reader :components
 
     def event(record = nil)
@@ -86,8 +92,15 @@
 
     def to_ical
       # TODO: user's timezone
-      "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:[EMAIL 
PROTECTED](&:to_ical).join("\n")}\nEND:VCALENDAR\n"
+      properties = @properties.map { |name, value| property(name, value) }
+      components = @components.map(&:to_ical)
+      ['BEGIN:VCALENDAR', 'VERSION:2.0', properties, components, 
'END:VCALENDAR'].flatten.join("\n")
     end
+
+    def content_type
+      "#{Mime::ICS};method=#{properties[:method]}"
+    end
+
   end
 
 
@@ -101,9 +114,9 @@
 
       def compile(template)
         content_type_handler = 
(@view.send!(:controller).respond_to?(:response) ? "controller.response" : 
"controller")
-        "#{content_type_handler}.content_type ||= Mime::ICS\n" +
         "calendar = ::ActionView::ICalBuilder.new(request)\n" +
         template.source +
+        "#{content_type_handler}.content_type ||= calendar.content_type\n" +
         "\ncalendar.to_ical\n"
       end
 

Modified: ode/sandbox/singleshot/public/stylesheets/default.css
URL: 
http://svn.apache.org/viewvc/ode/sandbox/singleshot/public/stylesheets/default.css?rev=658511&r1=658510&r2=658511&view=diff
==============================================================================
--- ode/sandbox/singleshot/public/stylesheets/default.css (original)
+++ ode/sandbox/singleshot/public/stylesheets/default.css Tue May 20 17:31:43 
2008
@@ -109,31 +109,32 @@
   color: #000;
   text-decoration: none;
 }
-#header ul#personal {
+#header ul.links {
   list-style: none;
-  float: right;
   margin: 0;
+  float: right  
 }
-#header ul#personal li {
+#header ul.links li {
   display: inline;
-  margin-left: 1.2em;
+  margin: 0;
+  padding: 0.5em;
 }
-#header ul#personal li a {
+#header ul.links li a {
   text-decoration: none;
 }
 
-#header ul#navigation {
+#header ul.tabs {
   clear: both;
   list-style: none;
   margin: 0;
   padding: 0;
 }
-#header ul#navigation li {
+#header ul.tabs li {
   display: inline;
   margin-right: 0.5em;
   padding: 0;
 }
-#header ul#navigation li a {
+#header ul.tabs li a {
   color: #eee;
   font-size: 1.2em;
   font-weight: bold;
@@ -144,10 +145,10 @@
   -webkit-border-top-left-radius: 6px;
   -webkit-border-top-right-radius: 6px;
 }
-#header ul#navigation li a:hover {
+#header ul.tabs li a:hover {
   background-color: #002f2f;
 }
-#header ul#navigation li a .counter {
+#header ul.tabs li a .counter {
   position: relative;
   top: -1.1em;
   right: -1em;
@@ -196,9 +197,13 @@
   margin: 0;
 }
 #main ol.tasks li.task .entry-title.priority_1:before {
-  content: '✭ ';
+  content: '★ ';
   color: red;
 }
+#main ol.tasks li.task .entry-title.priority_2:before {
+}
+#main ol.tasks li.task .entry-title.priority_1:before {
+}
 #main ol.tasks li.task .entry-title.overdue a {
   color: red;
 }
@@ -242,60 +247,59 @@
   margin:0;
   padding:0;
   border-bottom: solid 2px #046380;
+  background-color: #e0e0e0;
 }
-#task_bar #summary {
+#task_bar div.summary {
   height:2em;
   padding-top:0.3em;
-  background-color: #e0e0e0;
   padding: 0.5em 3em 3px 3em;
 }
-#task_bar #summary h1 {
+#task_bar div.summary h1 {
   margin: 0;
   font-size: 1.5em;
   display: inline;
 }
-#task_bar #summary h1 a {
+#task_bar div.summary h1 a {
   color: #000;
   text-decoration: none;
 }
-#task_bar #summary div.vitals {
+#task_bar div.summary div.vitals {
   display: inline;
   margin-left: 2em;
 }
-#task_bar #summary div.actions {
+#task_bar div.summary div.actions {
   display: inline;
   position: absolute;
   right: 2em;
   top: 0.5em;
 }
-#task_bar #summary .button-to {
+#task_bar div.summary .button-to {
   margin-left: 1em;
 }
 
-#task_bar #expanded {
+#task_bar div.expanded {
   clear: both;
-  background: #fff;
   padding: 2em 3em 2em 3em;
-  border-bottom: 0.05em solid #383838;
+  border-top: 1px solid #ccc;
   margin: 0;
 }
-#task_bar #expanded dt {
+#task_bar div.expanded dt {
   font-weight: bold;
   display: inline;
   float: left;
 }
-#task_bar #expanded dd {
+#task_bar div.expanded dd {
   margin: 0 0 1em 10em;
 }
-#task_bar #expanded dd ol.activities {
+#task_bar div.expanded dd ol.activities {
   margin: 0;
 }
-#task_bar #expanded a[rel=alternate] {
+#task_bar div.expanded a[rel=alternate] {
   float: right;
   padding-left: 1em;
   text-decoration: none;
 }
-#task_bar #expanded a[rel=alternate] img {
+#task_bar div.expanded a[rel=alternate] img {
   border: none;
   vertical-align: bottom;
   margin: 0.1em;


Reply via email to