diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index 94743dff..648b843d 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -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 diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index e3bd4998..7040a1c8 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -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. /project/show/ shows just . # 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 diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index 17e5028f..1df7dfe5 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -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 diff --git a/tracks/app/helpers/todo_helper.rb b/tracks/app/helpers/todo_helper.rb index 78a40594..2a43a0aa 100644 --- a/tracks/app/helpers/todo_helper.rb +++ b/tracks/app/helpers/todo_helper.rb @@ -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 diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/index.rhtml similarity index 100% rename from tracks/app/views/context/list.rhtml rename to tracks/app/views/context/index.rhtml diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index 495b2571..54310988 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -41,8 +41,8 @@ + <% note = nil -%> diff --git a/tracks/app/views/project/list.rhtml b/tracks/app/views/project/index.rhtml similarity index 100% rename from tracks/app/views/project/list.rhtml rename to tracks/app/views/project/index.rhtml diff --git a/tracks/app/views/project/show.rhtml b/tracks/app/views/project/show.rhtml index f31e0948..d120ba58 100644 --- a/tracks/app/views/project/show.rhtml +++ b/tracks/app/views/project/show.rhtml @@ -7,11 +7,11 @@

Notes

-
+
<%= render :partial => "shared/empty", :locals => { :message => "Currently there are no notes attached to this project"} %>
- <%= render :partial => "note/notes_summary", :collection => @notes %> + <%= render :partial => "note/notes_summary", :collection => @project.notes %>
diff --git a/tracks/app/views/shared/_add_new_item_form.rhtml b/tracks/app/views/shared/_add_new_item_form.rhtml index 48fc4ec7..a1da6b83 100644 --- a/tracks/app/views/shared/_add_new_item_form.rhtml +++ b/tracks/app/views/shared/_add_new_item_form.rhtml @@ -17,13 +17,13 @@
<%= error_messages_for("item") %>
-
-<%= text_field( "todo", "description", "size" => 25, "tabindex" => 1) %>
+ +<%= text_field( "todo", "description", "size" => 25, "tabindex" => 1) %> -
-<%= text_area( "todo", "notes", "cols" => 25, "rows" => 6, "tabindex" => 2) %>
+ +<%= text_area( "todo", "notes", "cols" => 25, "rows" => 6, "tabindex" => 2) %> -
+ @@ -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)); -
-
+ @@ -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)); -
-
+ <%= text_field("todo", "due", "size" => 10, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 5, "autocomplete" => "off") %> -

- <%= text_field("todo", "show_from", "size" => 10, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 6, "autocomplete" => "off") %>
+ + <%= text_field("todo", "show_from", "size" => 10, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 6, "autocomplete" => "off") %> <%= source_view_tag( @source_view ) %> - +
<% end -%> diff --git a/tracks/app/views/todo/_edit_form.rhtml b/tracks/app/views/todo/_edit_form.rhtml index 76a576e2..632ab413 100644 --- a/tracks/app/views/todo/_edit_form.rhtml +++ b/tracks/app/views/todo/_edit_form.rhtml @@ -13,43 +13,43 @@ <%= text_area( "item", "notes", "cols" => 20, "rows" => 5, "tabindex" => 9) %> - - - + + + - + - - + + -
diff --git a/tracks/app/views/todo/create.rjs b/tracks/app/views/todo/create.rjs index 88d4e94c..3ed6732b 100644 --- a/tracks/app/views/todo/create.rjs +++ b/tracks/app/views/todo/create.rjs @@ -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' diff --git a/tracks/app/views/todo/destroy.rjs b/tracks/app/views/todo/destroy.rjs index 04583a54..5646c299 100644 --- a/tracks/app/views/todo/destroy.rjs +++ b/tracks/app/views/todo/destroy.rjs @@ -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 diff --git a/tracks/app/views/todo/edit.rjs b/tracks/app/views/todo/edit.rjs index 321e3c91..47e1a494 100644 --- a/tracks/app/views/todo/edit.rjs +++ b/tracks/app/views/todo/edit.rjs @@ -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') diff --git a/tracks/app/views/todo/toggle_check.rjs b/tracks/app/views/todo/toggle_check.rjs index c377608e..8b64cec3 100644 --- a/tracks/app/views/todo/toggle_check.rjs +++ b/tracks/app/views/todo/toggle_check.rjs @@ -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 diff --git a/tracks/app/views/todo/update.rjs b/tracks/app/views/todo/update.rjs index dfac070a..926a1a0a 100644 --- a/tracks/app/views/todo/update.rjs +++ b/tracks/app/views/todo/update.rjs @@ -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 diff --git a/tracks/config/routes.rb b/tracks/config/routes.rb index 5b80a2ff..d0866ae4 100644 --- a/tracks/config/routes.rb +++ b/tracks/config/routes.rb @@ -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 diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index 8492537a..e4291a4d 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -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 { diff --git a/tracks/test/functional/context_controller_test.rb b/tracks/test/functional/context_controller_test.rb index 6e5fc477..b21c1660 100644 --- a/tracks/test/functional/context_controller_test.rb +++ b/tracks/test/functional/context_controller_test.rb @@ -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 diff --git a/tracks/test/functional/project_controller_test.rb b/tracks/test/functional/project_controller_test.rb index 994663c1..436522af 100644 --- a/tracks/test/functional/project_controller_test.rb +++ b/tracks/test/functional/project_controller_test.rb @@ -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 diff --git a/tracks/test/functional/todo_controller_test.rb b/tracks/test/functional/todo_controller_test.rb index fc3b0ac8..f28a6668 100644 --- a/tracks/test/functional/todo_controller_test.rb +++ b/tracks/test/functional/todo_controller_test.rb @@ -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