Did some more refactoring into partial templates.

Seems like I have too many divs in the next actions lists, so changed those to tables instead.


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@12 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-01-23 16:14:08 +00:00
parent 3c196c46d8
commit 177180ea6e
7 changed files with 52 additions and 63 deletions

View file

@ -0,0 +1,16 @@
<% @item = not_done %>
<tr>
<td valign="top"><%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
<td valign="top" width="30"><%= link_to( $edit_img, { :action => "edit", :id => @item.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :action => "destroy", :id => @item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %></td>
<td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :id => @item.project_id }, :title => "View project: #{@item.project['name']}" ) %>
<% end %>
<% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>
<% m_notes = markdown( @item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
<% end %>
</td>
</tr>

View file

@ -2,34 +2,9 @@
<div class="contexts">
<h2><%= @context.name.capitalize %></h2>
<ul>
<% for @item in @not_done %>
<li>
<div class="box">
<%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %>
</div>
<div class="description">
<%= due_date(@item.due) %>
<%= @item.description %>
<% if @item.project_id %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :id => @item.project_id }, :title => "View project: #{@item.project['name']}" ) %>
<% end %>
</div>
<div class="tools">
<%= link_to($edit_img, { :controller => "todo", :action => "edit", :id => @item.id }, :title => "Edit item") + " " + link_to($delete_img, { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@item.description}") + " " %>
<% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %></div>
<% m_notes = markdown(@item.notes) %>
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
<% else %>
</div>
<% end %>
</li>
<% end %>
</ul>
<table class="next_actions" cellspacing="2" cellpadding="0" border="0">
<%= render_collection_of_partials "not_done", @not_done %>
</table>
</div>
</div><!- End of display_box -->

View file

@ -1,13 +1,9 @@
<% @item = done %>
<li>
<tr>
<% if @item.completed %>
<div class="box">
<%= $done_img %>
</div>
<div class="description">
<span class="grey"><%= format_date( @item.completed ) %></span>
<%= " " + @item.description + " "%>
<td valign="top"><%= $done_img %></td>
<td valign="top"><span class="grey"><%= format_date( @item.completed ) %></span></td>
<td valign="top"><%= " " + @item.description + " "%>
<% if @item.project_id %>
<%= "(" + @item.context['name'].capitalize + ", " + @item.project['name'] + ")" %>
@ -24,6 +20,6 @@
<% m_notes = markdown( @item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
<% end %>
</div>
</td>
<% end %>
</li>
</tr>

View file

@ -1,22 +1,16 @@
<% @item = not_done %>
<li>
<div class="box">
<%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %>
</div>
<div class="description">
<%= due_date( @item.due ) %>
<tr>
<td valign="top"><%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
<td valign="top" width="30"><%= link_to( $edit_img, { :action => "edit", :id => @item.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :action => "destroy", :id => @item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %></td>
<td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :id => @item.project_id }, :title => "View project: #{@item.project['name']}" ) %>
<% end %>
</div>
<div class="tools">
<%= link_to( $edit_img, { :action => "edit", :id => @item.id }, :title => "Edit item" ) + " " + link_to($delete_img, { :action => "destroy", :id => @item.id }, :title => "Delete item", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %>
<% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %></div>
<% m_notes = markdown( @item.notes ) %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>
<% m_notes = markdown( @item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
<% else %>
</div>
<% end %>
</li>
</td>
</tr>

View file

@ -2,9 +2,9 @@
<div class="contexts">
<h2>Completed items</h2>
<ul>
<table class="next_actions" cellspacing="5" cellpadding="0" border="0">
<%= render_collection_of_partials "done", @done %>
</ul>
</table>
</div>
</div><!- End of display_box -->

View file

@ -2,20 +2,20 @@
<% for @place in @places %>
<% @not_done = Todo.find_all( "done=0 AND context_id=#{@place.id}", "created ASC" ) %>
<% if !@not_done.empty? %>
<div class="contexts">
<h2><%= link_to( "#{@place.name.capitalize}", :controller => "context", :action => "show", :id => @place.id ) %></h2>
<ul>
<div class="contexts">
<h2><%= link_to( "#{@place.name.capitalize}", :controller => "context", :action => "show", :id => @place.id ) %></h2>
<table class="next_actions" cellspacing="2" cellpadding="0" border="0">
<%= render_collection_of_partials "not_done", @not_done %>
</ul>
</table>
</div><!-- End contexts -->
<% end %>
<% end %>
<div class="contexts">
<h2>Last 5 completed actions</h2>
<ul>
<%= render_collection_of_partials "done", @done %>
</ul>
<table class="next_actions" cellspacing="5" cellpadding="0" border="0">
<%= render_collection_of_partials "done", @done %>
</table>
</div>
</div><!- End of display_box -->

View file

@ -20,7 +20,8 @@ a, a:link, a:active, a:visited {
}
a:hover {
text-decoration: underline;
color: #fff;
background-color: #cc3334;
}
/* Structural divs */
@ -99,6 +100,7 @@ h2 a, h2 a:link, h2 a:active, h2 a:visited {
h2 a:hover {
color: #cc3334;
background-color: transparent;
text-decoration: none;
}
@ -249,3 +251,9 @@ td {
.odd_row {
background: #EDF3FE;
}
.next_actions td {
border: none;
padding-top: 3px;
padding-bottom: 3px;
}