Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ec913ba5
Commit
ec913ba5
authored
Jan 10, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
8794b8ac
840e7e0e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
3 deletions
+89
-3
app/views/shared/empty_states/_issues.html.haml
app/views/shared/empty_states/_issues.html.haml
+18
-0
app/views/shared/empty_states/_merge_requests.html.haml
app/views/shared/empty_states/_merge_requests.html.haml
+19
-0
changelogs/unreleased/25043-empty-states.yml
changelogs/unreleased/25043-empty-states.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/features/groups/empty_states_spec.rb
spec/features/groups/empty_states_spec.rb
+41
-3
No files found.
app/views/shared/empty_states/_issues.html.haml
View file @
ec913ba5
...
...
@@ -2,6 +2,10 @@
-
project_select_button
=
local_assigns
.
fetch
(
:project_select_button
,
false
)
-
show_import_button
=
local_assigns
.
fetch
(
:show_import_button
,
false
)
&&
Feature
.
enabled?
(
:issues_import_csv
)
&&
can?
(
current_user
,
:import_issues
,
@project
)
-
has_button
=
button_path
||
project_select_button
-
closed_issues_count
=
issuables_count_for_state
(
:issues
,
:closed
)
-
opened_issues_count
=
issuables_count_for_state
(
:issues
,
:opened
)
-
is_opened_state
=
params
[
:state
]
==
'opened'
-
is_closed_state
=
params
[
:state
]
==
'closed'
.row.empty-state
.col-12
...
...
@@ -14,6 +18,20 @@
=
_
(
"Sorry, your filter produced no results"
)
%p
.text-center
=
_
(
"To widen your search, change or remove filters above"
)
-
if
show_new_issue_link?
(
@project
)
.text-center
=
link_to
_
(
"New issue"
),
new_project_issue_path
(
@project
),
class:
"btn btn-success"
,
title:
_
(
"New issue"
),
id:
"new_issue_body_link"
-
elsif
is_opened_state
&&
opened_issues_count
==
0
&&
closed_issues_count
>
0
%h4
.text-center
=
_
(
"There are no open issues"
)
%p
.text-center
=
_
(
"To keep this project going, create a new issue"
)
-
if
show_new_issue_link?
(
@project
)
.text-center
=
link_to
_
(
"New issue"
),
new_project_issue_path
(
@project
),
class:
"btn btn-success"
,
title:
_
(
"New issue"
),
id:
"new_issue_body_link"
-
elsif
is_closed_state
&&
opened_issues_count
>
0
&&
closed_issues_count
==
0
%h4
.text-center
=
_
(
"There are no closed issues"
)
-
elsif
current_user
%h4
=
_
(
"The Issue Tracker is the place to add things that need to be improved or solved in a project"
)
...
...
app/views/shared/empty_states/_merge_requests.html.haml
View file @
ec913ba5
-
button_path
=
local_assigns
.
fetch
(
:button_path
,
false
)
-
project_select_button
=
local_assigns
.
fetch
(
:project_select_button
,
false
)
-
has_button
=
button_path
||
project_select_button
-
closed_merged_count
=
issuables_count_for_state
(
:merged
,
:closed
)
-
opened_merged_count
=
issuables_count_for_state
(
:merged
,
:opened
)
-
is_opened_state
=
params
[
:state
]
==
'opened'
-
is_closed_state
=
params
[
:state
]
==
'closed'
-
can_create_merge_request
=
merge_request_source_project_for_project
(
@project
)
.row.empty-state.merge-requests
.col-12
...
...
@@ -13,6 +18,20 @@
=
_
(
"Sorry, your filter produced no results"
)
%p
.text-center
=
_
(
"To widen your search, change or remove filters above"
)
.text-center
-
if
can_create_merge_request
=
link_to
_
(
"New merge request"
),
project_new_merge_request_path
(
@project
),
class:
"btn btn-success"
,
title:
_
(
"New merge request"
),
id:
"new_merge_request_body_link"
-
elsif
is_opened_state
&&
opened_merged_count
==
0
&&
closed_merged_count
>
0
%h4
.text-center
=
_
(
"There are no open merge requests"
)
%p
.text-center
=
_
(
"To keep this project going, create a new merge request"
)
.text-center
-
if
can_create_merge_request
=
link_to
_
(
"New merge request"
),
project_new_merge_request_path
(
@project
),
class:
"btn btn-success"
,
title:
_
(
"New merge request"
),
id:
"new_merge_request_body_link"
-
elsif
is_closed_state
&&
opened_merged_count
>
0
&&
closed_merged_count
==
0
%h4
.text-center
=
_
(
"There are no closed merge requests"
)
-
else
%h4
=
_
(
"Merge requests are a place to propose changes you've made to a project and discuss those changes with others"
)
...
...
changelogs/unreleased/25043-empty-states.yml
0 → 100644
View file @
ec913ba5
---
title
:
Make issuable empty states actionable
merge_request
:
24077
author
:
type
:
changed
locale/gitlab.pot
View file @
ec913ba5
...
...
@@ -9360,6 +9360,12 @@ msgstr ""
msgid "To import an SVN repository, check out %{svn_link}."
msgstr ""
msgid "To keep this project going, create a new issue"
msgstr ""
msgid "To keep this project going, create a new merge request"
msgstr ""
msgid "To link Sentry to GitLab, enter your Sentry URL and Auth Token."
msgstr ""
...
...
spec/features/groups/empty_states_spec.rb
View file @
ec913ba5
...
...
@@ -23,14 +23,52 @@ describe 'Group empty states' do
end
context
"the project has
#{
issuable_name
}
s"
do
before
do
it
'does not display an empty state'
do
create
(
issuable
,
project_relation
=>
project
)
visit
path
expect
(
page
).
not_to
have_selector
(
'.empty-state'
)
end
it
'does not display an empty state'
do
expect
(
page
).
not_to
have_selector
(
'.empty-state'
)
it
"displays link to create new
#{
issuable
}
when no open
#{
issuable
}
is found"
do
create
(
"closed_
#{
issuable
}
"
,
project_relation
=>
project
)
issuable_link_fn
=
"project_
#{
issuable
}
s_path"
visit
public_send
(
issuable_link_fn
,
project
)
page
.
within
(
find
(
'.empty-state'
))
do
expect
(
page
).
to
have_content
(
/There are no open
#{
issuable
.
to_s
.
humanize
.
downcase
}
/
)
expect
(
page
).
to
have_selector
(
"#new_
#{
issuable
}
_body_link"
)
end
end
it
'displays link to create new issue when the current search gave no results'
do
create
(
issuable
,
project_relation
=>
project
)
issuable_link_fn
=
"project_
#{
issuable
}
s_path"
visit
public_send
(
issuable_link_fn
,
project
,
author_username:
'foo'
,
scope:
'all'
,
state:
'opened'
)
page
.
within
(
find
(
'.empty-state'
))
do
expect
(
page
).
to
have_content
(
/Sorry, your filter produced no results/
)
new_issuable_path
=
issuable
==
:issue
?
'new_project_issue_path'
:
'project_new_merge_request_path'
path
=
public_send
(
new_issuable_path
,
project
)
expect
(
page
).
to
have_selector
(
"#new_
#{
issuable
}
_body_link[href='
#{
path
}
']"
)
end
end
it
"displays conditional text when no closed
#{
issuable
}
is found"
do
create
(
issuable
,
project_relation
=>
project
)
issuable_link_fn
=
"project_
#{
issuable
}
s_path"
visit
public_send
(
issuable_link_fn
,
project
,
state:
'closed'
)
page
.
within
(
find
(
'.empty-state'
))
do
expect
(
page
).
to
have_content
(
/There are no closed
#{
issuable
.
to_s
.
humanize
.
downcase
}
/
)
end
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