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"> <div class="contexts">
<h2><%= @context.name.capitalize %></h2> <h2><%= @context.name.capitalize %></h2>
<ul> <table class="next_actions" cellspacing="2" cellpadding="0" border="0">
<% for @item in @not_done %> <%= render_collection_of_partials "not_done", @not_done %>
<li> </table>
<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>
</div> </div>
</div><!- End of display_box --> </div><!- End of display_box -->

View file

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

View file

@ -1,22 +1,16 @@
<% @item = not_done %> <% @item = not_done %>
<li> <tr>
<div class="box"> <td valign="top"><%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
<%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %> <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>
</div> <td valign="top"><%= due_date( @item.due ) %>
<div class="description">
<%= due_date( @item.due ) %>
<%= @item.description %> <%= @item.description %>
<% if @item.project_id %> <% if @item.project_id %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :id => @item.project_id }, :title => "View project: #{@item.project['name']}" ) %> <%= link_to( "[P]", { :controller => "project", :action => "show", :id => @item.project_id }, :title => "View project: #{@item.project['name']}" ) %>
<% end %> <% 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? %> <% if @item.notes? %>
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %></div> <%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>
<% m_notes = markdown( @item.notes ) %> <% m_notes = markdown( @item.notes ) %>
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %> <%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
<% else %>
</div>
<% end %> <% end %>
</li> </td>
</tr>

View file

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

View file

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

View file

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