Patch submitted by Sean Santry: this adds more useful information to the flash notifications when items are added, deleted or created, by giving you the name of the context, project or next action that you are acting on. Thanks Sean!

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@44 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-03-10 22:40:01 +00:00
parent eee3480918
commit 6f51118766
6 changed files with 27 additions and 27 deletions

View file

@ -26,10 +26,10 @@ class ContextController < ApplicationController
context.attributes = @params["new_context"]
if context.save
flash["confirmation"] = "Succesfully created context"
flash["confirmation"] = "Succesfully created context \"#{context.name}\""
redirect_to( :action => "list" )
else
flash["warning"] = "Couldn't add new context"
flash["warning"] = "Couldn't add new context \"#{context.name}\""
redirect_to( :action => "list" )
end
end
@ -46,10 +46,10 @@ class ContextController < ApplicationController
@context = Context.find(@params['context']['id'])
@context.attributes = @params['context']
if @context.save
flash["confirmation"] = 'Context was successfully updated'
flash["confirmation"] = "Context \"#{@context.name}\" was successfully updated"
redirect_to :action => 'list'
else
flash["warning"] = 'Context could not be updated'
flash["warning"] = "Context \"#{@context.name}\" could not be updated"
redirect_to :action => 'list'
end
end
@ -78,10 +78,10 @@ class ContextController < ApplicationController
back_to = item.context_id
if item.save
flash["confirmation"] = "Succesfully added action to context"
flash["confirmation"] = "Succesfully added action \"#{item.description}\" to context"
redirect_to( :controller => "context", :action => "show", :id => "#{back_to}" )
else
flash["warning"] = "Could not add action to context"
flash["warning"] = "Could not add action \"#{item.description}\" to context"
redirect_to( :controller => "context", :action => "show", :id => "#{back_to}" )
end
end
@ -94,10 +94,10 @@ class ContextController < ApplicationController
expire_action(:controller => "context", :action => "list")
context = Context.find(@params['id'])
if context.destroy
flash["confirmation"] = "Succesfully deleted context"
flash["confirmation"] = "Succesfully deleted context \"#{context.name}\""
redirect_to( :action => "list" )
else
flash["warning"] = "Couldn't delete context"
flash["warning"] = "Couldn't delete context \"#{context.name}\""
redirect_to( :action => "list" )
end
end

View file

@ -40,10 +40,10 @@ class ProjectController < ApplicationController
@project = Project.find(@params['project']['id'])
@project.attributes = @params['project']
if @project.save
flash["confirmation"] = 'Project was successfully updated'
flash["confirmation"] = "Project \"#{@project.name}\" was successfully updated"
redirect_to :action => 'list'
else
flash["warning"] = 'Project could not be updated'
flash["warning"] = "Project \"#{@project.name}\" could not be updated"
redirect_to :action => 'list'
end
end
@ -58,10 +58,10 @@ class ProjectController < ApplicationController
project.name = @params["new_project"]["name"]
if project.save
flash["confirmation"] = "Succesfully added project"
flash["confirmation"] = "Succesfully added project \"#{project.name}\""
redirect_to( :action => "list" )
else
flash["warning"] = "Couldn't add project"
flash["warning"] = "Couldn't add project \"#{project.name}\""
redirect_to( :action => "list" )
end
end
@ -78,10 +78,10 @@ class ProjectController < ApplicationController
back_to = item.project_id
if item.save
flash["confirmation"] = "Successfully added next action to project"
flash["confirmation"] = "Successfully added next action \"#{item.description}\" to project"
redirect_to( :controller => "project", :action => "show", :id => "#{back_to}" )
else
flash["warning"] = "Couldn't add next action to project"
flash["warning"] = "Couldn't add next action \"#{item.description}\" to project"
redirect_to( :controller => "project", :action => "show", :id => "#{back_to}" )
end
end
@ -91,10 +91,10 @@ class ProjectController < ApplicationController
expire_action(:controller => "project", :action => "list")
project = Project.find( @params['id'] )
if project.destroy
flash["confirmation"] = "Succesfully deleted project"
flash["confirmation"] = "Succesfully deleted project \"#{project.name}\""
redirect_to( :action => "list" )
else
flash["warning"] = "Couldn't delete project"
flash["warning"] = "Couldn't delete project \"#{project.name}\""
redirect_to( :action => "list" )
end
end

View file

