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/14 11:39:55 UTC

svn commit: r656189 - in /ode/sandbox/singleshot: app/controllers/ app/models/ app/views/layouts/ app/views/tasks/ public/stylesheets/

Author: assaf
Date: Wed May 14 02:39:55 2008
New Revision: 656189

URL: http://svn.apache.org/viewvc?rev=656189&view=rev
Log:
Basic task list rendering.

Removed:
    ode/sandbox/singleshot/public/stylesheets/buttons.css
    ode/sandbox/singleshot/public/stylesheets/screen.css
Modified:
    ode/sandbox/singleshot/app/controllers/tasks_controller.rb
    ode/sandbox/singleshot/app/models/task.rb
    ode/sandbox/singleshot/app/views/layouts/application.html.erb
    ode/sandbox/singleshot/app/views/tasks/index.html.erb
    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=656189&r1=656188&r2=656189&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/controllers/tasks_controller.rb (original)
+++ ode/sandbox/singleshot/app/controllers/tasks_controller.rb Wed May 14 02:39:55 2008
@@ -9,6 +9,7 @@
   layout 'application', :only=>[:index]
 
   def index
+    @tasks = Task.for_stakeholder(authenticated)
   end
 
   def new

Modified: ode/sandbox/singleshot/app/models/task.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=656189&r1=656188&r2=656189&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Wed May 14 02:39:55 2008
@@ -100,13 +100,12 @@
     end
   end
 
+  named_scope :active, :conditions=>{ :state=>'active' }
+  named_scope :completed, :conditions=>{ :state=>'completed' }
+
 
   # -- Common task attributes --
   #
-  # Task priority: 1 is the lowest (and default) priority.
-  PRIORITIES = 1..3
-  before_validation { |task| task.priority ||= PRIORITIES.min }
-  validates_inclusion_of :priority, :in=>PRIORITIES
 
   validates_presence_of :title, :frame_url
   validates_url :frame_url, :if=>:frame_url
@@ -140,6 +139,21 @@
   include Stakeholder::Accessors
   include Stakeholder::Validation
 
+  named_scope :for_stakeholder, lambda { |person|
+    { :joins=>'INNER JOIN stakeholders AS involved ON involved.task_id=tasks.id', :conditions=>['stakeholders.person_id=?', person.id], :include=>[:stakeholders] }
+  }
+  named_scope :for_owner,       lambda { |person|
+    { :joins=>:stakeholders, :conditions=>["stakeholders.person_id=? and stakeholders.role='owner'", person.id] }
+  }
+
+
+  # --- Priority and ordering ---
+  
+  # Task priority: 1 is the lowest (and default) priority.
+  PRIORITIES = 1..3
+  before_validation { |task| task.priority ||= PRIORITIES.min }
+  validates_inclusion_of :priority, :in=>PRIORITIES
+
  
   # --- Completion and cancellation ---
 

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=656189&r1=656188&r2=656189&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/layouts/application.html.erb (original)
+++ ode/sandbox/singleshot/app/views/layouts/application.html.erb Wed May 14 02:39:55 2008
@@ -2,7 +2,7 @@
   <head>
     <title>Singleshot<%= " &mdash; #{escape_once(@title)}" if @title %></title>
     <%= javascript_include_tag :all, :cache=>true %>
-    <%= stylesheet_link_tag 'screen', 'buttons', 'default', :cache=>true %>
+    <%= stylesheet_link_tag 'default', :cache=>true %>
     <%= stylesheet_link_tag 'print', :media=>'print', :cache=>true %>
     <% @alternate.each do |mime, url| %>
       <%= auto_discovery_link_tag mime.to_sym, url %>
@@ -12,16 +12,17 @@
     <div id='header'>
       <h1>Singleshot</h1>
       <ul id='personal'>
-        <li><a>Help</a></li>
-        <li><a>Settings</a></li>
+        <li><a href='#'>Help</a></li>
+        <li><a href='#'>Settings</a></li>
         <li><%= link_to 'Logout', session_url(:method=>:delete) %></li>
       </ul>
       <ul id='navigation'>
-        <li><a>Dashboard</a></li>
-        <li><a>Active Tasks</a></li>
-        <li><a>Notifications</a></li>
-        <li><a>Tracking</a></li>
-        <li><a>Archive</a></li>
+        <li><a href='#'>Dashboard</a></li>
+        <li><a href='#'>Tasks</a></li>
+        <li><a href='#'>Notifications</a></li>
+        <li><a href='#'>Completed</a></li>
+        <li><a href='#'>Tracking</a></li>
+        <li><a href='#'>Activities</a></li>
       </ul>
     </div>
     <div id='main'>

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=656189&r1=656188&r2=656189&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/views/tasks/index.html.erb (original)
+++ ode/sandbox/singleshot/app/views/tasks/index.html.erb Wed May 14 02:39:55 2008
@@ -0,0 +1,21 @@
+<ol class='tasks'>
+  <% @tasks.each do |task| %>
+    <% content_tag_for 'li', task do %>
+      <div class='actions'>
+        <%= button_to 'Claim', task, :title=>'Claim task' %>
+        <%= button_to 'Edit', edit_task_url(task), :method=>:get, :title=>'Edit task' %>
+        <%= button_to 'Cancel', task_url(task), :method=>:delete, :disabled=>true, :title=>'Cancel this task' %>
+      </div>
+      <h3 class='title'><%= link_to h(task.title), task_url(task), :title=>'View/perform task' %></h3>
+      <p class='description'><%= h(task.description) %></p>
+      <p class='stats'>
+      <%=
+      stats = ['Created ' + task.created_at.to_date.to_formatted_s(:long)]
+      stats << 'by ' + link_to(task.creator.fullname, task.creator.identity) if task.creator
+      stats << 'assigned to ' + link_to(task.owner.fullname, task.owner.identity) if task.owner
+      stats.to_sentence
+      %>
+      </p>
+    <% end %>
+  <% end %>
+</ol>

