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
40320141
Commit
40320141
authored
Sep 10, 2020
by
David O'Regan
Committed by
Peter Leitzen
Sep 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce type selector technical dept
parent
8afdc95f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
8 deletions
+29
-8
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+4
-0
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+1
-2
app/views/shared/issuable/form/_metadata.html.haml
app/views/shared/issuable/form/_metadata.html.haml
+1
-2
app/views/shared/issuable/form/_type_selector.html.haml
app/views/shared/issuable/form/_type_selector.html.haml
+6
-4
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+17
-0
No files found.
app/models/concerns/issuable.rb
View file @
40320141
...
...
@@ -189,6 +189,10 @@ module Issuable
is_a?
(
Issue
)
&&
super
end
def
supports_issue_type?
is_a?
(
Issue
)
end
def
severity
return
IssuableSeverity
::
DEFAULT
unless
incident?
...
...
app/views/shared/issuable/_form.html.haml
View file @
40320141
...
...
@@ -22,8 +22,7 @@
=
render
'shared/form_elements/apply_template_warning'
-
if
issuable
.
is_a?
(
Issuable
)
&&
@issue
=
render
'shared/issuable/form/type_selector'
,
issuable:
issuable
,
form:
form
,
type:
@issue
[
:issue_type
]
=
render
'shared/issuable/form/type_selector'
,
issuable:
issuable
,
form:
form
=
render
'shared/form_elements/description'
,
model:
issuable
,
form:
form
,
project:
project
...
...
app/views/shared/issuable/form/_metadata.html.haml
View file @
40320141
...
...
@@ -32,8 +32,7 @@
-
if
has_due_date
.col-lg-6
-
if
@issue
[
:issue_type
]
!=
'incident'
=
render_if_exists
"shared/issuable/form/weight"
,
issuable:
issuable
,
form:
form
=
render_if_exists
"shared/issuable/form/weight"
,
issuable:
issuable
,
form:
form
.form-group.row
=
form
.
label
:due_date
,
"Due date"
,
class:
"col-form-label col-md-2 col-lg-4"
.col-8
...
...
app/views/shared/issuable/form/_type_selector.html.haml
View file @
40320141
-
return
unless
issuable
.
supports_issue_type?
.form-group.row.gl-mb-0
=
form
.
label
:type
,
'Type'
,
class:
'col-form-label col-sm-2'
.col-sm-10
...
...
@@ -5,7 +7,7 @@
.dropdown.js-issuable-type-filter-dropdown-wrap
%button
.dropdown-menu-toggle
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%span
.dropdown-toggle-text.is-default
=
type
.
capitalize
||
_
(
"Select type"
)
=
issuable
.
issue_
type
.
capitalize
||
_
(
"Select type"
)
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-menu-selectable.dropdown-select
.dropdown-title
...
...
@@ -15,12 +17,12 @@
.dropdown-content
%ul
%li
.js-filter-issuable-type
=
link_to
new_project_issue_path
(
@project
),
class:
(
"is-active"
if
type
===
'issue'
)
do
=
link_to
new_project_issue_path
(
@project
),
class:
(
"is-active"
if
issuable
.
issue?
)
do
=
_
(
"Issue"
)
%li
.js-filter-issuable-type
=
link_to
new_project_issue_path
(
@project
,
{
issuable_template:
'incident'
,
issue:
{
issue_type:
'incident'
}
}),
class:
(
"is-active"
if
type
===
'incident'
)
do
=
link_to
new_project_issue_path
(
@project
,
{
issuable_template:
'incident'
,
issue:
{
issue_type:
'incident'
}
}),
class:
(
"is-active"
if
issuable
.
incident?
)
do
=
_
(
"Incident"
)
-
if
type
===
'incident'
-
if
issuable
.
incident?
%p
.form-text.text-muted
-
incident_docs_url
=
help_page_path
(
'operations/incident_management/incidents.md'
,
anchor:
'create-and-manage-incidents-in-gitlab'
)
-
incident_docs_start
=
'<a href="%{url}" target="_blank" rel="noopener noreferrer">'
.
html_safe
%
{
url:
incident_docs_url
}
...
...
spec/models/concerns/issuable_spec.rb
View file @
40320141
...
...
@@ -855,6 +855,23 @@ RSpec.describe Issuable do
end
end
describe
'#supports_issue_type?'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:issuable_type
,
:supports_issue_type
)
do
:issue
|
true
:merge_request
|
false
end
with_them
do
let
(
:issuable
)
{
build_stubbed
(
issuable_type
)
}
subject
{
issuable
.
supports_issue_type?
}
it
{
is_expected
.
to
eq
(
supports_issue_type
)
}
end
end
describe
'#severity'
do
subject
{
issuable
.
severity
}
...
...
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