mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 06:21:49 +01:00
Consolidate list and index actions in project and context controllers.
Use simply_helpful methods to simplify DOM IDs. Improve CSS rendering on IE7. (didn't get to test these changes on Safari!) Make new contexts appear automatically when added with new action on home page. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@384 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
c407fc2463
commit
a65e66168c
22 changed files with 106 additions and 138 deletions
|
|
@ -6,14 +6,6 @@ class ContextController < ApplicationController
|
|||
before_filter :init_todos, :only => :show
|
||||
|
||||
def index
|
||||
list
|
||||
render_action "list"
|
||||
end
|
||||
|
||||
# Main method for listing contexts
|
||||
# Set page title, and collect existing contexts in @contexts
|
||||
#
|
||||
def list
|
||||
@page_title = "TRACKS::List Contexts"
|
||||
respond_to do |wants|
|
||||
wants.html
|
||||
|
|
@ -91,7 +83,7 @@ class ContextController < ApplicationController
|
|||
render_text ""
|
||||
else
|
||||
notify :warning, "Couldn't delete context \"#{@context.name}\""
|
||||
redirect_to( :controller => "context", :action => "list" )
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -114,7 +106,7 @@ class ContextController < ApplicationController
|
|||
elsif params['id']
|
||||
@context = @user.contexts.find(params["id"])
|
||||
else
|
||||
redirect_to(:controller => "context", :action => "list" )
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
if @user == @context.user
|
||||
return @context
|
||||
|
|
|
|||
|
|
@ -5,14 +5,6 @@ class ProjectController < ApplicationController
|
|||
before_filter :init_todos, :only => :show
|
||||
|
||||
def index
|
||||
list
|
||||
render_action "list"
|
||||
end
|
||||
|
||||
# Main method for listing projects
|
||||
# Set page title, and collect existing projects in @projects
|
||||
#
|
||||
def list
|
||||
init_project_hidden_todo_counts
|
||||
@page_title = "TRACKS::List Projects"
|
||||
respond_to do |wants|
|
||||
|
|
@ -25,30 +17,7 @@ class ProjectController < ApplicationController
|
|||
# e.g. <home>/project/show/<project_name> shows just <project_name>.
|
||||
#
|
||||
def show
|
||||
@notes = @project.notes
|
||||
@page_title = "TRACKS::Project: #{@project.name}"
|
||||
|
||||
if @contexts.empty?
|
||||
notify :warning, 'You must add at least one context before adding next actions.'
|
||||
end
|
||||
|
||||
if @not_done.empty?
|
||||
@msg_nd = "Currently there are no uncompleted actions in this project"
|
||||
else
|
||||
@msg_nd = nil
|
||||
end
|
||||
|
||||
if @done.empty?
|
||||
@msg_d = "Currently there are no completed actions in this project"
|
||||
else
|
||||
@msg_d = nil
|
||||
end
|
||||
|
||||
if @notes.empty?
|
||||
@msg_n = "Currently there are no notes attached to this project"
|
||||
else
|
||||
@msg_n = nil
|
||||
end
|
||||
end
|
||||
|
||||
# Example XML usage: curl -H 'Accept: application/xml' -H 'Content-Type: application/xml'
|
||||
|
|
@ -122,7 +91,7 @@ class ProjectController < ApplicationController
|
|||
|
||||
@project.toggle!('done')
|
||||
if @project.save
|
||||
redirect_to(:action => "list")
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -134,7 +103,7 @@ class ProjectController < ApplicationController
|
|||
render :text => ''
|
||||
else
|
||||
notify :warning, "Couldn't delete project \"#{@project.name}\""
|
||||
redirect_to( :controller => "project", :action => "list" )
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -157,7 +126,7 @@ class ProjectController < ApplicationController
|
|||
elsif params['id']
|
||||
@project = @user.projects.find(params["id"])
|
||||
else
|
||||
redirect_to(:controller => "project", :action => "list" )
|
||||
redirect_to :action => 'index'
|
||||
end
|
||||
if @user == @project.user
|
||||
return @project
|
||||
|
|
|
|||
|
|
@ -20,10 +20,6 @@ class TodoController < ApplicationController
|
|||
@done = @user.completed_todos.find(:all, :limit => max_completed) unless max_completed == 0
|
||||
|
||||
@contexts_to_show = @contexts.reject {|x| x.hide? }
|
||||
|
||||
if @contexts.empty?
|
||||
notify :warning, "You must add at least one context before adding next actions."
|
||||
end
|
||||
|
||||
# Set count badge to number of not-done, not hidden context items
|
||||
@count = @todos.reject { |x| !x.active? || x.context.hide? }.size
|
||||
|
|
@ -57,6 +53,7 @@ class TodoController < ApplicationController
|
|||
context.name = p['context_name'].strip
|
||||
context.save
|
||||
@new_context_created = true
|
||||
@not_done_todos = [@item]
|
||||
end
|
||||
@item.context_id = context.id
|
||||
end
|
||||
|
|
@ -261,7 +258,7 @@ class TodoController < ApplicationController
|
|||
@todos = @user.todos.find(:all, :conditions => ['todos.state = ? or todos.state = ?', 'active', 'complete'], :include => [ :project, :context ])
|
||||
|
||||
# Exclude hidden projects from the home page
|
||||
@not_done_todos = @user.todos.find(:all, :conditions => ['todos.state = ?', 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [ :project, :context ])
|
||||
@not_done_todos = @user.todos.find(:all, :conditions => ['todos.state = ?', 'active'], :order => "todos.due ASC", :include => [ :project, :context ])
|
||||
end
|
||||
|
||||
def determine_down_count
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module TodoHelper
|
|||
|
||||
def form_remote_tag_edit_todo( item, &block )
|
||||
form_remote_tag( :url => { :controller => 'todo', :action => 'update', :id => item.id },
|
||||
:html => { :id => "form-action-#{item.id}", :class => "inline-form" }, &block
|
||||
:html => { :id => dom_id(item, 'form'), :class => "inline-form" }, &block
|
||||
)
|
||||
end
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ module TodoHelper
|
|||
if !item.completed?
|
||||
url_options[:action] = 'edit'
|
||||
str << link_to_remote( image_tag_for_edit(item),
|
||||
{ :url => url_options, :loading => visual_effect(:pulsate, "action-#{item.id}-edit-icon") },
|
||||
{ :url => url_options, :loading => visual_effect(:pulsate, dom_id(item, 'edit_icon')) },
|
||||
{ :class => "icon" }
|
||||
)
|
||||
else
|
||||
|
|
@ -118,6 +118,7 @@ module TodoHelper
|
|||
end
|
||||
|
||||
def context_names_for_autocomplete
|
||||
return array_or_string_for_javascript(['Create a new context']) if @contexts.empty?
|
||||
array_or_string_for_javascript( @contexts.collect{|c| escape_javascript(c.name) } )
|
||||
end
|
||||
|
||||
|
|
@ -128,7 +129,7 @@ module TodoHelper
|
|||
end
|
||||
|
||||
def image_tag_for_edit(item)
|
||||
image_tag("blank.png", :title =>"Edit action", :class=>"edit_item", :id=>"action-#{item.id}-edit-icon")
|
||||
image_tag("blank.png", :title =>"Edit action", :class=>"edit_item", :id=> dom_id(item, 'edit_icon'))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@
|
|||
<div id="navcontainer">
|
||||
<ul id="navlist">
|
||||
<li><%= navigation_link("Home", {:controller => "todo", :action => "index"}, {:accesskey => "t", :title => "Home"} ) %></li>
|
||||
<li><%= navigation_link( "Contexts", {:controller => "context", :action => "list"}, {:accesskey=>"c", :title=>"Contexts"} ) %></li>
|
||||
<li><%= navigation_link( "Projects", {:controller => "project", :action => "list"}, {:accesskey=>"p", :title=>"Projects"} ) %></li>
|
||||
<li><%= navigation_link( "Contexts", {:controller => "context", :action => "index"}, {:accesskey=>"c", :title=>"Contexts"} ) %></li>
|
||||
<li><%= navigation_link( "Projects", {:controller => "project", :action => "index"}, {:accesskey=>"p", :title=>"Projects"} ) %></li>
|
||||
<li><%= navigation_link( "Tickler", {:controller => "todo", :action => "tickler"}, :title => "Tickler" ) %></li>
|
||||
<li><%= navigation_link( "Done", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %></li>
|
||||
<li><%= navigation_link( "Notes", {:controller => "note", :action => "index"}, {:accesskey => "o", :title => "Show all notes"} ) %></li>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
:complete => visual_effect(:appear, "note-#{note.id}-container") do -%>
|
||||
<%= render :partial => "note_edit_form", :object => note %>
|
||||
<% end -%>
|
||||
</div><!-- [end:action-item.id-edit-form] -->
|
||||
</div><!-- [end:note-note.id-edit-form] -->
|
||||
|
||||
</div><!-- [end.note-note.id-container] -->
|
||||
<% note = nil -%>
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
<div id="notes">
|
||||
<div class="add_note_link"><%= link_to_function( "Add a note", "Element.toggle('new-note'); Form.focusFirstElement('form-new-note');") %></div>
|
||||
<h2>Notes</h2>
|
||||
<div id="empty-n" style="display:<%= @notes.empty? ? 'block' : 'none'%>;">
|
||||
<div id="empty-n" style="display:<%= @project.notes.empty? ? 'block' : 'none'%>;">
|
||||
<%= render :partial => "shared/empty",
|
||||
:locals => { :message => "Currently there are no notes attached to this project"} %>
|
||||
</div>
|
||||
<%= render :partial => "note/notes_summary", :collection => @notes %>
|
||||
<%= render :partial => "note/notes_summary", :collection => @project.notes %>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
<div id="status"><%= error_messages_for("item") %></div>
|
||||
|
||||
<label for="todo_description">Description</label><br />
|
||||
<%= text_field( "todo", "description", "size" => 25, "tabindex" => 1) %><br />
|
||||
<label for="todo_description">Description</label>
|
||||
<%= text_field( "todo", "description", "size" => 25, "tabindex" => 1) %>
|
||||
|
||||
<label for="todo_notes">Notes</label><br />
|
||||
<%= text_area( "todo", "notes", "cols" => 25, "rows" => 6, "tabindex" => 2) %><br />
|
||||
<label for="todo_notes">Notes</label>
|
||||
<%= text_area( "todo", "notes", "cols" => 25, "rows" => 6, "tabindex" => 2) %>
|
||||
|
||||
<label for="todo_context_name">Context</label><br />
|
||||
<label for="todo_context_name">Context</label>
|
||||
<input id="todo_context_name" name="context_name" autocomplete="off" tabindex="3" size="25" type="text" value="<%= @initial_context_name %>" />
|
||||
<div class="page_name_auto_complete" id="context_list" style="display:none"></div>
|
||||
|
||||
|
|
@ -32,9 +32,8 @@ contextAutoCompleter = new Autocompleter.Local('todo_context_name', 'context_lis
|
|||
Event.observe($('todo_context_name'), "focus", contextAutoCompleter.activate.bind(contextAutoCompleter));
|
||||
Event.observe($('todo_context_name'), "click", contextAutoCompleter.activate.bind(contextAutoCompleter));
|
||||
</script>
|
||||
<br />
|
||||
|
||||
<label for="todo_project_name">Project</label><br />
|
||||
<label for="todo_project_name">Project</label>
|
||||
<input id="todo_project_name" name="project_name" autocomplete="off" tabindex="4" size="25" type="text" value="<%= @initial_project_name %>" />
|
||||
<div class="page_name_auto_complete" id="project_list" style="display:none"></div>
|
||||
|
||||
|
|
@ -43,16 +42,15 @@ projectAutoCompleter = new Autocompleter.Local('todo_project_name', 'project_lis
|
|||
Event.observe($('todo_project_name'), "focus", projectAutoCompleter.activate.bind(projectAutoCompleter));
|
||||
Event.observe($('todo_project_name'), "click", projectAutoCompleter.activate.bind(projectAutoCompleter));
|
||||
</script>
|
||||
<br />
|
||||
|
||||
<label for="todo_due">Due</label><br />
|
||||
<label for="todo_due">Due</label>
|
||||
<%= text_field("todo", "due", "size" => 10, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 5, "autocomplete" => "off") %>
|
||||
|
||||
<br /> <label for="todo_show_from">Show from</label><br />
|
||||
<%= text_field("todo", "show_from", "size" => 10, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 6, "autocomplete" => "off") %><br />
|
||||
<label for="todo_show_from">Show from</label>
|
||||
<%= text_field("todo", "show_from", "size" => 10, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 6, "autocomplete" => "off") %>
|
||||
|
||||
<%= source_view_tag( @source_view ) %>
|
||||
<input type="submit" value="Add item" tabindex="7" />
|
||||
<div class="submit_box"><input type="submit" value="Add item" tabindex="7" /></div>
|
||||
<% end -%><!--[eoform:todo]-->
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,43 +13,43 @@
|
|||
<td><%= text_area( "item", "notes", "cols" => 20, "rows" => 5, "tabindex" => 9) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="item_context_name">Context</label></td>
|
||||
<td><input id="item_context_name" name="context_name" autocomplete="off" tabindex="10" size="25" type="text" value="<%= @item.context.name %>" />
|
||||
<div class="page_name_auto_complete" id="edit_form_context_list" style="display:none"></div></td>
|
||||
<td class="label"><label for="<%= dom_id(@item, 'context_name') %>">Context</label></td>
|
||||
<td><input id="<%= dom_id(@item, 'context_name') %>" name="context_name" autocomplete="off" tabindex="10" size="25" type="text" value="<%= @item.context.name %>" />
|
||||
<div class="page_name_auto_complete" id="<%= dom_id(@item, 'context_list') %>" style="display:none"></div></td>
|
||||
<script type="text/javascript">
|
||||
editFormContextAutoCompleter = new Autocompleter.Local('item_context_name', 'edit_form_context_list', <%= context_names_for_autocomplete %>, {choices:100,autoSelect:true});
|
||||
Event.observe($('item_context_name'), "focus", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
|
||||
Event.observe($('item_context_name'), "click", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
|
||||
editFormContextAutoCompleter = new Autocompleter.Local('<%= dom_id(@item, 'context_name') %>', '<%= dom_id(@item, 'context_list') %>', <%= context_names_for_autocomplete %>, {choices:100,autoSelect:true});
|
||||
Event.observe($('<%= dom_id(@item, 'context_name') %>'), "focus", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
|
||||
Event.observe($('<%= dom_id(@item, 'context_name') %>'), "click", editFormContextAutoCompleter.activate.bind(editFormContextAutoCompleter));
|
||||
</script>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="item_project_name">Project</label></td>
|
||||
<td class="label"><label for="<%= dom_id(@item, 'project_name') %>">Project</label></td>
|
||||
<td>
|
||||
<input id="item_project_name" name="project_name" autocomplete="off" tabindex="11" size="25" type="text" value="<%= @item.project.nil? ? 'None' : @item.project.name %>" />
|
||||
<div class="page_name_auto_complete" id="edit_form_project_list" style="display:none"></div>
|
||||
<input id="<%= dom_id(@item, 'project_name') %>" name="project_name" autocomplete="off" tabindex="11" size="25" type="text" value="<%= @item.project.nil? ? 'None' : @item.project.name %>" />
|
||||
<div class="page_name_auto_complete" id="<%= dom_id(@item, 'project_list') %>" style="display:none"></div>
|
||||
</td>
|
||||
<script type="text/javascript">
|
||||
editFormProjectAutoCompleter = new Autocompleter.Local('item_project_name', 'edit_form_project_list', <%= project_names_for_autocomplete %>, {choices:100,autoSelect:true});
|
||||
Event.observe($('item_project_name'), "focus", editFormProjectAutoCompleter.activate.bind(editFormProjectAutoCompleter));
|
||||
Event.observe($('item_project_name'), "click", editFormProjectAutoCompleter.activate.bind(editFormProjectAutoCompleter));
|
||||
editFormProjectAutoCompleter = new Autocompleter.Local('<%= dom_id(@item, 'project_name') %>', '<%= dom_id(@item, 'project_list') %>', <%= project_names_for_autocomplete %>, {choices:100,autoSelect:true});
|
||||
Event.observe($('<%= dom_id(@item, 'project_name') %>'), "focus", editFormProjectAutoCompleter.activate.bind(editFormProjectAutoCompleter));
|
||||
Event.observe($('<%= dom_id(@item, 'project_name') %>'), "click", editFormProjectAutoCompleter.activate.bind(editFormProjectAutoCompleter));
|
||||
</script>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="item_due">Due</td>
|
||||
<td><input name="item[due]" id="due_<%= @item.id %>" type="text" value="<%= format_date(@item.due) %>" tabindex="12" size="10" onfocus="Calendar.setup" autocomplete="off" class="Date" /></td>
|
||||
<td class="label"><label for="<%= dom_id(@item, 'due') %>">Due</td>
|
||||
<td><input name="item[due]" id="<%= dom_id(@item, 'due') %>" type="text" value="<%= format_date(@item.due) %>" tabindex="12" size="10" onfocus="Calendar.setup" autocomplete="off" class="Date" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="item_show_from">Show from</td>
|
||||
<td><input name="item[show_from]" id="show_from_<%= @item.id %>" type="text" value="<%= format_date(@item.show_from) %>" tabindex="13" size="10" onfocus="Calendar.setup" autocomplete="off" class="Date" /></td>
|
||||
<td class="label"><label for="<%= dom_id(@item, 'show_from') %>">Show from</td>
|
||||
<td><input name="item[show_from]" id="<%= dom_id(@item, 'show_from') %>" type="text" value="<%= format_date(@item.show_from) %>" tabindex="13" size="10" onfocus="Calendar.setup" autocomplete="off" class="Date" /></td>
|
||||
</tr>
|
||||
<% if controller.controller_name == "project" || @item.deferred? -%>
|
||||
<input type="hidden" name="on_project_page" value="true" />
|
||||
<% end -%>
|
||||
<tr>
|
||||
<td colspan="2"><input type="submit" value="Update" tabindex="14" />
|
||||
<a href="javascript:void(0);" onclick="Element.toggle('item-<%= @item.id %>');Element.toggle('action-<%= @item.id %>-edit-form');">Cancel</a></td>
|
||||
<a href="javascript:void(0);" onclick="Element.toggle('<%= dom_id(@item, 'line') %>');Element.toggle('<%= dom_id(@item, 'edit') %>');">Cancel</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<%= calendar_setup( "due_#{@item.id}" ) %>
|
||||
<%= calendar_setup( "show_from_#{@item.id}" ) %>
|
||||
<%= calendar_setup( dom_id(@item, 'due') ) %>
|
||||
<%= calendar_setup( dom_id(@item, 'show_from') ) %>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<div id="item-<%= item.id %>-container" class="item-container">
|
||||
<div id="item-<%= item.id %>">
|
||||
<div id="<%= dom_id(item) %>" class="item-container">
|
||||
<div id="<%= dom_id(item, 'line') %>">
|
||||
<%= link_to_remote_todo item %>
|
||||
|
||||
<% unless source_view_is :deferred -%>
|
||||
|
|
@ -38,10 +38,10 @@
|
|||
<%= render :partial => "todo/toggle_notes", :locals => { :item => item } %>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div><!-- [end:item-item.id] -->
|
||||
<div id="action-<%= item.id %>-edit-form" class="edit-form" style="display:none;">
|
||||
</div><!-- [end:<%= dom_id(item, 'line') %>] -->
|
||||
<div id="<%= dom_id(item, 'edit') %>" class="edit-form" style="display:none">
|
||||
<% form_remote_tag_edit_todo( item ) do -%>
|
||||
<% #note: edit form will load here remotely -%>
|
||||
<% end -%>
|
||||
</div><!-- [end:action-item.id-edit-form] -->
|
||||
</div><!-- [end:item-item.id-container] -->
|
||||
</div><!-- [end:<%= dom_id(item, 'edit') %>] -->
|
||||
</div><!-- [end:<%= dom_id(item) %>] -->
|
||||
|
|
|
|||
|
|
@ -14,10 +14,14 @@ if @saved
|
|||
show_new_item = true if source_view_is(:project) && @item.project.hidden? && @item.project_hidden?
|
||||
show_new_item = true if !source_view_is(:deferred) && @item.active?
|
||||
if show_new_item
|
||||
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}" if source_view_is(:todo)
|
||||
page.insert_html :bottom, item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type, :source_view => @source_view }
|
||||
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
|
||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
||||
if @new_context_created
|
||||
page.insert_html :top, 'display_box', :partial => 'context/context', :locals => { :context => @item.context, :collapsible => true }
|
||||
else
|
||||
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}" if source_view_is(:todo)
|
||||
page.insert_html :bottom, item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type, :source_view => @source_view }
|
||||
page.visual_effect :highlight, dom_id(@item), :duration => 3
|
||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
||||
end
|
||||
end
|
||||
else
|
||||
page.show 'status'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
if @saved
|
||||
page["item-#{@item.id}-container"].remove
|
||||
page[@item].remove
|
||||
page['badge_count'].replace_html @down_count
|
||||
page.visual_effect :fade, item_container_id, :duration => 0.4 if source_view_is(:todo) && @remaining_undone_in_context == 0
|
||||
page[empty_container_msg_div_id].show if !empty_container_msg_div_id.nil? && @down_count == 0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
page["form-action-#{@item.id}"].replace_html :partial => 'todo/edit_form'
|
||||
page["item-#{@item.id}"].hide
|
||||
page["action-#{@item.id}-edit-form"].show
|
||||
page.call "Form.focusFirstElement", "form-action-#{@item.id}"
|
||||
page[dom_id(@item, 'form')].replace_html :partial => 'todo/edit_form'
|
||||
page[dom_id(@item, 'line')].hide
|
||||
page[dom_id(@item, 'edit')].show
|
||||
page.call "Form.focusFirstElement", dom_id(@item, 'form')
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
if @saved
|
||||
page.remove "item-#{@item.id}-container"
|
||||
page[@item].remove
|
||||
if @item.completed?
|
||||
# Don't try to insert contents into a non-existent container!
|
||||
unless @user.preference.hide_completed_actions?
|
||||
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "completed" }
|
||||
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
|
||||
page.visual_effect :highlight, dom_id(@item, 'line'), {'startcolor' => "'#99ff99'"}
|
||||
page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil?
|
||||
page.hide "empty-d" # If we've checked something as done, completed items can't be empty
|
||||
end
|
||||
|
|
@ -14,7 +14,7 @@ if @saved
|
|||
else
|
||||
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id
|
||||
page.insert_html :bottom, item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
|
||||
page.visual_effect :highlight, dom_id(@item, 'line'), {'startcolor' => "'#99ff99'"}
|
||||
page.show "empty-d" if @completed_count == 0
|
||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? # If we've checked something as undone, uncompleted items can't be empty
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
if @saved
|
||||
item_container_id = "item-#{@item.id}-container"
|
||||
status_message = 'Action saved'
|
||||
status_message += ' to tickler' if @item.deferred?
|
||||
status_message = 'Added new project / ' + status_message if @new_project_created
|
||||
|
|
@ -9,7 +8,7 @@ if @saved
|
|||
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
|
||||
if source_view_is_one_of [:todo, :context]
|
||||
if @context_changed || @item.deferred?
|
||||
page[item_container_id].remove
|
||||
page[@item].remove
|
||||
if (@remaining_undone_in_context == 0)
|
||||
source_view do |from|
|
||||
from.todo { page.visual_effect :fade, "c#{@original_item_context_id}", :duration => 0.4 }
|
||||
|
|
@ -26,28 +25,28 @@ if @saved
|
|||
page.call "todoItems.ensureContainerHeight", "c#{@original_item_context_id}items"
|
||||
if source_view_is(:todo) && @item.active?
|
||||
page.call "todoItems.ensureContainerHeight", "c#{@item.context_id}items"
|
||||
page.visual_effect :highlight, item_container_id, :duration => 3
|
||||
page.visual_effect :highlight, dom_id(@item), :duration => 3
|
||||
end
|
||||
end
|
||||
else
|
||||
page.replace item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, item_container_id, :duration => 3
|
||||
page.replace dom_id(@item), :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, dom_id(@item), :duration => 3
|
||||
end
|
||||
elsif source_view_is :project
|
||||
if @project_changed || @item.deferred?
|
||||
page[item_container_id].remove
|
||||
page[@item].remove
|
||||
page.show("p#{@original_item_project_id}empty-nd") if (@remaining_undone_in_project == 0)
|
||||
page.replace_html "badge_count", @remaining_undone_in_project
|
||||
else
|
||||
page.replace item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, item_container_id, :duration => 3
|
||||
page.replace dom_id(@item), :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, dom_id(@item), :duration => 3
|
||||
end
|
||||
elsif source_view_is :deferred
|
||||
if @item.deferred?
|
||||
page.replace item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, item_container_id, :duration => 3
|
||||
page.replace dom_id(@item), :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, dom_id(@item), :duration => 3
|
||||
else
|
||||
page[item_container_id].remove
|
||||
page[@item].remove
|
||||
page.show(empty_container_msg_div_id) if (@down_count == 0)
|
||||
page.replace_html "badge_count", @down_count
|
||||
end
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
map.connect 'context/:context/feed/:action/:login/:token', :controller => 'feed'
|
||||
map.connect 'context/:url_friendly_name', :controller => 'context', :action => 'show'
|
||||
|
||||
map.connect 'contexts', :controller => 'context', :action => 'list'
|
||||
map.connect 'contexts', :controller => 'context', :action => 'index'
|
||||
map.connect 'contexts/feed/:feedtype/:login/:token', :controller => 'feed', :action => 'list_contexts_only'
|
||||
|
||||
# Projects Routes
|
||||
|
|
@ -52,7 +52,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
map.connect 'project/:id', :controller => 'project', :action => 'show', :requirements => {:id => /\d+/}
|
||||
map.connect 'project/:url_friendly_name', :controller => 'project', :action => 'show'
|
||||
|
||||
map.connect 'projects', :controller => 'project', :action => 'list'
|
||||
map.connect 'projects', :controller => 'project', :action => 'index'
|
||||
map.connect 'projects/feed/:feedtype/:login/:token', :controller => 'feed', :action => 'list_projects_only'
|
||||
|
||||
# Notes Routes
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
body {
|
||||
font-family: "Lucida Grande", Verdana, Geneva, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 19px;
|
||||
line-height: 140%;
|
||||
padding: 0px 10px;
|
||||
margin: 0px;
|
||||
background: #eee;
|
||||
|
|
@ -83,6 +83,7 @@ a.show_notes:hover {background-image: url(../images/notes_on.png); background-re
|
|||
#navcontainer {
|
||||
position: fixed;
|
||||
top: 48px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
#navlist {
|
||||
|
|
@ -138,6 +139,9 @@ a.show_notes:hover {background-image: url(../images/notes_on.png); background-re
|
|||
padding-left: 15px;
|
||||
white-space: nowrap; /* added 2006-05-17 for safari display, timfm */
|
||||
}
|
||||
#date h1 {
|
||||
line-height:120%
|
||||
}
|
||||
|
||||
#minilinks {
|
||||
text-align: right;
|
||||
|
|
@ -184,7 +188,7 @@ h2 a:hover {
|
|||
|
||||
#input_box {
|
||||
margin: 0% 5% 0% 60%;
|
||||
padding: 0px 15px 0px 15px;
|
||||
padding: 0px 15px 0px 0px;
|
||||
}
|
||||
|
||||
#input_box h2 {
|
||||
|
|
@ -203,9 +207,6 @@ h2 a:hover {
|
|||
padding:2px;
|
||||
clear: left;
|
||||
}
|
||||
.item-container-drop-target {
|
||||
border:2px inset black;
|
||||
}
|
||||
a.icon {
|
||||
float: left;
|
||||
vertical-align: middle;
|
||||
|
|
@ -415,26 +416,34 @@ h4.notice {
|
|||
background: #ff0;
|
||||
}
|
||||
|
||||
|
||||
/* Shows the number of undone next action */
|
||||
.badge {
|
||||
color: #fff;
|
||||
background: #f00;
|
||||
padding: 5px;
|
||||
padding: 3px 5px;
|
||||
font-size: 16px;
|
||||
line-height:26px;
|
||||
margin: 10px 10px 0px 0px;
|
||||
display:inline-block;
|
||||
height:26px;
|
||||
}
|
||||
|
||||
ul {
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin-left: -25px;
|
||||
}
|
||||
#sidebar ul {
|
||||
margin-left: auto;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
li {
|
||||
li {
|
||||
font-size: 1.1em;
|
||||
padding: 3px 0px;
|
||||
}
|
||||
|
||||
#sidebar li {
|
||||
padding: auto;
|
||||
}
|
||||
.even_row {
|
||||
background: #fff;
|
||||
_background: transparent;
|
||||
|
|
@ -456,7 +465,6 @@ li {
|
|||
}
|
||||
|
||||
/* Right align labels in forms */
|
||||
|
||||
.label {
|
||||
text-align: right;
|
||||
}
|
||||
|
|
@ -525,12 +533,9 @@ form {
|
|||
margin: 0px;
|
||||
width: 313px;
|
||||
}
|
||||
|
||||
.inline-form {
|
||||
border: none;
|
||||
padding: 3px;
|
||||
width: 100%;
|
||||
_width: 40%;
|
||||
}
|
||||
|
||||
.inline-form table {
|
||||
|
|
@ -548,6 +553,9 @@ form {
|
|||
.inline-form table td.label {
|
||||
width: 13ex;
|
||||
}
|
||||
#todo-form-new-action label {
|
||||
display:block;
|
||||
}
|
||||
|
||||
form.button-to {
|
||||
border: none;
|
||||
|
|
@ -561,7 +569,7 @@ label {
|
|||
}
|
||||
|
||||
input, select {
|
||||
margin-bottom: 5px;
|
||||
margin: 0px 0px 5px 0px;
|
||||
}
|
||||
|
||||
.feed {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ContextControllerTest < TodoContainerControllerTestBase
|
|||
|
||||
def test_contexts_list
|
||||
@request.session['user_id'] = users(:admin_user).id
|
||||
get :list
|
||||
get :index
|
||||
end
|
||||
|
||||
def test_create_context_via_ajax_increments_number_of_context
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ProjectControllerTest < TodoContainerControllerTestBase
|
|||
|
||||
def test_projects_list
|
||||
@request.session['user_id'] = users(:admin_user).id
|
||||
get :list
|
||||
get :index
|
||||
end
|
||||
|
||||
def test_create_project_via_ajax_increments_number_of_projects
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class TodoControllerTest < Test::Unit::TestCase
|
|||
def test_destroy_item
|
||||
@request.session['user_id'] = users(:admin_user).id
|
||||
xhr :post, :destroy, :id => 1, :_source_view => 'todo'
|
||||
assert_rjs :page, "item-1-container", :remove
|
||||
assert_rjs :page, "todo_1", :remove
|
||||
#assert_rjs :replace_html, "badge-count", '9'
|
||||
end
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ class TodoControllerTest < Test::Unit::TestCase
|
|||
t = Todo.find(1)
|
||||
@request.session['user_id'] = users(:admin_user).id
|
||||
xhr :post, :update, :id => 1, :_source_view => 'todo', "item"=>{"context_id"=>"1", "project_id"=>"2", "id"=>"1", "notes"=>"", "description"=>"Call Warren Buffet to find out how much he makes per day", "due"=>"30/11/2006"}
|
||||
#assert_rjs :page, "item-1-container", :visual_effect, :highlight, :duration => '1'
|
||||
#assert_rjs :page, "todo_1", :visual_effect, :highlight, :duration => '1'
|
||||
t = Todo.find(1)
|
||||
assert_equal "Call Warren Buffet to find out how much he makes per day", t.description
|
||||
assert_equal Date.new(2006,11,30), t.due
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue