Skip to content

Commit 476bda6

Browse files
authored
Merge pull request #653 from topcoder-platform/issues-652
Issues-652: Client Manager - no navigation when embedded
2 parents 68d67e2 + 833befa commit 476bda6

File tree

7 files changed

+32
-14
lines changed

7 files changed

+32
-14
lines changed

config/vanilla/bootstrap.before.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ function watchIcon($hasWatched = false, $title='') {
374374
* @return string
375375
*/
376376
function watchButton($category, $isHijackButton = true) {
377+
if(hideInMFE()){
378+
return '';
379+
}
380+
377381
$output = ' ';
378382
$userID = Gdn::session()->UserID;
379383
if(is_numeric($category)) {

vanilla/applications/vanilla/controllers/class.vanillacontroller.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ protected function buildBreadcrumbs($CategoryID) {
9696
$ancestors = CategoryModel::getAncestors($CategoryID);
9797
$parentCategoryID = val('ParentCategoryID', $Category);
9898
// FIX https://github.com/topcoder-platform/forums/issues/648
99-
if(getIncomingValue('embed_type') == 'mfe') {
99+
100+
$showFullBreadcrumbs = true;
101+
$this->EventArguments['ShowFullBreadcrumbs'] = & $showFullBreadcrumbs;
102+
$this->fireEvent('BeforeBuildBreadcrumbs');
103+
// getIncomingValue('embed_type') == 'mfe'
104+
if(!$showFullBreadcrumbs) {
100105
if(val('GroupID', $Category) > 0) {
101106
$temp = [];
102107
foreach ($ancestors as $id => $ancestor) {

vanilla/applications/vanilla/views/categories/helper_functions.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ function writeListItem($category, $depth) {
178178
<div class="ItemContent Category">
179179
<div class="Options">
180180
<?php
181-
echo watchButton($category);
181+
if(!hideInMFE()){
182+
echo watchButton($category);
183+
}
182184
echo getOptions($category);
183185
?>
184186
</div>
@@ -191,13 +193,9 @@ function writeListItem($category, $depth) {
191193
<div class="CategoryDescription">
192194
<?php echo val('Description', $category) ?>
193195
</div>
194-
<?php if(getIncomingValue('embed_type') != 'mfe') { ?>
195-
<div class="Challenge">
196196
<?php
197197
Gdn::controller()->fireEvent('AfterChallenge', ['Category' =>$category]);
198198
?>
199-
</div>
200-
<?php } ?>
201199
<div class="Meta">
202200
<?php if (val('LastTitle', $category) != '') { ?>
203201
<span class="MItem LastDiscussionTitle">
@@ -537,6 +535,11 @@ function getWriteChildrenMethod($category, $depth) {
537535
*/
538536
function followButton($categoryID) {
539537
$output = ' ';
538+
539+
if(hideInMFE()) {
540+
return $output;
541+
}
542+
540543
$userID = Gdn::session()->UserID;
541544
$category = CategoryModel::categories($categoryID);
542545

vanilla/applications/vanilla/views/discussion/helper_functions.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,13 @@ function getCommentOptions($comment) {
502502
);
503503
$canSelfDelete = ($canEdit && $session->UserID == $comment->InsertUserID && c('Vanilla.Comments.AllowSelfDelete'));
504504
if ($canDelete || $canSelfDelete) {
505-
$options['DeleteComment'] = [
506-
'Label' => t('Delete'),
507-
'Url' => '/discussion/deletecomment/'.$comment->CommentID.'/'.$session->transientKey().'/?Target='.urlencode("/discussion/{$comment->DiscussionID}/x"),
508-
'Class' => 'DeleteComment'
509-
];
505+
if(!hideInMFE()) {
506+
$options['DeleteComment'] = [
507+
'Label' => t('Delete'),
508+
'Url' => '/discussion/deletecomment/' . $comment->CommentID . '/' . $session->transientKey() . '/?Target=' . urlencode("/discussion/{$comment->DiscussionID}/x"),
509+
'Class' => 'DeleteComment'
510+
];
511+
}
510512
}
511513

512514
// DEPRECATED (as of 2.1)

vanilla/applications/vanilla/views/discussions/helper_functions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ function bookmarkButton($discussion) {
7070
return '';
7171
}
7272

73+
if(hideInMFE()) {
74+
return '';
75+
}
76+
7377
// Bookmark link
7478
// FIX : https://github.com/topcoder-platform/forums/issues/577
7579
// If User is watching a category then show it as bookmarked

vanilla/applications/vanilla/views/discussions/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
echo discussionSorts();
5050
}
5151

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

6969
echo '<div class="PageControls Bottom">';
7070
PagerModule::write($PagerOptions);
71-
if(getIncomingValue('embed_type') != 'mfe') {
71+
if(!hideInMFE()) {
7272
echo Gdn_Theme::module('NewDiscussionModule', $this->data('_NewDiscussionProperties', ['CssClass' => 'Button Action Primary']));
7373
}
7474
echo '</div>';

vanilla/library/core/class.theme.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function assetEnd() {
5959
*/
6060
public static function breadcrumbs($data, $homeLink = true, $options = []) {
6161
// FIX https://github.com/topcoder-platform/forums/issues/648
62-
if(getIncomingValue('embed_type') == 'mfe') {
62+
if(hideInMFE()) {
6363
$homeLink = false;
6464
}
6565
$format = '<a href="{Url,html}" itemprop="url"><span itemprop="title">{Name,html}</span></a>';

0 commit comments

Comments
 (0)