tracks/tracks/app/views/project/_project_listing.rhtml
bsag 5e4f0f9fe8 Improved the security of the new drag and drop features of the projects and contexts lists by checking that the logged in user owns those items.
Also changed references to Form.focus_first which were defined in the removed file prototype-ex.js to Form.focusFirstElement, which is defined in prototype.js. Fixes #133.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@149 a4c988fc-2ded-0310-b66e-134b36920a42
2005-10-10 21:14:34 +00:00

44 lines
No EOL
2.3 KiB
Text

<% project = project_listing %>
<div id="container_<%= project.id %>" class="list">
<!-- %= error_messages_for 'project' % -->
<div id="project-<%= project.id %>" class="even_row" style="display:'';">
<div class="position">
<span class="handle">DRAG</span>
</div>
<div class="data">
<%= link_to( sanitize("#{project.name}"), :action => "show", :name => urlize(project.name) ) %><%= " (" + project.count_undone_todos("actions") + ")" %>
</div>
<div class="buttons">
<% if project.done == 1 -%>
<span class="grey">COMPLETED</span>
<% else -%>
<span class="grey">ACTIVE</span>
<% end -%>
<%= link_to_remote( image_tag("blank", :title =>"Delete project", :class=>"delete_item"),
:update => "container_#{project.id}",
:loading => visual_effect(:fade, 'container_#{project.id}'),
:url => { :controller => "project", :action => "destroy", :id => project.id },
:confirm => "Are you sure that you want to delete the project \'#{project.name}\'?" ) + " " +
link_to_function(image_tag( "blank", :title => "Edit item", :class=>"edit_item"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focus_first('form-project-#{project.id}');" ) %>
</div>
</div><!-- [end:project-project.id] -->
<div id="project-<%= project.id %>-edit-form" class="edit-form" style="display:none;">
<%= form_remote_tag :url => { :controller => 'project', :action => 'update', :id => project.id },
:html => { :id => "form-project-#{project.id}", :class => "form" },
:update => "container_#{project.id}",
:complete => visual_effect(:appear, 'container_#{project.id}') %>
<%= render_partial 'project_form', project %>
<div class="buttons">
<input type="submit" value="Update" />
<a href="javascript:void(0);" onclick="Element.toggle('project-<%= project.id %>','project-<%= project.id %>-edit-form');Form.reset('form-project-<%= project.id %>');">Cancel</a>
</div>
<%= end_form_tag %>
</div><!-- [end:project-project.id-edit-form] -->
</div><!-- [end:container_project.id] -->
<% if controller.action_name == 'new_project' %>
<script>
new Effect.Appear('project-<%= project.id %>');
</script>
<% end %>