tracks/tracks/app/views/project/_project_listing.rhtml
bsag 5ce97df3f4 Quite a few changes in this revision:
1. The contexts and projects lists are now drag and droppable. In other words, if you visit [tracks_url]/projects or [tracks_url]/contexts, you can grab the 'DRAG' handle with the mouse and drag and drop the projects or contexts into your preferred order. At the same time, this re-orders the 'position' column appropriately, so that changes in order will be reflected on other pages. '''NB''': At the moment, deleting projects and contexts is a bit buggy. The item doesn't disappear, but if you refresh the page it will update appropriately. Also, if you add a new item, you can't drag it until you refresh. I'll try to fix these things. Fixes #115.
2. Fixed typo of 'tomorrow' due date label. Fixes #131
3. I updated the syntax for some of the visual effects to use the new {{{visual_effect(:fade, 'element')}}} syntax. Also removed the javascript files effects2 and prototype-ex, which aren't used now. 


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@148 a4c988fc-2ded-0310-b66e-134b36920a42
2005-10-09 17:51:31 +00:00

46 lines
No EOL
2.4 KiB
Text

<% project = project_listing %>
<div id="container_<%= project.id %>">
<!-- %= error_messages_for 'project' % -->
<div id="project-<%= project.id %>-display" class="list">
<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><!-- [end:project-project.id-display] -->
<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 %>