fix #1109 and do some small optimizations on home page

This commit is contained in:
Reinier Balt 2011-02-25 23:54:53 +01:00
parent 4cca813bc7
commit e9d92438d6
5 changed files with 14 additions and 10 deletions

View file

@ -59,7 +59,7 @@ class ApplicationController < ActionController::Base
def set_session_expiration
# http://wiki.rubyonrails.com/rails/show/HowtoChangeSessionOptions
unless session == nil
return if @controller_name == 'feed' or session['noexpiry'] == "on"
return if self.controller_name == 'feed' or session['noexpiry'] == "on"
# If the method is called by the feed controller (which we don't have
# under session control) or if we checked the box to keep logged in on
# login don't set the session expiry time.

View file

@ -11,6 +11,8 @@ class TodosController < ApplicationController
:completed_archive, :check_deferred, :toggle_check, :toggle_star,
:edit, :update, :defer, :create, :calendar, :auto_complete_for_predecessor, :remove_predecessor, :add_predecessor]
protect_from_forgery :except => :check_deferred
def index
@projects = current_user.projects.find(:all, :include => [:default_context])
@contexts = current_user.contexts.find(:all)
@ -823,13 +825,13 @@ class TodosController < ApplicationController
# current_users.todos.find but that broke with_scope for :limit
# Exclude hidden projects from count on home page
@todos = current_user.todos.find(:all, :include => [ :project, :context, :tags ])
@todos = current_user.todos.find(:all, :include => [ :project, :context, :tags, :pending_successors, :recurring_todo ])
# Exclude hidden projects from the home page
@not_done_todos = current_user.todos.find(:all,
:conditions => ['contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', false, 'active'],
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC",
:include => [ :project, :context, :tags ])
:include => [ :project, :context, :tags, :pending_successors, :recurring_todo ])
end
end

View file

@ -30,12 +30,14 @@ module TodosHelper
:_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")}
url[:_tag_name] = @tag_name if @source_view == 'tag'
futuredate = (todo.show_from || todo.user.date) + days.days
options = {:x_defer_alert => false, :class => "icon_defer_item" }
if todo.due && futuredate > todo.due
if todo.due
futuredate = (todo.show_from || todo.user.date) + days.days
if futuredate > todo.due
options[:x_defer_alert] = true
options[:x_defer_date_after_due_date] = t('todos.defer_date_after_due_date')
end
end
return link_to(image_tag_for_defer(days), url, options)
end

View file

@ -25,7 +25,7 @@
<% if current_user.prefs.refresh != 0 -%>
setup_auto_refresh(<%= current_user.prefs["refresh"].to_i*60000 %>);
<% end -%>
<% unless @controller_name == 'feed' or session['noexpiry'] == "on" -%>
<% unless controller.controller_name == 'feed' or session['noexpiry'] == "on" -%>
setup_periodic_check("<%=url_for(:controller => "login", :action => "check_expiry")%>", 5*60);
<% end -%>
setup_periodic_check("<%=check_deferred_todos_path(:format => 'js')%>", 10*60, 'POST');

View file

@ -299,7 +299,7 @@ nl:
added_new_next_action: Nieuwe actie toegevoegd
star_action: Markeer deze actie met een ster
completed_recurrence_completed: Er is geen actie na de terugkerende actie die u new verwijderd heeft. De herhaling is voltooid
defer_date_after_due_date: Uitsteldatum is na de vervaldag. Gelieve vervaldag bewerken alvorens uitstedatuml aan te passen.
defer_date_after_due_date: Uitsteldatum is na de vervaldag. Gelieve vervaldag bewerken alvorens uitsteldatum aan te passen.
unable_to_add_dependency: Niet in staat om de afhankelijkheid toe te voegen
done: Voltooid?
star_action_with_description: markeer de actie '%{description}' met een ster