mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-12 10:24:22 +01:00
get selenium scenarios running again and add some scenarios for adding todos started
This commit is contained in:
parent
09830d044d
commit
ab2e51a51a
17 changed files with 135 additions and 69 deletions
|
|
@ -116,18 +116,20 @@ class TodosController < ApplicationController
|
|||
end
|
||||
end
|
||||
format.js do
|
||||
determine_down_count if @saved
|
||||
@contexts = current_user.contexts.find(:all) if @new_context_created
|
||||
@projects = current_user.projects.find(:all) if @new_project_created
|
||||
@initial_context_name = params['default_context_name']
|
||||
@initial_project_name = params['default_project_name']
|
||||
@default_tags = @todo.project.default_tags unless @todo.project.nil?
|
||||
@status_message = 'Added new next action'
|
||||
@status_message += ' to tickler' if @todo.deferred?
|
||||
@status_message += ' in pending state' if @todo.pending?
|
||||
@status_message += ' in hidden state' if @todo.hidden?
|
||||
@status_message = 'Added new project / ' + status_message if @new_project_created
|
||||
@status_message = 'Added new context / ' + status_message if @new_context_created
|
||||
if @saved
|
||||
determine_down_count
|
||||
@contexts = current_user.contexts.find(:all) if @new_context_created
|
||||
@projects = current_user.projects.find(:all) if @new_project_created
|
||||
@initial_context_name = params['default_context_name']
|
||||
@initial_project_name = params['default_project_name']
|
||||
@default_tags = @todo.project.default_tags unless @todo.project.nil?
|
||||
@status_message = 'Added new next action'
|
||||
@status_message += ' to tickler' if @todo.deferred?
|
||||
@status_message += ' in pending state' if @todo.pending?
|
||||
@status_message += ' in hidden state' if @todo.hidden?
|
||||
@status_message = 'Added new project / ' + @status_message if @new_project_created
|
||||
@status_message = 'Added new context / ' + @status_message if @new_context_created
|
||||
end
|
||||
render :action => 'create'
|
||||
end
|
||||
format.xml do
|
||||
|
|
@ -830,7 +832,7 @@ class TodosController < ApplicationController
|
|||
def determine_down_count
|
||||
source_view do |from|
|
||||
from.todo do
|
||||
@down_count = current_user.todos.active.not_hidden.count(:all)
|
||||
@down_count = current_user.todos.active.not_hidden.count
|
||||
end
|
||||
from.context do
|
||||
@down_count = current_user.contexts.find(@todo.context_id).todos.not_completed.count(:all)
|
||||
|
|
|
|||
|
|
@ -208,7 +208,11 @@ module TodosHelper
|
|||
return false if source_view_is(:todo) && @todo.hidden?
|
||||
return false if source_view_is(:context) && @todo.hidden? && !@todo.context.hidden?
|
||||
|
||||
return false if (source_view_is(:tag) && !@todo.tags.include?(@tag_name))
|
||||
return true if source_view_is(:tag) && (
|
||||
(@todo.pending? && @todo.tags.include?(@tag_name)) ||
|
||||
@todo.tags.include?(@tag_name) ||
|
||||
(@todo.starred? && @tag_name == Todo::STARRED_TAG_NAME))
|
||||
|
||||
return false if (source_view_is(:context) && !(@todo.context_id==@default_context.id) )
|
||||
|
||||
return true if source_view_is(:deferred) && @todo.deferred?
|
||||
|
|
@ -217,9 +221,12 @@ module TodosHelper
|
|||
return true if source_view_is(:project) && @todo.pending?
|
||||
return true if !source_view_is(:deferred) && @todo.active?
|
||||
|
||||
return true if source_view_is(:tag) && @todo.pending?
|
||||
return false
|
||||
end
|
||||
|
||||
def should_add_new_context
|
||||
return @new_context_created && !source_view_is(:project)
|
||||
end
|
||||
|
||||
def parent_container_type
|
||||
return 'tickler' if source_view_is :deferred
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Todo < ActiveRecord::Base
|
|||
:conditions => ["todos.state = ? OR (contexts.hide = ? AND (todos.state = ? OR todos.state = ? OR todos.state = ?))",
|
||||
'project_hidden', true, 'active', 'deferred', 'pending']
|
||||
named_scope :not_hidden,
|
||||
:joins => [:context, :project],
|
||||
:joins => [:context],
|
||||
:conditions => ['NOT(todos.state = ? OR (contexts.hide = ? AND (todos.state = ? OR todos.state = ? OR todos.state = ?)))',
|
||||
'project_hidden', true, 'active', 'deferred', 'pending']
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
<% if @saved -%>
|
||||
TracksPages.page_notify('notice', "<%=@status_message%>", 5);
|
||||
hide_empty_message();
|
||||
TracksPages.hide_errors();
|
||||
TracksPages.set_page_badge(<%= @down_count %>);
|
||||
<% if should_show_new_item -%>
|
||||
<% if @new_context_created -%>
|
||||
<% if should_add_new_context -%>
|
||||
insert_new_context_with_new_todo();
|
||||
<% else -%>
|
||||
add_todo_to_existing_context();
|
||||
|
|
@ -16,15 +15,6 @@
|
|||
TracksPages.show_errors(html_for_error_messages());
|
||||
<% end -%>
|
||||
|
||||
function hide_empty_message() {
|
||||
<% if @todo %>
|
||||
$('#<%=empty_container_msg_div_id%>').hide();
|
||||
<% if (source_view_is :project and @todo.pending?) or (source_view_is :deferred) -%>
|
||||
$('#tickler-empty-nd').hide();
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
function clear_form() {
|
||||
$('#todo-form-new-action').clearForm();
|
||||
TracksForm.set_context_name('<%=@initial_context_name%>');
|
||||
|
|
@ -34,14 +24,15 @@ function clear_form() {
|
|||
}
|
||||
|
||||
function insert_new_context_with_new_todo() {
|
||||
$('#no_todos_in_tag_view').slideUp(100);
|
||||
$('#display_box').prepend(html_for_new_context());
|
||||
}
|
||||
|
||||
function add_todo_to_existing_context() {
|
||||
<% if source_view_is_one_of(:todo, :deferred, :tag) -%>
|
||||
TodoItemsContainer.ensureVisibleWithEffectAppear("c<%=@todo.context_id%>");
|
||||
$('#<%=empty_container_msg_div_id%>').hide();
|
||||
<% end -%>
|
||||
$('#<%=empty_container_msg_div_id%>').hide();
|
||||
$('#<%=item_container_id(@todo)%>').append(html_for_new_todo());
|
||||
$('#<%= dom_id(@todo)%>').effect('highlight', {}, 2000 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ function show_empty_messages() {
|
|||
<% if empty_container_msg_div_id && todo_container_is_empty -%>
|
||||
$('#<%=empty_container_msg_div_id%>').slideDown(1000);
|
||||
<% end -%>
|
||||
|
||||
<% if source_view_is(:deferred) && @down_count==0 -%>
|
||||
$('#tickler-empty-nd').slideDown(100);
|
||||
<% end -%>
|
||||
}
|
||||
|
||||
function remove_todo_from_page() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue