mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
Yet more refactoring, particularly of the option drop downs.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@13 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
177180ea6e
commit
9a649506a5
11 changed files with 41 additions and 64 deletions
|
|
@ -41,7 +41,6 @@ class ContextController < ApplicationController
|
||||||
#
|
#
|
||||||
def show
|
def show
|
||||||
@context = Context.find(@params["id"])
|
@context = Context.find(@params["id"])
|
||||||
@places = Context.find_all
|
|
||||||
@projects = Project.find_all
|
@projects = Project.find_all
|
||||||
@page_title = "Context: #{@context.name.capitalize}"
|
@page_title = "Context: #{@context.name.capitalize}"
|
||||||
@not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created ASC" )
|
@not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created ASC" )
|
||||||
|
|
|
||||||
|
|
@ -87,23 +87,5 @@ class ProjectController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Toggles the 'done' status of the action
|
|
||||||
def toggle_check
|
|
||||||
item = Todo.find( @params['id'] )
|
|
||||||
|
|
||||||
case item.done
|
|
||||||
when 0: item.done = 1; item.completed = Time.now()
|
|
||||||
when 1: item.done = 0; item.completed = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
if item.save
|
|
||||||
flash["confirmation"] = "Marked next action as completed"
|
|
||||||
redirect_to( :action => "list" )
|
|
||||||
else
|
|
||||||
flash["warning"] = "Couldn't mark next action as completed"
|
|
||||||
redirect_to( :action => "list" )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ class TodoController < ApplicationController
|
||||||
#
|
#
|
||||||
def list
|
def list
|
||||||
@page_title = "List tasks"
|
@page_title = "List tasks"
|
||||||
@places = Context.find_all
|
|
||||||
@projects = Project.find_all
|
@projects = Project.find_all
|
||||||
|
@places = Context.find_all
|
||||||
@done = Todo.find_all( "done=1", "completed DESC", 5 )
|
@done = Todo.find_all( "done=1", "completed DESC", 5 )
|
||||||
@count = Todo.count( "done=0" )
|
@count = Todo.count( "done=0" )
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -49,5 +49,15 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_projects()
|
||||||
|
@projects = Project.find_all
|
||||||
|
return @@projects
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_contexts()
|
||||||
|
@places = Context.find_all
|
||||||
|
return @@places
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div id="display_box">
|
<div id="display_box">
|
||||||
|
|
||||||
<table cellpadding="5" width="450">
|
<table class="list" cellspacing="0" cellpadding="5" width="450" border="0">
|
||||||
<% row = 1 %>
|
<% row = 1 %>
|
||||||
<% for @context in @contexts %>
|
<% for @context in @contexts %>
|
||||||
<% if row % 2 == 0 %>
|
<% if row % 2 == 0 %>
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@
|
||||||
<label for="new_item_project_id">Project</label><br />
|
<label for="new_item_project_id">Project</label><br />
|
||||||
<select name="new_item[project_id]" id="new_item_project_id">
|
<select name="new_item[project_id]" id="new_item_project_id">
|
||||||
<option value="" selected>None</option>
|
<option value="" selected>None</option>
|
||||||
<% for @project in @projects %>
|
<%= options_from_collection_for_select(@projects, "id", "name" ) %>
|
||||||
<option value="<%= @project.id %>"><%= @project.name %></option>
|
|
||||||
<% end %>
|
|
||||||
</select><br />
|
</select><br />
|
||||||
<label for="new_item_due">Due</label><br />
|
<label for="new_item_due">Due</label><br />
|
||||||
<%= text_field( "new_item", "due", {"size" => 10, "maxlength" => 10} ) %>
|
<%= text_field( "new_item", "due", {"size" => 10, "maxlength" => 10} ) %>
|
||||||
|
|
|
||||||
16
tracks/app/views/project/_not_done.rhtml
Normal file
16
tracks/app/views/project/_not_done.rhtml
Normal 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, { :controller => "todo", :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( "[C]", { :controller => "context", :action => "show", :id => @item.context_id }, :title => "View context: #{@item.context['name'].capitalize}" ) %>
|
||||||
|
<% 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>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<div id="display_box">
|
<div id="display_box">
|
||||||
|
|
||||||
<table cellpadding="5" width="450">
|
<table class="list" cellspacing="0" cellpadding="5" width="450" border="0">
|
||||||
<% row = 1 %>
|
<% row = 1 %>
|
||||||
<% for @project in @projects %>
|
<% for @project in @projects %>
|
||||||
<% if row % 2 == 0 %>
|
<% if row % 2 == 0 %>
|
||||||
|
|
|
||||||
|
|
@ -6,32 +6,10 @@
|
||||||
<% if @not_done == [] %>
|
<% if @not_done == [] %>
|
||||||
<p>There are no next actions yet in this project</p>
|
<p>There are no next actions yet in this project</p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<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 %>
|
|
||||||
<%= link_to( "[C]", { :controller => "context", :action => "show", :id => @item.context_id }, :title => "View context: #{@item.context['name'].capitalize}" ) %>
|
|
||||||
</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? %>
|
<table class="next_actions" cellspacing="2" cellpadding="0" border="0">
|
||||||
<%= "<a href=\"javascript:toggle('" + @item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %></div>
|
<%= render_collection_of_partials "not_done", @not_done %>
|
||||||
<% m_notes = markdown(@item.notes) %>
|
</table>
|
||||||
<%= "<div class=\"notes\" id=\"" + @item.id.to_s + "\">" + m_notes + "</div>" %>
|
|
||||||
<% else %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -49,9 +27,7 @@
|
||||||
<br />
|
<br />
|
||||||
<label for="new_item_context_id">Context</label><br />
|
<label for="new_item_context_id">Context</label><br />
|
||||||
<select name="new_item[context_id]" id="new_item_context_id">
|
<select name="new_item[context_id]" id="new_item_context_id">
|
||||||
<% for @place in @places %>
|
<%= options_from_collection_for_select(@places, "id", "name" ) %>
|
||||||
<option value="<%= @place.id %>"><%= @place.name.capitalize %></option>
|
|
||||||
<% end %>
|
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
<label for="new_item_due">Due</label><br />
|
<label for="new_item_due">Due</label><br />
|
||||||
|
|
|
||||||
|
|
@ -38,17 +38,13 @@
|
||||||
<br />
|
<br />
|
||||||
<label for="new_item_context_id">Context</label><br />
|
<label for="new_item_context_id">Context</label><br />
|
||||||
<select name="new_item[context_id]" id="new_item_context_id">
|
<select name="new_item[context_id]" id="new_item_context_id">
|
||||||
<% for @place in @places %>
|
<%= options_from_collection_for_select(@places, "id", "name" ) %>
|
||||||
<option value="<%= @place.id %>"><%= @place.name.capitalize %></option>
|
|
||||||
<% end %>
|
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
<label for="new_item_project_id">Project</label><br />
|
<label for="new_item_project_id">Project</label><br />
|
||||||
<select name="new_item[project_id]" id="new_item_project_id">
|
<select name="new_item[project_id]" id="new_item_project_id">
|
||||||
<option value="" selected>None</option>
|
<option value="" selected>None</option>
|
||||||
<% for @project in @projects %>
|
<%= options_from_collection_for_select(@projects, "id", "name" ) %>
|
||||||
<option value="<%= @project.id %>"><%= @project.name %></option>
|
|
||||||
<% end %>
|
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
<label for="new_item_due">Due</label><br />
|
<label for="new_item_due">Due</label><br />
|
||||||
|
|
|
||||||
|
|
@ -239,10 +239,6 @@ li {
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
padding: 3px 0px;
|
padding: 3px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
|
||||||
border: 1px solid #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.even_row {
|
.even_row {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
@ -251,7 +247,11 @@ td {
|
||||||
.odd_row {
|
.odd_row {
|
||||||
background: #EDF3FE;
|
background: #EDF3FE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.list {
|
||||||
|
border: 1px solid #999;
|
||||||
|
}
|
||||||
|
|
||||||
.next_actions td {
|
.next_actions td {
|
||||||
border: none;
|
border: none;
|
||||||
padding-top: 3px;
|
padding-top: 3px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue