From 3da6fe2525395224973c537d7ac7e201d0200e97 Mon Sep 17 00:00:00 2001 From: bsag Date: Mon, 29 May 2006 11:02:28 +0000 Subject: [PATCH] Tried out using a modal 'lightbox' style dialog for the new next action form on the home page (I'm using the scripts written by Bruno of [http://blog.feedmarker.com/2006/02/12/how-to-make-better-modal-windows-with-lightbox/ Feedmarker]). Instead of opening up a form on the main page, clicking the 'Add new action' link (or hitting Alt/Ctrl N) opens up an overlay window, with a semi-transparent window underneath. You can add as many actions as you like by filling in the forms and hitting submit, then when you're done, click the close box or the shaded overlay area to dismiss the window. It works very well on Safari, but for some reason, on my copy of Firefox, the cursor is invisible. My plan is to also allow deferred actions to be added using this form, and eventually set up editing of existing actions to use the same format. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@250 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/todo_controller.rb | 6 +- tracks/app/views/layouts/standard.rhtml | 2 + .../app/views/shared/_new_action_form.rhtml | 48 +++++++ tracks/app/views/shared/sidebar.rhtml | 8 +- tracks/app/views/todo/add_item.rjs | 6 +- tracks/app/views/todo/list.rhtml | 3 +- tracks/public/images/close.gif | Bin 0 -> 109 bytes tracks/public/javascripts/lightbox.js | 130 ++++++++++++++++++ tracks/public/stylesheets/calendar-system.css | 1 + tracks/public/stylesheets/lightbox.css | 44 ++++++ tracks/public/stylesheets/standard.css | 2 +- 11 files changed, 239 insertions(+), 11 deletions(-) create mode 100644 tracks/app/views/shared/_new_action_form.rhtml create mode 100644 tracks/public/images/close.gif create mode 100755 tracks/public/javascripts/lightbox.js create mode 100755 tracks/public/stylesheets/lightbox.css diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index be8f56c6..719ff8f6 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -61,7 +61,8 @@ class TodoController < ApplicationController @on_page = "home" if @saved - @up_count = @todos.collect { |x| ( !x.done? and !x.context.hide? ) ? x:nil }.compact.size.to_s + self.init # we have to do this again to update @todos + @up_count = @todos.reject { |x| x.done? or x.context.hide? }.size.to_s end return if request.xhr? @@ -202,7 +203,8 @@ class TodoController < ApplicationController @saved = @item.destroy @on_page = "home" if @saved - @down_count = @todos.collect { |x| ( !x.done? and !x.context.hide? ) ? x:nil }.compact.size.to_s + self.init + @down_count = @todos.reject { |x| x.done? or x.context.hide? }.size.to_s end return if request.xhr? diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index c750a862..5b6be65f 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -10,6 +10,8 @@ <%= javascript_include_tag 'calendar', 'calendar-en', 'calendar-setup' %> <%= javascript_include_tag "accesskey-hints" %> <%= javascript_include_tag "todo-items" %> + <%= javascript_include_tag "lightbox" %> + <%= stylesheet_link_tag "lightbox" %> <%= auto_discovery_link_tag(:rss,{:controller => "feed", :action => "na_feed", :name => "#{@user.login}", :token => "#{@user.word}"}, {:title => "RSS feed of next actions"}) %> diff --git a/tracks/app/views/shared/_new_action_form.rhtml b/tracks/app/views/shared/_new_action_form.rhtml new file mode 100644 index 00000000..1683a334 --- /dev/null +++ b/tracks/app/views/shared/_new_action_form.rhtml @@ -0,0 +1,48 @@ + \ No newline at end of file diff --git a/tracks/app/views/shared/sidebar.rhtml b/tracks/app/views/shared/sidebar.rhtml index f15c090f..010a9e7a 100644 --- a/tracks/app/views/shared/sidebar.rhtml +++ b/tracks/app/views/shared/sidebar.rhtml @@ -1,6 +1,6 @@

Active Projects: