mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-26 09:04: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
|
|
@ -1,6 +1,28 @@
|
|||
# The methods added to this helper will be available to all templates in the
|
||||
# application.
|
||||
module ApplicationHelper
|
||||
|
||||
def group_view_by_menu_entry
|
||||
# not set, no menu entry
|
||||
return "" if @group_view_by.nil?
|
||||
|
||||
# if view == context, the menu shows Order By Project
|
||||
menu_name = @group_view_by == 'context' ? 'project' : 'context'
|
||||
|
||||
content_tag(:li) do
|
||||
link_to(
|
||||
t("layouts.navigation.group_view_by_#{menu_name}"),
|
||||
'#',
|
||||
{:id => "group_view_by_link", :accesskey => "g", :title => t('layouts.navigation.group_view_by_title'), :x_current_group_by => @group_view_by} )
|
||||
end
|
||||
end
|
||||
|
||||
def container_toggle(id)
|
||||
link_to(
|
||||
image_tag("blank.png", :alt => t('common.collapse_expand')),
|
||||
"#",
|
||||
{:class => "container_toggle", :id => id} )
|
||||
end
|
||||
|
||||
def navigation_link(name, options = {}, html_options = nil, *parameters_for_method_reference)
|
||||
link_to name, options, html_options
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
module ContextsHelper
|
||||
|
||||
def show_context_name(context)
|
||||
if source_view_is :context
|
||||
content_tag(:span, :id => "context_name"){context.name}
|
||||
else
|
||||
link_to_context( context )
|
||||
end
|
||||
end
|
||||
|
||||
def link_to_delete_context(context, descriptor = sanitize(context.name))
|
||||
link_to(descriptor,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,19 @@
|
|||
module ProjectsHelper
|
||||
|
||||
def show_project_name(project)
|
||||
if source_view_is :project
|
||||
content_tag(:span, :id => "project_name"){project.name}
|
||||
else
|
||||
link_to_project( project )
|
||||
end
|
||||
end
|
||||
|
||||
def show_project_settings(project)
|
||||
content_tag(:div, :id => dom_id(project, "container"), :class=>"list") do
|
||||
render :partial => "projects/project_settings", :object => project
|
||||
end
|
||||
end
|
||||
|
||||
def project_next_prev
|
||||
html = ""
|
||||
html << link_to_project(@previous_project, "« #{@previous_project.shortened_name}".html_safe) if @previous_project
|
||||
|
|
|
|||
|
|
@ -1,5 +1,19 @@
|
|||
module TodosHelper
|
||||
|
||||
def empty_message_holder(show)
|
||||
content_tag(:div, :id => "no_todos_in_view", :class => "container context", :style => "display:" + (show ? "block" : "none") ) do
|
||||
content_tag(:h2) { t('todos.no_actions_found_title') }
|
||||
content_tag(:div, :class => "message") do
|
||||
content_tag(:p) { t('todos.no_actions_found') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show_grouped_todos
|
||||
collection = (@group_view_by == 'context') ? @contexts_to_show : @projects_to_show
|
||||
render(:partial => collection, :locals => { :collapsible => true })
|
||||
end
|
||||
|
||||
def remote_star_icon(todo=@todo)
|
||||
link_to( image_tag_for_star(todo),
|
||||
toggle_star_todo_path(todo),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue