Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2016-03-30 21:41:51 +0300
committerJacob Schatz <jschatz1@gmail.com>2016-03-30 21:41:51 +0300
commit2fb7392ed7afeb47cfaae4059426aeda45a12cff (patch)
tree48ced39fab88c219a6f4e74284fbde49eec63c72
parentfa9d140f00d4f3d52e08acb595ec62cd4a1e1caf (diff)
parentf79687ea9763a7c7f5ade988ed76b0128de9098e (diff)
Merge branch '14547_todo-click' into 'master'
Make entire todo row clickable Fixes #14547 I had some issues with timeouts when searching for the selector to click on, so I ended up using `execute_script`. Please let me know if you think there's a better solution See merge request !3456
-rw-r--r--app/assets/javascripts/todos.js.coffee5
-rw-r--r--app/assets/stylesheets/pages/todos.scss6
-rw-r--r--app/views/dashboard/todos/_todo.html.haml2
-rw-r--r--features/dashboard/todos.feature5
-rw-r--r--features/steps/dashboard/todos.rb8
5 files changed, 25 insertions, 1 deletions
diff --git a/app/assets/javascripts/todos.js.coffee b/app/assets/javascripts/todos.js.coffee
index b6b4bd90e6a..ec2df6c5b73 100644
--- a/app/assets/javascripts/todos.js.coffee
+++ b/app/assets/javascripts/todos.js.coffee
@@ -6,10 +6,12 @@ class @Todos
clearListeners: ->
$('.done-todo').off('click')
$('.js-todos-mark-all').off('click')
+ $('.todo').off('click')
initBtnListeners: ->
$('.done-todo').on('click', @doneClicked)
$('.js-todos-mark-all').on('click', @allDoneClicked)
+ $('.todo').on('click', @goToTodoUrl)
doneClicked: (e) =>
e.preventDefault()
@@ -54,3 +56,6 @@ class @Todos
updateBadges: (data) ->
$('.todos-pending .badge, .todos-pending-count').text data.count
$('.todos-done .badge').text data.done_count
+
+ goToTodoUrl: ->
+ Turbolinks.visit($(this).data('url'))
diff --git a/app/assets/stylesheets/pages/todos.scss b/app/assets/stylesheets/pages/todos.scss
index f983e9829e6..e909e15f74c 100644
--- a/app/assets/stylesheets/pages/todos.scss
+++ b/app/assets/stylesheets/pages/todos.scss
@@ -13,6 +13,12 @@
}
}
+.todo {
+ &:hover {
+ cursor: pointer;
+ }
+}
+
.todo-item {
.todo-title {
@include str-truncated(calc(100% - 174px));
diff --git a/app/views/dashboard/todos/_todo.html.haml b/app/views/dashboard/todos/_todo.html.haml
index e3a4d64df01..25d2b64e381 100644
--- a/app/views/dashboard/todos/_todo.html.haml
+++ b/app/views/dashboard/todos/_todo.html.haml
@@ -1,4 +1,4 @@
-%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
= image_tag avatar_icon(todo.author_email, 40), class: 'avatar s40', alt:''
diff --git a/features/dashboard/todos.feature b/features/dashboard/todos.feature
index 1e7b1b50d64..8677b450813 100644
--- a/features/dashboard/todos.feature
+++ b/features/dashboard/todos.feature
@@ -36,3 +36,8 @@ Feature: Dashboard Todos
Scenario: I filter by action
Given I filter by "Mentioned"
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
diff --git a/features/steps/dashboard/todos.rb b/features/steps/dashboard/todos.rb
index 963e4f21365..30b21b93ac7 100644
--- a/features/steps/dashboard/todos.rb
+++ b/features/steps/dashboard/todos.rb
@@ -88,6 +88,14 @@ class Spinach::Features::DashboardTodos < Spinach::FeatureSteps
should_not_see_todo "John Doe assigned you issue ##{issue.iid}"
end
+ step 'I click on the todo' do
+ find('.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)
page.within(".todo:nth-child(#{position})") do
expect(page).to have_content title