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

Commit

Permalink
WCP-441 Adds LTI-Launch as a widget type (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
vertein authored Jan 20, 2017
1 parent 26d5300 commit ba6b3c9
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
5 changes: 5 additions & 0 deletions angularjs-portal-home/src/main/webapp/css/widget.less
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ swl {
}
}

/* LTI Launch WIDGET */
.lti-launch .launch-app-button{
margin-left : -8px !important;
}

/* WEATHER WIDGET */
weather {
.forecast .day {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ define(['angular', 'jquery'], function(angular, $) {
}
} else if ('search-with-links' === portlet.widgetType) {
return "SWL";
} else if ('lti-launch' === portlet.widgetType){
return "LTI_LAUNCH";
} else {
return "WIDGET";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ define(['angular'], function(angular){
configInit();
populateWidgetContent();
}]);

app.controller('LTILaunchController', ['$scope', 'layoutService', 'keyValueService', '$q', '$sce', function($scope, layoutService, keyValueService, $q, $sce){
$scope.loading = false;
var init = function(){
$scope.loading = true;
layoutService.getWidgetJson($scope.portlet).then(function(data) {
$scope.loading = false;
if(data) {
$scope.formInputs = data.formInputs;
$scope.formAction = $sce.trustAsResourceUrl(data.action);
}
}, function(){
$scope.loading = false;
});
}
init();
}]);

app.controller('WeatherController', ['$scope', 'layoutService', 'keyValueService', '$q', function($scope, layoutService, keyValueService, $q){
$scope.weatherData = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ define(['angular', 'require'], function(angular, require) {
controller: 'SearchWithLinksController'
}
});

app.directive('ltiLaunch', function(){
return {
restrict: 'E',
scope: {
portlet: '=app',
config: '=config'
},
templateUrl: require.toUrl('./partials/lti-launch.html'),
controller: 'LTILaunchController'
}
});

/**
<rss></rss> is an rss widget card that will show your info in a view
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div class="widget-body lti-launch">
<form method="post" id="{{portlet.fname}}_LtiRequestForm" name="{{portlet.fname}}_LtiRequestForm" action={{formAction}}
enctype="application/x-www-form-urlencoded" target="_blank" rel="noopener noreferrer">
<input ng-repeat='input in formInputs' type="hidden" name={{input.name}} value={{input.value}}>
<a tabindex="-1" class="normal-widget" href="javascript:{}" onclick="javascript:this.parentNode.submit();">
<div class="widget-icon-container" layout="column" layout-align="center center">
<portlet-icon></portlet-icon>
</div>
</a>
<a href="javascript:{}" onclick="javascript:this.parentNode.submit();">
<launch-button
ng-if='config.launchText && portlet.url'
data-button-text="{{config.launchText}}">
</launch-button>
</a>
</form>

</div>

Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
<div ng-switch-when="SWL">
<swl app="portlet" config="portlet.widgetConfig"></swl>
</div>

<div ng-switch-when="LTI_LAUNCH">
<lti-launch app="portlet" config="portlet.widgetConfig"></lti-launch>
</div>

<!-- For pithy content, display the pithy content -->
<div ng-switch-when="PITHY">
Expand Down

0 comments on commit ba6b3c9

Please sign in to comment.