-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update #12481 Fix list item metadata duplication
- Loading branch information
Patrick Lewis
committed
Jun 21, 2017
1 parent
5487f39
commit 05cd469
Showing
4 changed files
with
34 additions
and
23 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
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,32 @@ | ||
/* globals $ */ | ||
$('.hub_feed_more_control, .republished_feed_more_control') | ||
.live({ click: toggleListItemMetadata }) | ||
|
||
function toggleListItemMetadata (e) { | ||
e.preventDefault() | ||
|
||
var element = $(this) | ||
|
||
if (element.hasClass('more_details_included')) { | ||
hideListItemMetadata(element) | ||
} else { | ||
showListItemMetadata(element) | ||
} | ||
} | ||
|
||
function hideListItemMetadata (element) { | ||
element.removeClass('more_details_included') | ||
element.closest('li').find('.metadata').empty() | ||
element.find('.fa').removeClass('fa-caret-down').addClass('fa-caret-right') | ||
} | ||
|
||
function showListItemMetadata (element) { | ||
$.ajax({ | ||
url: element.attr('href'), | ||
success: function (html) { | ||
element.addClass('more_details_included') | ||
element.closest('li').find('.metadata').replaceWith(html) | ||
element.find('.fa').removeClass('fa-caret-right').addClass('fa-caret-down') | ||
} | ||
}) | ||
} |
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