Modified: ode/sandbox/singleshot/public/stylesheets/default.css
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/public/stylesheets/default.css?rev=656189&r1=656188&r2=656189&view=diff
==============================================================================
--- ode/sandbox/singleshot/public/stylesheets/default.css (original)
+++ ode/sandbox/singleshot/public/stylesheets/default.css Wed May 14 02:39:55 2008
@@ -1,5 +1,11 @@
-@import 'screen.css';
-@import 'buttons.css';
+body {
+  font: 10pt "Lucida Grande", Helvetica, Sans;
+  color: #000;
+  background-color: #fff;
+  margin: 0;
+  padding: 0;
+}
+
 
 /** Form controls **/
 
@@ -24,12 +30,6 @@
   padding-bottom: 0.3em;
   border-bottom: 1px solid #ccc;
 }
-form.button-to {
-  display: inline;
-}
-form.button-to div {
-  display: inline;
-}
 /*
 form div.fieldWithErrors {
   color: red;
@@ -87,7 +87,6 @@
 /** Task view: bar and frame **/
 body#task {
   margin:0;
-  font-size:100%;
 }
 body#task #task_bar {
   position:absolute;
@@ -114,7 +113,6 @@
   font-size:100%;
   line-height:100%;
   background:transparent;
-  cursor:pointer;
   color:white;
   padding:0;
   margin:0 1em 0 0;
@@ -142,60 +140,104 @@
 
 
 #header {
-  background-color: #666;
-  padding: 1em 2em 0 2em;
-  border-bottom: solid 0.3em #999;
+  background-color: #e0e0e0;
+  padding: 0.5em 3em 3px 3em;
+  border-bottom: solid 2px #046380;
 }
 #header h1 {
-  font-size: 2.5em;
+  font-size: 2.2em;
   font-weight: bold;
-  color:#fff;
+  margin: 0 auto 1em auto;
   float: left;
 }
-
-ul#personal {
+#header ul#personal {
   list-style: none;
   float: right;
-  font-size: 1.1em;
   margin: 0;
 }
-ul#personal li {
+#header ul#personal li {
   display: inline;
-  margin-left: 1em;
+  margin-left: 1.2em;
 }
-ul#personal li a {
-  color: #fff;
+#header ul#personal li a {
   text-decoration: none;
 }
 
-ul#navigation {
+#header ul#navigation {
   clear: both;
   list-style: none;
-  margin: 0 0 1px 0;
+  margin: 0;
   padding: 0;
 }
-ul#navigation li {
+#header ul#navigation li {
   display: inline;
-  margin-right: 0.3em;
+  margin-right: 0.5em;
   padding: 0;
 }
-ul#navigation li a {
+#header ul#navigation li a {
   color: #eee;
-  font-size: 1.3em;
+  font-size: 1.2em;
   font-weight: bold;
   text-decoration: none;
-  background-color:#336699;
-  padding: 0.6em 0.6em 0.3em 0.6em;
-  -webkit-border-top-left-radius: 0.2em;
-  -webkit-border-top-right-radius: 0.2em;
-  -moz-border-radius-topright: 0.6em;
-  -moz-border-radius-topleft: 0.6em;
+  background-color: #046380;
+  padding: 0.3em 0.6em 0.3em 0.6em;
+  -moz-border-radius-topright: 4px;
+  -moz-border-radius-topleft: 4px;
+  -webkit-border-top-left-radius: 6px;
+  -webkit-border-top-right-radius: 6px;
 }
-ul#navigation li a:hover {
-  background-color:#6299c5;
+#header ul#navigation li a:hover {
+  background-color: #002f2f;
 }
-#header hr {
-  background-color: #000;
-  margin:0;
-  padding:0;
+
+ol.tasks {
+  list-style: none;
+  margin: 2em 3.5em 0 3.5em;
+  padding: 0;
+}
+ol.tasks li.task {
+  border-bottom: 1px solid #ccc;
+  margin-bottom: 1.5em;
+}
+ol.tasks li.task h3.title {
+  font-size: 1.2em;
+  margin: 0;
+}
+ol.tasks li.task a {
+  text-decoration: none;
+}
+ol.tasks li.task .description {
+  color: #222;
+}
+ol.tasks li.task .actions {
+  float: right;
+}
+ol.tasks li.task .actions form {
+  margin-left: 0.1em;
+}
+
+
+form.button-to, form.button-to div {
+  display: inline;
+}
+form.button-to input {
+  font-size: 1em;
+  font-weight: bold;
+  border: none;
+  padding: 0.3em 0.6em 0.3em 0.6em;
+  margin: 0;
+  color: #fff;
+  background-color: #646060;
+  cursor:pointer;
+  -moz-border-radius: 2px;
+  -webkit-border-radius: 4px;
+}
+form.button-to input:hover {
+  border: none;
+  color: #fff;
+  background-color: #4c4848;
+}
+form.button-to input[disabled] {
+  background-color: #eee;
+  cursor:default;
 }