Skip to content
This repository was archived by the owner on May 4, 2022. It is now read-only.

fix: disabling options rendering on non-home paths #703

Merged
merged 2 commits into from
Sep 26, 2017
Merged
Changes from 1 commit
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
Next Next commit
fix: disabling options rendering on non-home paths
davidmsibley committed Sep 26, 2017
commit 501fece44ed672129690d2a959ce882d6fcd96fa
12 changes: 12 additions & 0 deletions angularjs-portal-home/src/main/webapp/my-app/layout/controllers.js
Original file line number Diff line number Diff line change
@@ -396,5 +396,17 @@ define(['angular', 'jquery'], function(angular, $) {
};

vm.init();
}])
.controller('OptionsController', [
'$scope', '$location', function($scope, $location) {
var expanded = 'expanded';
var compact = 'compact';
$scope.renderMe = false;
if (
$location.url().indexOf(expanded) > -1 ||
$location.url().indexOf(compact) > -1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a temporary or permanent fix? If permanent, any worries that someday there will be a "Mayflower Compact" app and weirdly the expand/contract widget is going to start showing on its details page? heh.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "permanent" in the same sense that our current solution to toggling modes is "permanent."

That said, it's probably worth looking for a better long-term solution for toggling expanded/compact modes, which would presumably change this implementation as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we're just finding all the edges of customization that we made in uw-frame to support angularjs-portal. This is as permanent as we want it to be. This will be temporary as long as we make efforts to transform angularjs-portal into "just another frame app".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, you're right @apetro, this would break if any entities have expanded or compact in their paths. this should really be a startsWith

) {
$scope.renderMe = true;
}
}]);
});
Original file line number Diff line number Diff line change
@@ -18,31 +18,10 @@
under the License.

-->
<!-- MEDIUM AND LARGE SCREENS -->
<div layout="row" layout-align="end center" hide-xs>
<md-button ng-href="apps" class="md-primary">
<span ng-if="GuestMode">
<md-icon>explore</md-icon> Browse {{ portal.theme.title }}
</span>
<span ng-if="!GuestMode">
<md-icon>add</md-icon> Add more to home
</span>
</md-button>
<md-switch class="md-accent app-header-toggle" ng-model="expandedMode" ng-controller="ToggleController"
aria-label="Toggle expanded widget layout" ng-change="toggleMode(expandedMode)"
style="margin-top:0;margin-bottom:0;color:#fff;">
<span>Expand widgets</span>
</md-switch>
</div>

<!-- SMALL SCREENS -->
<md-menu md-position-mode="target-right bottom" hide-gt-xs>
<md-button aria-label="Open options menu" class="md-primary link-div" ng-click="$mdOpenMenu($event)">
<span layout="row" layout-align="center center"><md-icon>settings</md-icon></span>
<md-tooltip class="top-bar-tooltip" md-direction="bottom" md-delay="500">Options</md-tooltip>
</md-button>
<md-menu-content width="5">
<md-menu-item>
<div ng-controller="OptionsController">
<div ng-if="renderMe">
<!-- MEDIUM AND LARGE SCREENS -->
<div layout="row" layout-align="end center" hide-xs>
<md-button ng-href="apps" class="md-primary">
<span ng-if="GuestMode">
<md-icon>explore</md-icon> Browse {{ portal.theme.title }}
@@ -51,13 +30,38 @@
<md-icon>add</md-icon> Add more to home
</span>
</md-button>
</md-menu-item>
<md-menu-item>
<md-switch class="md-accent app-header-toggle" ng-model="expandedMode" ng-controller="ToggleController"
aria-label="Toggle expanded widget layout" ng-change="toggleMode(expandedMode)"
style="margin-top:0;margin-bottom:0;color:#fff;">
<span>Expand widgets</span>
</md-switch>
</md-menu-item>
</md-menu-content>
</md-menu>
</div>

<!-- SMALL SCREENS -->
<md-menu md-position-mode="target-right bottom" hide-gt-xs>
<md-button aria-label="Open options menu" class="md-primary link-div" ng-click="$mdOpenMenu($event)">
<span layout="row" layout-align="center center"><md-icon>settings</md-icon></span>
<md-tooltip class="top-bar-tooltip" md-direction="bottom" md-delay="500">Options</md-tooltip>
</md-button>
<md-menu-content width="5">
<md-menu-item>
<md-button ng-href="apps" class="md-primary">
<span ng-if="GuestMode">
<md-icon>explore</md-icon> Browse {{ portal.theme.title }}
</span>
<span ng-if="!GuestMode">
<md-icon>add</md-icon> Add more to home
</span>
</md-button>
</md-menu-item>
<md-menu-item>
<md-switch class="md-accent app-header-toggle" ng-model="expandedMode" ng-controller="ToggleController"
aria-label="Toggle expanded widget layout" ng-change="toggleMode(expandedMode)"
style="margin-top:0;margin-bottom:0;color:#fff;">
<span>Expand widgets</span>
</md-switch>
</md-menu-item>
</md-menu-content>
</md-menu>
</div>
</div>