-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12492 from saraycp/watchlist_more_request_info_to…
…oltip Add collapsible tooltips to display more info about requests in watchlist
- Loading branch information
Showing
12 changed files
with
148 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/api/app/assets/javascripts/webui/new_watchlist/collapsible_tooltip.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function toggleTooltip() { // jshint ignore:line | ||
$('.toggle-tooltip').on('click', function(){ | ||
var replaceTitle = $(this).attr('title') === 'Click to keep it open' ? 'Click to close it' : 'Click to keep it open'; | ||
var infoContainer = $(this).parents('.toggle-tooltip-parent').next(); | ||
$(infoContainer).toggleClass('collapsed'); | ||
$(infoContainer).removeClass('hover'); | ||
$(this).attr('title', replaceTitle); | ||
}); | ||
$('.toggle-tooltip').on('mouseover', function(){ | ||
$(this).parents('.toggle-tooltip-parent').next().addClass('hover'); | ||
}); | ||
$('.toggle-tooltip').on('mouseout', function(){ | ||
$(this).parents('.toggle-tooltip-parent').next().removeClass('hover'); | ||
}); | ||
} |
69 changes: 66 additions & 3 deletions
69
src/api/app/assets/stylesheets/webui/new_watchlist/watchlist.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,67 @@ | ||
.color-inverted { | ||
-webkit-filter: invert(100%); /* safari 6.0 - 9.0 */ | ||
filter: invert(100%); | ||
body.new-watchlist { | ||
.color-inverted { | ||
-webkit-filter: invert(100%); /* safari 6.0 - 9.0 */ | ||
filter: invert(100%); | ||
} | ||
|
||
// TODO: the following rules are mostly duplicated from build-results.scss. | ||
// Please try to unify both when new_watchlist feature is rolled out. | ||
|
||
.toggle-tooltip { cursor: pointer; } | ||
.toggle-tooltip-parent { z-index: 2; } | ||
|
||
.extended-info { | ||
@extend .d-flex; | ||
@extend .flex-column; | ||
position: relative; | ||
background-color: lighten($dark, 10%); | ||
max-height: 100vh; | ||
transition: max-height .3s 0s ease-in-out, margin-bottom .1s .1s linear; | ||
|
||
.triangle { | ||
position: absolute; | ||
width: 0; | ||
height: 0; | ||
top: -.5rem; | ||
border-left: .5rem solid transparent; | ||
border-right: .5rem solid transparent; | ||
border-bottom: .5rem solid lighten($dark, 10%); | ||
transition: top .3s .1s ease-in-out, opacity 0.1s .2s ease-in-out; | ||
|
||
&.left { left: .5rem; } | ||
} | ||
|
||
.extended-info-content { | ||
overflow-y: hidden; | ||
} | ||
|
||
&.collapsed { | ||
max-height: 0; | ||
@extend .mb-0; | ||
|
||
.triangle { | ||
top: 0; | ||
opacity: 0; | ||
} | ||
} | ||
|
||
&.hover { | ||
max-height: 100vh; | ||
|
||
.triangle { | ||
top: -.5rem; | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
@include media-breakpoint-up(md) { | ||
.main-info .triangle.left { left: .25rem; } | ||
} | ||
|
||
@include media-breakpoint-between(sm, md) { | ||
.extended-info .triangle { | ||
&.left { left: .5rem; } | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/api/app/components/bs_request_action_source_and_target_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
class BsRequestActionSourceAndTargetComponent < ApplicationComponent | ||
attr_reader :bs_request_action, :number_of_bs_request_actions | ||
|
||
def initialize(bs_request) | ||
super | ||
|
||
@bs_request = bs_request | ||
@bs_request_action = @bs_request.bs_request_actions.first | ||
@number_of_bs_request_actions = @bs_request.bs_request_actions.size | ||
end | ||
|
||
def call | ||
capture do | ||
if source.present? | ||
concat(tag.span(source)) | ||
concat(tag.i(nil, class: 'fas fa-long-arrow-alt-right text-info mx-2')) | ||
end | ||
concat(tag.span(target)) | ||
end | ||
end | ||
|
||
private | ||
|
||
def source | ||
@source ||= if number_of_bs_request_actions > 1 | ||
'' | ||
else | ||
[bs_request_action.source_project, bs_request_action.source_package].compact.join(' / ') | ||
end | ||
end | ||
|
||
def target | ||
return bs_request_action.target_project if number_of_bs_request_actions > 1 | ||
|
||
[bs_request_action.target_project, bs_request_action.target_package].compact.join(' / ') | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
src/api/app/components/bs_request_state_badge_component.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class BsRequestStateBadgeComponent < ApplicationComponent | ||
def initialize(bs_request:, css_class: nil) | ||
super | ||
|
||
@bs_request = bs_request | ||
@css_class = css_class | ||
end | ||
|
||
def call | ||
tag.span(@bs_request.state, | ||
class: ['badge', "badge-#{helpers.request_badge_color(@bs_request.state)}", @css_class]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters