remove option to show empty containers and start fixing failing cucumber scenarios

This commit is contained in:
Reinier Balt 2013-03-10 22:51:31 +01:00
parent 22b371ef8c
commit ede898120c
11 changed files with 24 additions and 43 deletions

View file

@ -329,12 +329,6 @@ var TracksPages = {
refresh_page();
});
$("a#show_empty_containers").click(function () {
var show = ($(this).attr("x_show_empty_containers") == "true");
$.cookie('show_empty_containers', !show);
refresh_page();
});
/* fade flashes and alerts in automatically */
$(".alert").fadeOut(8000);
}

View file

@ -9,7 +9,6 @@ class TodosController < ApplicationController
def index
@source_view = params['_source_view'] || 'todo'
@group_view_by = cookies['group_view_by'] || 'context'
@show_empty_containers = (cookies['show_empty_containers']=="true") || false
init_data_for_sidebar unless mobile?
@ -934,7 +933,6 @@ class TodosController < ApplicationController
@tag_title = @single_tag ? @tag_name : tag_title(@tag_expr)
@group_view_by = cookies['group_view_by'] || 'context'
@show_empty_containers = (cookies['show_empty_containers']=="true") || false
end
def get_ids_from_tag_expr(tag_expr)

View file

@ -17,17 +17,6 @@ module ApplicationHelper
end
end
def show_empty_containers_menu_entry
@show_empty_containers ||= false
@group_view_by ||= 'context'
content_tag(:li) do
link_to(
t("layouts.navigation.show_empty_containers_#{@group_view_by}"),
'#',
{:id => "show_empty_containers", :accesskey => "s", :title => t('layouts.navigation.show_empty_containers_title'), :x_show_empty_containers => @show_empty_containers} )
end
end
def container_toggle(id)
link_to(
image_tag("blank.png", :alt => t('common.collapse_expand')),

View file

@ -66,7 +66,8 @@ module TodosHelper
:object => todos_without_project,
:locals => {:settings => {
:collapsible => true,
:container_name => "without_project"
:container_name => "without_project",
:parent_container_type => "home"
}
}
end
@ -457,13 +458,13 @@ module TodosHelper
end
def item_container_id (todo)
return "hiddenitems" if source_view_is(:tag) && todo.hidden?
return "c#{todo.context_id}items" if source_view_is :deferred
return @new_due_id if source_view_is :calendar
return "tickleritems" if !source_view_is(:todo) && (todo.deferred? || todo.pending?)
return "completed_containeritems" if todo.completed?
return "p#{todo.project_id}items" if source_view_is :project
return "c#{todo.context_id}items"
return "hidden_items" if source_view_is(:tag) && todo.hidden?
return "c#{todo.context_id}_items" if source_view_is :deferred
return @new_due_id if source_view_is :calendar
return "tickler_items" if !source_view_is(:todo) && (todo.deferred? || todo.pending?)
return "completed_container_items" if todo.completed?
return "p#{todo.project_id}_items" if source_view_is :project
return "c#{todo.context_id}_items"
end
def empty_container_msg_div_id(todo = @todo || @successor)
@ -472,12 +473,12 @@ module TodosHelper
source_view do |page|
page.project {
return "tickler-empty-nd" if empty_criteria_met
return "p#{todo.project_id}empty-nd"
return "p#{todo.project_id}-empty-d"
}
page.tag {
return "tickler-empty-nd" if empty_criteria_met
return "hidden-empty-nd" if @todo.hidden?
return "c#{todo.context_id}empty-nd"
return "c#{todo.context_id}-empty-d"
}
page.calendar {
return "tickler-empty-nd" if empty_criteria_met
@ -485,11 +486,11 @@ module TodosHelper
}
page.context {
return "tickler-empty-nd" if empty_criteria_met
return "c#{todo.context_id}empty-nd"
return "c#{todo.context_id}-empty-d"
}
end
return "c#{todo.context_id}empty-nd"
return "c#{todo.context_id}-empty-d"
end
def empty_criteria_met

View file

@ -13,7 +13,7 @@ cache [context, @source_view, current_user.date.strftime("%Y%m%d"), @tag_name] d
:collapsible => settings[:collapsible],
:container_name => 'context',
:title => show_context_name(context),
:show_empty_containers => @show_empty_containers
:show_empty_containers => settings[:show_empty_containers]
}}
%>

View file

@ -4,7 +4,7 @@
done_todo_options = {:append_descriptor => suffix_completed, :suppress_context => true, :parent_container_type => 'context'}
-%>
<div id="display_box">
<%= render :partial => @context, :locals => { :settings => {:collapsible => false }} %>
<%= render :partial => @context, :locals => { :settings => {:collapsible => false, :show_empty_containers => true }} %>
<%= show_deferred_pending_todos(@deferred_todos, @pending_todos, deferred_pending_options) %>

View file

@ -73,7 +73,6 @@
<li><%= navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) %></li>
<li><hr/></li>
<%= group_view_by_menu_entry %>
<%= show_empty_containers_menu_entry %>
</ul>
</li>
<li><a href="#"><%= t('layouts.navigation.admin') %></a>

View file

@ -3,8 +3,8 @@
<%= show_grouped_todos %>
<% if @group_view_by == 'context' -%>
<%= show_todos_without_project(@todos_with_project) unless @todos_without_project.nil? -%>
<% if @group_view_by == 'project' -%>
<%= show_todos_without_project(@todos_without_project) unless @todos_without_project.nil? -%>
<% end -%>
<%= show_done_todos(@done, {:collapsible => true}) unless @done.nil? %>

View file

@ -106,7 +106,7 @@ function html_for_todo() {
}
function html_for_new_context() {
return "<%= @saved && @new_context_created ? escape_javascript(render(:partial => @new_context, :locals => { :collapsible => true })) : "" %>";
return "<%= @saved && @new_context_created ? escape_javascript(render(:partial => @new_context, :locals => { :settings => {:collapsible => true }})) : "" %>";
}
function html_for_error_messages() {
@ -118,7 +118,7 @@ function update_predecessors(next_steps) {
<% if @removed_predecessors
@removed_predecessors.each do |p| -%>
if ($('#<%=item_container_id(p)%>')) {
$('#<%=dom_id(p)%>').html('<%=escape_javascript(render(:partial => p, :locals => { :parent_container_type => parent_container_type }))%>');
$('#<%=dom_id(p)%>').html('<%=escape_javascript(render(:partial => p, :locals => { :settings => {:parent_container_type => parent_container_type }}))%>');
}
<% end -%>
<% end -%>
@ -131,7 +131,7 @@ function regenerate_predecessor_family() {
until parents.empty?
parent = parents.pop
parents += parent.predecessors -%>
$('#<%= dom_id(parent) %>').html("<%= escape_javascript(render(:partial => parent, :locals => { :parent_container_type => parent_container_type })) %>");
$('#<%= dom_id(parent) %>').html("<%= escape_javascript(render(:partial => parent, :locals => { :settings => {:parent_container_type => parent_container_type }})) %>");
<%end
-%>
}

View file

@ -434,7 +434,7 @@ en:
actions:
completed: Completed actions
tag_completed: "Completed actions tagged with '%{param}'"
without_project: "Actions without project"
home_without_project: "Actions without project"
project_project: "Actions in this project"
project_deferred_pending: Deferred/pending actions in this project
context_deferred_pending: Deferred/pending actions in this context

View file

@ -12,7 +12,7 @@ Feature: Edit a context
And I have a project called "test project"
And I have 2 todos in project "test project" in context "@pc" with tags "starred" prefixed by "test_project "
@javascript
@javascript
Scenario: In place edit of context name
Given I have a context called "Errands"
When I go to the context page for "Errands"
@ -22,7 +22,7 @@ Feature: Edit a context
Then I should see that a context named "Errands" is not present
And I should see that a context named "OutAndAbout" is present
@javascript
@javascript
Scenario: Editing the context of a todo will remove the todo
When I go to the the context page for "@pc"
Then the badge should show 2
@ -30,7 +30,7 @@ Feature: Edit a context
Then I should not see the todo "todo 1"
And the badge should show 1
@javascript
@javascript
Scenario: Editing the description of a a todo will update that todo
When I go to the the context page for "@pc"
And I edit the description of "test_project todo 1" to "changed"