Skip to content

Issues-652: Client Manager - no navigation when embedded #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/vanilla/bootstrap.before.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ function watchIcon($hasWatched = false, $title='') {
* @return string
*/
function watchButton($category, $isHijackButton = true) {
if(hideInMFE()){
return '';
}

$output = ' ';
$userID = Gdn::session()->UserID;
if(is_numeric($category)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ protected function buildBreadcrumbs($CategoryID) {
$ancestors = CategoryModel::getAncestors($CategoryID);
$parentCategoryID = val('ParentCategoryID', $Category);
// FIX https://github.com/topcoder-platform/forums/issues/648
if(getIncomingValue('embed_type') == 'mfe') {

$showFullBreadcrumbs = true;
$this->EventArguments['ShowFullBreadcrumbs'] = & $showFullBreadcrumbs;
$this->fireEvent('BeforeBuildBreadcrumbs');
// getIncomingValue('embed_type') == 'mfe'
if(!$showFullBreadcrumbs) {
if(val('GroupID', $Category) > 0) {
$temp = [];
foreach ($ancestors as $id => $ancestor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ function writeListItem($category, $depth) {
<div class="ItemContent Category">
<div class="Options">
<?php
echo watchButton($category);
if(!hideInMFE()){
echo watchButton($category);
}
echo getOptions($category);
?>
</div>
Expand All @@ -191,13 +193,9 @@ function writeListItem($category, $depth) {
<div class="CategoryDescription">
<?php echo val('Description', $category) ?>
</div>
<?php if(getIncomingValue('embed_type') != 'mfe') { ?>
<div class="Challenge">
<?php
Gdn::controller()->fireEvent('AfterChallenge', ['Category' =>$category]);
?>
</div>
<?php } ?>
<div class="Meta">
<?php if (val('LastTitle', $category) != '') { ?>
<span class="MItem LastDiscussionTitle">
Expand Down Expand Up @@ -537,6 +535,11 @@ function getWriteChildrenMethod($category, $depth) {
*/
function followButton($categoryID) {
$output = ' ';

if(hideInMFE()) {
return $output;
}

$userID = Gdn::session()->UserID;
$category = CategoryModel::categories($categoryID);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,13 @@ function getCommentOptions($comment) {
);
$canSelfDelete = ($canEdit && $session->UserID == $comment->InsertUserID && c('Vanilla.Comments.AllowSelfDelete'));
if ($canDelete || $canSelfDelete) {
$options['DeleteComment'] = [
'Label' => t('Delete'),
'Url' => '/discussion/deletecomment/'.$comment->CommentID.'/'.$session->transientKey().'/?Target='.urlencode("/discussion/{$comment->DiscussionID}/x"),
'Class' => 'DeleteComment'
];
if(!hideInMFE()) {
$options['DeleteComment'] = [
'Label' => t('Delete'),
'Url' => '/discussion/deletecomment/' . $comment->CommentID . '/' . $session->transientKey() . '/?Target=' . urlencode("/discussion/{$comment->DiscussionID}/x"),
'Class' => 'DeleteComment'
];
}
}

// DEPRECATED (as of 2.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ function bookmarkButton($discussion) {
return '';
}

if(hideInMFE()) {
return '';
}

// Bookmark link
// FIX : https://github.com/topcoder-platform/forums/issues/577
// If User is watching a category then show it as bookmarked
Expand Down
4 changes: 2 additions & 2 deletions vanilla/applications/vanilla/views/discussions/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
echo discussionSorts();
}

if(getIncomingValue('embed_type') != 'mfe') {
if(!hideInMFE()) {
echo Gdn_Theme::module('NewDiscussionModule', $this->data('_NewDiscussionProperties', ['CssClass' => 'Button Action Primary']));
}
echo '</div>';
Expand All @@ -68,7 +68,7 @@

echo '<div class="PageControls Bottom">';
PagerModule::write($PagerOptions);
if(getIncomingValue('embed_type') != 'mfe') {
if(!hideInMFE()) {
echo Gdn_Theme::module('NewDiscussionModule', $this->data('_NewDiscussionProperties', ['CssClass' => 'Button Action Primary']));
}
echo '</div>';
Expand Down
2 changes: 1 addition & 1 deletion vanilla/library/core/class.theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function assetEnd() {
*/
public static function breadcrumbs($data, $homeLink = true, $options = []) {
// FIX https://github.com/topcoder-platform/forums/issues/648
if(getIncomingValue('embed_type') == 'mfe') {
if(hideInMFE()) {
$homeLink = false;
}
$format = '<a href="{Url,html}" itemprop="url"><span itemprop="title">{Name,html}</span></a>';
Expand Down