Skip to content

Commit

Permalink
Merge pull request #1241 from dradis/issues/fix-library-import-link
Browse files Browse the repository at this point in the history
fix issues empty state link for importing from lib
  • Loading branch information
MattBudz authored Mar 25, 2024
2 parents 2cdcfc1 + 8a1e95a commit f968a57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/tylium/behaviors.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ document.addEventListener "turbolinks:load", ->
$this = $(this)
$this.find('[data-behavior~=toggle-chevron]').toggleClass('fa-chevron-down fa-chevron-up')

if $this.is('[data-behavior~=import-box]') && $($this.data('target')).innerHeight() == 0
if $this.is('[data-behavior~=import-box-header]') && $($this.data('target')).innerHeight() == 0
$($this.data('target')).find("input[type='text']:first").focus()

# Scroll for more indicator functionality
Expand Down
8 changes: 8 additions & 0 deletions app/assets/javascripts/tylium/pages/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,13 @@ document.addEventListener('turbolinks:load', function () {
e.stopPropagation();
new bootstrap.Dropdown($('[data-name~=issues]')).show();
});

$('[data-behavior~=import-dropdown-toggle]').on('click', function (e) {
e.stopPropagation();
$(
'[data-behavior~=import-box-header] [data-behavior~=toggle-chevron]'
).toggleClass('fa-chevron-down fa-chevron-up');
$('[data-behavior~=import-box]').toggle();
});
}
});
4 changes: 2 additions & 2 deletions app/views/issues/_import_box.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<%= link_to '#import-box',
class: 'import-toggle',
data: { bs_toggle: 'collapse', behavior: 'collapse-collection import-box' } do %>
data: { bs_toggle: 'collapse', behavior: 'collapse-collection import-box-header' } do %>
<i class="fa-solid fa-chevron-down" data-behavior="toggle-chevron"></i><span class="visually-hidden">Toggle import box</span>
<% end %>
</div>
Expand All @@ -14,7 +14,7 @@
</div>
</div>

<%= content_tag :div, class: 'import-box collapse', id: 'import-box' do %>
<%= content_tag :div, class: 'import-box collapse', id: 'import-box', data: { behavior: 'import-box' } do %>
<% if Dradis::Plugins::with_feature(:import).empty? %>
<p>
Connect Dradis to a library of issue descriptions so you don't have to
Expand Down

0 comments on commit f968a57

Please sign in to comment.