mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-03 07:48:50 +01:00
Added the lightbox interface to the project and context pages too, but altered it so that it's activated by a hidden link (using the hotkey Ctrl/Alt Q). The actual link on the page opens the inline form as usual, and is activated by Ctrl/Alt N). So the lightbox is still available, but optional.
For some reason that I really can't figure out, adding an action to the context page results in the badge being incremented by two, but almost identical code on the project page gives the correct count. Baffling, but I'm sure I'm missing something that's staring me in the face. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@252 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
463a61f514
commit
f395a37e63
11 changed files with 46 additions and 19 deletions
|
|
@ -64,6 +64,8 @@ class ContextController < ApplicationController
|
|||
@saved = @item.save
|
||||
@on_page = "context"
|
||||
if @saved
|
||||
# This reports real count +1 for some reason that I don't understand
|
||||
# Almost identical code for add_item in projects reports correct num
|
||||
@up_count = Todo.find(:all, :conditions => ["todos.user_id = ? and todos.done = ? and todos.context_id IN (?)", @user.id, false, @item.context_id]).size.to_s
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
if @saved
|
||||
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
|
||||
page.hide "status"
|
||||
page.show "status"
|
||||
page.replace_html "status", content_tag("div", "Added new next action", "class" => "confirmation")
|
||||
page.visual_effect :appear, 'status', :duration => 0.5
|
||||
page.replace_html "badge_count", @up_count
|
||||
page.visual_effect :fade, 'status', :duration => 2
|
||||
page['badge_count'].replace_html @up_count
|
||||
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
|
||||
page.send :record, "Form.reset('todo-form-new-action-lightbox');Form.focusFirstElement('todo-form-new-action-lightbox')"
|
||||
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
|
||||
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
|
||||
page.hide "empty-nd" # If we are adding an new action, the uncompleted actions must be > 0
|
||||
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
|
||||
else
|
||||
page.hide "status"
|
||||
page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@item.errors.count, "error")} prohibited this record from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @item.errors.each_full { |msg| content_tag("li", msg) }), "id" => "ErrorExplanation", "class" => "ErrorExplanation")
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
</div><!-- [end:display_box] -->
|
||||
|
||||
<div id="input_box">
|
||||
|
||||
<%= render :partial => "shared/add_new_item_form", :locals => {:hide_link => false, :msg => ""} %>
|
||||
<%= render :partial => "shared/add_new_item_form", :locals => {:hide_link => false, :msg => ""} %>
|
||||
<%= render :partial => "shared/new_action_form", :locals => {:hide_link => false, :msg => ""} %>
|
||||
<%= render :partial => "shared/new_action_form" %>
|
||||
<%= render "shared/sidebar" %>
|
||||
</div><!-- End of input box -->
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
if @saved
|
||||
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item'
|
||||
page.hide "status"
|
||||
page.show "status"
|
||||
page.replace_html "status", content_tag("div", "Added new next action", "class" => "confirmation")
|
||||
page.visual_effect :appear, 'status', :duration => 0.5
|
||||
page.replace_html "badge_count", @up_count
|
||||
page.visual_effect :fade, 'status', :duration => 2
|
||||
page['badge_count'].replace_html @up_count
|
||||
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
|
||||
page.send :record, "Form.reset('todo-form-new-action-lightbox');Form.focusFirstElement('todo-form-new-action-lightbox')"
|
||||
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item'
|
||||
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
|
||||
page.hide "empty-nd" # If we are adding an new action, the uncompleted actions must be > 0
|
||||
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
|
||||
else
|
||||
page.hide "status"
|
||||
page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@item.errors.count, "error")} prohibited this record from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @item.errors.each_full { |msg| content_tag("li", msg) }), "id" => "ErrorExplanation", "class" => "ErrorExplanation")
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
<div id="input_box">
|
||||
|
||||
<%= render "shared/_add_new_item_form" %>
|
||||
<%= render :partial => "shared/add_new_item_form", :locals => {:hide_link => false, :msg => ""} %>
|
||||
<%= render :partial => "shared/new_action_form", :locals => {:hide_link => false, :msg => ""} %>
|
||||
<%= render "shared/sidebar" %>
|
||||
</div><!-- End of input box -->
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
<% unless controller.controller_name == "project" -%>
|
||||
<label for="todo_project_id">Project</label><br />
|
||||
<%= collection_select( "todo", "project_id", @projects.reject{|p| p.done}, "id", "name",
|
||||
<%= collection_select( "todo", "project_id", @projects.reject{|p| p.done?}, "id", "name",
|
||||
{ :include_blank => true }, {"tabindex" => 4}) %><br />
|
||||
<% end -%>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
<% hide_link ||= false %>
|
||||
<% unless hide_link -%>
|
||||
<%= link_to_function(
|
||||
" ",
|
||||
"onclick=new Lightbox.base('mybox', { closeOnOverlayClick : true });Form.focusFirstElement('todo-form-new-action-lightbox'); return false;",
|
||||
{:title => "Add the next action", :accesskey => "q"}) %>
|
||||
<% end -%>
|
||||
|
||||
<div id="mybox" style="display:none">
|
||||
<div id="todo_new_action" class="context_new">
|
||||
<div id="todo_new_action-lightbox" class="context_new">
|
||||
<%= form_remote_tag(
|
||||
:url => { :controller => controller.controller_name, :action => "add_item" },
|
||||
:html=> { :id=>'todo-form-new-action', :name=>'todo', :class => 'inline-form' }) %>
|
||||
:html=> { :id=>'todo-form-new-action-lightbox', :name=>'todo', :class => 'inline-form' }) %>
|
||||
|
||||
<h2>Add a new next action:</h2>
|
||||
<div id="status">
|
||||
|
|
@ -16,16 +24,20 @@
|
|||
<td><label for="todo_notes">Notes</label></td>
|
||||
<td><%= text_area( "todo", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2) %></td>
|
||||
</tr>
|
||||
<% unless controller.controller_name == "context" -%>
|
||||
<tr>
|
||||
<td><label for="todo_context_id">Context</label></td>
|
||||
<td><%= collection_select( "todo", "context_id", @contexts, "id", "name",
|
||||
{}, {"tabindex" => 3}) %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
<% unless controller.controller_name == "project" -%>
|
||||
<tr>
|
||||
<td><label for="todo_project_id">Project</label></td>
|
||||
<td><%= collection_select( "todo", "project_id", @projects.reject{|p| p.done?}, "id", "name",
|
||||
{ :include_blank => true }, {"tabindex" => 4}) %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
<tr>
|
||||
<td><label for="todo_due">Due</label></td>
|
||||
<td><%= text_field("todo", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 5, "autocomplete" => "off") %></td>
|
||||
|
|
@ -37,6 +49,13 @@
|
|||
<%= hidden_field( "todo", "context_id", "value" => "#{@context.id}") %>
|
||||
<% end -%>
|
||||
|
||||
<% if request.request_uri == "/todo/tickler" -%>
|
||||
<tr>
|
||||
<td><label for="todo_show_from">Show from</label></td>
|
||||
<td><%= date_select( "todo", "show_from", :start_year => Date.today.year, :order => [:year, :month, :day] ) %></td>
|
||||
</tr>
|
||||
<% end -%>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Add item" tabindex="6"></td>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ if @saved
|
|||
page.visual_effect :fade, 'status', :duration => 2
|
||||
page['badge_count'].replace_html @up_count
|
||||
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
|
||||
page.send :record, "Form.reset('todo-form-new-action-lightbox');Form.focusFirstElement('todo-form-new-action-lightbox')"
|
||||
page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todo/item'
|
||||
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
|
||||
else
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
</div><!-- End of display_box -->
|
||||
|
||||
<div id="input_box">
|
||||
<a href="#" onclick="new Lightbox.base('mybox', { closeOnOverlayClick : true });Form.focusFirstElement('todo-form-new-action'); return false" accesskey="n">Add new action »</a>
|
||||
<%= render :partial => "shared/add_new_item_form", :locals => {:hide_link => false, :msg => ""} %>
|
||||
<%= render :partial => "shared/new_action_form", :locals => {:hide_link => false, :msg => ""} %>
|
||||
<%= render :partial => "shared/new_action_form" %>
|
||||
<%= render "shared/sidebar" %>
|
||||
</div><!-- End of input box -->
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
* Homepage: http://www.rousette.org.uk/projects/
|
||||
* Author: bsag (http://www.rousette.org.uk/)
|
||||
* Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard (for great installation tutorials on Windows XP)
|
||||
* Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard (for great installation tutorials on Windows XP), Jim Strupp, Eric Lesh, Damien Cirotteau
|
||||
* Version: 1.04
|
||||
* Copyright: (cc) 2004-2006 rousette.org.uk
|
||||
* License: GNU GPL
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* Trac (for bug reports): http://dev.rousette.org.uk/report/6
|
||||
* Wiki (more info on installation): http://dev.rousette.org.uk/wiki
|
||||
* Author: bsag (http://www.rousette.org.uk/)
|
||||
* Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard (for great installation tutorials on Windows XP)
|
||||
* Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard (for great installation tutorials on Windows XP), Jim Strupp, Eric Lesh, Damien Cirotteau
|
||||
* Version: 1.041
|
||||
* Copyright: (cc) 2004-2006 rousette.org.uk
|
||||
* License: GNU GPL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue