BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
fd0c40fc
Commit
fd0c40fc
authored
May 09, 2016
by
Alfredo Sumaran
Committed by
Jacob Schatz
May 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address feedback
Signed-off-by:
Alfredo Sumaran
<
alfredo@gitlab.com
>
parent
7d7ded5e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
49 deletions
+31
-49
CHANGELOG
CHANGELOG
+0
-1
todos_helper.rb
app/helpers/todos_helper.rb
+10
-7
_todo.html.haml
app/views/dashboard/todos/_todo.html.haml
+0
-1
target_state_spec.rb
spec/features/todos/target_state_spec.rb
+21
-40
No files found.
CHANGELOG
View file @
fd0c40fc
...
...
@@ -114,7 +114,6 @@ v 8.7.4
- Fix always showing build notification message when switching between merge requests
- Links for Redmine issue references are generated correctly again (Benedikt Huss)
- Fix an issue when filtering merge requests with more than one label. !3886
- Fix links on wiki pages for relative url setups. !4026 (Artem Sidorenko)
v 8.7.3
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
...
...
app/helpers/todos_helper.rb
View file @
fd0c40fc
...
...
@@ -38,16 +38,13 @@ module TodosHelper
end
def
todo_target_state_pill
(
todo
)
klass
=
'status-box '
klass
<<
"status-box-
#{
todo
.
target
.
state
.
dasherize
}
"
content_tag
(
:span
,
nil
,
class:
klass
)
do
if
show_todo_state?
(
todo
)
content_tag
(
:span
,
nil
,
class:
'target-status'
)
do
content_tag
(
:span
,
nil
,
class:
"status-box status-box-
#{
todo
.
target
.
state
.
dasherize
}
"
)
do
todo
.
target
.
state
.
capitalize
end
end
def
show_todo_state?
(
todo
)
(
todo
.
target
.
is_a?
(
MergeRequest
)
||
todo
.
target
.
is_a?
(
Issue
))
&&
[
'closed'
,
'merged'
].
include?
(
todo
.
target
.
state
)
end
end
def
todos_filter_params
...
...
@@ -108,4 +105,10 @@ module TodosHelper
options_from_collection_for_select
(
types
,
'name'
,
'title'
,
params
[
:type
])
end
private
def
show_todo_state?
(
todo
)
(
todo
.
target
.
is_a?
(
MergeRequest
)
||
todo
.
target
.
is_a?
(
Issue
))
&&
[
'closed'
,
'merged'
].
include?
(
todo
.
target
.
state
)
end
end
app/views/dashboard/todos/_todo.html.haml
View file @
fd0c40fc
...
...
@@ -4,7 +4,6 @@
.todo-title.title
-
unless
todo
.
build_failed?
-
if
show_todo_state?
(
todo
)
%span
.target-status
=
todo_target_state_pill
(
todo
)
%span
.author-name
...
...
spec/features/todos/target_state_
todos_
spec.rb
→
spec/features/todos/target_state_spec.rb
View file @
fd0c40fc
require
'rails_helper'
describe
'Todos > Target State Labels'
do
feature
'Todo target states'
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:issue_open
)
{
create
(
:issue
)
}
let
(
:issue_closed
)
{
create
(
:issue
,
state:
'closed'
)
}
let
(
:mr_open
)
{
create
(
:merge_request
,
:simple
,
author:
user
)
}
let
(
:mr_merged
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
state:
'merged'
)
}
let
(
:mr_closed
)
{
create
(
:merge_request
,
:simple
,
author:
user
,
state:
'closed'
)
}
describe
'GET /dashboard/todos'
do
context
'On a todo for a Closed Issue'
do
before
do
create
(
:todo
,
:mentioned
,
user:
user
,
project:
project
,
target:
issue_closed
,
author:
author
)
login_as
user
visit
dashboard_todos_path
end
it
'has closed label'
do
scenario
'on a closed issue todo has closed label'
do
issue_closed
=
create
(
:issue
,
state:
'closed'
)
create_todo
issue_closed
visit
dashboard_todos_path
page
.
within
'.todos-list'
do
expect
(
page
).
to
have_content
(
'Closed'
)
end
end
end
context
'On a todo for a Open Issue'
do
before
do
create
(
:todo
,
:mentioned
,
user:
user
,
project:
project
,
target:
issue_open
,
author:
author
)
login_as
user
scenario
'on an open issue todo does not have an open label'
do
issue_open
=
create
(
:issue
)
create_todo
issue_open
visit
dashboard_todos_path
end
it
'does not have a open label'
do
page
.
within
'.todos-list'
do
expect
(
page
).
not_to
have_content
(
'Open'
)
end
end
end
context
'On a todo for a merged Merge Request'
do
before
do
create
(
:todo
,
:mentioned
,
user:
user
,
project:
project
,
target:
mr_merged
,
author:
author
)
login_as
user
scenario
'on a merged merge request todo has merged label'
do
mr_merged
=
create
(
:merge_request
,
:simple
,
author:
user
,
state:
'merged'
)
create_todo
mr_merged
visit
dashboard_todos_path
end
it
'has merged label'
do
page
.
within
'.todos-list'
do
expect
(
page
).
to
have_content
(
'Merged'
)
end
end
end
context
'On a todo for a closed Merge Request'
do
before
do
create
(
:todo
,
:mentioned
,
user:
user
,
project:
project
,
target:
mr_closed
,
author:
author
)
login_as
user
scenario
'on a closed merge request todo has closed label'
do
mr_closed
=
create
(
:merge_request
,
:simple
,
author:
user
,
state:
'closed'
)
create_todo
mr_closed
visit
dashboard_todos_path
end
it
'has closed label'
do
page
.
within
'.todos-list'
do
expect
(
page
).
to
have_content
(
'Closed'
)
end
end
end
context
'On a todo for a open Merge Request'
do
before
do
create
(
:todo
,
:mentioned
,
user:
user
,
project:
project
,
target:
mr_open
,
author:
author
)
login_as
user
scenario
'on an open merge request todo does not have an open label'
do
mr_open
=
create
(
:merge_request
,
:simple
,
author:
user
)
create_todo
mr_open
visit
dashboard_todos_path
end
it
'does not have a open label'
do
page
.
within
'.todos-list'
do
expect
(
page
).
not_to
have_content
(
'Open'
)
end
end
end
def
create_todo
(
target
)
create
(
:todo
,
:mentioned
,
user:
user
,
project:
project
,
target:
target
,
author:
author
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment