Commit 51031a68 authored by Annabel Dunstone's avatar Annabel Dunstone

Make entire todo row clickable

parent 673bb9ef
...@@ -10,6 +10,7 @@ class @Todos ...@@ -10,6 +10,7 @@ class @Todos
initBtnListeners: -> initBtnListeners: ->
$('.done-todo').on('click', @doneClicked) $('.done-todo').on('click', @doneClicked)
$('.js-todos-mark-all').on('click', @allDoneClicked) $('.js-todos-mark-all').on('click', @allDoneClicked)
$('.todo').on('click', @goToTodoUrl)
doneClicked: (e) => doneClicked: (e) =>
e.preventDefault() e.preventDefault()
...@@ -54,3 +55,7 @@ class @Todos ...@@ -54,3 +55,7 @@ class @Todos
updateBadges: (data) -> updateBadges: (data) ->
$('.todos-pending .badge, .todos-pending-count').text data.count $('.todos-pending .badge, .todos-pending-count').text data.count
$('.todos-done .badge').text data.done_count $('.todos-done .badge').text data.done_count
goToTodoUrl: (e) ->
$this = $(e.currentTarget)
window.location.href = $this.data('url')
...@@ -13,6 +13,12 @@ ...@@ -13,6 +13,12 @@
} }
} }
.todo {
&:hover {
cursor: pointer;
}
}
.todo-item { .todo-item {
.todo-title { .todo-title {
@include str-truncated(calc(100% - 174px)); @include str-truncated(calc(100% - 174px));
......
%li{class: "todo todo-#{todo.done? ? 'done' : 'pending'}", id: dom_id(todo) } %li{class: "todo todo-#{todo.done? ? 'done' : 'pending'}", id: dom_id(todo), data:{url: todo_target_path(todo)} }
.todo-item.todo-block .todo-item.todo-block
= image_tag avatar_icon(todo.author_email, 40), class: 'avatar s40', alt:'' = image_tag avatar_icon(todo.author_email, 40), class: 'avatar s40', alt:''
......
...@@ -36,3 +36,8 @@ Feature: Dashboard Todos ...@@ -36,3 +36,8 @@ Feature: Dashboard Todos
Scenario: I filter by action Scenario: I filter by action
Given I filter by "Mentioned" Given I filter by "Mentioned"
Then I should not see todos related to "Assignments" in the list Then I should not see todos related to "Assignments" in the list
@javascript
Scenario: I click on a todo row
Given I click on the todo
Then I should be directed to the corresponding page
...@@ -88,6 +88,14 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps ...@@ -88,6 +88,14 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
should_not_see_todo "John Doe assigned you issue ##{issue.iid}" should_not_see_todo "John Doe assigned you issue ##{issue.iid}"
end end
step 'I click on the todo' do
execute_script("$('.todo:nth-child(1)').click()")
end
step 'I should be directed to the corresponding page' do
page.should have_css('.identifier', text: 'Merge Request !1')
end
def should_see_todo(position, title, body, pending = true) def should_see_todo(position, title, body, pending = true)
page.within(".todo:nth-child(#{position})") do page.within(".todo:nth-child(#{position})") do
expect(page).to have_content title expect(page).to have_content title
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment