Skip to content

Commit

Permalink
see release notes 0.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
noctivityinc committed May 3, 2010
1 parent 167ef1b commit 25107e6
Show file tree
Hide file tree
Showing 18 changed files with 215 additions and 148 deletions.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.textile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
h1. Todopia Release Notes

h3. 0.2.8
* Added ability to schedule todos in the future. Just start tag with "starts DATE PHRASE"
* Fixed reordering todo within group bug
* Fixed width of tag groups in textboxlist

h3. 0.2.7 (hotfix)
* Slide options panel width fixed
* Clicking anywhere outside of slide options panel closes panel
Expand Down
7 changes: 4 additions & 3 deletions app/controllers/public/todos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def create

def edit
@todo.tag_list.push(@todo.due_date.strftime('%m/%d/%Y')) if @todo.due_date
@todo.tag_list.push("starts #{@todo.starts_at.strftime('%m/%d/%Y')}") if @todo.starts_at
@todo.tag_string = @todo.tag_list
respond_to do |format|
format.js { render :partial => 'form' }
Expand Down Expand Up @@ -69,13 +70,13 @@ def move
end
render_list
end

def reorder
todo_list = params[:cb_todo]
todo_list.each_with_index {|id, ndx| Todo.update(id,:priority => ndx+1)} if todo_list
render_list
end

def wait
@todo.toggle_waiting
render_list
Expand Down Expand Up @@ -136,6 +137,6 @@ def filter_by_tag
render_list
end
end


end
17 changes: 11 additions & 6 deletions app/helpers/public/todos_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ def todo_cb_css(todo)

def show_due_date(todo)
return " " unless todo.due_date
"<div class='due_date #{todo.due_date > Date.today ? '' : 'past_due'}'>#{todo.due_date.strftime('%m/%d/%Y')}</div>"
"<div class='due_date #{todo.due_date > Date.today ? '' : 'past_due'}'>#{" - due " if todo.not_active} #{todo.due_date.strftime('%m/%d/%Y')}</div>"
end

def show_scheduled(todo)
return "&nbsp;" if todo.active
"<div class='scheduled_date'>starting #{todo.starts_at.strftime('%m/%d/%Y')}</div>"
end

def show_notes(todo)
Expand All @@ -42,7 +47,7 @@ def show_notes(todo)

def show_waiting(todo)
if todo.waiting_since
link_to image_tag("icons/waiting.png", :title => "since #{todo.waiting_since.strftime('%m/%d/%Y')}. click or (w) to resume", :class => "icon"), '#', :class => 'wait_todo', :rel => wait_todo_path(todo)
link_to image_tag("icons/waiting.png", :title => "since #{todo.waiting_since.strftime('%m/%d/%Y')}. click or (w) to resume", :class => "icon"), '#', :class => 'wait_todo', :rel => wait_todo_path(todo)
else
link_to image_tag("icons/clock.png", :title => "in process...", :class => "icon"), '#', :class => 'wait_todo', :rel => wait_todo_path(todo)
end
Expand All @@ -53,19 +58,19 @@ def tag_groups_empty?(user=nil)
if user.tag_groups.empty?
return true
else
return @todos.tagged_with(user.tag_groups.map {|x| x.tag}, :any => true).empty?
return @todos.active.tagged_with(user.tag_groups.map {|x| x.tag}, :any => true).empty?
end
end

def unfiled_todos(scope=nil, user=nil)
user ||= current_user
if user.tag_groups.empty?
scope ? @todos.send(scope.intern) : @todos
scope ? @todos.active.send(scope.intern) : @todos.active
else
if scope
@todos.send(scope.intern).tagged_with(user.tag_groups.map {|x| x.tag}.join(','), :exclude => true)
@todos.active.send(scope.intern).tagged_with(user.tag_groups.map {|x| x.tag}.join(','), :exclude => true)
else
@todos.tagged_with(user.tag_groups.map {|x| x.tag}.join(','), :exclude => true)
@todos.active.tagged_with(user.tag_groups.map {|x| x.tag}.join(','), :exclude => true)
end
end
end
Expand Down
57 changes: 40 additions & 17 deletions app/models/todo.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# == Schema Information
# Schema version: 20100421004421
# Schema version: 20100502203721
#
# Table name: todos
#
# id :integer not null, primary key
# label :string(255)
# priority :integer
# completed_at :datetime
# user_id :integer
# completed_by_id :integer
# created_at :datetime
# updated_at :datetime
# due_date :date
# waiting_since :datetime
# id :integer not null, primary key
# label :string(255)
# priority :integer
# completed_at :datetime
# user_id :integer
# completed_by_id :integer
# created_at :datetime
# updated_at :datetime
# due_date :date
# waiting_since :datetime
# starts_at :datetime
# reminder_sent_at :datetime
#

class Todo < ActiveRecord::Base
Expand All @@ -33,26 +35,37 @@ class Todo < ActiveRecord::Base
named_scope :in_process, :conditions => ['waiting_since IS NOT ?', nil]
named_scope :not_in_process, :conditions => ['waiting_since IS ?', nil]
named_scope :complete, :conditions => ['completed_at IS NOT ?', nil], :order => 'completed_at DESC'
named_scope :scheduled, :conditions => ['starts_at IS NOT ?', nil]
named_scope :active, :conditions => ['starts_at IS ? OR starts_at <= ?', nil, Date.today]


before_create :set_priority
before_save :set_completed_by_id, :tag_string_to_tag_list, :pre_tag_plugins
before_update :check_completed

after_save :post_tag_plugins

def toggle_waiting
self.waiting_since = (self.waiting_since ? nil : Time.now)
self.save
end

def delete_tag(tag)
self.tags.find_by_name(tag).destroy rescue nil
end

def rename_tag(tag, new_name)
tag = self.tags.find_by_name(tag)
tag.update_attribute(:name, new_name) if tag
end

def active
starts_at.blank? || starts_at < Time.now
end

def not_active
starts_at && starts_at >= Time.now
end

private

Expand Down Expand Up @@ -91,14 +104,24 @@ def filter_plugins

def pre_tag_plugins
return unless self.tag_string
self.tag_string.split(',').each { |tag| self.due_date = Chronic.parse(tag) if Chronic.parse(tag) }
self.tag_string.split(',').each {|tag| self.priority = tag[1..-1] if tag.starts_with? '#' }

self.starts_at = self.due_date = nil
self.tag_string.split(',').each { |tag|
if !tag.scan(/^(start|begin)s?(\s[at|on])?\s(.*)\b/).empty?
self.starts_at = Chronic.parse(tag)
elsif Chronic.parse(tag)
self.due_date = Chronic.parse(tag)
end
self.priority = tag[1..-1] if tag.starts_with? '#'
}

self.starts_at = self.due_date if self.starts_at && self.due_date && self.due_date < self.starts_at # => prevents setting a due date before the event starts
end

def post_tag_plugins
return unless self.tag_string
self.tag_string.downcase.split(',').each {|tag| self.user.tag_groups.create(:tag => tag[1..-1]) if tag.starts_with? '!' }
end


end
31 changes: 18 additions & 13 deletions app/stylesheets/partials/_slidebox.sass
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,24 @@
height: 72px

.slide-button
display: none
margin-left: auto
margin-right: auto
position: relative
width: 150px
z-index: 20
cursor: pointer
height: 30px
padding-top: 10px
text-align: center
background-color: #343434
color: white
top: 2px
border-top-right-radius: 5px
border-top-left-radius: 5px
-moz-border-radius-topleft: 5px
-webkit-border-radius-top-left: 5px
-moz-border-radius-topright: 5px
-webkit-border-radius-top-right: 5px

.slide-bottom
bottom: 0
Expand All @@ -43,15 +60,3 @@
.slide-top
top: 0

#slideBox_overlay
position: fixed
top: 0px
left: 0px
height: 100%
width: 100%

.slideBox_hide
z-index: -100

.slideBox_overlayBG
z-index: 99
2 changes: 1 addition & 1 deletion app/stylesheets/partials/_textbox.sass
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.textboxlist
font: 11px "Lucida Grande", Verdana
cursor: text
width: 400px
width: 650px

.textboxlist-bits
zoom: 1
Expand Down
12 changes: 10 additions & 2 deletions app/stylesheets/partials/_todos.sass
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
margin-top: 1em
font-size: 12px

.scheduled
display: none

h2
font-size: 1.15em
margin: 1em 0em .25em 0em
Expand Down Expand Up @@ -97,9 +100,14 @@
overflow: hidden

.col_due
width: 80px
width: 100px
text-align: right

.col_scheduled
width: 120px
text-align: right

.due_date
.due_date, .scheduled_date
font-size: .90em
color: #666

