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

Commit

Permalink
Merge pull request #347 from UW-Madison-DoIT/switch_all_the_things
Browse files Browse the repository at this point in the history
use ng-switch for widget selection
  • Loading branch information
Tim Levett committed Nov 6, 2015
2 parents 700a4a4 + 1a8276a commit eddce60
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ define(['angular', 'jquery'], function(angular, $) {
return date >= today;
}
}]);

app.controller('GoToAppsController', ['$location',function($location){
this.redirectToApps = function(){$location.path("/apps");};
}]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,52 +30,56 @@ <h4 id="appTitle_portlet.title-{{::portlet.nodeId}}" aria-labelledby="appTitle_p
<a class="btn btn-default launch-app-button" href="{{::portlet.url}}" target="{{::portlet.target}}">Launch full app</a>
</div>

<div ng-if="'OPTION_LINK' === widgetCtrl.portletType(portlet)">
<option-link app="portlet" config="portlet.widgetConfig"></option-link>
</div>
<div ng-switch='widgetCtrl.portletType(portlet)'>

<div ng-if="'WEATHER' === widgetCtrl.portletType(portlet)">
<weather app="portlet" config="portlet.widgetConfig"></weather>
</div>
<div ng-switch-when="OPTION_LINK">
<option-link app="portlet" config="portlet.widgetConfig"></option-link>
</div>

<div ng-if="'RSS' === widgetCtrl.portletType(portlet)">
<rss app="portlet" config="portlet.widgetConfig"></rss>
</div>

<div ng-if="'LOL' === widgetCtrl.portletType(portlet)">
<lol app="portlet" config="portlet.widgetConfig"></lol>
</div>
<div ng-switch-when="WEATHER">
<weather app="portlet" config="portlet.widgetConfig"></weather>
</div>

<div ng-if="'GENERIC' === widgetCtrl.portletType(portlet)">
<div ng-controller="GenericWidgetController as genericWidgetCtrl">
<div ng-if="loading" id="loading">
<loading-gif data-object='content' data-empty='isEmpty'></loading-gif>
</div>
<content-item ng-if="!loading"></content-item>
<div ng-switch-when="RSS">
<rss app="portlet" config="portlet.widgetConfig"></rss>
</div>
</div>

<!-- For basic apps (not a widget, not simple content, no pithy content), show only an icon -->
<a tabindex="-1" ng-if="'NORMAL' === widgetCtrl.portletType(portlet)" href="{{::portlet.url}}" target="{{::portlet.target}}">
<div class="widget-icon-container">
<portlet-icon></portlet-icon>
<div ng-switch-when="LOL">
<lol app="portlet" config="portlet.widgetConfig"></lol>
</div>
<button aria-labelledby="goToApps-{{::portlet.nodeId}} appTitle_portlet.title-{{::portlet.nodeId}}" class="btn btn-default launch-app-button">Launch full app</button>
</a>

<!-- For pithy content, display the pithy content -->
<div ng-if="'PITHY' === widgetCtrl.portletType(portlet)">
<div class="portlet-content">
<div ng-bind-html="portlet.pithyStaticContent"></div>
<!-- For pithy content, display the pithy content -->
<div ng-switch-when="PITHY">
<div class="portlet-content">
<div ng-bind-html="portlet.pithyStaticContent"></div>
</div>
<a class="btn btn-default launch-app-button" href="{{::portlet.url}}" target="{{::portlet.target}}">Launch full app</a>
</div>
<a class="btn btn-default launch-app-button" href="{{::portlet.url}}" target="{{::portlet.target}}">Launch full app</a>
</div>

<!-- For simple content portlets, show only an icon -->
<a tabindex="-1" ng-if="'SIMPLE' === widgetCtrl.portletType(portlet)" ng-click="widgetCtrl.maxStaticPortlet(portlet)" class="simple-content-container">
<div class="widget-icon-container">
<portlet-icon></portlet-icon>
<div ng-switch-when="GENERIC">
<div ng-controller="GenericWidgetController as genericWidgetCtrl">
<div ng-if="loading" id="loading">
<loading-gif data-object='content' data-empty='isEmpty'></loading-gif>
</div>
<content-item ng-if="!loading"></content-item>
</div>
</div>
<button aria-labelledby="goToApps-{{::portlet.nodeId}} appTitle_portlet.title-{{::portlet.nodeId}}" class="btn btn-default launch-app-button">Launch full app</button>
</a>

<!-- For basic apps (not a widget, not simple content, no pithy content), show only an icon -->
<a tabindex="-1" ng-switch-when="NORMAL" href="{{::portlet.url}}" target="{{::portlet.target}}">
<div class="widget-icon-container">
<portlet-icon></portlet-icon>
</div>
<button aria-labelledby="goToApps-{{::portlet.nodeId}} appTitle_portlet.title-{{::portlet.nodeId}}" class="btn btn-default launch-app-button">Launch full app</button>
</a>

<!-- For simple content portlets, show only an icon -->
<a tabindex="-1" ng-switch-when="SIMPLE" ng-click="widgetCtrl.maxStaticPortlet(portlet)" class="simple-content-container">
<div class="widget-icon-container">
<portlet-icon></portlet-icon>
</div>
<button aria-labelledby="goToApps-{{::portlet.nodeId}} appTitle_portlet.title-{{::portlet.nodeId}}" class="btn btn-default launch-app-button">Launch full app</button>
</a>

</div>
</div>

0 comments on commit eddce60

Please sign in to comment.