mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-16 01:06:32 +01:00
fix #1287. Fix various small bugs and some small improvements
This commit is contained in:
parent
88729f57ce
commit
bd8498f39c
10 changed files with 18 additions and 40 deletions
|
|
@ -100,11 +100,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def count_deferred_todos(todos_parent)
|
||||
if todos_parent.nil?
|
||||
count = 0
|
||||
else
|
||||
count = todos_parent.todos.deferred.count
|
||||
end
|
||||
return todos_parent.nil? ? 0 : eval("@#{todos_parent.class.to_s.downcase}_deferred_counts[#{todos_parent.id}]") || 0
|
||||
end
|
||||
|
||||
# Convert a date object to the format specified in the user's preferences in
|
||||
|
|
@ -284,7 +280,8 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def init_not_done_counts(parents = ['project','context'])
|
||||
parents.each do |parent|
|
||||
eval("@#{parent}_not_done_counts = @#{parent}_not_done_counts || current_user.todos.active.count(:group => :#{parent}_id)")
|
||||
eval("@#{parent}_not_done_counts ||= current_user.todos.active.group('#{parent}_id').count")
|
||||
eval("@#{parent}_deferred_counts ||= current_user.todos.deferred.group('#{parent}_id').count")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ class ContextsController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.js do
|
||||
@down_count = current_user.contexts.size
|
||||
init_not_done_counts
|
||||
end
|
||||
format.xml do
|
||||
if @context.new_record?
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class IntegrationsController < ApplicationController
|
|||
require 'mail'
|
||||
|
||||
skip_before_filter :login_required, :only => [:cloudmailin, :search_plugin, :google_gadget]
|
||||
|
||||
|
||||
def index
|
||||
@page_title = 'TRACKS::Integrations'
|
||||
end
|
||||
|
|
@ -27,11 +27,8 @@ class IntegrationsController < ApplicationController
|
|||
end
|
||||
|
||||
def search_plugin
|
||||
# TODO: ASSET PATH!!
|
||||
@icon_data = [File.open(Rails.root + '/app/assets/images/done.png').read].
|
||||
@icon_data = [File.open(File.join(Rails.root, 'app', 'assets', 'images', 'done.png')).read].
|
||||
pack('m').gsub(/\n/, '')
|
||||
|
||||
render :layout => false
|
||||
end
|
||||
|
||||
def google_gadget
|
||||
|
|
|
|||
|
|
@ -182,7 +182,10 @@ class ProjectsController < ApplicationController
|
|||
@contexts = current_user.contexts
|
||||
|
||||
respond_to do |format|
|
||||
format.js { @down_count = current_user.projects.size }
|
||||
format.js do
|
||||
@down_count = current_user.projects.size
|
||||
init_not_done_counts
|
||||
end
|
||||
format.xml do
|
||||
if @project.new_record?
|
||||
render_failure @project.errors.to_xml.html_safe, 409
|
||||
|
|
|
|||
|
|
@ -10,26 +10,6 @@ class TodosController < ApplicationController
|
|||
# :calendar, :auto_complete_for_predecessor, :remove_predecessor, :add_predecessor]
|
||||
|
||||
protect_from_forgery :except => :check_deferred
|
||||
|
||||
def with_parent_resource_scope(&block)
|
||||
@feed_title = t('common.actions')
|
||||
if (params[:context_id])
|
||||
@context = current_user.contexts.find_by_params(params)
|
||||
@feed_title = @feed_title + t('todos.feed_title_in_context', :context => @context.name)
|
||||
Todo.send :where, ['todos.context_id = ?', @context.id] do
|
||||
yield
|
||||
end
|
||||
elsif (params[:project_id])
|
||||
@project = current_user.projects.find_by_params(params)
|
||||
@feed_title = @feed_title + t('todos.feed_title_in_project', :project => @project.name)
|
||||
@project_feed = true
|
||||
Todo.send :where, ['todos.project_id = ?', @project.id] do
|
||||
yield
|
||||
end
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue