diff --git a/app/assets/javascripts/tracks.js.coffee b/app/assets/javascripts/tracks.js.coffee index 255a4d17..74b158d2 100644 --- a/app/assets/javascripts/tracks.js.coffee +++ b/app/assets/javascripts/tracks.js.coffee @@ -6,20 +6,30 @@ # go_projects: this.goto_page "/projects" TracksApp = - currentPosition: 0 - updateCurrentPosition: -> - this.currentPosition = 0 - $("div.todo-item").each -> - if $(this).hasClass("selected-item") - return false - else - this.currentPosition++ + createSubmenu: (todo, itemToAddBefore) -> + template_clone = $("div.todo-sub-menu-template").clone() + itemToAddBefore.before(template_clone) + todo_menu = todo.find("div.todo-sub-menu-template") + todo_menu.removeClass("todo-sub-menu-template") + todo_menu.addClass("todo-sub-menu") + todo_menu.removeClass("hide") + + appendTodoSubMenu: (todo) -> + if todo.find("div.todo-sub-menu").length is 0 + notes_row = todo.find(".todo-notes").parent() + submenu = TracksApp.createSubmenu(todo, notes_row) + else + todo.find("div.todo-sub-menu").removeClass("hide") selectTodo: (new_todo) -> - $("div.todo-item.selected-item").removeClass("selected-item") + selected_item = $("div.todo-item.selected-item") + selected_item.find("div.todo-sub-menu").addClass("hide") + selected_item.find("span.todo-item-detail").addClass("hide") + selected_item.removeClass("selected-item") + TracksApp.appendTodoSubMenu(new_todo) + new_todo.find("span.todo-item-detail").removeClass("hide") new_todo.addClass("selected-item") - TracksApp.updateCurrentPosition() selectPrevNext: (go_next) -> current = prev = next = null @@ -66,5 +76,5 @@ $ -> todo_item = $(this).parent().parent().parent().parent() TracksApp.selectTodo(todo_item) - $("div.todo-item-description-container").click -> + $("span.todo-item-description-container").click -> TracksApp.selectTodo( $(this).parent().parent().parent() ) \ No newline at end of file diff --git a/app/assets/stylesheets/tracks.css.scss b/app/assets/stylesheets/tracks.css.scss index 4c4731db..ef3d4449 100644 --- a/app/assets/stylesheets/tracks.css.scss +++ b/app/assets/stylesheets/tracks.css.scss @@ -80,12 +80,12 @@ div.todo-item { span.todo-description { margin-right: 10px; } - div.todo-item-icons { + span.todo-item-icons { display: block; margin-right: 10px; float:left; } - div.todo-item-description-container { + span.todo-item-description-container { display: inline-block; float:left; } @@ -95,11 +95,24 @@ div.todo-item { padding: 10px; margin: 0px -3px 0px -3px; } + div.todo-sub-menu { + margin-top: 5px; + padding-top: 5px; + margin-bottom: 10px; + border: 1px solid #EEE; + border-width: 1px 0 0 0; + } + span.todo-item-detail { + text-decoration: none; + font-weight: normal; + font-style: italic; + color: #999; + } } div.selected-item { - border: 3px solid #AAA; - border-radius: 3px; + border: 1.5px solid #AAA; + border-radius: 4px; .row { font-weight: bold; } diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index e6f12e2a..42717f33 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -125,6 +125,10 @@ module TodosHelper # === helpers for rendering a todo + def todo_notes(todo) + todo.rendered_notes.html_safe + end + def remote_star_icon(todo=@todo) link_to( image_tag_for_star(todo), toggle_star_todo_path(todo), diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 4c437e19..079b2814 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -29,7 +29,7 @@ - <% cache do -%> + <% cache [:navbar] do -%> <%= render partial: "shared/navbar" %> <% end -%> @@ -42,11 +42,12 @@ - <% cache do -%> + <% cache [:footer] do -%> <%= render partial: "shared/footer" %> <% # dialogs -%> <%= render partial: "shared/keyboard_shortcuts" %> <%= render partial: "shared/add_new_action" %> + <%= render partial: "todos/todo_sub_menu" %> <% end -%> <% # Javascripts diff --git a/app/views/todos/_container_items.html.erb b/app/views/todos/_container_items.html.erb index 659472d1..bf68a7b6 100644 --- a/app/views/todos/_container_items.html.erb +++ b/app/views/todos/_container_items.html.erb @@ -1,11 +1,11 @@
- <% cache container_name, show_empty_message do %> - <%= render partial: "todos/container_empty_message", locals: { - container_id: settings[:container_id], - container_name: settings[:container_name], - show_empty_message: settings[:show_empty_message]} -%> + <% cache [settings[:container_name], settings[:show_empty_message]] do %> + <%= render partial: "todos/container_empty_message", locals: { + container_id: settings[:container_id], + container_name: settings[:container_name], + show_empty_message: settings[:show_empty_message]} -%> <% end -%> - <%= render(:partial => "todos/todo", :collection => collection, :locals => settings) %> + <%= render(:partial => "todos/todo", :collection => collection, :locals => settings) %>
\ No newline at end of file diff --git a/app/views/todos/_todo.html.erb b/app/views/todos/_todo.html.erb index e5a8eae7..9a34f70b 100644 --- a/app/views/todos/_todo.html.erb +++ b/app/views/todos/_todo.html.erb @@ -6,17 +6,23 @@
-
+ "> "> -
-
+ + <%= todo.description %> <%= content_tag(:i, {class: "icon-refresh"}){} if todo.from_recurring_todo? -%> <%= deferred_due_date(todo) -%> <%= content_tag(:i, {class: "icon-sitemap"}){} if todo.has_pending_successors -%> <%= content_tag(:i, {class: "icon-book", "data-note-id" => dom_id(todo, 'notes')}){} unless todo.notes.blank? %> -
+ +
+

+ project: <%= todo.project.name.blank? ? "none" : todo.project.name %> + context: <%= todo.context.name.blank? ? "none" : todo.context.name %> +

+
<%= date_span(todo) -%> @@ -25,7 +31,7 @@
- <%=todo.rendered_notes.html_safe%> + <%= todo_notes(todo) %>
diff --git a/app/views/todos/_todo_sub_menu.html.erb b/app/views/todos/_todo_sub_menu.html.erb new file mode 100644 index 00000000..29384ef1 --- /dev/null +++ b/app/views/todos/_todo_sub_menu.html.erb @@ -0,0 +1,18 @@ +
+ Edit + + + + Make Project + Delete +
diff --git a/app/views/todos/index.html.erb b/app/views/todos/index.html.erb index 8f751fc0..29331e0e 100644 --- a/app/views/todos/index.html.erb +++ b/app/views/todos/index.html.erb @@ -1,7 +1,7 @@ <%# Template Dependency: todos/collection -%> <%# Template Dependency: contexts/context -%> <%# Template Dependency: projects/project -%> -<% cache("not_done", @not_done_todos.empty?) do -%> +<% cache ["not_done", @not_done_todos.empty?] do -%> <%= render partial: "empty_message_container", locals: {:show => @not_done_todos.empty?, :container_name => "not_done"} %> <% end -%> @@ -11,4 +11,6 @@ <%= show_todos_without_project(@todos_without_project) -%> <% end -%> -<%= show_done_todos(@done, {:parent_container_type => @group_view_by, :collapsible => true}) unless @done.nil? %> \ No newline at end of file +<% cache [@done.first, "home_completed"] do %> + <%= show_done_todos(@done, {:parent_container_type => @group_view_by, :collapsible => true}) unless @done.nil? %> +<% end %> \ No newline at end of file