mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-16 12:18:07 +01:00
initial changes to add an option to select either context or project as grouping of todos on home or tag page
* new menu item in view menu * js to toggle view * store setting in cookie to keep de choice of view persistent * refactor index and tag page of todos to look more alike * refactor context and project partials to look more alike
This commit is contained in:
parent
55aa387ab9
commit
f22dfc1f9b
15 changed files with 160 additions and 84 deletions
|
|
@ -6,14 +6,8 @@ cache [context, @source_view, current_user.date.strftime("%Y%m%d"), @tag_name] d
|
|||
%>
|
||||
<div id="c<%= context.id %>" class="container context" style="display:<%= (collapsible && @not_done.empty?) ? "none" : "block" %>">
|
||||
<h2>
|
||||
<% if collapsible -%>
|
||||
<a href="#" class="container_toggle" id="toggle_c<%= context.id %>"><%= image_tag("blank.png", :alt => t('common.collapse_expand')) %></a>
|
||||
<% end -%>
|
||||
<% if source_view_is :context %>
|
||||
<span id="context_name"><%= context.name %></span>
|
||||
<% else %>
|
||||
<%= link_to_context( context ) %>
|
||||
<% end %>
|
||||
<%= container_toggle("toggle_c#{context.id}") %>
|
||||
<%= show_context_name(context) %>
|
||||
</h2>
|
||||
<div id="c_<%=context.id%>_target" class="context_target drop_target"></div>
|
||||
<div id="c<%= context.id %>items" class="items toggle_target">
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@
|
|||
<li><%= navigation_link( t('layouts.navigation.completed_tasks'), done_overview_path, {:accesskey=>"d", :title=>t('layouts.navigation.completed_tasks_title')} ) %></li>
|
||||
<li><%= navigation_link( t('layouts.navigation.feeds'), feeds_path, :title => t('layouts.navigation.feeds_title')) %></li>
|
||||
<li><%= navigation_link( t('layouts.navigation.stats'), stats_path, :title => t('layouts.navigation.stats_title')) %></li>
|
||||
<li><hr/></li>
|
||||
<%= group_view_by_menu_entry %>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#"><%= t('layouts.navigation.admin') %></a>
|
||||
|
|
|
|||
|
|
@ -1,21 +1,16 @@
|
|||
<%
|
||||
@not_done = @not_done_todos.select {|t| t.project_id == project.id }
|
||||
# invalidate the cache every day because of staleness or
|
||||
# rendering of "due in x days" that change without touching updated at of the todo
|
||||
cache [project, current_user.date.strftime("%Y%m%d")] do %>
|
||||
<div class="container">
|
||||
<h2 id="project_name_container">
|
||||
<% if collapsible -%>
|
||||
<a href="#" class="container_toggle" id="toggle_p<%= project.id %>"><%= image_tag("blank.png", :alt => t('common.collapse_expand')) %></a>
|
||||
<% end -%>
|
||||
<div id="project_name" style="width: 100%;"><%= project.name -%></div>
|
||||
</h2>
|
||||
<div id="<%= dom_id(project, "container")%>" class="list">
|
||||
<%= render :partial => "projects/project_settings", :object => project, :locals => { :collapsible => collapsible } %>
|
||||
</div>
|
||||
</div>
|
||||
cache [project, @source_view, current_user.date.strftime("%Y%m%d")] do
|
||||
%>
|
||||
<%= render :partial => "project_settings_container", :locals => {:project => project} if source_view_is :project %>
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('projects.actions_in_project_title') %></h2>
|
||||
<div id="p<%= project.id %>" class="container project" style="display:<%= (collapsible && @not_done.empty?) ? "none" : "block" %>">
|
||||
<h2>
|
||||
<%= container_toggle("toggle_p#{project.id}") if collapsible %>
|
||||
<%= source_view_is(:project) ? t('projects.actions_in_project_title') : show_project_name(project) %>
|
||||
</h2>
|
||||
<div id="p<%= project.id %>items" class="items toggle_target">
|
||||
<div id="p<%= project.id %>empty-nd" style="display:<%= @not_done.empty? ? 'block' : 'none'%>;">
|
||||
<div class="message"><p><%= t('projects.no_actions_in_project') %></p></div>
|
||||
|
|
@ -23,4 +18,5 @@ cache [project, current_user.date.strftime("%Y%m%d")] do %>
|
|||
<%= render :partial => "todos/todo", :collection => @not_done, :locals => { :parent_container_type => "project" } %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
|
|
|||
6
app/views/projects/_project_settings_container.html.erb
Normal file
6
app/views/projects/_project_settings_container.html.erb
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<div class="container project">
|
||||
<h2 id="project_name_container">
|
||||
<%= show_project_name(project) %>
|
||||
</h2>
|
||||
<%= show_project_settings(project) %>
|
||||
</div>
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
</div>
|
||||
|
||||
<%= render :partial => @project, :locals => {:collapsible => false } %>
|
||||
<%= render :partial => "todos/deferred", :object => @deferred, :locals => { :collapsible => false, :append_descriptor => t('projects.todos_append'), :parent_container_type => 'project', :pending => @pending } %>
|
||||
<%= render :partial => "todos/deferred", :object => @deferred_todos, :locals => { :collapsible => false, :append_descriptor => t('projects.todos_append'), :parent_container_type => 'project', :pending => @pending_todos } %>
|
||||
<% unless @max_completed==0 -%>
|
||||
<%= render :partial => "todos/completed", :object => @done, :locals => { :collapsible => false, :suppress_project => true, :append_descriptor => t('projects.todos_append') } %>
|
||||
<% end -%>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<div id="display_box">
|
||||
<div id="no_todos_in_view" class="container context" style="display:<%= @not_done_todos.empty? ? "block" : "none" %>">
|
||||
<h2><%= t('todos.no_actions_found_title')%></h2>
|
||||
<div class="message"><p><%= t('todos.no_actions_found') %></p></div>
|
||||
</div>
|
||||
<%= render(:partial => @contexts_to_show, :locals => { :collapsible => true }) -%>
|
||||
<%= empty_message_holder(@not_done_todos.empty?) %>
|
||||
|
||||
<%= show_grouped_todos %>
|
||||
|
||||
<% unless @done.nil? -%>
|
||||
<%= render(:partial => "todos/completed", :object => @done,
|
||||
:locals => { :collapsible => true, :append_descriptor => nil }) -%>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div id="input_box">
|
||||
<%= render :partial => "shared/add_new_item_form" %>
|
||||
<%= render :file => "sidebar/sidebar" %>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
<div id="display_box">
|
||||
<div id="no_todos_in_view" class="container context" <%= "style=\"display:none\"".html_safe unless @not_done_todos.empty? %> >
|
||||
<h2><%= t('todos.no_actions_found_title')%></h2>
|
||||
<div class="message"><p><%= t('todos.no_actions_with', :tag_name=>@tag_name) %></p></div>
|
||||
</div>
|
||||
<%= empty_message_holder(@not_done_todos.empty?) %>
|
||||
|
||||
<%= render :partial => "contexts/context", :collection => @contexts_to_show,
|
||||
:locals => { :collapsible => true } %>
|
||||
<%= show_grouped_todos %>
|
||||
|
||||
<% unless @deferred.nil? -%>
|
||||
<% unless @deferred_todos.nil? -%>
|
||||
<%= render :partial => "todos/deferred", :locals => {
|
||||
:deferred => @deferred,
|
||||
:pending => @pending,
|
||||
:deferred => @deferred_todos,
|
||||
:pending => @pending_todos,
|
||||
:collapsible => true,
|
||||
:append_descriptor => t('todos.tagged_with', :tag_name => @tag_title),
|
||||
:parent_container_type => 'tag'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue