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
f0f94278
Commit
f0f94278
authored
Jul 06, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy up close_reopen helpers and fix filtered-search-token padding
parent
848d868b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
23 deletions
+41
-23
app/assets/stylesheets/framework/filters.scss
app/assets/stylesheets/framework/filters.scss
+4
-0
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+32
-18
app/views/shared/issuable/_close_reopen_button.html.haml
app/views/shared/issuable/_close_reopen_button.html.haml
+4
-4
app/views/shared/issuable/_close_reopen_report_toggle.html.haml
...ews/shared/issuable/_close_reopen_report_toggle.html.haml
+1
-1
No files found.
app/assets/stylesheets/framework/filters.scss
View file @
f0f94278
...
@@ -163,6 +163,10 @@
...
@@ -163,6 +163,10 @@
}
}
}
}
.droplab-dropdown
li
.filtered-search-token
{
padding
:
0
;
}
.filtered-search-term
{
.filtered-search-term
{
.name
{
.name
{
background-color
:
inherit
;
background-color
:
inherit
;
...
...
app/helpers/issuables_helper.rb
View file @
f0f94278
...
@@ -254,36 +254,50 @@ module IssuablesHelper
...
@@ -254,36 +254,50 @@ module IssuablesHelper
end
end
def
close_reopen_issuable_url
(
issuable
,
should_inverse
=
false
)
def
close_reopen_issuable_url
(
issuable
,
should_inverse
=
false
)
is_closed
=
issuable
.
closed?
issuable
.
closed?
^
should_inverse
?
reopen_issuable_url
(
issuable
)
:
close_issuable_url
(
issuable
)
is_closed
=
!
is_closed
if
should_inverse
is_closed
?
reopen_issuable_url
(
issuable
)
:
close_issuable_url
(
issuable
)
end
end
def
issuable_url
(
issuable
,
*
options
)
def
issuable_url
(
issuable
,
*
options
)
case
issuable
case
issuable
when
Issue
then
issue_url
(
issuable
,
*
options
)
when
Issue
when
MergeRequest
then
merge_request_url
(
issuable
,
*
options
)
issue_url
(
issuable
,
*
options
)
else
raise
'unknown issuable type'
when
MergeRequest
merge_request_url
(
issuable
,
*
options
)
else
raise
TypeError
.
new
(
'unknown issuable type'
)
end
end
end
end
def
issuable_button_visibility
(
issuable
,
closed
)
def
issuable_button_visibility
(
issuable
,
closed
)
case
issuable
case
issuable
when
Issue
then
issue_button_visibility
(
issuable
,
closed
)
when
Issue
when
MergeRequest
then
merge_request_button_visibility
(
issuable
,
closed
)
issue_button_visibility
(
issuable
,
closed
)
else
raise
'unknown issuable type'
when
MergeRequest
merge_request_button_visibility
(
issuable
,
closed
)
else
raise
TypeError
.
new
(
'unknown issuable type'
)
end
end
end
end
def
issuable_close_reopen_button_method
(
issuable
)
def
issuable_close_reopen_button_method
(
issuable
)
case
issuable
case
issuable
when
Issue
then
''
when
Issue
when
MergeRequest
then
'put'
''
else
raise
'unknown issuable type'
when
MergeRequest
'put'
else
raise
TypeError
.
new
(
'unknown issuable type'
)
end
end
end
end
def
issuable_author_is_current_user
(
issuable
)
issuable
.
author
==
current_user
end
def
issuable_display_type
(
issuable
)
issuable
.
model_name
.
human
.
downcase
end
private
private
def
sidebar_gutter_collapsed?
def
sidebar_gutter_collapsed?
...
@@ -342,10 +356,10 @@ module IssuablesHelper
...
@@ -342,10 +356,10 @@ module IssuablesHelper
end
end
def
close_reopen_params
(
issuable
,
action
)
def
close_reopen_params
(
issuable
,
action
)
params
=
{}
{
params
[
issuable
.
model_name
.
to_s
.
underscore
]
=
{
}
issuable
.
model_name
.
to_s
.
underscore
=>
{
state_event:
action
}
params
[
issuable
.
model_name
.
to_s
.
underscore
][
:state_event
]
=
action
}.
tap
do
|
params
|
params
[
:format
]
=
:json
if
issuable
.
is_a?
(
Issue
)
params
[
:format
]
=
:json
if
issuable
.
is_a?
(
Issue
)
params
end
end
end
end
end
app/views/shared/issuable/_close_reopen_button.html.haml
View file @
f0f94278
-
is_current_user
=
current_user
==
issuable
.
author
-
is_current_user
=
issuable_author_is_current_user
(
issuable
)
-
display_issuable_type
=
issuable
.
model_name
.
human
.
downcase
-
display_issuable_type
=
issuable
_display_type
(
issuable
)
-
button_method
=
issuable_close_reopen_button_method
(
issuable
)
-
button_method
=
issuable_close_reopen_button_method
(
issuable
)
-
if
can_update
&&
is_current_user
-
if
can_update
&&
is_current_user
=
link_to
"Close
#{
display_issuable_type
}
"
,
close_issuable_url
(
issuable
),
method:
button_method
,
=
link_to
"Close
#{
display_issuable_type
}
"
,
close_issuable_url
(
issuable
),
method:
button_method
,
class:
"btn btn-grouped btn-close
#{
issuable_button_visibility
(
issuable
,
true
)
}
"
,
title:
"Close
#{
display_issuable_type
}
"
class:
"
hidden-xs hidden-sm
btn btn-grouped btn-close
#{
issuable_button_visibility
(
issuable
,
true
)
}
"
,
title:
"Close
#{
display_issuable_type
}
"
=
link_to
"Reopen
#{
display_issuable_type
}
"
,
reopen_issuable_url
(
issuable
),
method:
button_method
,
=
link_to
"Reopen
#{
display_issuable_type
}
"
,
reopen_issuable_url
(
issuable
),
method:
button_method
,
class:
"btn btn-grouped btn-reopen
#{
issuable_button_visibility
(
issuable
,
false
)
}
"
,
title:
"Reopen
#{
display_issuable_type
}
"
class:
"
hidden-xs hidden-sm
btn btn-grouped btn-reopen
#{
issuable_button_visibility
(
issuable
,
false
)
}
"
,
title:
"Reopen
#{
display_issuable_type
}
"
-
elsif
can_update
&&
!
is_current_user
-
elsif
can_update
&&
!
is_current_user
=
render
'shared/issuable/close_reopen_report_toggle'
,
issuable:
issuable
=
render
'shared/issuable/close_reopen_report_toggle'
,
issuable:
issuable
-
else
-
else
...
...
app/views/shared/issuable/_close_reopen_report_toggle.html.haml
View file @
f0f94278
-
display_issuable_type
=
issuable
.
model_name
.
human
.
downcase
-
display_issuable_type
=
issuable
_display_type
(
issuable
)
-
button_action
=
issuable
.
closed?
?
'reopen'
:
'close'
-
button_action
=
issuable
.
closed?
?
'reopen'
:
'close'
-
display_button_action
=
button_action
.
capitalize
-
display_button_action
=
button_action
.
capitalize
-
button_responsive_class
=
'hidden-xs hidden-sm'
-
button_responsive_class
=
'hidden-xs hidden-sm'
...
...
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