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 @@