add message when there are no actions in a container and handle state changes

This commit is contained in:
Reinier Balt 2008-10-04 15:56:22 +02:00
parent 541d6f5b69
commit 5d30512e97
5 changed files with 97 additions and 16 deletions

View file

@ -2,6 +2,9 @@
<div class="container">
<h2>Due today</h2>
<div id="empty_due_today" <%= "style=\"display:none\"" unless @due_today.empty? %>>
No actions due today
</div>
<div id="due_today">
<%= render :partial => "todos/todo", :collection => @due_today %>
</div>
@ -9,6 +12,9 @@
<div class="container">
<h2>Due in rest of this week</h2>
<div id="empty_due_this_week" <%= "style=\"display:none\"" unless @due_this_week.empty? %>>
No actions due in rest of this week
</div>
<div id="due_this_week">
<%= render :partial => "todos/todo", :collection => @due_this_week %>
</div>
@ -16,6 +22,9 @@
<div class="container">
<h2>Due next week</h2>
<div id="empty_due_next_week" <%= "style=\"display:none\"" unless @due_next_week.empty? %>>
No actions due in next week
</div>
<div id="due_next_week">
<%= render :partial => "todos/todo", :collection => @due_next_week %>
</div>
@ -23,6 +32,9 @@
<div class="container">
<h2>Due in rest of this month</h2>
<div id="empty_due_this_month" <%= "style=\"display:none\"" unless @due_this_month.empty? %>>
No actions due in rest of this month
</div>
<div id="due_this_month">
<%= render :partial => "todos/todo", :collection => @due_this_month %>
</div>
@ -30,6 +42,9 @@
<div class="container">
<h2>Due next month and later</h2>
<div id="empty_due_after_this_month" <%= "style=\"display:none\"" unless @due_after_this_month.empty? %>>
No actions due after this month
</div>
<div id="due_after_this_month">
<%= render :partial => "todos/todo", :collection => @due_after_this_month %>
</div>
@ -37,9 +52,11 @@
</div><!-- End of display_box -->
<div class="input_box" id="input_box">
<!--
<input class="hide_tickler" id="hide_tickler" type="checkbox" tabindex="5" name="hide_tickler" checked="true"/>
<label for="hide_tickler"> Show actions in tickler</label>
<br/><br/>
-->
<p><%= link_to('<span class="feed">iCal</span>', {:format => 'ics', :token => current_user.token}, :title => "iCal feed" ) %>
- Get this calendar in iCal format</p>
</div>

View file

@ -1,5 +1,6 @@
if @saved
page[@todo].remove
page.show "empty_"+@original_item_due_id if @old_due_empty
page['badge_count'].replace_html @down_count
# remove context if empty

View file

@ -1,5 +1,6 @@
if @saved
page[@todo].remove
page.show "empty_"+@original_item_due_id if @old_due_empty
if @todo.completed?
# completed todos move from their context to the completed container
@ -26,7 +27,7 @@ if @saved
page.notify :notice, "There is no next action after the recurring action you just finished. The recurrence is completed", 6.0 if @new_recurring_todo.nil?
end
end
else
# todo is activated from completed container
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@todo)

View file

@ -104,8 +104,19 @@ if @saved
elsif source_view_is :calendar
if @due_date_changed
page[@todo].remove
page.show "empty_"+@original_item_due_id if @old_due_empty
page.hide "empty_"+@new_due_id
page.insert_html :bottom, @new_due_id, :partial => 'todos/todo'
page.visual_effect :highlight, dom_id(@todo), :duration => 3
else
if @todo.due.nil?
# due date removed
page[@todo].remove
page.show "empty_"+@original_item_due_id if @old_due_empty
else
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
page.visual_effect :highlight, dom_id(@todo), :duration => 3
end
end
else
logger.error "unexpected source_view '#{params[:_source_view]}'"