mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-10 14:42:35 +01:00
Merge branch 'feed_improvements' of git://github.com/lrbalt/tracks
This commit is contained in:
commit
628d0b3a7d
3 changed files with 19 additions and 9 deletions
|
|
@ -542,11 +542,17 @@ class TodosController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def determine_remaining_in_context_count(context_id = @todo.context_id)
|
def determine_remaining_in_context_count(context_id = @todo.context_id)
|
||||||
if source_view_is :deferred
|
source_view do |from|
|
||||||
@remaining_in_context = current_user.contexts.find(context_id).deferred_todo_count
|
from.deferred { @remaining_in_context = current_user.contexts.find(context_id).deferred_todo_count }
|
||||||
else
|
from.tag {
|
||||||
@remaining_in_context = current_user.contexts.find(context_id).not_done_todo_count
|
tag = Tag.find_by_name(params['_tag_name'])
|
||||||
|
if tag.nil?
|
||||||
|
tag = Tag.new(:name => params['tag'])
|
||||||
|
end
|
||||||
|
@remaining_in_context = current_user.contexts.find(context_id).not_done_todo_count({:tag => tag.id})
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
@remaining_in_context = current_user.contexts.find(context_id).not_done_todo_count if @remaining_in_context.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def determine_completed_count
|
def determine_completed_count
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ if @saved
|
||||||
# #update auto completer arrays for context and project
|
# #update auto completer arrays for context and project
|
||||||
page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true" if @new_context_created
|
page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true" if @new_context_created
|
||||||
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
|
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
|
||||||
if source_view_is_one_of(:todo, :context)
|
if source_view_is_one_of(:todo, :context, :tag)
|
||||||
if @context_changed || @todo.deferred?
|
if @context_changed || @todo.deferred?
|
||||||
page[@todo].remove
|
page[@todo].remove
|
||||||
|
|
||||||
|
|
@ -17,11 +17,12 @@ if @saved
|
||||||
# remove context container from page if empty
|
# remove context container from page if empty
|
||||||
source_view do |from|
|
source_view do |from|
|
||||||
from.todo { page.visual_effect :fade, "c#{@original_item_context_id}", :duration => 0.4 }
|
from.todo { page.visual_effect :fade, "c#{@original_item_context_id}", :duration => 0.4 }
|
||||||
|
from.tag { page.visual_effect :fade, "c#{@original_item_context_id}", :duration => 0.4 }
|
||||||
from.context { page.show "c#{@original_item_context_id}empty-nd" }
|
from.context { page.show "c#{@original_item_context_id}empty-nd" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if source_view_is(:todo) && @todo.active?
|
if source_view_is_one_of(:todo, :tag) && @todo.active?
|
||||||
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}"
|
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}"
|
||||||
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
|
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
|
||||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
||||||
|
|
@ -36,7 +37,7 @@ if @saved
|
||||||
# show todo in context
|
# show todo in context
|
||||||
page.delay(0.5) do
|
page.delay(0.5) do
|
||||||
page.call "todoItems.ensureContainerHeight", "c#{@original_item_context_id}items"
|
page.call "todoItems.ensureContainerHeight", "c#{@original_item_context_id}items"
|
||||||
if source_view_is(:todo) && @todo.active?
|
if source_view_is_one_of(:todo, :tag) && @todo.active?
|
||||||
page.call "todoItems.ensureContainerHeight", "c#{@todo.context_id}items"
|
page.call "todoItems.ensureContainerHeight", "c#{@todo.context_id}items"
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,12 @@ module Tracks
|
||||||
def with_not_done_scope(opts={})
|
def with_not_done_scope(opts={})
|
||||||
conditions = ["todos.state = ?", 'active']
|
conditions = ["todos.state = ?", 'active']
|
||||||
if opts.has_key?(:include_project_hidden_todos) && (opts[:include_project_hidden_todos] == true)
|
if opts.has_key?(:include_project_hidden_todos) && (opts[:include_project_hidden_todos] == true)
|
||||||
conditions = ["(todos.state = ? or todos.state = ?)", 'active', 'project_hidden']
|
conditions = ["(todos.state = ? OR todos.state = ?)", 'active', 'project_hidden']
|
||||||
end
|
end
|
||||||
self.todos.send :with_scope, :find => {:conditions => conditions} do
|
if opts.has_key?(:tag)
|
||||||
|
conditions = ["todos.state = ? AND taggings.tag_id = ?", 'active', opts[:tag]]
|
||||||
|
end
|
||||||
|
self.todos.send :with_scope, :find => {:conditions => conditions, :include => [:taggings]} do
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue