tracks/tracks/app/views/project/show.rhtml

133 lines
5.3 KiB
Text

<div id="display_box">
<div class="contexts">
<h2><%= @project.name %></h2>
<div id="next_actions">
<% if @project.done == 1 -%>
<p class="info">This project has been completed</p>
<% for item in @not_done -%>
<%= render_partial "show_items", item %>
<% end -%>
<% elsif @not_done.empty? -%>
<p>There are no next actions yet in this project</p>
<% else -%>
<% for item in @not_done -%>
<%= render_partial "show_items", item %>
<% end -%>
<% end -%>
</div><!-- [end:next_actions] -->
</div><!-- [end:contexts] -->
<div class="contexts">
<h2>Completed actions in this project</h2>
<div id="completed">
<% if @done.empty? %>
<p>There are no completed next actions yet in this project</p>
<% else %>
<% for done_item in @done %>
<%= render_partial "show_items", done_item %>
<% end %>
<% end %>
</div>
</div><!-- [end:contexts] -->
<!-- begin div.contexts -->
<% @notes = Note.list_of(@project.id) -%>
<div class="contexts">
<div id="notes">
<h2>Notes</h2>
<% for note in @notes -%>
<%= render_partial "note/notes_summary", note %>
<% end -%>
</div>
</div>
<!-- end div.contexts -->
<%= link_to_function( "Add a note",
"Element.toggle('new-note'); Form.focusFirstElement('form-new-note');") %>
<div id="new-note" style="display:none;">
<%= form_remote_tag :url => { :controller => "note", :action => "add_note" },
:update => "notes",
:position => "bottom",
:complete => "new Effect.Highlight('notes');",
:html => {:id=>'form-new-note', :class => 'inline-form'} %>
<%= hidden_field( "new_note", "project_id", "value" => "#{@project.id}" ) %>
<%= text_area( "new_note", "body", "cols" => 50, "rows" => 3, "tabindex" => 1 ) %>
<br /><br />
<input type="submit" value="Add note" tabindex="2" />
<%= end_form_tag %>
</div>
</div><!-- [end:display_box] -->
<div id="input_box">
<%= link_to_function( "Add the next action in this project &#187;", "Element.toggle('project_new_action'); Form.focusFirstElement('project-form-new-action');", {:title => "Add the next action [Alt+n]", :accesskey => "n"}) %>
<div id="project_new_action" class="project_new" style="display:none">
<!--[form:project]-->
<%= form_remote_tag :url => { :action => "add_item" },
:update=> "next_actions",
:position=> "bottom",
:loading => "project.reset()",
:complete => "Form.focusFirstElement('project-form-new-action'); new Effect.Highlight('next_actions');",
:html=> { :id=>'project-form-new-action', :name=>'project', :class => 'inline-form' } %>
<%= hidden_field( "new_item", "project_id", "value" => "#{@project.id}") %>
<label for="new_item_description">Description</label><br />
<%= text_field( "new_item", "description", "size" => 25, "tabindex" => 1 ) %><br />
<label for="new_item_notes">Notes</label><br />
<%= text_area( "new_item", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2 ) %><br />
<label for="new_item_context_id">Context</label><br />
<select name="new_item[context_id]" id="new_item_context_id" tabindex="3">
<%= options_from_collection_for_select(@places, "id", "name" ) %>
</select><br />
<label for="item_due">Due</label><br />
<%= text_field("new_item", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 4) %>
<br /><br />
<input type="submit" value="Add item" tabindex="5">
<%= end_form_tag %><!--[eoform:project]-->
<script type="text/javascript">
Calendar.setup({ ifFormat:"<%= ApplicationController::DATE_FORMAT %>",firstDay:<%= ApplicationController::WEEK_STARTS_ON %>,showOthers:true,range:[2004, 2010],step:1,inputField:"new_item_due",cache:true,align:"TR" })
</script>
</div><!-- [end:project-new-action] -->
<h3>Active Projects:</h3>
<ul>
<% for project in Project.list_of -%>
<li><%= link_to( project.name, { :controller => "project", :action => "show",
:name => urlize(project.name) } ) + " (" + project.count_undone_todos("actions") + ")" %></li>
<% end -%>
</ul>
<h3>Completed Projects:</h3>
<ul>
<% for project in Project.list_of( isdone=1 ) -%>
<li><%= link_to( project.name, { :controller => "project", :action => "show",
:name => urlize(project.name) } ) + " (" + project.count_undone_todos("actions") + ")" %></li>
<% end -%>
</ul>
<h3>Active Contexts:</h3>
<ul>
<% for context in Context.list_of -%>
<li><%= link_to( context.name, { :controller => "context", :action => "show",
:name => urlize(context.name) } ) + " (" + context.count_undone_todos("actions") + ")" %></li>
<% end -%>
</ul>
<h3>Hidden Contexts:</h3>
<ul>
<% for context in Context.list_of( hidden=1 ) -%>
<li><%= link_to( context.name, { :controller => "context", :action => "show",
:name => urlize(context.name) } ) + " (" + context.count_undone_todos("actions") + ")" %></li>
<% end -%>
</ul>
</div><!-- End of input box -->
<% if @flash["confirmation"] %><div class="confirmation"><%= @flash["confirmation"] %></div><% end %>
<% if @flash["warning"] %><div class="warning"><%= @flash["warning"] %></div><% end %>