Move edit button out of dropdown menu

Closes #976
This commit is contained in:
Eric Allen 2010-03-07 16:54:17 -05:00
parent ec68e04f27
commit 42c4c199a9
3 changed files with 20 additions and 11 deletions

View file

@ -24,14 +24,12 @@ module TodosHelper
:class => "icon star_item", :title => "star the action '#{@todo.description}'")
end
def remote_edit_menu_item(parameters, todo)
return link_to_remote(
image_tag("edit_off.png", :mouseover => "edit_on.png", :alt => "Edit", :align => "absmiddle", :id => 'edit_icon_todo_'+todo.id.to_s)+" Edit",
:url => {:controller => 'todos', :action => 'edit', :id => todo.id},
:method => 'get',
:with => "'#{parameters}'",
:before => todo_start_waiting_js(todo),
:complete => todo_stop_waiting_js(todo))
def remote_edit_button
link_to(
image_tag("blank.png", :alt => "Edit", :align => "absmiddle", :id => 'edit_icon_todo_'+@todo.id.to_s, :class => 'edit_item'),
{:controller => 'todos', :action => 'edit', :id => @todo.id},
:class => "icon edit_item",
:title => "Edit the action '#{@todo.description}'")
end
def remote_delete_menu_item(parameters, todo)

View file

@ -11,12 +11,12 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
<div id="<%= dom_id(todo, 'line') %>" class="item-show">
<%= remote_star_icon %>
<%= remote_toggle_checkbox unless source_view_is :deferred %>
<% unless suppress_edit_button %>
<%= remote_edit_button %>
<% end %>
<ul class="sf-menu sf-item-menu">
<li style="z-index:<%=@z_index_counter%>"><%= image_tag "downarrow.png", :alt=> "" %>
<ul id="ul<%= dom_id(todo) %>">
<% unless suppress_edit_button %>
<li><%= remote_edit_menu_item(parameters, todo) %></li>
<% end %>
<li><%= remote_delete_menu_item(parameters, todo) %></li>
<% unless todo.completed? || todo.deferred? %>
<li><%= remote_defer_menu_item(1, todo) %></li>

View file

@ -310,6 +310,17 @@ $(document).ready(function() {
$.post(this.value, params, null, 'script');
});
/* set behavior for edit icon */
$(".item-container a.edit_item").live('click', function (ev){
itemContainer = $(this).parents(".item-container");
$.ajax({
url: this.href,
beforeSend: function() { itemContainer.block({message: null});},
complete: function() { itemContainer.unblock();},
dataType: 'script'});
return false;
});
setup_container_toggles();
$('#toggle_action_new').click(function(){