@ -59,10 +59,10 @@ class TodoController < ApplicationController
@item.attributes = @params["item"]
if @item.save
flash["confirmation"] = "Next action was successfully added"
flash["confirmation"] = "Next action \"#{@item.description}\" was successfully added"
redirect_to( :action => "list" )
else
flash["warning"] = "Couldn't add the action because of an error"
flash["warning"] = "Couldn't add the action \"#{@item.description}\""
redirect_to( :action => "list" )
end
end
@ -83,10 +83,10 @@ class TodoController < ApplicationController
@item = Todo.find(@params['item']['id'])
@item.attributes = @params['item']
if @item.save
flash["confirmation"] = 'Next action was successfully updated'
flash["confirmation"] = "Next action \"#{@item.description}\" was successfully updated"
redirect_to :action => 'list'
else
flash["warning"] = 'Next action could not be updated'
flash["warning"] = "Next action \"#{@item.description}\" could not be updated"
redirect_to :action => 'list'
end
end
@ -96,10 +96,10 @@ class TodoController < ApplicationController
expire_action(:controller => "todo", :action => "list")
item = Todo.find(@params['id'])
if item.destroy
flash["confirmation"] = "Next action was successfully deleted"
flash["confirmation"] = "Next action \"#{item.description}\" was successfully deleted"
redirect_to :action => "list"
else
flash["warning"] = "Couldn't delete next action"
flash["warning"] = "Couldn't delete next action \"#{item.description}\""
redirect_to :action => "list"
end
end
@ -115,10 +115,10 @@ class TodoController < ApplicationController
item.toggle!('done')
if item.save
flash["confirmation"] = "Next action marked as completed"
flash["confirmation"] = "Next action \"#{item.description}\" marked as completed"
redirect_to( :action => "list" )
else
flash["warning"] = "Couldn't mark action as completed"
flash["warning"] = "Couldn't mark action \"#{item.description}\" as completed"
redirect_to( :action => "list" )
end
end

View file

@ -17,7 +17,7 @@
shown
<% end %>
</td>
<td width="40"><%= link_image_to("edit", { :action => "edit", :id => @context.id }, :title => "Edit item", :size => "10x10") + " " + link_image_to("delete", { :action => "destroy", :id => @context.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete this context: #{@context.name}. Any todos in this context will be deleted.") + " " %></td>
<td width="40"><%= link_image_to("edit", { :action => "edit", :id => @context.id }, :title => "Edit item", :size => "10x10") + " " + link_image_to("delete", { :action => "destroy", :id => @context.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete the context \"#{@context.name}?\" Any todos in this context will be deleted.") + " " %></td>
</tr>
<% row += 1 %>
<% end %>

View file

@ -10,7 +10,7 @@
<% end %>
<td align="right" width="20"><%= @project.id.to_s %></td>
<td width="390"><%= link_to ( "#{@project.name}", :action => "show", :id => @project.id ) %></td>
<td width="40"><%= link_image_to( "edit", { :action => "edit", :id => @project.id }, :title => "Edit item", :size => "10x10" ) + " " + link_image_to( "delete", { :action => "destroy", :id => @project.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete the project: #{@project.name}. Any todos in this project will be deleted." ) + " " %></td>
<td width="40"><%= link_image_to( "edit", { :action => "edit", :id => @project.id }, :title => "Edit item", :size => "10x10" ) + " " + link_image_to( "delete", { :action => "destroy", :id => @project.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete the project \"#{@project.name}?\" Any todos in this project will be deleted." ) + " " %></td>
</tr>
<% row += 1 %>
<% end %>

View file

@ -3,7 +3,7 @@
<!-- <%= '<tr id="' + @notdone_item.id.to_s + '">' %> -->
<td valign="top">
<%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@notdone_item.id}'" ) %></td>
<td valign="top" width="30"><%= link_to( $edit_img, { :action => "edit", :id => @notdone_item.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :action => "destroy", :id => @notdone_item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@notdone_item.description}" ) + " " %></td>
<td valign="top" width="30"><%= link_to( $edit_img, { :action => "edit", :id => @notdone_item.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :action => "destroy", :id => @notdone_item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete the action \"#{@notdone_item.description}?\"" ) + " " %></td>
<td valign="top"><%= due_date( @notdone_item.due ) %>
<%= @notdone_item.description %>
<% if @notdone_item.project_id %>