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
...
@@ -189,6 +189,10 @@ module Issuable
is_a?
(
Issue
)
&&
super
is_a?
(
Issue
)
&&
super
end
end
def
supports_issue_type?
is_a?
(
Issue
)
end
def
severity
def
severity
return
IssuableSeverity
::
DEFAULT
unless
incident?
return
IssuableSeverity
::
DEFAULT
unless
incident?
...
...
app/views/shared/issuable/_form.html.haml
View file @
40320141
...
@@ -22,8 +22,7 @@
...
@@ -22,8 +22,7 @@
=
render
'shared/form_elements/apply_template_warning'
=
render
'shared/form_elements/apply_template_warning'
-
if
issuable
.
is_a?
(
Issuable
)
&&
@issue
=
render
'shared/issuable/form/type_selector'
,
issuable:
issuable
,
form:
form
=
render
'shared/issuable/form/type_selector'
,
issuable:
issuable
,
form:
form
,
type:
@issue
[
:issue_type
]
=
render
'shared/form_elements/description'
,
model:
issuable
,
form:
form
,
project:
project
=
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 @@
...
@@ -32,8 +32,7 @@
-
if
has_due_date
-
if
has_due_date
.col-lg-6
.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-group.row
=
form
.
label
:due_date
,
"Due date"
,
class:
"col-form-label col-md-2 col-lg-4"
=
form
.
label
:due_date
,
"Due date"
,
class:
"col-form-label col-md-2 col-lg-4"
.col-8
.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-group.row.gl-mb-0
=
form
.
label
:type
,
'Type'
,
class:
'col-form-label col-sm-2'
=
form
.
label
:type
,
'Type'
,
class:
'col-form-label col-sm-2'
.col-sm-10
.col-sm-10
...
@@ -5,7 +7,7 @@
...
@@ -5,7 +7,7 @@
.dropdown.js-issuable-type-filter-dropdown-wrap
.dropdown.js-issuable-type-filter-dropdown-wrap
%button
.dropdown-menu-toggle
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%button
.dropdown-menu-toggle
{
type:
'button'
,
'data-toggle'
=>
'dropdown'
}
%span
.dropdown-toggle-text.is-default
%span
.dropdown-toggle-text.is-default
=
type
.
capitalize
||
_
(
"Select type"
)
=
issuable
.
issue_
type
.
capitalize
||
_
(
"Select type"
)
=
icon
(
'chevron-down'
)
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-menu-selectable.dropdown-select
.dropdown-menu.dropdown-menu-selectable.dropdown-select
.dropdown-title
.dropdown-title
...
@@ -15,12 +17,12 @@
...
@@ -15,12 +17,12 @@
.dropdown-content
.dropdown-content
%ul
%ul
%li
.js-filter-issuable-type
%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"
)
=
_
(
"Issue"
)
%li
.js-filter-issuable-type
%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"
)
=
_
(
"Incident"
)
-
if
type
===
'incident'
-
if
issuable
.
incident?
%p
.form-text.text-muted
%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_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
}
-
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
...
@@ -855,6 +855,23 @@ RSpec.describe Issuable do
end
end
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
describe
'#severity'
do
subject
{
issuable
.
severity
}
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