mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-20 09:10:12 +01:00
fix suppressing some edit actions on certain views that were enables incorrectly
This commit is contained in:
parent
4f8132adc2
commit
1dca4747f3
4 changed files with 253 additions and 294 deletions
|
|
@ -22,25 +22,6 @@ module TodosHelper
|
||||||
:prevent_default => true
|
:prevent_default => true
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_behavior_for_delete_icon
|
|
||||||
parameters = "_source_view=#{@source_view}"
|
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|
||||||
apply_behavior '.item-container a.delete_icon:click', :prevent_default => true do |page|
|
|
||||||
page.confirming "'Are you sure that you want to ' + this.title + '?'" do
|
|
||||||
page << "itemContainer = this.up('.item-container'); itemContainer.startWaiting();"
|
|
||||||
page << remote_to_href(:method => 'delete', :with => "'#{parameters}'", :complete => "itemContainer.stopWaiting();")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def remote_delete_icon
|
|
||||||
str = link_to( image_tag_for_delete,
|
|
||||||
todo_path(@todo), :id => "delete_icon_"+@todo.id.to_s,
|
|
||||||
:class => "icon delete_icon", :title => "delete the action '#{@todo.description}'")
|
|
||||||
set_behavior_for_delete_icon
|
|
||||||
str
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_behavior_for_star_icon
|
def set_behavior_for_star_icon
|
||||||
apply_behavior '.item-container a.star_item:click',
|
apply_behavior '.item-container a.star_item:click',
|
||||||
remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"),
|
remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"),
|
||||||
|
|
@ -55,27 +36,6 @@ module TodosHelper
|
||||||
str
|
str
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_behavior_for_edit_icon
|
|
||||||
parameters = "_source_view=#{@source_view}"
|
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
|
||||||
apply_behavior '.item-container a.edit_icon:click', :prevent_default => true do |page|
|
|
||||||
page << "Effect.Pulsate(this);"
|
|
||||||
page << remote_to_href(:method => 'get', :with => "'#{parameters}'")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def remote_edit_icon
|
|
||||||
if !@todo.completed?
|
|
||||||
str = link_to( image_tag_for_edit(@todo),
|
|
||||||
edit_todo_path(@todo),
|
|
||||||
:class => "icon edit_icon")
|
|
||||||
set_behavior_for_edit_icon
|
|
||||||
else
|
|
||||||
str = '<a class="icon">' + image_tag("blank.png") + "</a> "
|
|
||||||
end
|
|
||||||
str
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_behavior_for_toggle_checkbox
|
def set_behavior_for_toggle_checkbox
|
||||||
parameters = "_source_view=#{@source_view}"
|
parameters = "_source_view=#{@source_view}"
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||||
|
|
@ -267,14 +227,6 @@ module TodosHelper
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def image_tag_for_delete
|
|
||||||
image_tag("blank.png", :title =>"Delete action", :class=>"delete_item")
|
|
||||||
end
|
|
||||||
|
|
||||||
def image_tag_for_edit(todo)
|
|
||||||
image_tag("blank.png", :title =>"Edit action", :class=>"edit_item", :id=> dom_id(todo, 'edit_icon'))
|
|
||||||
end
|
|
||||||
|
|
||||||
def image_tag_for_star(todo)
|
def image_tag_for_star(todo)
|
||||||
class_str = todo.starred? ? "starred_todo" : "unstarred_todo"
|
class_str = todo.starred? ? "starred_todo" : "unstarred_todo"
|
||||||
image_tag("blank.png", :title =>"Star action", :class => class_str)
|
image_tag("blank.png", :title =>"Star action", :class => class_str)
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,7 @@
|
||||||
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
|
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
|
||||||
<% if @not_done.empty?
|
<% if @not_done.empty?
|
||||||
# fix (hack) for #713
|
# fix (hack) for #713
|
||||||
set_behavior_for_delete_icon
|
|
||||||
set_behavior_for_star_icon
|
set_behavior_for_star_icon
|
||||||
set_behavior_for_edit_icon
|
|
||||||
set_behavior_for_toggle_checkbox
|
set_behavior_for_toggle_checkbox
|
||||||
end
|
end
|
||||||
-%>
|
-%>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
@todo = todo
|
@todo = todo
|
||||||
suppress_context ||= false
|
suppress_context ||= false
|
||||||
suppress_project ||= false
|
suppress_project ||= false
|
||||||
suppress_edit_button ||= false
|
suppress_edit_button ||= todo.completed?
|
||||||
parameters = "_source_view=#{@source_view}"
|
parameters = "_source_view=#{@source_view}"
|
||||||
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||||
@z_index_counter = @z_index_counter - 1 # for IE z-index bug
|
@z_index_counter = @z_index_counter - 1 # for IE z-index bug
|
||||||
|
|
@ -12,10 +12,14 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
|
||||||
<%= remote_star_icon %>
|
<%= remote_star_icon %>
|
||||||
<%= remote_toggle_checkbox unless source_view_is :deferred %>
|
<%= remote_toggle_checkbox unless source_view_is :deferred %>
|
||||||
<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) %>">
|
<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><%= link_to_remote("Edit", :url => {:controller => 'todos', :action => 'edit', :id => @todo.id}, :method => 'get', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();") %></li>
|
<li><%= link_to_remote("Edit", :url => {:controller => 'todos', :action => 'edit', :id => @todo.id}, :method => 'get', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();") %></li>
|
||||||
|
<% end %>
|
||||||
<li><%= link_to_remote "Delete", :url => {:controller => 'todos', :action => 'destroy', :id => @todo.id}, :method => 'delete', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
<li><%= link_to_remote "Delete", :url => {:controller => 'todos', :action => 'destroy', :id => @todo.id}, :method => 'delete', :with => "'#{parameters}'", :before => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
||||||
|
<% unless todo.completed? || todo.deferred? %>
|
||||||
<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 => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); 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 => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); 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 => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); 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 => "$('ul#{dom_id(todo)}').hide(); itemContainer = $('#{dom_id(todo)}'); itemContainer.startWaiting()", :complete => "itemContainer.stopWaiting();" %></li>
|
||||||
|
<% end %>
|
||||||
</ul></ul>
|
</ul></ul>
|
||||||
<div class="description<%= staleness_class( todo ) %>">
|
<div class="description<%= staleness_class( todo ) %>">
|
||||||
<%= date_span -%>
|
<%= date_span -%>
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,15 @@
|
||||||
* Mailing list: http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
|
* Mailing list: http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss
|
||||||
* Original developer: bsag (http://www.rousette.org.uk/)
|
* Original developer: bsag (http://www.rousette.org.uk/)
|
||||||
* Contributors: http://getontracks.org/wiki/Tracks/Contributing/Contributors
|
* Contributors: http://getontracks.org/wiki/Tracks/Contributing/Contributors
|
||||||
* Version: 1.7
|
* Version: 1.8devel
|
||||||
* Copyright: (cc) 2004-2009 rousette.org.uk.
|
* Copyright: (cc) 2004-2009 rousette.org.uk.
|
||||||
* License: GNU GPL
|
* License: GNU GPL
|
||||||
|
|
||||||
|
== Version 1.7devel
|
||||||
|
|
||||||
|
New features:
|
||||||
|
1. Redesign of menus and introduction of a context menu per todo
|
||||||
|
|
||||||
== Version 1.7
|
== Version 1.7
|
||||||
|
|
||||||
New features:
|
New features:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue