further integrate contact menu and add visual feedback of ajax actions

This commit is contained in:
Reinier Balt 2009-03-18 22:34:40 +01:00
parent 5b31d4cf84
commit 3a8ce12fe8
3 changed files with 12 additions and 7 deletions

View file

@ -433,6 +433,7 @@ class TodosController < ApplicationController
@source_view = params['_source_view'] || 'todo'
numdays = params['days'].to_i
@todo = Todo.find(params[:id])
@original_item_context_id = @todo.context_id
@todo.show_from = (@todo.show_from || @todo.user.date) + numdays.days
@saved = @todo.save

View file

@ -26,6 +26,7 @@
href="<%= search_plugin_path %>" />
<script type="text/javascript">
var sfLastUL;
jQuery(document).ready(function() {
jQuery('ul.sf-menu').superfish({
delay: 250,
@ -39,7 +40,10 @@ jQuery(document).ready(function() {
animation: {opacity:'show',height:'show'},
autoArrows: false,
dropShadows: false,
speed: 'fast'
speed: 'fast',
onShow: function() {
sfLastUL = this;
}
});
Nifty("div#todo_new_action_container","normal");
if ($('flash').visible()) { new Effect.Fade("flash",{duration:5.0}); }

View file

@ -10,14 +10,14 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
<div id="<%= dom_id(todo, 'line') %>">
<%= remote_star_icon %>
<%= remote_toggle_checkbox unless source_view_is :deferred %>
<ul class="sf-menu sf-item-menu"><li>^<ul>
<li><%= link_to_remote("Edit", :url => {:controller => 'todos', :action => 'edit', :id => @todo.id}, :method => 'get', :with => "'#{parameters}'") %></li>
<li>Delete</li>
<li><%= link_to_remote "Defer 1 day", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 1, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")} %></li>
<li><%= link_to_remote "Defer 7 days", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 7, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")} %></li>
<ul class="sf-menu sf-item-menu"><li><%= image_tag "downarrow.png" %><ul id="ul<%= dom_id(todo) %>">
<li><%= link_to_remote("Edit", :url => {:controller => 'todos', :action => 'edit', :id => @todo.id}, :method => 'get', :with => "'#{parameters}'",
:before => "$('ul#{dom_id(todo)}').hide(); itemContainer = this.up('.item-container'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();") %></li>
<li><%= link_to_remote "Delete", :url => {:controller => 'todos', :action => 'destroy', :id => @todo.id}, :method => 'delete', :with => "'#{parameters}'", :before => "itemContainer = this.up('.item-container'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
<li><%= link_to_remote "Defer 1 day", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 1, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}, :before => "itemContainer = this.up('.item-container'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
<li><%= link_to_remote "Defer 7 days", :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => 7, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}, :before => "itemContainer = this.up('.item-container'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
</ul></ul>
<div class="description<%= staleness_class( todo ) %>">
<%# unless @todo.completed? <span class="defer-container"><%= defer_link(1) %> <% # defer_link(7) </span><% end %>
<%= date_span -%>
<span class="todo.descr"><%= h sanitize(todo.description) %></span>
<%= link_to(