Expand Down
10 changes: 7 additions & 3 deletions app/views/public/todos/_docs.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@
any date or
= link_to 'date expression', '#', :title => 'e.g 4/15/10 or "2 weeks from now" or "tomorrow"'
creates a due date for the item
.sc
%b #1, #2, #3, etc
sets a priority, 1 being highest
%p
.sc
%b #1, #2, #3, etc
sets a priority, 1 being highest
.sc
%b "starts DATE EXPRESSION"
schedules the todo for later
%p
%u Also...
.sc Click tag(s) to filter
Expand Down
17 changes: 11 additions & 6 deletions app/views/public/todos/_list.html.haml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#not_complete
- current_user.tag_groups.ordered.each do |tg|
- unless @todos.tagged_with(tg.tag).blank?
- unless @todos.active.tagged_with(tg.tag).blank?
%h2
= link_to "#{tg.tag} (#{@todos.tagged_with(tg.tag).count})", '#', :class => 'select_tag_group tag_group_menu_trigger', :rel => tg.id, 'url:filter' => filter_user_todos_path(current_user, :tag => tg.tag), 'tg:tag' => tg.tag
.tag_group{'tg:tag' => tg.tag}
= render @todos.due.not_in_process.tagged_with(tg.tag)
= render @todos.not_due.not_in_process.tagged_with(tg.tag)
.in_process= render @todos.in_process.tagged_with(tg.tag)
= render @todos.active.due.not_in_process.tagged_with(tg.tag)
= render @todos.active.not_due.not_in_process.tagged_with(tg.tag)
.in_process= render @todos.active.in_process.tagged_with(tg.tag)

- unless unfiled_todos.empty?
- unless tag_groups_empty?
%h2= link_to "and ze rest... (#{unfiled_todos.count})", '#', :class => 'select_tag_group unfiled_group', :rel => current_user.id, 'url:filter' => filter_user_todos_path(current_user, :unfiled => true)
.tag_group{'tg:tag' => '-99'}
.due= render unfiled_todos('due').not_in_process
.not_due= render unfiled_todos('not_due').not_in_process
= render unfiled_todos('due').not_in_process
= render unfiled_todos('not_due').not_in_process
.in_process= render unfiled_todos.in_process

- unless @todos.scheduled.empty?
%h2= link_to "Scheduled (#{@todos.scheduled.count})", '#', :class => 'select_tag_group'
.tag_group.scheduled
= render @todos.scheduled

- unless @completed.blank?
#completed
Expand Down
3 changes: 2 additions & 1 deletion app/views/public/todos/_todo.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
.col_select.col
&nbsp;
.col_move.col
= image_tag "icons/move.jpg", :title => "move", :class => "handle icon"
= image_tag "icons/move.jpg", :title => "move", :class => "handle icon" if todo.active
.col_cb.col
- if todo.waiting_since
= show_waiting(todo)
Expand All @@ -27,6 +27,7 @@
= tag

#right_pane
.col_scheduled.col= show_scheduled(todo)
.col_due.col= show_due_date(todo)
.col_wait.col
= show_waiting(todo)
Expand Down
9 changes: 9 additions & 0 deletions db/migrate/20100502113948_add_start_at_to_todo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddStartAtToTodo < ActiveRecord::Migration
def self.up
add_column :todos, :starts_at, :timestamp
end

def self.down
remove_column :todos, :start_at
end
end
9 changes: 9 additions & 0 deletions db/migrate/20100502203721_add_reminder_sent_at_to_todo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddReminderSentAtToTodo < ActiveRecord::Migration
def self.up
add_column :todos, :reminder_sent_at, :timestamp
end

def self.down
remove_column :todos, :reminder_sent_at
end
end
4 changes: 3 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20100421004421) do
ActiveRecord::Schema.define(:version => 20100502203721) do

create_table "histories", :force => true do |t|
t.integer "todo_id"
Expand Down Expand Up @@ -81,6 +81,8 @@
t.datetime "updated_at"
t.date "due_date"
t.datetime "waiting_since"
t.datetime "starts_at"
t.datetime "reminder_sent_at"
end

create_table "users", :force => true do |t|
Expand Down
3 changes: 1 addition & 2 deletions public/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function select_current_checkbox(){
}

function checklist_sortable() {
$(".tag_group").sortable({handle: '.handle',
$(".tag_group:not('.scheduled')").sortable({handle: '.handle',
connectWith: '.tag_group',
placeholder: 'ui-state-highlight',
stop: function(event, ui) {
Expand All @@ -183,7 +183,6 @@ function checklist_sortable() {
reorder_url = $('#urls').attr('url:reorder_todos')
$.post(reorder_url, $(this).sortable('serialize'), function(todoResponse) {
$(document).bind('checklist.reloaded', function(){
ui_item.find('.todo_checkbox').focus();
$(document).unbind('checklist.reloaded')
})
reload_checklist(todoResponse);
Expand Down
1 change: 1 addition & 0 deletions public/javascripts/controllers/public/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ function setup_add_form() {
error: function(responseText, statusText, xhr, form){
setup_autocomplete();
$('#todo_label').addClass('fieldWithErrors');
$.flash.show();
}
});
}
Expand Down
Loading

0 comments on commit 25107e6

Please sign in to comment.